VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: mulcamd on March 27, 2012, 19:43:35 PM

Title: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: mulcamd on March 27, 2012, 19:43:35 PM
When making a parent and children with "Generic Child Variant" I get a very nice dropdown list with the parent and the children listed. THIS IS FINE!

BUT because often the parent is the template for the variants of the children, the parent, at least in some cases, should not be addable to the shopping cart.
This because all the variations, the children, have the specific properties.

For example T-shirts. T-shirts have size and color.
To show all the variants with "Generic Child Variant" works perfectly. The parent being the pattern and the children the different entities.
But if a shopper, by accident puts the parent in the shopping cart, the shop owner can not know which size and color to ship.

How can be prevent that the parent is put in the shopping cart.

If not possible in version 2.0.2 / 2.0.3, could an option be added to parents like "addable to shoping cart"or "valid cart value" or ... (what's in a name).

Please give me advise how to handle.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Orfirel on March 28, 2012, 18:09:21 PM
I have the same problem. My semi optimal solution so far is to add these lines after line 703 in
administrator\components\com_virtuemart\models\customfields.php
----------------------------------------------------------------------
if (sizeof($options) > 1) {
    $options[0]['text'] = "Choose";
}
----------------------------------------------------------------------
And then add the following lines after line 119 in
components\com_virtuemart\controllers\cart.php
----------------------------------------------------------------------
if (sizeof($virtuemart_product_ids)>0) {
            $jobDb = JFactory::getDbo();
            $sqlStmt = 'SELECT count(*) 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 ((int)$jobResult >= 1) {
                jExit();   
            }
        }
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: mulcamd on March 28, 2012, 19:17:50 PM
One word: GREAT!

One small suggestion: when trying to add the parent to the shopping cart, give a error message that the user has to choose!
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: 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?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: patrik60 on April 01, 2012, 10:43:21 AM
This is a very good solution. Thank you. Would it be possible to have an option like "please choose" instead of the parents name at the top of the list?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Orfirel on April 03, 2012, 15:49:15 PM
Yes you can by inserting these lines after line 703 in administrator\components\com_virtuemart\models\customfields.php
if (sizeof($options) > 1) {
    $options[0]['text'] = "Please choose";
}


Another semi optimal solution is to follow Milbo's advice here: http://forum.virtuemart.net/index.php?topic=98648.0
That way your users will have the first variant if they forget to choose and click the "add to cart"-button.

I have found another bug in VM2 regarding variants. The combo box is not visible when using IE9 and the default VM2 template. It works in firefox and chrome though.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: patrik60 on April 03, 2012, 16:30:49 PM
Thank you for your answer. But it doesn't help. I still don't see the "Please choose", just the parents name on top of the dropdown. May be this is why I'm testing with version 2.0.3H? This version seems to have some bugs.

EDIT: updated to 2.0.3 I, still no effect. First part in cart.php works fine! Is it correct to insert it just before the line beginning with
"if ($is_list>0) {"

EDIT2: I have found it: Need to go to line 766 after

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']);
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Orfirel on April 04, 2012, 10:20:09 AM
Oh sorry, I forgot to mention, I am using 2.0.2 which according to "Virtuemart 2 - Live update" is the latest stable version. Nevertheless, it seems so unstable that I will have to go back to 1.1.9.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: cmalo on April 07, 2012, 15:26:17 PM
I see that you write that you have a good dropdown list when using "Generic Child Variant"

If i make this, i get a list , but it expands and closes when i click on the list.
Only way to choose from the list is when i hold my mouse button on the list, and move the mouse cursor a little bit....

Someone that can help me out??

http://cmalo.nl/testsite2/index.php?option=com_virtuemart&amp;view=productdetails&amp;virtuemart_category_id=37&amp;virtuemart_product_id=58 (http://cmalo.nl/testsite2/index.php?option=com_virtuemart&amp;view=productdetails&amp;virtuemart_category_id=37&amp;virtuemart_product_id=58)
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: thomaska on April 12, 2012, 13:00:55 PM
I am facing another problem and i am looking for a solution.
I am using VM 2.0.2 and Joomla 2.5.4
I had create a Generic Child Variant, associated with the parent item, and one child item. My problem is that the dropdown list contains the parent item more than once time and one child item. The result of the dropdown is the parent 3 times and the child one.

