Author Topic: "Generic Child Variant" - Prevent adding Parent to Shopping cart  (Read 29730 times)

dsrpmedia

  • Jr. Member
  • **
  • Posts: 328
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #30 on: June 29, 2012, 18:20:56 pm »
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

  • Beginner
  • *
  • Posts: 19
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #31 on: August 21, 2012, 14:09:12 pm »
Hi, does anyone know the Virtuemart 2.0.8e equivalent of this?

DaggaTora

  • Jr. Member
  • **
  • Posts: 253
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #32 on: August 28, 2012, 19:02:43 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

  • Beginner
  • *
  • Posts: 29
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #33 on: October 24, 2012, 18:25:55 pm »
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

  • Jr. Member
  • **
  • Posts: 132
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #34 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.

doell-computer

  • Beginner
  • *
  • Posts: 6
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #35 on: November 26, 2012, 18:06:48 pm »
i'm using 2.0.14 and adding the parent is always possible, wether i check "parent orderable" or not!  :(  :-[  :'(

nuntius

  • Beginner
  • *
  • Posts: 2
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #36 on: November 28, 2012, 14:40:07 pm »
Same problem here after updating to 2.0.14  :-\

alanbagl;ey

  • Beginner
  • *
  • Posts: 19
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #37 on: November 28, 2012, 15:49:13 pm »
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

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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9533
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #38 on: December 14, 2012, 14:35:24 pm »
Alan, you use K2, ask them.

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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

DaggaTora

  • Jr. Member
  • **
  • Posts: 253
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #39 on: December 19, 2012, 14:15:02 pm »
2.2? It would be great to have it in 2.1  :'(
Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #40 on: December 19, 2012, 19:26:35 pm »
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

  • Jr. Member
  • **
  • Posts: 253
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #41 on: January 04, 2013, 11:56:52 am »
 :-\ Thought that 2.1 was going to be stable enough for production.
Joomla 2.5.17 | VM2.0.26d | PHP 5.3.28

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #42 on: January 06, 2013, 17:57:57 pm »
@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

  • Jr. Member
  • **
  • Posts: 253
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #43 on: January 08, 2013, 10:07:36 am »
@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

  • Beginner
  • *
  • Posts: 42
Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
« Reply #44 on: March 08, 2013, 10:42:42 am »
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.