| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
extending / overriding product search | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
extending / overriding product search
Howdy. I am currently looking at extending / replacing the customer product search function on the front end. I believe this starts here:
classes/XLite/Controller/Customer/Search.php Code:
with the bulk of the control logic actually happening in the view: classes/XLite/View/ItemsList/Product/Customer\Search.php Code:
The template that gets loaded appears to be: skins/default/en/product/search/body.tpl Which has a direct call to the class that does the actual search: Code:
Based on that, is the only way to change the core search functionality to override the above template? I may be doing it incorrectly but so far I have not been able to get any obvious behavioural changes by extending "classes/XLite/View/ItemsList/Product/Customer/Search.php" in my testing module.
__________________
multiple versions (4 and 5) |
|||||||
#2
|
|||||||
|
|||||||
Re: extending / overriding product search
Hoping a bump spikes someone's interest. . .
=) I am feeling pretty stumped here as I can't seem to sort out how to get my module's search view to load. If I want to override this view: Code:
and have a dev called "MyDev" and a module called "MyModule", where should the overridden class go? I have tried placing it here: Code:
But it does not get loaded. Any help appreciated. I've looked through the docs but did not see any examples specific to search results that seemed to apply. Do you have to create a "A[object name].php" stub at every branch of the tree for lower level files to be loaded?
__________________
multiple versions (4 and 5) |
|||||||
#3
|
|||||||
|
|||||||
Re: extending / overriding product search
In case this helps anyone else, if you want to see what files are actually being loaded during execution (so as to find what file you need to replicate or change), you can do this by temporarily adding some code to the autoloader class (starts at line 101):
includes/autoloader.php Code:
__________________
multiple versions (4 and 5) |
|||||||
#4
|
|||||||||
|
|||||||||
Re: extending / overriding product search
It depends on the desired changes.
\XLite\Controller\Customer\Search is the class that implements the logic to change search filters and pass the data to the widget class. \XLite\View\ItemsList\Product\Customer\Search is the widget class that contains/calls all the logic to retrieve the list of products to be shown on the page. Quote:
No, most likely you don't have to edit the template. Quote:
How did you extend it? Did you use the "implements \XLite\Base\IDecorator" construction?
__________________
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 |
|||||||||
#5
|
|||||||
|
|||||||
Re: extending / overriding product search
Thanks for the response Alex.
I did use the Decorator interface but I initially was extending the abstract class "ACustomer.php" instead of "Search.php". If I extend the Search.php view my class seems to take precedence. However, if I extend the abstract class ACustomer.php view, my class does not appear to take precedence. Code:
What I expect from the above is that all searches will return no results due to me overriding the getData() call. The behaviour is that it has no effect (searches work normally). If I change the extends directive to instead use Search.php, it does what I expect and returns no data. Why does the ACustomer version get ignored?
__________________
multiple versions (4 and 5) |
|||||||
|
|||
X-Cart forums © 2001-2020
|