Notice: Only variables should be assigned by reference in /var/www/clients/client4/web20/web/templates/shape5_vertex/vertex/responsive/responsive_mobile_sidebar.php on line 8

Notice: Only variables should be assigned by reference in /var/www/clients/client4/web20/web/templates/shape5_vertex/vertex/responsive/responsive_mobile_menu.php on line 278

VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me

TOPIC: Custom variables not working properly

Custom variables not working properly 29 Apr 2016 10:41 #1

Hello

I'm trying to use custom variables on product categories. I have tried to use
Categories
categories
Category
category
for variables and using equal and contains condition and non of them work.
What i want to achieve:
If category = AAA then prefix = AAA
I have [prefix]-[year]-[#####] as an output.

But instead of getting let's say AAA-2016-00001 i get [prefix]-2016-00001 as an invoice and order numbers.
I have disabled all plugins and moved to default theme, but it did not help.

How to use categories as a custom variable. I have tested demo and it did the job. But once i've purchases it does not work on my site.
The administrator has disabled public write access.

Custom variables not working properly 03 May 2016 11:33 #2

Ok. Seems i have found a bug in your plugin
1) custom variables does not work if name (tag or category) consists of multiple words like training materials. It does not work neither with equal sign nor with contain option. Once i change slug to one word (let's say training) it works ok but then second error comes.... below
2) custom variables does not work if = sign is used, even if work is written completely. It works only when i pur contains. So Categories = training will not work, but Categories contains training will work.
The administrator has disabled public write access.

Custom variables not working properly 03 May 2016 23:10 #3

Dear Iai,
Thank you for investigating further.

The categories (and tags) variables are a list of all category/tag SLUGs, not the human-readable names, as the names might be translated in multilingual shops. Typically, if you have a category with display name "Training Materials", the Slug in the category definitions page is "training-materials". If you use that in the custom variable definitions, things should work.

I have updated the documentation page to indicate that the Categories list contains the SLUGs of the categories, not their human-readable names.

Regarding the check with an equal sign: Categories is a LIST, so = does not really make sense in general. For list variables like SKUs, Categories, Tags, ShippingClasses etc. you should always use "contains".
The only case where = makes sense if there is only one category in the cart (i.e. all products belong only to one and the same category, and no other categories => the categories list is a list with one entry). In this case, category="training-materials" might be understood as a condition: There are only products from that one category in the cart, and none of the products in the cart belong to any other category (i.e. the Categories list is a one-element list with sole entry "training-materials"). For now, I think this is too much of a borderline-case, so we'll probably not implement this idea. Using "contains" on those five list variables provides exactly the functionality that you want to use, so I don't see any pressing need to change this.

Sorry for the confusion with the contents of the Categories list!

Best regards,
Reinhold
The administrator has disabled public write access.

VM - Shopping cart

 x 

Cart empty

Login Formular