| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Module extend module | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Module extend module
Hi, is it possible to create a module that extend another module?
I wanna extend ProductVariant model from ProductVariants module and i keep getting : Class "XLite\Module\Grempels\Restfully\Model\ProductVari ant" sub class of "XLite\Module\XC\ProductVariants\Model\ProductVari antAbstract" is not a valid entity or mapped super class. PHP Code:
And why ProductVariantAbstract ? I extend ProductVariant.
__________________
xcart 4.6.4 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Module extend module
Yes, it is possible, and you are doing it almost right.
Since your class depends on another module, you must mention this in the class declaration as follows: PHP Code:
Quote:
When re-deploying the site X-Cart finds all classes that "decorate" (the "implements \XLite\Base\IDecorator" thing) core classes or other modules and then rewrite the source code to make them extend each other in the correct order. The resulting code ends up in the var/run/classes/ directory, and this is where all PHP scripts are executed from (not from the original classes/ directory). For each class decorated by other modules X-Cart creates an empty class having the same name, but with "Abstract" suffix. This class is the latest in the inheritance tree, so it inherits all methods and properties added by modules. And this class is then used in the rest of the source code instead of the original one (which becomes the top one in the inheritance tree for that class).
__________________
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 Last edited by qualiteam : 05-18-2018 at 09:10 AM. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|