Prestashop 1.7 : How to get remove from cart URL in accessories -
how can remove cart url in each $accessories item ? tried template :
{foreach from=$accessories item=accessory} {assign var="deleteurl" value=link::getremovefromcarturl($accessory.id_product,$accessory.id_product_attribute,null)} {/foreach} but error :
runtime notice: non-static method linkcore::getremovefromcarturl() should not called statically which controller should modify access remove cart url $accessories ?
in controllers/front/productcontroller.php, edit function initcontent.
$accessories = $this->product->getaccessories($this->context->language->id); if (is_array($accessories)) { foreach ($accessories &$accessory) { $accessory = $presenter->present( $presentationsettings, product::getproductproperties($this->context->language->id, $accessory, $this->context), $this->context->language ); } unset($accessory); } to
$accessories = $this->product->getaccessories($this->context->language->id); if (is_array($accessories)) { foreach ($accessories &$accessory) { $accessory = $presenter->present( $presentationsettings, product::getproductproperties($this->context->language->id, $accessory, $this->context), $this->context->language ); $accessory['remove_from_cart_url'] = $this->context->link->getremovefromcarturl($accessory['id'],$accessory['id_product_attribute']); } unset($accessory); } edit : should not edit controller directly, creating override in override/controllers/front/productcontroller.php. if file not created yet, yourself.
Comments
Post a Comment