News:

Looking for documentation? Take a look on our wiki

Main Menu

Simple VM3 Product Cart Variant Custom Field / Attribute Plugin [ FREE ]

Started by AH, December 20, 2014, 10:53:56 AM

Previous topic - Next topic

AH

Designed to offer a simple way to setup product variants such as size / colour etc - without the  need to create multiple VM products

Update April 2021 - Version 6.1

  • Support for Language Keys in Title and Variant names
  • Add a new option to allow the price to be shown next to the variant option when using a multiply modifier (*)

Update March 2021 - Version 6
GJC - Great idea to display variant in the cart using its own template, allowing for simple adjustments to be made
New tmpl/cartdisplay.php - can now be styled to control the look of the items in the cart


Update June 2018 - Version 5.1

  • Removed some old vm2 functions: plgVmDisplayInOrderCustom, plgVmCreateOrderLinesCustom
  • Tidied up preparecartproduct function and coded to handle accidental spaces that may have been set by the user in the parameter for modifier value (mv - below)
  • Modified the template to handle the display of variants where accidental spaces have been set by the use in the modifier value (mv - below)

Tested on VM3 using J3  PHP7.  Its functionality is based on the original DROPBOX by PRO - This version has greater functionality  :)

Download zip file is at the bottom of this post


This plugin does not handle stock control at a variant level

Plugin Features:

    Apply A Template Of Options with just 1 Click includes pricing adjustments -     Options are configured as a simple comma separated List
    Creates a Product drop down selection list of cart variants Or a Radio List (Radio list is new option in version 5 - thanks to Stefano Pascucci )

    Price Variants supported for each cart variant:-

  •    Standard sales price + or -
  •    Standard sales price Multiplied by a value (including decimals)   e.g. *2.5 ,  *.5 , *1
  •    Fixed price (overrides Standard sales price)
  •    Append string to SKU (adds a string to the original SKU - useful for analytics and export of order lines)
  •    Fix the weight (Overrides the product weight)
Each variant can use a different price rule

Additionally you can adjust cart weight using the price multiplier * Where the Multiply rule is used, you can optionally modify the cart product weight by the same factor, (Configuration option for each Product cart customfield variant)

Instructions:
Install The Plugin,  Enable It
Go to custom fields.
Click "new"

Fill in the title. 
Make it a cart variant and cart input.
Additional parameters - Choose Plugins, Then "VMCustom - VM Product Cart Variants"
If you save at this point the configuration parameters will be shown. (If you alrady know what to complete - you can just add the parameters required)
Fill In the option field separated by Commas.
Then save.

Structure t@mv,
t = Item variant - Drop selection text and Item variant text that will show in cart
@ = separates the modifier from the selection text - If there is no modifier nothing else is needed
m = modifier either + - * or =
v = modifier value
, = separates variants

Examples

1.Simple selections no price adjust
Config: Red,Green,Blue
All variants are at Retail

2.Adjust the price + or -
Config: Sml,Med@+1,Lrg@+2
Give prices of: Sml = Retail, Med = Retail +1, Lrg = Retail +2

3.Multiply the price *
Config: 1m,2m@*2,3m@*3
Gives prices of: 1m = Retail, 2m = Retail * 2, 3m = Retail * 3

You can also use decimals here e.g. 1 feet,1.5 feet@*1.5,2 feet@*2

4.Sell fixed multiples *
Config: 2kg@*2,4kg@*4,6kg@*6

5.Fix the price of a variant
Config: Red,Green,Blue@=12.50
Gives prices of: Red Green = Retail, Blue = 12.50

And of course you can do a combination of all of the above

6. Append a string to the sku
Config: Sml@@sml,Med@+1@med,Lrg@+2@lrg
Gives SKU's of: SKU: origsku-sml, origsku-med, origsku-lrg

Note: you need 2@ symbols before the sku variant else you will change some other setting

7. Change the cart weight for a variant

Config: Sml,Med@@@2,Lrg@@@4
Gives cart weight of: Sml = product weight, Med = 2, Lrg = 4

Note: you need 3 @ symbols in a variant for the weight to be set correctly otherwise you will change some other setting
Setting a weight using this parameter will override any weight calculated by the multiplier option.


8. Product variant selections can be a set of mixed types if required
Config: Sml@*2,Med@+12,Lrg@-2
The custom field setup WILL save to the product with price variations.
You can adjust this in an individual product if required.


Multiple Cart variant customfields

It is possible to have multiple Cart variant customfields for a product
Each Cart variant customfields creates its' own value based on the Standard sales price of the item. They are not chained or linked, a selection in one product drop box that produces a price variant will not affect any other drop box calculation. 



The plugin is offered "as is" so make sure you test thoroughly before deploying in a live environment.
Regards
A

Joomla 3.10.11
php 8.0

AH

Regards
A

Joomla 3.10.11
php 8.0

lekreator

its possible to make percentage?

