latest changes
This commit is contained in:
117
config.php
117
config.php
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Helpers\McCansHelpers;
|
||||
|
||||
return [
|
||||
"debug" => true,
|
||||
"flex-file-prefix" => "flex",
|
||||
@@ -73,6 +75,11 @@ return [
|
||||
"testimonial" => \Helpers\McCansHelpers::testimonial(),
|
||||
"locationTile" => \Helpers\McCansHelpers::locationTile(),
|
||||
"productTile" => \Helpers\McCansHelpers::productTile(),
|
||||
"renderBlock" => \Helpers\McCansHelpers::renderBlock(),
|
||||
"renderCallout" => \Helpers\McCansHelpers::renderCallout(),
|
||||
"productBox" => \Helpers\McCansHelpers::searchResultBox('product'),
|
||||
"pageBox" => \Helpers\McCansHelpers::searchResultBox('page'),
|
||||
"usd" => \Helpers\McCansHelpers::usd(),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -86,6 +93,7 @@ return [
|
||||
"post-thumbnails",
|
||||
"menus",
|
||||
"woocommerce",
|
||||
"excerpts",
|
||||
],
|
||||
|
||||
|
||||
@@ -100,34 +108,107 @@ return [
|
||||
"gutenberg",
|
||||
"patterns",
|
||||
"emojis",
|
||||
"revisions",
|
||||
"meta-generator",
|
||||
"woocommerce.breadcrumb",
|
||||
"woocommerce.sidebar",
|
||||
"woocommerce.result_count",
|
||||
"woocommerce.page_title",
|
||||
"woocommerce.archive_description",
|
||||
"woocommerce.reviews",
|
||||
],
|
||||
|
||||
"hooks" => [
|
||||
"woocommerce_before_main_content" => function () {
|
||||
"actions" => [
|
||||
"woocommerce_before_single_product_summary" => [function () {
|
||||
echo site()->render('woocommerce-before-content', [
|
||||
"additionalTopLevelClass" => "single-product-top",
|
||||
]);
|
||||
}, 0],
|
||||
"woocommerce_single_product_summary" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
[
|
||||
"hook" => "woocommerce_after_single_product_summary",
|
||||
"priority" => 0,
|
||||
"callback" => function () {
|
||||
echo site()->render('woocommerce-before-content');
|
||||
},
|
||||
],
|
||||
"woocommerce_after_single_product" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
[
|
||||
"hook" => "woocommerce_after_single_product_summary",
|
||||
"priority" => 18,
|
||||
"callback" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
}
|
||||
],
|
||||
[
|
||||
"hook" => "woocommerce_after_single_product_summary",
|
||||
"priority" => 19,
|
||||
"callback" => function () {
|
||||
echo site()->render('flex_callout_text', [
|
||||
"headline_1" => "Shop",
|
||||
"headline_2" => "Related Products",
|
||||
]);
|
||||
echo site()->render('woocommerce-before-content', [
|
||||
"additionalTopLevelClass" => "related-wrapper"
|
||||
]);
|
||||
}
|
||||
],
|
||||
|
||||
"woocommerce_before_main_content" => [function () {
|
||||
// skip this for individual products
|
||||
if (is_product()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// shop page
|
||||
if (is_shop()) {
|
||||
echo site()->render("shop-top", site()->getPost(wc_get_page_id('shop'), ["headline", "intro_text", 'thumbnail']));
|
||||
echo site()->render("shop-top", site()->getPost(wc_get_page_id('shop'), [
|
||||
"headline",
|
||||
"intro_text",
|
||||
"thumbnail",
|
||||
]));
|
||||
echo site()->render('woocommerce-before-content');
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_product_category()) {
|
||||
echo site()->render("shop-category-slice", site()->getQueriedObject(null, [
|
||||
"title",
|
||||
"description",
|
||||
"thumbnail",
|
||||
"url",
|
||||
"acf.intro_headline",
|
||||
"acf.intro_content",
|
||||
]));
|
||||
echo site()->render('woocommerce-before-content');
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render('woocommerce-before-content');
|
||||
},
|
||||
"woocommerce_after_main_content" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
"init" => function() {
|
||||
remove_all_actions( 'woocommerce_before_shop_loop_item' );
|
||||
remove_all_actions( 'woocommerce_before_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_after_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_after_shop_loop_item' );
|
||||
add_action( 'woocommerce_shop_loop_item_title', function() {
|
||||
}, 5],
|
||||
[
|
||||
"hook" => "woocommerce_after_main_content",
|
||||
"callback" => function () {
|
||||
// skip this for individual products
|
||||
if (is_product()) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
"priority" => 50,
|
||||
],
|
||||
"init" => function () {
|
||||
remove_all_actions('woocommerce_before_shop_loop_item');
|
||||
remove_all_actions('woocommerce_before_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_after_shop_loop_item_title');
|
||||
remove_all_actions('woocommerce_after_shop_loop_item');
|
||||
add_action('woocommerce_shop_loop_item_title', function () {
|
||||
global $product;
|
||||
|
||||
$data = site()->getPost($product->id, [
|
||||
@@ -141,13 +222,7 @@ return [
|
||||
"woocommerce.sku",
|
||||
]);
|
||||
|
||||
if ($data["price"] && $data["msrp"]) {
|
||||
$difference = $data["msrp"] - $data["price"];
|
||||
|
||||
if ($difference > 0) {
|
||||
$data["savings"] = round(($difference / $data["msrp"]) * 100);
|
||||
}
|
||||
}
|
||||
$data["savings"] = McCansHelpers::calcDifference($data["price"], $data["msrp"]);
|
||||
|
||||
echo site()->render("product-tile", $data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user