Author Topic: Simple VM3 Product Cart Variant Custom Field / Attribute Plugin [ FREE ]  (Read 46233 times)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Designed to offer a simple way to setup product variants such as size / colour etc - without the  need to create multiple VM products

The Plugin has been modified to a new name - VMCustom - VM Product Cart Variants (this should help avoid confusion caused by old name of DropBox as this did not reflect functionality)

Tested on VM3 using J3 php5.6 and php7and J2.5.  Its functionality is based on the original DROPBOX by PRO with 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

    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: <b>Sml@@sml,Med@+1@med,Lrg@+2@lrg</b>
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: <b>Sml,Med@@@2,Lrg@@@4</b>
Gives cart weight of: Sml = product weight, Med = 2, Lrg = 4

Note: you need 3 @ symbols before the weight variant else you will change some other setting
If the multiplier option is set in the configuration - these values are ignored


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.7.2
php 5.6 + php 7

doc_denis

  • Beginner
  • *
  • Posts: 36
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #1 on: January 09, 2015, 15:26:28 pm »
in the future,
Dropbox can it change the weight of the article ?
so it would be possible to avoid the child product creation for simple products

thank you, Denis

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #2 on: January 09, 2015, 16:19:58 pm »
It can do whatever it is coded to do.  ;)
regards
A

Joomla 3.7.2
php 5.6 + php 7

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #3 on: January 26, 2015, 19:27:08 pm »
Is there a simple way to get a cascading dropbox calculation effect, starting from your plugin? Do you ever planned such a thing?
Right now you can add only one dropbox per product.
But in my case I should split an option in 2 or more dropbox [i.e., a first dropbox for sw licence type (1 user, 2 users, 3 user, etc), and a second one for maintenance cost (1 year included, 2 years +30%, 3 years +50%, etc) for each license type coded in the first dropbox]: obviously you can't curenntly cascade this kind of action.
Thank you in advance for any hint.
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #4 on: January 27, 2015, 09:41:41 am »
You are not limited to just one drop per item

You can add as many dropboxes per product as you like  :)

example in image
regards
A

Joomla 3.7.2
php 5.6 + php 7

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #5 on: January 27, 2015, 09:57:56 am »
Maybe I have not explained my question in the right way :(

I have made this test

I have setup a product with a price = 100, having two different dropbox.

The first dropbox sets the price in that way:
first drop option       -> no action (base price = 100)
second drop option  -> price = 300
third drop option      -> price = 600

The second dropbox modifies the price in that way:
fisrt drop option       -> price * 1.5
second drop option  -> price * 2

if you select the second option in the first dropbox, and the first in the second one, the final price should be 300 + (300 * 0.5) = 450
but I get 300 + (100 * 0.5) = 350

This is why the second option uses the BASE product price (100), and NOT the one set by the first dropbox.
Am i wrong somewhere, or this is the current plugin way to calculate prices?
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #6 on: January 27, 2015, 10:38:54 am »
Agreed they are not chained for pricing calculation
regards
A

Joomla 3.7.2
php 5.6 + php 7

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #7 on: January 27, 2015, 10:44:10 am »
Any chance to get the plugin working in that way?
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #8 on: January 27, 2015, 18:45:31 pm »
STEP IT

The way you have described the functionality is the way it is designed to function

Product price = 100

Two dropbox customfields are created.

Box 1 has fixed pricing:-

Configuration: option1,option2@=300,option3@=300
Gives $modificatorSum pricing of:-
option1 = (uses product price)
option2  = 300
option3   = 600

Box2
Configuration: option1@*1.5,option2@*2
Gives $modificatorSum pricing of:-
option1 = 100*1.5
option2  = 100*2


The two $modificatorSum values for the selected options from the two drop customfields are added to the product price
regards
A

Joomla 3.7.2
php 5.6 + php 7

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #9 on: January 28, 2015, 08:05:59 am »
That's true.
But when the first dropbox changes the price to 200 or 300, the second one still uses the base price (100): this is wrong, the first dropbox has changed the base price to 200 o 300, then all other dropboxes should base their calculation on the new price set by the dropbox using the = operand, if any.
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #10 on: January 28, 2015, 11:24:22 am »
Quote
But when the first dropbox changes the price to 200 or 300, the second one still uses the base price (100): this is wrong,

I have to disagree, the plugin is working as designed. It was designed to meet my particular requirements and it does that perfectly.

Each drop box creates its' own value based on the salesprice 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. 

It may not meet your particular requirements and you are welcome to modify the code as you see fit.

If I change my code to meet your requirements then I have just messed up my required functionality and I trust you can see why that is not going to happen.

From a VM perspective:-

The base price NEVER changes, what is required by VM is to calculate the VM variable $modificatorSum

http://docs.virtuemart.net/tutorials/development/175-code-adjustments-for-virtuemart-3.html

It is very similar to the textarea vs input at a product level discussion earlier in this thread. Textarea met your needs but failed miserably for my requirement - therefore the core solution uses an input field at product level, into which the pre-set values are "read".

If you code something to meet both our needs I am happy to take a look  :)
regards
A

Joomla 3.7.2
php 5.6 + php 7

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #11 on: January 28, 2015, 12:02:26 pm »
OK, it was clear that my "wrong" expression was related to my needing :)
But (in my point of view) when you use the = option, you're changing the base product price and not simply modifing it!!!
Choosing an option where the = is set is equal to substitute the old base price value with another one you set by that option: so any other action ( +, - or * ) you add in that product as customfield should refer to the NEW product price you previously set by the plugin itself.
According to my point of view about the plugin, right now you should set only one = options dropbox per product, and no other customfields: otherwise you'll set a new product baseprice, but any further customfield will always refer to the old baseprice.
This DOESN'T mean your plugin doesn't work, but should mean that it's 'semantically uncorrect' in its global action when the = option is used in a product (following my point of view regarding the action set by the = option).
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2561
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #12 on: January 28, 2015, 12:33:22 pm »
Step

I feel your pain.

I used original dropbox by PRO for VM2 and needed similar functionality (plus the additional multiplier functionality that I required) to be available in VM3, so I made the upgrades. As a result dropbox for VM3 was created and made available for free, in the same spirit as PRO did with the original.

Coding to take into consideration every other drop box variant and changes in customer selection and user configuration is way too complicated for me to consider.
If you can come up with the logic to handle two dropboxes that are set to type "=" were added to an item. The code needs to handle it if chaining were introduced
(At least the current functionality is predictable, not what you need, but predictable :-) )
regards
A

Joomla 3.7.2
php 5.6 + php 7

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #13 on: February 01, 2015, 10:53:06 am »
Step: you need to set up child products

For your case, you setup child products at top level option:

then do dropbox
I do NOT do development work for hire.

SteP[IT]

  • Jr. Member
  • **
  • Posts: 186
  • Independent Websites Builder
    • MMC Edizioni - Italian Publisher (PaperBook)
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #14 on: February 01, 2015, 11:05:46 am »
Yes, I know that, this is exactly the way it's working now: but it requires to maintain A LOT of child products.
In my case I have to set up to 100 childs for some parent products, and this is a waste of time... this is why I'm looking for a faster implementation of this kind of option.
J 3.7.2 - VM 3.2.3

*** MMC EDIZIONI - Italian High-Quality PaperBooks Publisher ***
*** Company Site: http://www.mmcedizioni.it ***