What am I trying to achieve?
- IN SHORT: I need to add new variables to products. IN LONG: I want to either extend the TableProducts class and add new variable to it, or be able to show certain custom fields without having to select them from a list, every time I create a product.
- Somehow, I have to find a way to get the products I want from the database by using SQL queries of my own (they are quite complicated), without hacking files that will get overridden.
- I've tried using MVC Override (https://gruz.ml/en/extensions/mvcoverride.html) but I've had difficulties at early stages and I'm not sure that's the option I should use.
- I've tried adding a new variable to TableProducts (/administrator/components/com_virtuemart/tables/products.php). But this is being overridden in any VirtueMart update.
- In order to extend the product's variables, I'm thinking about creating a new table with all the variables I want, and attach a product_id to it. Similar to how custom fields work.
- I've tried editing VirtueMartModelProduct class (/administrator/components/com_virtuemart/models/product.php) and changing SQL queries. This also wont be saved once VirtueMart udpates.
- This is kinda wack, but I tried to create fields that when the product is being saved, are all converted into an array and inserted in a custom field. Then I can extract them in product view, but I still cant run queries on a product with this way.
I don't ask for code, or specifics, I only need to know what are my best options. I will figure the rest.
If i can't find a solution, I'll have to keep hacking core files (which is so hard to maintain) or simply keep using the same VirtueMart version.
PHP Version 5.6.30
Joomla Version 3.7.0
VirtueMart Version 3.0.16 (I'm about to update to the latest)
Quoteshow certain custom fields without having to select them from a list, every time I create a product
You mean the dropdown on custom fields tab to add the fields to the product? Why is this to complicated? If you have a lot of fields you can add all this fields to a group and the only thing you need to do on new products is to choose this group on the dropdown and all fields are added to your product with one click.
better is to use a product pattern, so you can easily change all products at once.
K&K media production, can I tweak with the search results to show me products by certain custom fields? Order by these fields? I really need make some major changes in the SQL.
Milbo, I'm not sure I get it.
Quoteproduct pattern
install somewhere the demo VM package with products and study how the various custom fields are configured
OriyanJ,
what are the variables?
You can do a lot with custom fields. You can also do a lot with product plugins.
You can also add a custom
"Sort by Container" with your own links in it
then in your sublayout/products grab the parameter from the url, and sort by it.