| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Replacing templates from common skins | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Replacing templates from common skins
I am working on a module which replaces the invoice templates. Following the guide here, I created the following template file:
Code:
Code:
This results in both the original title.twig and my title.twig being rendered side-by-side on the invoice header. Since the original title.twig is located under the common skins, that INTERFACE_CUSTOMER is not correct. I looked in XLite\Model\ViewList.php for a possible INTERFACE_COMMON definition. Since there was none, I saw that INTERFACE_CUSTOMER returns the string 'customer', and INTERFACE_ADMIN returns the string 'admin', so I tried changing the line, Code:
Code:
What is the proper way to replace a template found within skins/common? Or is it it that the viewList 'invoice.head' is part of another viewList? Do I need to specify all the parents and grandparents of the viewList? I shall try something along those lines to see if it works in the meantime while waiting for some much appreciated feedback.
__________________
X-Cart version 5.4.1.46 PHP version 7.4.33 MySQL version 15.1 Apache version 2.4.56 cURL version 7.74.0 |
|||||||||
#2
|
|||||||
|
|||||||
Re: Replacing templates from common skins
This may be a "dirty" work around, but should work: instead of bothering with viewlist, just override the viewer. So override XLite/View/Invoice.php to change
getDefaultTemplate() or XLite/View/InvoicePage.php to modify getDir(), getBody() or getHead(), whichever is appropriate.
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Replacing templates from common skins
Quote:
I have since tried that, by implementing IDecorator on both Invoice and InvoicePage View classes, and updating the getDir(), getBody() and getHead(), among other functions referring to various template files. Now, everything is duplicated. I also copied the template files into the appropriate modules' locations. The result is that both the original templates and module templates are appearing side-by-side. It's as though both sets of Invoice and InvoicePage classes are being loaded, rather than the module replacing the original view.
__________________
X-Cart version 5.4.1.46 PHP version 7.4.33 MySQL version 15.1 Apache version 2.4.56 cURL version 7.74.0 |
|||||||||
#4
|
|||||||||
|
|||||||||
Re: Replacing templates from common skins
SOLUTION
I was able to resolve my issue quite simply by amending the getSkins() function of my module's Main.php file as follows: Code:
__________________
X-Cart version 5.4.1.46 PHP version 7.4.33 MySQL version 15.1 Apache version 2.4.56 cURL version 7.74.0 |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|