Any suggestions how to resolve the problem?

Thomas
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: olesman on April 12, 2012, 15:27:09 PM
@cmalo...I clicked on your link because I am having the same problem you describe.

How did you fix it?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Bruce Morgan on April 12, 2012, 16:45:30 PM
I see you guys are using 2.0.2 not 2.0.4.  Have you tried updating?  I need to implement a similar solution.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: olesman on April 12, 2012, 16:52:27 PM
It's all in the upgrade apparently.

After upgrading to 2.0.4 it looks like the customfield for child product variants has a drop down that stay dropped down.

The issue @cmalo was having.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: thomaska on April 12, 2012, 16:57:45 PM
I tried upgrading to 2.0.4 and this version was worst than 2.0.2
Any suggenstions on 2.0.2?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: cmalo on April 12, 2012, 18:13:45 PM
Quote from: olesman on April 12, 2012, 15:27:09 PM
@cmalo...I clicked on your link because I am having the same problem you describe.

How did you fix it?

Updating to 2.0.4 fixed it

_______________________________

My next problem is that i dont know how to sort child items
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: patrik60 on April 12, 2012, 18:20:09 PM
As far as I know there is no sort option. Children are sorted in the order they were created.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on April 13, 2012, 06:44:59 AM
Quotebecause often the parent is the template for the variants of the children, the parent, at least in some cases, should not be addable to the shopping cart.
This because all the variations, the children, have the specific properties.

I`ve been fighting with this for weeks - another thing that was super easy in vm 1.1 which apparently cannot be done in vm2 - at least without hacking the core (and re-hacking & re-hacking the core with every update)

I don `t know if the dev team even bothers to read these forums, but it was soooo much better when the parents were not added to the children dropdowns & all you had to do to make it so that the parent could not be added to the cart was simply not give it a price.

can`t we have something that easy with this new 'improved' system? PLEASE!
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on April 13, 2012, 06:48:04 AM
Quote from: patbe60 on April 12, 2012, 18:20:09 PM
As far as I know there is no sort option. Children are sorted in the order they were created.

how can they possibly expect you to create your products in the correct order you want them displayed?

say you have 1500 products in your shop & each has several children - if you get a new child option & want this product displayed near the top you have to delete every other product & re-add them in order?

that`s insane
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Bruce Morgan on April 13, 2012, 17:16:21 PM
I agree.  It is another basic usability feature that should not be ignored.  I could live without it but is sure makes life easier.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: patrik60 on April 17, 2012, 18:46:54 PM
@ Orfirel
I'm on VM 2.0.6 now. Your hack works still fine. BUT: There'a a new option in configuration, " Display modal popup upon 'Add to cart' ".
When enabled the hack works fine, when disabled it doesn't work, also Parent will be added to the cart. Is there any solution?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: doell-computer on April 21, 2012, 16:06:43 PM
Quote from: thomaska on April 12, 2012, 13:00:55 PM
I had create a Generic Child Variant, associated with the parent item, and one child item. My problem is that the dropdown list contains the parent item more than once time and one child item. The result of the dropdown is the parent 3 times and the child one.

