Initial commit: is_shoppingcart out of the box. V3.0.1
This commit is contained in:
36
is_shoppingcart/src/Hook/DisplayTop.php
Normal file
36
is_shoppingcart/src/Hook/DisplayTop.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Oksydan\IsShoppingcart\Hook;
|
||||
|
||||
use PrestaShop\PrestaShop\Adapter\Presenter\Cart\CartPresenter;
|
||||
|
||||
class DisplayTop extends AbstractDisplayHook
|
||||
{
|
||||
private const TEMPLATE_FILE = 'is_shoppingcart.tpl';
|
||||
|
||||
protected function getTemplate(): string
|
||||
{
|
||||
return DisplayTop::TEMPLATE_FILE;
|
||||
}
|
||||
|
||||
protected function assignTemplateVariables(array $params)
|
||||
{
|
||||
$this->context->smarty->assign([
|
||||
'cart' => (new CartPresenter())->present(isset($params['cart']) ? $params['cart'] : $this->context->cart),
|
||||
'refresh_url' => $this->context->link->getModuleLink($this->module->name, 'ajax', [], null, null, null, true),
|
||||
'cart_url' => $this->context->link->getPageLink(
|
||||
'cart',
|
||||
null,
|
||||
$this->context->language->id,
|
||||
[
|
||||
'action' => 'show',
|
||||
],
|
||||
false,
|
||||
null,
|
||||
true
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user