Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Page 1 of 2
BUG - 1.3.2.3 and lower - bundled product with custom options can mess up the cart. 
 
fragilem17
Member
 
Total Posts:  56
Joined:  2009-02-15
 

Issue: http://www.magentocommerce.com/bug-tracking/issue?issue=7136

When a bundled product has custom options like a textfield and you add 1combination of the bundled product to the cart, THEN add the same combination but with a different text in the custom option field, the cart doesn’t show the second bundled poduct as it should. It adds the second bundled product, but also the simple products you selected as a single cart item.

how to re-produce:

1) Create a bundled product with a fixed price.
- add a custom option (eg: textfield)
- add atleast one bundled item.

2) Add the bundled product to cart - select the bundled item and type “test” for the custom option.
everything looks okay in cart

3) add the bundled product again - select the same bundled item and type “test 2” for the custom option.
stuff goes wrong! the simple product of the bunded product are shown. then the bundled product is shown again.

I currently don’t have a workarround. I found that when you change the quantity to add to the cart of the second bundled product to something else as the first bundled product, things work correct as expected.

somebody an idea on how to fix this?

except for this showstopper i love magento, thanks for the hard work and open sourcing it!

 
Magento Community Magento Community
Magento Community
Magento Community
 
fragilem17
Member
 
Total Posts:  56
Joined:  2009-02-15
 

the issue I posted has been assigned.
you can find the state here..

http://www.magentocommerce.com/bug-tracking/issue?issue=7136

can people with the same troubles please post something.
Just so I know i’m not the only one…

 
Magento Community Magento Community
Magento Community
Magento Community
 
fragilem17
Member
 
Total Posts:  56
Joined:  2009-02-15
 

little bump, can’t believe nobody has its shop configured so it has bundled products with custom options..

 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  223
Joined:  2009-02-05
Sydney
 

I can confirm this on 1.3.2.3 as well - it only occurs if you pick identical bundle options on the second and subsequent additions

 Signature 

Still has a soft spot for version 1.3.2.4

 
Magento Community Magento Community
Magento Community
Magento Community
 
constructaid
Sr. Member
 
Avatar
Total Posts:  146
Joined:  2008-08-21
Seattle, WA
 

Since you guys seem to be dealing with Bundle Items like I am, I thought I would post my problem here.

The items of my Bundled Product are no longer showing up as a list in the cart (see first image attachment).  They use to look like my second image attachment.  As you can see, the included options of my Bundle no longer show in the cart.  This is a big problem. 

I really need customers to be able to see what they just spent time configuring. If anyone can guide me how to fix this, that would be great.

I think I the code involved may be located in default/template/checkout/onepage/review/item.phtml, but I’m not sure?  The code that I think needs modification looks like this, but then again, I’m not sure if I’ve tracked down the right code?

<td class="attributes-col"><h4 class="title"><?php echo $this->htmlEscape($this->getProductName()) ?></h4>
 <!-- 
item custom options -->
        
<?php if ($_options $this->getOptionList()):?>
        
<dl class="item-options">
            
<?php foreach ($_options as $_option) : ?>
            <?php $_formatedOptionValue 
$this->getFormatedOptionValue($_option?>
            
<dt><?php echo $this->htmlEscape($_option['label']?></dt>
            <
dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
                <?php 
if (isset($_formatedOptionValue['full_view'])): ?>
                
<div class="truncated_full_value">
                    <
dl class="item-options">
                        <
dt><?php echo $this->htmlEscape($_option['label']?></dt>
                        <
dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
                    </
dl>
                </
div>
                
<?php endif; ?>
            
</dd>
            
<?php endforeach; ?>
        
</dl>
        
<?php endif;?>
        
<!-- / -->

As you can see, it appears that there is some code commented out?  However, when I remove these comments the site doesn’t change… any ideas?

Image Attachments
sample-2.gifsample-1.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  223
Joined:  2009-02-05
Sydney
 

That’s not the right file, you probably want:
template/checkout/cart/item/default.phtml

This has the loop that iterates through all the options (both bundled products and normal product options). In your screenshot it looks like either that entire file is being skipped or all options have been missed from the product model.

If this was working previously its most likely:
1) a problem in your layout xml file (probably bundle.xml or checkout.xml)
2) the phtml file that calls default.phtml has been changed
3) or possibly the entire bundle products module has been disabled - although you wouldn’t be able to add it to the cart in the first place if that was the case!

If you are missing custom options for non-bundle products as well then it will probably be something in checkout.xml or template/checkout/cart.phtml

The only thing to do is slowly chase through the files!

If you haven’t already turn on template path hints so you can at least get close to the block that’s causing the problem (System > Configuration > Developer > (pick a website) > Debug > Template Path Hints). Remember, if this is live store visitors will see your template path hints as well unless you restrict them to your IP address.

Good luck grin

 Signature 

Still has a soft spot for version 1.3.2.4

 
Magento Community Magento Community
Magento Community
Magento Community
 
hexagram
Jr. Member
 
Total Posts:  23
Joined:  2009-01-08
 

Just following up, I think I found a solution finally…

In /app/code/core/Mage/Sales/Model/Quote.php on line 783, change getAllItems() to getAllVisibleItems(). This should make it grab only the parent (bundle) products.

Note: You should obviously do this under the ‘local’ directory or create a module.

This seems to work for version 1.4.1, but haven’t seen any side effects yet.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hexagram
Jr. Member
 
Total Posts:  23
Joined:  2009-01-08
 

