News:

Looking for documentation? Take a look on our wiki

Main Menu

Issue with slug auto-generation

Started by ermes, July 07, 2020, 16:28:36 PM

Previous topic - Next topic

ermes

Hi forum, i have more then one store (clothing) with products that have more then 40 variants (child product).
All variants retain the same name and when I try to save the 41st, virtuemart gives me the following error:

You are not an administrator or the correct vendor, storing of product cancelled

With a bit of debug, I understood that the problem is given by the automatic generation of the slug, more precisely in the file administrator/components/com_virtuemart/helpers/vmtable.php.

The offending function is checkCreateUnique that try to create a slug for 40 times. If my products are named all "T-Shirt" the slugs will be "t-shirt", "t-shirt-1", "t-shirt-2"... "t-shirt-39" and after this last, i can't add more childs because the cicle (while ($i < 40)) finished without a slug and return false. Wouldn't it be more correct to use a recursive function or at least to parameterize this value (40)?

Thank you in advance!

[EDIT]
To reproduce the error just create 41 products with the same name (there is no need to enter other data): the 41st will return the error indicated above. I have tested the problem on all versions of VM since 3.6

pinochico

very easy: you must create slug manually, what's the problem?

QuoteAll variants retain the same name

Very bad idea, if you send to Google Merchant Centre, then product name must with variant option.
Change the name of child and add to product name parameters name too.

Parent: T-SHIRT
Child: T-SHIRT Blue
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ermes

Yours is a good reply, but i think that this is a bug :)

pinochico

Definitely technically.

But on the business side, I don't think so, and I thank the VM Dev Team for putting that restriction there. At least the administrators will wonder why this is so
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ermes