Hi dear
Is there a way to override the _sfBuildWhereQuery and _sfBuildQueryJoins methods in the file https://github.com/j2commerce/j2cart/blob/main/administrator/components/com_j2store/models/products.php through Joomla MVC or by creating a plugin?
Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Latest post by Olivier on Sunday, 31 August 2025 21:50 UTC
Hi dear
Is there a way to override the _sfBuildWhereQuery and _sfBuildQueryJoins methods in the file https://github.com/j2commerce/j2cart/blob/main/administrator/components/com_j2store/models/products.php through Joomla MVC or by creating a plugin?
Hello,
theorytically, you can override the model with the class loader, but I have not tested it.
You could package it in a plugin in the onAfterInitialise() function (\JLoader::register...).
May I ask you what you need to change in the queries? Something that could benefit other users?
Thank you!
Olivier.
Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.
I tried a lot but I didn't succeed, could you please help me with the code? Maybe I made a mistake somewhere. I want to display articles that have not yet been converted into product in the products list.
Well this is a rather complicated process and a bit out of scope from regular support, not sure you really want to go to that rabbit hole.
Here is an example of a plugin that would override the admin Products model.
Installation:
1. Unzip then install the included zipped plugin through Joomla's extension manager
2. Enable "System - J2Store Products Override" in Plugin Manager
3. Set "Enable Override" to "Yes" in plugin configuration
4. The override will automatically activate when J2Store is used
Customization:
Edit plugins/system/j2store_products_override/models/products.php to:
- Add your custom logic to processCustomProductLogic()
- Override additional methods from the original model
- Add new custom methods
- Modify database queries in getProductListQuery()
Olivier.
Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.
Thank you very much Olivier, you really helped me a lot. I meant exactly the override structure, thanks again.
You are very welcome!
Olivier.
Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.
Subscribe for free and be the first to know about the latest features, updates, and new additions.