View Single Post
  #1  
Old 06-10-2020, 01:17 PM
  The Knotty Celt's Avatar 
The Knotty Celt The Knotty Celt is offline
 

Advanced Member
  
Join Date: Jan 2020
Posts: 32
 

Default 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:
skins/common/modules/LBS/OrderNumber/order/invoice/parts/title.twig
Since it is a part of the invoice.head viewList, I added the following to the end of my module's Main.php.
Code:
protected static function moveTemplatesInLists() { $templates = [ 'order/invoice/parts/title.twig' => [ static::TO_DELETE => [ ['invoice.head', \XLite\Model\ViewList::INTERFACE_CUSTOMER], ], ], ]; return $templates; }


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:
['invoice.head', \XLite\Model\ViewList::INTERFACE_CUSTOMER]
to,
Code:
['invoice.head', 'common']
which produced the same result.


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
Reply With Quote