phpprestashopsmartyprestashop-1.6

Getting cart content inside *.tpl file


For first: I am a complete Smarty newbie.

I've created custom PrestaShop *.tpl file which is used by custom CMS page and now I need to get an IDs of products which are already added to shopping cart. Is there any possibility to achieve this?

My first thought was to use $cart variable and make a foreach loop, but then I've realized... that variable doesn't store cart items.


Solution

  • You were not that far, just try :

    {$products = $cart->getProducts()}
    

    Then you will be able to make some loop :).