Skip to Content

New J2Commerce 6.6.5 is out. Here is everything in the release.

See What’s New
Account
Enter the email address on your account.
Forgot your username?
Enter your password.
Forgot your password?

Or continue with

Closed Public Category: Technical Support / Bugs Ticket #440

Override method

This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Conversation

Olivier Buisard Staff

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.

S derjan

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.

Olivier Buisard Staff

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()

Attachments

plg_system_j2store_products_override_UNZIPFIRST.zip

Olivier.

S derjan

Thank you very much Olivier, you really helped me a lot. I meant exactly the override structure, thanks again.