| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
XC5 Problem overriding class with a module | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
XC5 Problem overriding class with a module
Hi everyone,
I'm having problems with overriding the class \XLite\View\ItemsList\Product\Customer\Search with the function getData(). The original class and function still gets called. What are the usual things I should check? Is there a restriction on certain classes that cannot be overridden? Code:
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: XC5 Problem overriding class with a module
What is your name space? Is your file being put in the run directory after redeployment?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: XC5 Problem overriding class with a module
Hey Mike, thanks for replying.
This is my namespace Code:
And function code-wise, there shouldn't be a problem there as I can get the code to work temporary by replacing the actual search function in the run directory.
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
#4
|
|||||||||
|
|||||||||
Re: XC5 Problem overriding class with a module
There is a possibility that another module is also decorating this class, and it may come alphabetically after yours.
In this case you need to make your module depend on the other, and you do this via module dependencies in your main.php I believe. Check the class that you are decorating in the run directory. It should be extending your class after deployment, or it could be that it is extending another, you can chase through which class depends on which by seeing how they reference each other in the run directory.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
#5
|
|||||||||
|
|||||||||
Re: XC5 Problem overriding class with a module
Thanks Mike!
Your answer helped me realize that the bundled CloudSearch Module must have been doing some overriding to the Search class somehow. Although the class in the run folder didn't specifically point to CloudSearch, my module worked perfectly after disabling CloudSearch Cheers! -Niboon
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|