| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Working with Twig File | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Working with Twig File
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 ?
__________________
alex |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Working with Twig File
Use the moveTemplatesInLists() function in Main.php to remove the original template
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#3
|
|||||||||
|
|||||||||
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).
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#4
|
|||||||
|
|||||||
Re: Working with Twig File
Yes ! It works using Main::moveTemplatesInLists() !
__________________
alex |
|||||||
|
|||
X-Cart forums © 2001-2020
|