News:

Looking for documentation? Take a look on our wiki

Main Menu

1 product with different quanties and pricing...

Started by knlpres, November 07, 2016, 15:02:48 PM

Previous topic - Next topic

knlpres

Using VirtueMart 3.0.18
Hello, This is not difficult I'm sure.  I do it in Amazon with a spreadsheet and create a parent/child relationship.

I have 1 product that I sell in different quantities and the client can select the quantity and it changes the price respectively.

I bought a plugin but it is for price "ranges" as far as I can tell.  Like for 5 - 10 x price. 11-20 another price.

Mine is specific quantities.  10 costs X  25 costs this much and 50 this much.

How is this done effectively in VM?  Also, I did a search but I'm not sure what keywords to use.
Joomla 3.3.6  and I believe php 5.1

gap

#1
If I understood well you have 3 product kits:
-10 pcs kit
- 25 pcs kit
- 50 pcs kit
Each kit has different prices.

You can solve this thus:
1. name the default product as Product 10 pcs kit
price should be 10x unit price, packaging should be "10"
2. make 2 child products:
        - 25 pcs kit
        - 50 pcs kit
pricing the same way
3. navigate to Products/custom fields and make a new variant "kit type". That might be a generic variant too, but then you cannot name the dropdown list items individually, you can only choose "name" or SKU and some other. I prefer to make a multivariant therefore where you can name the items as you want.
4. Go back to the main product (parent product). Navigate to custom fields tab and add the new multivariant "kit type".

If you choose the "unit price" on the prices tab in VM setup (/administrator/index.php?option=com_virtuemart&view=config) then the unit price will be also written in the price sheet. This is calculated like total price / packaging.
Now there is only one problem here. By the packaging you may only choose among "kg", m, m2 etc packaging units. You haven't got piece. This isn't very good because you sell now kits that are of pieces of products thus you need the "piece" unit.

To overcome this you need a core hack: ( UPDATED ON 10.12.2016 )
1. Find and backup the file: /administrator/components/com_virtuemart/helpers/shopfunctions.php
2. Find row number 329, this part
$weight_unit_default = array(
'KG' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_KG')
, '100G' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100G')
, 'M'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_M')
, 'SM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_SM')
, 'CUBM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_CUBM')
, 'L'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_L')
, '100ML'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100ML')
);


and replace with this:
$weight_unit_default = array(
'KG' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_KG')
, '100G' => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100G')
, 'M'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_M')
, 'SM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_SM')
, 'CUBM'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_CUBM')
, 'L'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_L')
, '100ML'   => vmText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_100ML')
, 'PC'   => JText::_ ('COM_VIRTUEMART_UNIT_SYMBOL_PC')
);


As you can see, all labels on the left are with capital. It has a role in prices.php thus you should pay attention to use capital letters.

2.b     Go to file /administrator/components/com_virtuemart/language/en-GB/en-GB.com_virtuemart.ini
and add the line:
COM_VIRTUEMART_UNIT_SYMBOL_PC="piece"

2.c   if you have other languages, you have to add the translations too. For example if you have German then go to
/administrator/language/de-DE/de-DE.com_virtuemart.ini
and add the line:
COM_VIRTUEMART_UNIT_SYMBOL_PC="Stück"

3. Go back to the product and choose "piece" from the packaging unit dropdown.

knlpres

Hi gap,

Well, I have gotten into it but it seems I'm either not seeing the simplicity of the system or it is as involved as it seems.

As I see it, I need to know how to create the new variant, which I learned to do thank you.  But I'm a bit lost in the structure and how it is applied.

I had a primary product say marbles.
28 blue marbles sells for $18.95.

But I also sell bags of 56, 114, 228 and 456 at varying prices because of volume discounts.

I had the 28 blue marbles set up and then created the others as children.  But there was no way to apply them.

I then created this multivariant and now when I go there I see all of them in the parent.  Problem is I'm unclear as to how to apply them.
Even in the product the variant appears on the product on the front end but just the one 28 items kit. The drop down is there but none of the others are appearing.

I'm sooooo close.  Maybe what I'm saying makes sense and you know that yes, I have to do such and such for them to appear...

knlpres

GOT IT.

For anyone needing the answer.

In the main product after you create the multivariant when you go in to the parent product when you go to the custom fields tab you need to add the name in the box that differentiates it and set it to "Product name".  Then add the names in the box to the right. Then save.

Now below where the child products are listed those names will be added to the dropdown next to the products.  Select the name and corresponding price and bang! 

Now I have to see if it processes through the cart properly. :-)

Thank you for pointing me in the right direction.  I learned a bunch.