News:

Looking for documentation? Take a look on our wiki

Main Menu

"Generic Child Variant" - Prevent adding Parent to Shopping cart

Started by mulcamd, March 27, 2012, 19:43:35 PM

Previous topic - Next topic

dsrpmedia

this hack is for 2.0.6 - you can see it in action here http://vm20b.fyica.com/virtuemart/gardentools/test-detail - the thing I haven`t figured out is how to not display a price for the parent.

I`m on the road today, when I get back to the office I`ll upload my customfields.php file

ben1390

Hi, does anyone know the Virtuemart 2.0.8e equivalent of this?

DaggaTora

Quote from: ben1390 on August 21, 2012, 14:09:12 PM
Hi, does anyone know the Virtuemart 2.0.8e equivalent of this?

I think i solved this using http://forum.virtuemart.net/index.php?topic=100330.msg346003#msg346003 and displaying parent in customfield and categorizing only parent. But images of child 1 are the same of parent.
Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

delliott

I found this to work.

foreach ($uncatChildren as $k => $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']), 'text' => $child['product_name']);
}
array_unshift($options,"Please chooose an option"); // this pushes the option to the top of the list.

However, I am still looking for a way to now require that something get picked.

spyderwebdesign

In 2.0.14 you can not longer add the parent, however the first item in the drop down box is your first child so it appears to the customer that they can't order the first child variant. The first item in the drop down box should say something similar to Select Your Variant.

doell-computer

i'm using 2.0.14 and adding the parent is always possible, wether i check "parent orderable" or not!  :(  :-[  :'(

nuntius


alanbagl;ey

Hi Orfirel,

do you have a working example of this? Or has there been any updates from the Virtuemart Dev team on this?

I have followed the thread and I am unable to get this working. My demo / dev site with parent child products and attributes is here:

http://integrousdemo.co.uk/ccs/shop/painting/paint/k2-paint-detail

so VOLUME, YEAR  and GENERAL COLOR need to be mandatory and I should not be able to add to cart if  VOLUME has not been selected

Thanks in advise
Kind regards
Alan

Quote from: Orfirel on March 30, 2012, 09:32:55 AM
Insert these lines in cart.php instead:
-----------------------------------------------------
       if (sizeof($virtuemart_product_ids)>0) {
            $jobDb = JFactory::getDbo();
            $sqlStmt = 'SELECT c.custom_title FROM #__virtuemart_products p, #__virtuemart_product_customfields f, #__virtuemart_customs c
                                        WHERE p.product_parent_id=0 and p.virtuemart_product_id='.$virtuemart_product_ids[0].' and
                                            p.virtuemart_product_id=f.virtuemart_product_id and c.field_type=\'A\' and c.virtuemart_custom_id=f.virtuemart_custom_id';
            $jobDb->setQuery($sqlStmt);
            $jobResult = $jobDb->loadResult();               

            if ($jobResult != null) {
                $errorMsg = "You must choose " . $jobResult;
                $this->json->msg = '<a class="continue" href="' . $continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
      $this->json->msg .= '<div>'.$errorMsg.'</div>';
      $this->json->stat = '2';
                echo json_encode($this->json);
                jExit();   
            }
        }
-----------------------------------------------------

Can someone from the virtuemart team please respond on this topic? Why can't we have such a basic feature without editing the source code? Or am I missing something fundamental here?

Milbo

Alan, you use K2, ask them.

Quote from: spyderwebdesign on November 19, 2012, 01:06:08 AM
In 2.0.14 you can not longer add the parent, however the first item in the drop down box is your first child so it appears to the customer that they can't order the first child variant. The first item in the drop down box should say something similar to Select Your Variant.

Then you must check also the option "display parent as option" but configurate it as not orderable. This will be enhanced vm2.2. Exactly with a empty value "select your variant" we work on this.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

DaggaTora

Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

bytelord

2.2 will be the first stable release of 2.1 series. Atm will be released vm2.0.16
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

DaggaTora

 :-\ Thought that 2.1 was going to be stable enough for production.
Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

bytelord

@DaggaTora

For that reason the 2.0.16 was released, the next release will be 2.2
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

DaggaTora

@bytelord

;D I have a mess in the head with so many versions.

Now I see the Light!
Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

syntalk

Hi all,

All of you are doing great work here and thanks for all your help.
After reading this post I'm totally confused though :-\

In summary; is there a way to make a custom field (cart variant) as "required" that the customer MUST make the choice and to display "please choose" or similar as a first option in 2.0.18a version?

Thanks in advance.