shop changes
This commit is contained in:
32
actions/WooCommerceProductTile.php
Normal file
32
actions/WooCommerceProductTile.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Actions;
|
||||
|
||||
use Helpers\McCansHelpers;
|
||||
use ofc\RadAction;
|
||||
|
||||
class WooCommerceProductTile extends RadAction
|
||||
{
|
||||
protected string $hookName = "woocommerce_shop_loop_item_title";
|
||||
protected bool $wrapInit = true;
|
||||
|
||||
public function callback()
|
||||
{
|
||||
global $product;
|
||||
|
||||
$data = site()->getPost($product->id, [
|
||||
"url",
|
||||
"id",
|
||||
"title",
|
||||
"thumbnail",
|
||||
"woocommerce.price",
|
||||
"woocommerce.attribute.msrp",
|
||||
"woocommerce.cartUrl",
|
||||
"woocommerce.sku",
|
||||
]);
|
||||
|
||||
$data["savings"] = McCansHelpers::calcDifference($data["price"], $data["msrp"]);
|
||||
|
||||
echo site()->render("product-tile", $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user