X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Third Party Add-Ons for X-Cart 5 (https://forum.x-cart.com/forumdisplay.php?f=64)
-   -   Extend module's layout. (https://forum.x-cart.com/showthread.php?t=76286)

Soptareanu @Alex 05-30-2018 12:29 AM

Extend module's layout.
 
I want to change some logic from product\details\stock\body.twig layout.
For that task, I decorate \XLite\View\Product\Details\Customer\Stock class and I override the getDefaultTemplate() method.
PHP Code:

protected function getDefaultTemplate()
    {
        return 
'modules/XGhosty/Disponibility/product/details/stock/body.twig';
    } 

It works very fine. But still it is a problem. I have install Backorder Module. This module also extands product\details\stock\body.twig layout. If this module is active the runner goes to the layout found in QSL\Backorder... and ignore the implementation of my module. How can i deal with such situation ?!

tony_sologubov 05-30-2018 02:33 AM

Re: Extend module's layout.
 
Quote:

Originally Posted by Soptareanu @Alex
I want to change some logic from product\details\stock\body.twig layout.
For that task, I decorate \XLite\View\Product\Details\Customer\Stock class and I override the getDefaultTemplate() method.
PHP Code:

protected function getDefaultTemplate()
    {
        return 
'modules/XGhosty/Disponibility/product/details/stock/body.twig';
    } 

It works very fine. But still it is a problem. I have install Backorder Module. This module also extands product\details\stock\body.twig layout. If this module is active the runner goes to the layout found in QSL\Backorder... and ignore the implementation of my module. How can i deal with such situation ?!


You can make your module to be placed after QSL/Backorder in decoration chain as explained here:
https://devs.x-cart.com/basics/making_one_module_depend_on_another_one_--_creating_a_menu_in_the_customer_area.html

This way you will be in control of final version of the class.


All times are GMT -8. The time now is 06:36 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.