shop changes
This commit is contained in:
45
actions/WooCommerceCategoryLayout.php
Normal file
45
actions/WooCommerceCategoryLayout.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Actions;
|
||||
|
||||
use ofc\RadAction;
|
||||
|
||||
class WooCommerceCategoryLayout extends RadAction
|
||||
{
|
||||
protected string $hookName = "woocommerce_before_main_content";
|
||||
protected int $priority = 5;
|
||||
|
||||
public function callback()
|
||||
{
|
||||
if (!is_product_category()) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render("shop-category-slice", site()->getQueriedObject(null, [
|
||||
"title",
|
||||
"description",
|
||||
"thumbnail",
|
||||
"url",
|
||||
"acf.intro_headline",
|
||||
"acf.intro_content",
|
||||
]));
|
||||
|
||||
$type = site()->getQueriedObject(null, ['display_type']);
|
||||
if ($type === "") {
|
||||
$type = "products";
|
||||
} else {
|
||||
$type = $type["display_type"];
|
||||
}
|
||||
|
||||
if ($type === "both" || $type === "subcategories") {
|
||||
$childCats = site()->getQueriedObject(null, ["children.url,thumbnail,title,count"]);
|
||||
|
||||
echo site()->render("shop-sub-categories", $childCats);
|
||||
}
|
||||
|
||||
if ($type === "both" || $type === "products") {
|
||||
// die("why?");
|
||||
}
|
||||
echo site()->render('woocommerce-before-content');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user