News:

Looking for documentation? Take a look on our wiki

Main Menu

how to: selecting a child product from the parent product,please help

Started by angusmcr, June 12, 2013, 19:37:21 PM

Previous topic - Next topic

angusmcr

Joomla 2.5.9
VM 2.0.20b

I am having issues setting up the parent and child options for different sized products. the products are identical in description and image but the stock and weight needs to be different.

So I have a product that has 3 sizes
each of these products needs stock control and is a different weight for postage

So i have set up the parent as 500ml then added to child variants '1 litre' and '2 litre'.

I have set up a custom field type
Generic child variant
title: Select Size
published: yes
cart attribute: yes
description: (blank)
tool tip: ( Blank)
Layout position: (blank)
admin only : no
is a list: I've tried yes and no doesn't seem to make a difference
Hidden: no.

On the parent product I have selected the custom field 'Select Size'

So now on the parent product there is a drop down box and 'Choose a product variant  first'  where the add to cart would be.

The problem is that only the child products show in this list the parent is not selectable.

So I have added the parent size as a child product with a diffent sku for the parent
Now all three sizes show in the drop down list, with want was the parent first in the drop down list
However I am unable to  select that the first child option from the drop down on the parent product.
I can choose one of the other sizes which are the second and third option in the drop down. This takes me to the correct child variant and gives the add to cart option on the child product page for the 1 litre.  I can then On the child product page  reselect the first option in the list '500ml' in the list which takes me to the correct child product with an add to cart button.

So the child products are working fine but the drop down selection on the parent is not, as the first option in not selectable.

How do i set a product up so that the parent product can be added to the cart with the option to change to a different size child product . so that i have a main parent product and two other size variants
Or if i need a parent and three children  How do i make the first option in the variants drop down work so that it takes me to the child product.

sample page http://www.salehydroponics.co.uk/nutrients-and-additives/humboldt/prozyme-detail.html

A clear explanation of this would be greatly appreciated as i have been going round in circles looking for an answer in the forums, guides and manual.






studioblue

usually I create a dummy parent product  "Select Juice Size" and add All 3 products to that dropdown as children

lindapowers

Quote from: studioblue on June 17, 2013, 15:59:33 PM
usually I create a dummy parent product  "Select Juice Size" and add All 3 products to that dropdown as children


Hi, is this nowadays still the solution?

We just want the first element to be something like "please make a selection"

Regards

scarradice

I had exactly the same issue with the first child option not being selectable unless you chose the second child first then the first child after.  I was trawling through the forums to no avail.  I upgraded my Virtuemart version from 2.6.6 to 2.6.17 which fixed the drop down but for whatever reason, this broke my shipping and payment options in one page checkout mode.

I thought i would post my resolution in order to help anyone else who has had the same issue.  On line 1075  administrator/components/com_virtuemart/models/customfields.php, change:

foreach ($uncatChildren as $child) {
$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $child['product_name']);
}


to:

if(!$customfield->withParent or ($customfield->withParent and $customfield->parentOrderable)){
$options[0] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id,FALSE), 'text' => vmText::_ ('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
}
foreach ($uncatChildren as $child) {
$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $child['product_name']);
}