Working with Twig File
1 Attachment(s)
I make a module that put some new info on products in the cart. But i need my view class to point from my custom skin and overriede the original shopping_cart/parts/item.info.twig .
This is the original shopping_cart/parts/item.info.twig : {## # Shopping cart item : info # # @ListChild (list="cart.item", weight="30") #} <td class="item-info"> {{ widget_list('cart.item.info', item=this.item) }} </td> And this is my custom skin {## # Shopping cart item : info # # @ListChild (list="cart.item", weight="30") #} <td class="item-info"> {{ widget_list('cart.item.info', item=this.item) }} {% if this.getDataLivrare() is not null %} <span> Produsul poate fi livrat cel mai devreme la data de <b> {{ this.getDataLivrare() }} </b> </span> {% endif %} </td> The final result must show like in the picture. What should i change in my view class in order to render data from my custom twig ? |
Re: Working with Twig File
Use the moveTemplatesInLists() function in Main.php to remove the original template
|
Re: Working with Twig File
Please check this article:
https://devs.x-cart.com/getting_started/how-to-apply-design-changes.html Sometimes you can decorate an existing view class and make its getDefaultTemplate() method to return the path to your custom template file instead of the original one. But in this case the template is inserted with the help of @ListChild directive, so you should either a) add a new template to the list and remove the existing one in Main::moveTemplatesInLists(); or b) use Main::getSkins() to register a new theme directory and make templates from there overlap original ones (in this case you don't need the @ListChild directive in your custom files, otherwise templates will duplicate themselves on the page). |
Re: Working with Twig File
Yes ! It works using Main::moveTemplatesInLists() !
|
All times are GMT -8. The time now is 12:20 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.