removed....

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-04-16
Cologne, Germany
 

Thanks hexagram.

The 1.4.x versions I am looking at contain “getAllItems()” on a number of lines in that file, but not on line 783. Could you post the context of the code that needs changing please?

By the way, I have also found that adding two of the same bundled product to the cart also results in the simple items being added separately and in addition. See http://vimeo.com/11489891 and http://www.magentocommerce.com/boards/viewthread/185051/

 Signature 

David Oliver - web and print design

 
Magento Community Magento Community
Magento Community
Magento Community
 
hexagram
Jr. Member
 
Total Posts:  23
Joined:  2009-01-08
 

Sorry, for version 1.4.1 the line number should be 774 under the function getItemByProduct().

It should then be:

public function getItemByProduct($product)
{
    
foreach ($this->getAllVisibleItems() as $item{
        
if ($item->representProduct($product)) {
            
return $item;
        
}
    }
    
return false;
}

Edit: Sorry, this “fix” causes other bundles to double when adding them to the cart and therefore will not work.  Will keep trying.

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Guru
 
Avatar
Total Posts:  739
Joined:  2008-10-21
 

Fix for this.

Sales_Model_Quote

Quote.php

protected function _addCatalogProduct(Mage_Catalog_Model_Product $product$qty=1)
    
{

        $item 
$this->getItemByProduct($product);
        if (!
$item{
            $item 
Mage::getModel('sales/quote_item');
            
$item->setQuote($this);
        
}

        
/**
         * We can't modify existing child items
         */
        
if ($item->getId() && $product->getParentProductId()) {
            
return $item;
        
}

Fix is (from Unigy)

protected function _addCatalogProduct(Mage_Catalog_Model_Product $product$qty=1)
    
{

       $item 
$this->getItemByProduct($product);
         if (!
$item || $item->getParentItemId()) {
         $item 
Mage::getModel('sales/quote_item');
         
$item->setQuote($this);
         
}


        $item
->setOptions($product->getCustomOptions())
            ->
setProduct($product);

        
$this->addItem($item);

        return 
$item;
    
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Guru
 
Avatar
Total Posts:  739
Joined:  2008-10-21
 

Sorry, that should be Sales_Model .. ignore the quote. Otherwise you edit the wrong .php file

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-04-16
Cologne, Germany
 

Thanks elfling,

The site that was giving me this issue is no longer a problem for me, but it’s good to know your solution is here.

 Signature 

David Oliver - web and print design

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Guru
 
Avatar
Total Posts:  739
Joined:  2008-10-21
 

Well, I wish I could say that the problem was completely resolved. It appears though that the side effects of this is the bundle id gets confused and added the the first product to cart.

Update _addCatalogProduct function above to

protected function _addCatalogProduct(Mage_Catalog_Model_Product $product$qty=1)
    
{
        $item 
$this->getItemByProduct($product);
        if (!
$item || $item->getParentItemId()) {
            $item 
Mage::getModel('sales/quote_item');
            
$item->setQuote($this);
            if (
Mage::app()->getStore()->isAdmin()) {
                $item
->setStoreId($this->getStore()->getId());
            
}
            
else {
                $item
->setStoreId(Mage::app()->getStore()->getId());
            
}
        }

        
/**
         * We can't modify existing child items
         */
        
if ($item->getId() && $product->getParentProductId()) {
            
return $item;
        
}

        $item
->setOptions($product->getCustomOptions())
            ->
setProduct($product);


        
$this->addItem($item);

        return 
$item;
    
}
Change the checkData function in Sales_Model_Quote_Item_Abstract to the following.

public function checkData()
    
{
        $this
->setHasError(false);
        
$this->unsMessage();

        
$qty $this->_getData('qty');

        try 
{
            $this
->setQty($qty);
        
catch (Mage_Core_Exception $e){
            $this
->setHasError(true);
            
$this->setMessage($e->getMessage());
        
catch (Exception $e){
            $this
->setHasError(true);
            
$this->setMessage(Mage::helper('sales')->__('Item qty declaration error.'));
        
}

        
try {
            $this
->getProduct()->getTypeInstance(true)->checkProductBuyState($this->getProduct());
        
catch (Mage_Core_Exception $e{
            $this
->setHasError(true);
            
$this->setMessage($e->getMessage());
            
$this->getQuote()->setHasError(true);
            
$this->getQuote()->addMessage(
                
Mage::helper('sales')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.')
            );
        
catch (Exception $e{
            $this
->setHasError(true);
            
$this->setMessage(Mage::helper('sales')->__('Item options declaration error.'));
            
$this->getQuote()->setHasError(true);
            
$this->getQuote()->addMessage(Mage::helper('sales')->__('Items options declaration error.'));
        
}

        
return $this;
    
}

Seems to now be completely fixed

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Guru
 
Avatar
Total Posts:  739
Joined:  2008-10-21
 

The above fixes issue of adding 2 or more to cart or selecting different bundle options on the particular bundle item and fixes the bundle custom options.

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Guru
 
Avatar
Total Posts:  739
Joined:  2008-10-21
 

Found another problem that still persists.

For some reason the configurable parentId and Bundle parentIds seem to get muddled up when they are in the cart.

Anyone else seen this behaviour?

Edit - this may have been caused by my ajax add to cart :(

Edit Edit - Actually this parentId problem getting mixed up was a 1.3.1 issue.


Used the above patch on 1.3.2.4 and all works successfully!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
© Copyright Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
819302 users|775 users currently online|519717 forum posts