VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: FREESERVIS on November 12, 2024, 21:59:06 PM

Title: Setting maxChilds=100
Post by: FREESERVIS on November 12, 2024, 21:59:06 PM
Hello,

I have 94 childs for one product in the e-shop.
In the administrator/components/com_virtuemart/views/product/view.html.php file,
I edited on line 115 $maxChilds = VmConfig::get('maxChilds',100);
and administrator/components/com_virtuemart/virtuemart.cfg inserted maxChilds=100.

When I set a custom color multivariant field for the product and want to save the product, the multivariants are not saved.
Where can the problem be?

Joomla! 5.1.4
VirtueMart 4.2.18 11050
PHP 8.2.25

Regards, Milan
Title: Re: Setting maxChilds=100
Post by: Milbo on November 12, 2024, 22:51:00 PM
Please read this manual https://docs.virtuemart.net/manual/general-concepts/hidden-configurations

just how to use it, write into your virtuemart.cfg

maxChilds=150
Title: Re: Setting maxChilds=100
Post by: FREESERVIS on November 12, 2024, 23:29:08 PM
What should I look for in the manual?

In the configuration file, maxChilds=100 is set and the configuration is saved. The entry maxChilds=100 is in the database, even so the custom color multivariant field is not saved.
Title: Re: Setting maxChilds=100
Post by: FREESERVIS on December 19, 2024, 02:26:23 AM
Hello,

unfortunately I didn't get any answer here, so at least I'll write what the problem is.

I have a default PHP max_input_vars setting of 1000 on my hosting. With this setting, a large number of product variants are not stored at all. I set max_input_vars to 5000 and saving works.

Milan
Title: Re: Setting maxChilds=100
Post by: hazael on December 19, 2024, 11:06:01 AM
Your problem is not only related to custom fields, but also to the number of added images, product description and other available forms in the product. For a very large store with a lot of data, Virtuemart becomes inefficient for standard hosting settings. There is a bottleneck..

This approach (sending all data in one large form) is not scalable and can lead to performance issues. A more efficient solution would involve:
Breaking down the form submission: Submit data in smaller parts (e.g., variants separately).
Using AJAX: Dynamically send data without relying on a single large form.

How AJAX Could Work in VirtueMart?

Product Creation:
The user creates a new product and saves only the basic data (e.g., name, category).
Once created, the product is assigned a unique ID in the database.
Dynamic Field Saving:
Each form field (e.g., price, variants, description) could be saved individually and automatically, without requiring the user to save the entire form manually.
AJAX sends the data to the backend immediately after it is edited or changed.
Benefits:
Increased Efficiency: Avoid sending the entire form with a large amount of data for every change.
Reduced Risk of Errors: If one field fails to save, the other data remains intact.
Better Scalability: The form is no longer limited by max_input_vars since variables are sent in small chunks.

Of course, this is not a job for you, but for Milbo. We have already written about it - Virtuemart requires changes to be able to compete with other popular e-commerce applications