IE: variant 1 20%, variant 2 30% ?

AH

QuoteIE: variant 1 20%, variant 2 30% ?

3.Multiply the price *
Config: 1m,2m@*2,3m@*3
Gives prices of: 1m = Retail, 2m = Retail * 2, 3m = Retail * 3

You can also use decimals here e.g. 1 feet,1.5 feet@*1.5,2 feet@*2


So to increase by 50% =  *1.5
To decrease to 90% = *.9
Regards
A

Joomla 3.10.11
php 8.0

arkimede360

Hi, the price is whitout tax, es:

15 gg lavorativi@+60

How to add price with tax?

Thank you.

AH

Yes the prices are displayed without tax

You can modify your template to "hard code" a tax calculation

I have no plans to modify the plugin to support the displaying the modifier inclusive of tax
Regards
A

Joomla 3.10.11
php 8.0

Vickham

EDIT: I solved this. Thanks!

Hi!

How can I add a price modifier for a cart weight total?

My product weights 1kg so I use 6kg@@@6 to add a variant of 6kg to the cart weight but also I want to add a +$10 for that variant of 6kg

AH

Format is :-

variantdisplayed@pricemodifier@skumodifier@weightmodifier

So in your case:-

variantdisplayed@pricemodifier@@weightmodifier

6kg@+10@@6


:)



Regards
A

Joomla 3.10.11
php 8.0

Vickham


Pirosoft

Hi, i have a problem with this plugin, if a set a multi variant calculations, don't give the right price.
for example i have the product with base price 79.9
And the custom qvariant:
1000@=79.70,3000@=105.00,5000@=128.50,7500@=156.75,10.000@=182.00,15000@=234.00,20000@=292
and in other i have:
7 days@*1,7 days@*1.15

if i set 3000 from the first
and 7 days from the second
105*1.15=120,75

But your plugin give me the price: 116,96

Because make the calcs over the base price in virtuemart product:
79,9*1,15-79,9=11,985
105+11,985=116,96

how i can resolve?

thanks


AH

This is relevant to your issue:-

Multiple Cart variant customfields
It is possible to have multiple Cart variant customfields for a product
Each Cart variant customfields creates its' own value based on the Standard sales price of the item. [b]They are not chained or linked, a selection in one product drop box that produces a price variant will not affect any other drop box calculation. [/b]


This plugin does not chain multiple boxes - one variant will not affect another.

I have no plans to modify the plugin to support this.
Regards
A

Joomla 3.10.11
php 8.0

rvbgnu

Hi AH,

Thank you for keeping this plugin up-to-date.

I migrated in 2015 a website from VM 2.6 to VM 3.0.x, which was using the Dropbox plugin by Pro. I found this thread and followed the discussion to get tips and SQL commands to update the old format. I took some notes, and also URLs of messages. Unfortunately, these posts are no longer available. Why?
http://forum.virtuemart.net/index.php?topic=127362.msg436581#msg436581

Do you have instructions on how to do it?
(at that time, your plugin was in version 3.0.7).

I'm looking forward to hearing from you.
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - [url="https://www.puma-it.ie"]https://www.puma-it.ie[/url]

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! [url="//stripe.com"]Stripe.com[/url] payment plugin for VirtueMart 3: [url="https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart"]https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart[/url]
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: [url="https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart"]https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart[/url]

AH

The posts were removed because they had become outdated and irrelevant to the current version.

Regarding the updating from old versions to new version:

In table: #_virtuemart_customs

The content of custom_element and custom_value fields should now be qvariant

The content of custom_params should be in the format:

custom_qvariant="1m,2m@*2,3m@*3,4m@*4,5m@*5,6m"|custom_qvariant_weight="0"|
Regards
A

Joomla 3.10.11
php 8.0

rvbgnu

Thank you for your reply A, it helps a bit. But I am not comfortable with SQL commands and Regex, so would you have the SQL to migrate from the last dropbox format (on VM2) to the current one? As I kept old versions on my dev environment, I would be able to test and adjust them if needed.

It should be helpful also to people with late migration.

And even if I did it on previous posts (now removed), thank you A for providing us with an up-to-date version of this plugin, and much better for free! I really appreciate it.
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - [url="https://www.puma-it.ie"]https://www.puma-it.ie[/url]

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! [url="//stripe.com"]Stripe.com[/url] payment plugin for VirtueMart 3: [url="https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart"]https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart[/url]
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: [url="https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart"]https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart[/url]

AH

Quoteso would you have the SQL to migrate from the last dropbox format (on VM2)
It should be helpful also to people with late migration.

Sorry but I never did a migration.

You will need to modify two tables  - my suggestion is to create a "dummy Customfield Cart variant" for the new plugin and see the changes you need to make to any existing ones.

#_virtuemart_customs  (where the Master variant is stored)
AND
#_virtuemart_product_customfields (where variant for the product is stored)




Regards
A

Joomla 3.10.11
php 8.0