Same here!
It seems if you use a product (with childs) in more than one category then the parent item appears multiple.  :(
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: jux on May 04, 2012, 15:34:35 PM
ok I think I have spot a bug here , because I m not the only to get this error, and I have test and install on 3 differents computer with fresh download joomla 2.5.4 + vm 2.0.6 and the issue is still here:

*BUG find  with  the parent product /child

when you set up the stock of the parent product to =6
When the stock of the child product is coming to = 0 it takes automatically the stock of the parent (=6)

Moreover the parent product can be ordered which is not ok. (there should be a warning popup asking to choose a size or color first - meaining choosing a child product from the parent product)

I could set up the stock of the parent produt to = 0 but there will be a problem on the page of the parent product it will show= product out of stock or notify me which is measleading the customer that will think the product is not available.

Could you please let me know on how to fix this issue?
My e-commerce is stuck from opening because of this.

Im using VM 2.0.6 and joomla 2.5.4
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on May 04, 2012, 21:14:25 PM
I`ve been begging for a fix for this for months

I`m still using VM 1.1 for all my ecommerce sites because VM2.0 just doesn `t work as well as the original
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Childitem on May 22, 2012, 13:17:04 PM
Virtuemart 2.0.6

When I insert the code below in cart.php just after the line with:

$virtuemart_product_ids = JRequest::getVar('virtuemart_product_id', array(), 'default', 'array');

The error message isn't generated when the parent item is added. Is this the right place to insert this code?
-----------------------------------------------------
       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();   
            }
        }
-----------------------------------------------------

Update:
The error message pop ups only if the option 'Display modal popup upon 'Add to cart'' in [Components, Virtuemart, Configuration, Checkout] is checked. If this option is not checked, the error message will not appear and the parent can be added to the shopping cart.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: spyderwebdesign on June 17, 2012, 05:06:51 AM
I am using VM 2.0.6 and I am having trouble

in customfields.php line 703 is

if ($is_list>0) {

on line 704 I paste
if ($is_list>0) {
   if (sizeof($options) > 1) {
      $options[0]['text'] = "Please choose a size";
   }

When I look at my page http://www.likdancewear.com/component/virtuemart/ellieshoes/3-or-less/016-mila-g-blkg-adult-glitter-flat-with-bow-detail.html?Itemid=0
I still see the parent item listed as the first item in the drop down. I want to see "Please choose a size".

I have the stock on my parents set to 0 so you can't order them. Only my children have stock.

Can anyone please help with the correct code for VM 2.0.6?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: spyderwebdesign on June 17, 2012, 05:28:14 AM
HOLY CRAP!!! - I think I found it with my fundamental php skills.

This appears to work, but I need to test ordering a product to see what happens.

in administrator\components\com_virtuemart\models\customfields.php
around line 763

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']);

change to

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']);
   $options[0]['text'] = "Please choose a size";
               }


-----------------------------------------------
or just add
   $options[0]['text'] = "Please choose a size";
on the line before the
}
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Parsimonious on June 17, 2012, 17:14:48 PM
Thanks that seems to work, although I'd prefer that "notify me" wasn't there as it could make some people believe the whole product is out of stock and deter them from trying to choose a size or colour. But it's still much better than what we had.

Just a note - If you're using a newer test version it has moved in the code down to around 1038 (well in 2.0.7f it has). They've changed the spacing a bit so using the find function doesn't easily work.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on June 17, 2012, 21:22:52 PM
QuoteHOLY CRAP!!! - I think I found it with my fundamental php skills.

This appears to work, but I need to test ordering a product to see what happens.

Yeah! - that`s very good work.

I also wish that the Parent Price and the 'notify me' or 'add to cart' would not appear on the parent page (used to be so easy - just set parent price to '0.00'), but this is by far the closest that I have seen anyone come to making the new VM work as well as the old.

This should be incorporated into the core of the next release.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on June 17, 2012, 22:01:31 PM
I made a small adjustment to the hack
foreach($uncatChildren as $k => $child){
$childprice = getChildPrice($child['virtuemart_product_id']); // get the price for child products
$childprice = number_format($childprice->product_price, 2, '.', '');
   $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']." [$".$childprice."]");
   $options[0]['text'] = "Please choose a size";
               }


this allows to show the child product price in the dropdown
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Maxim Pishnyak on June 29, 2012, 07:24:05 AM
Quote from: dsrpmedia on June 17, 2012, 22:01:31 PM
I made a small adjustment to the hack
foreach($uncatChildren as $k => $child){
$childprice = getChildPrice($child['virtuemart_product_id']); // get the price for child products
$childprice = number_format($childprice->product_price, 2, '.', '');
   $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']." [$".$childprice."]");
   $options[0]['text'] = "Please choose a size";
               }


this allows to show the child product price in the dropdown
Pardon me, but I can't solve your puzzle. I saw
Fatal error: Call to undefined function getChildPrice() in ..........administrator\components\com_virtuemart\models\customfields.php on line 763
and can't find getChildPrice neither in 2.0.6, nor in 2.0.7 files at all
Can you share developed by you function "getChildPrice"?
Thanx in advance!
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia 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
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: ben1390 on August 21, 2012, 14:09:12 PM
Hi, does anyone know the Virtuemart 2.0.8e equivalent of this?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: DaggaTora on August 28, 2012, 19:02:43 PM
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.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: delliott 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.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: 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.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: doell-computer 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!  :(  :-[  :'(
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: nuntius on November 28, 2012, 14:40:07 PM
Same problem here after updating to 2.0.14  :-\
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: alanbagl;ey 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

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?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Milbo on December 14, 2012, 14:35:24 PM
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.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: DaggaTora on December 19, 2012, 14:15:02 PM
2.2? It would be great to have it in 2.1  :'(
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: bytelord 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
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: DaggaTora on January 04, 2013, 11:56:52 AM
 :-\ Thought that 2.1 was going to be stable enough for production.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: bytelord 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
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: DaggaTora 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!
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: syntalk 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.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: motografik on May 17, 2013, 16:11:52 PM
Quote from: syntalk 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.
I am looking for this solution too. To prevent customers from accidentally choosing the wrong drop-down value.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on May 17, 2013, 20:00:29 PM
I had it working in a previous version, but in one of the new updates the hack stopped working.

I wound up just creating a child named 'please select' with no price, and set it so that it was the first child in the dropdown, not very elegant but it works
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: solmab on June 01, 2013, 01:07:44 AM
If that works that's great! does not work in Joomla! 2.5.6 VM 2.0.20b

What version are you using dsrpmedia.  If you set a child named 'please select' with no price- it still lets you add that to cart  ???

Any update on how to get round this issue?

Using Joomla! 2.5.6 VM 2.0.20b
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: dsrpmedia on June 01, 2013, 04:01:56 AM
hmmm I`m using joomla 2.5.9, VM 20.20b

the product 'please select' is not orderable - I don `t think I did anything to the code see


http://spectrum.rejuvasolutions.co/wellness/immunity/nasal-sinus-pray-detail
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: solmab on June 01, 2013, 23:49:01 PM
Thanks dsrpmedia. It does work.   :)

I had template override.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: jgbauer on June 03, 2013, 19:08:02 PM
can someone clarify the final solution on this issue?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Danny Poole on December 05, 2013, 05:00:18 AM
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.

This one worked for me but I changed it so if it is selected after another selection is made it doesn't boot me out to the home page.
array_unshift($options, array('value' => '#', 'text' => 'Please select an option'));
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: T.A. Garrison, LLC on January 13, 2014, 22:38:00 PM
There seems to be a lot of confusion - for many reasons. One reason is that some people are using a "Parent/Child" situation and creating resolutions. Those of us who "cannot" use that method are still using an independent product with "Custom Fields" due to the way the clients' products need to be tracked with the SKU "and" inventory.

Hence, there is no method for mandating a customer select something. At least, there has been nothing posted that actually works in the latest J2.5.17 and VM2.0.26d

I've tried many of the solutions, even some hacks. But nothing works - at least nothing I've tried to follow.
I don't want and cannot have my products a child of something. Each product needs to be independent.
And the "hacks" that I've read will be overwritten with any updates - they are not written as overrides. Those that had it working in previous versions, I'm sure, have found that the solutions no longer work...from what I've come across.

Here it is, January 2014, and this simple issue of making a selection "required" eludes VM2.0.26d

Let me ask the developers. What will it take to have the following issues resolved:
selection required to "any" list of custom fields
strikethrough "easily" assigned to the original price
tax per total in cart by US city (AlvaTax is NOT an option)
"Select a shipping method" AND "Select a payment method" hidden when there is ONLY 1 option offered

Will it take money? Time? Expertise?
Those same 4 issues have been now 2 years that I've watched the forums with no resolve.
I don't know how to word this message without it sounding like a complaint. But I truly am asking, what "will" it take for these resolves? Is it because they are only issues in the US?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: green-products.co.uk on May 30, 2015, 12:21:50 PM
Hello,

I know I am adding to an old topic but I cant find anything recent that comes close.

I have the same problem where in the dropdown I want "Please select" or something similar as the first option. Instead I see the description for the parent, and when I click, that is then added to the cart which I really don't want. Only child products should be ok to add to the cart.

Can anyone help with this please. I'm a Joomla and VM novice and I have spent hours trying to fix this. I'm using the Multi Variant Custom Field type.
VM 3.0.8
Joomla 3.4.1

David
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Milbo on June 04, 2015, 09:30:41 AM
All of the above problems are solved.

When you use the multivivariant just select for your parent in the matrix for one selection "none", done. Download the fullpackage and install the sampeldata
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: green-products.co.uk on June 22, 2015, 17:27:01 PM
Hello,

I have uploaded the sample data into a staging environment so I can check product setup.

I am still having a problem though with Parent and child setup. When I view categories or do a search the search results show both parent and child - that isnt what I would expect to happen. I have checked the sample data and been through the configuration and matched the setup of the multi-variant custom field exactly but I still see the parent and the child products.

I would appreciate any help I have been trying to fix this for weeks.

Thanks

David
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: green-products.co.uk on June 24, 2015, 12:14:05 PM
Hello,

I've found a workaround for this purely by chance.

I noticed that when I upload products with a parent and child relationship from a csv file I get exactly what I needed, so I deleted the incorrect products then just replaced them from a csv file.

No idea why this works given all other things are the same (all setup such as custom fields),but that's how I will be setting them up in future.

David
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: biltong on October 05, 2016, 17:07:21 PM
Quote from: Milbo on June 04, 2015, 09:30:41 AM
All of the above problems are solved.

When you use the multivivariant just select for your parent in the matrix for one selection "none", done. Download the fullpackage and install the sampeldata

Not quite Milbo - if you already have custom fields setup of a different type to multivariant, e.g. string and assigned values to products then there is still no out-of-the-box solution for this without changing the custom field setup, which is not a viable option if the site is already mostly built.

I don't understand why when all that is needed is a simple Required checkbox for checkout, which is configured in the Custom Field edit.

What am I missing here?
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: lausianne on March 20, 2018, 11:30:49 AM
Bumpring this. Is there any news on the issue, new existing solution or upcoming?
Thank you!
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: biltong on March 20, 2018, 12:26:20 PM
I recenty used the services of my template developer to implement a custom solution that makes a cart string custom field 'required'.

See it in action here https://www.trendco.co.uk/shop/rae (https://www.trendco.co.uk/shop/rae)
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: Studio 42 on March 20, 2018, 15:41:33 PM
This https://shop.st42.fr/en/products/shortcodes.htm implement mandatory fields without any hacks or template changes.
See http://pro.st42.fr/en/shortcodes/test-product-no4-in-engb.html for eg.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: lausianne on March 20, 2018, 19:49:02 PM
"Rating: 5 based on 1 rating" - This must be good  ;)

Could actually be the solution, plus some extras, thank you!

EDIT: It actually solved my problem. But mine was not about variants (OP), only about custom field options.
Title: Re: "Generic Child Variant" - Prevent adding Parent to Shopping cart
Post by: jjk on March 20, 2018, 21:01:56 PM
Normally you would add a custom field type 'Generic child variant' to the parent product. Afterwards you can select the option 'Parent orderable' Yes/No in the 'Product Edit' view > 'Custom Fields' tab.