Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Enable Quantity in Bundled Product with Checkbox
 
lakirarodricks
Jr. Member
 
Total Posts:  7
Joined:  2010-10-28
 

Just add to my system now - the checkboxes are set to use? All this is due? There is an administration interface at all? A great work of code!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

@lakirarodricks: Please see post at http://www.magentocommerce.com/boards/viewreply/204065/ in this thread for more information about how it works and install notes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christen
Jr. Member
 
Total Posts:  19
Joined:  2010-11-10
 

Hi kabel. First off, I would like to say thank you for this wonderful plugin. I had trouble getting it to work with 1.4.1, but finding the right directories got it working.

Now, I’d like to ask if there’s a problem with my installation, but when I add a set of products under a checkbox option that is not required, checking out later in the page still gives me an error.

Here’s a screenshot for your convenience. I grayed out the products since it’s still confidential.

http://img696.imageshack.us/img696/3305/screen1wt.png

Basically, when I don’t select anything OPTIONS, it processes and gives me the error on top.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

Christen: Glad you were able to put the plugin to use and figure out the directory structure. Regarding the screen-shot, it appear that there is another custom option/bundle option (size) that is required. Magento won’t let you add the product to the cart without that option. Aside from that, a product that doesn’t have ANY required options should be able to be instantly added to the cart.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christen
Jr. Member
 
Total Posts:  19
Joined:  2010-11-10
 

I did select something for the size option. Magento does prevent you from processing if you haven’t selected any of the required options via javascript. To verify, I tried removing my custom options, and add the item to the cart without selecting any of the checkbox options. It gave me the same error (Please specify product options). If I did make it a required option, I don’t get to the error screen since javascript has already stopped me from doing that.

EDIT: I made a new product and I didn’t have problems afterwards. I still wonder who I got it though.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

Thanks for elaborating. I looked into this issue, and once again, this is an issue that is not introduced through my module. Rather, it’s part of the Magento core codebase. You can review http://svn.magentocommerce.com/source/branches/1.4/app/code/core/Mage/Bundle/Model/Product/Type.php around line 599 (the same functionality was copied into my module). Basically, Magento requires ALL bundle products to have at least 1 bundle option to be required. You could probably write a patch that part of the code, however I’m concerned about applying it to my module as skipping that constraint could have negative side-effects (especially for dynamic priced bundle items that don’t have any required options).

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christen
Jr. Member
 
Total Posts:  19
Joined:  2010-11-10
 

Thanks for identifying the problem. The new product I made has two bundled products so that’s why I didn’t encounter it again.

Again, thanks for the wonderful plugin.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

WARNING: Another bug in the core code of the Mage_Bundle module has been identified. This bug effects users that are using ANY shipping carrier that collects shipping rates based on product weight.

The bug occurs when a bundle item with a selection with a user-defined qty (as is the case with the checkbox options in my extension). When the bundle is added to the cart, the child items (the actual products that make up the bundle) have the correct Qty set, however when getting the weight of the parent (bundle) item, these Qty’s are ignored and the code only adds the weight of a each child item (selection) as if only one was in the cart.

This is extremely dangerous if a customer is adding a large quantity of a heavy weight item. The calculated weight will be significantly less than what is expected.

I’ll file a bug report with Magento to see what they do with it. In the mean time, I have prepared a patch and with update all of the download links in this thread to an updated copy of my extension with the patch included. Others who would like to know exactly what file has changed, my PM me for details rather than waiting for the next release.

EDIT: The previous links have been updated with the latest release. It fixes a couple of outstanding issues in the stable Magento 1.4 branch. The previous release is also available at the same Google Docs link.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webnerd
Jr. Member
 
Total Posts:  2
Joined:  2008-09-11
 

Hi Kabel

Thank you for this - almost exactly what I needed.  Just wondering how I might pre-fill the QTY fields with the default QTYs?  (I need the QTY fields pre-filled with the defaults whether the item is ticked default or not.. and the QTY to be ignored if that item is not ticked by the customer)

Kind regards
James

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webnerd
Jr. Member
 
Total Posts:  2
Joined:  2008-09-11
 

I figured it out!

If anyone else needs to know how to pre-fill the default QTYs… here’s how:

Edit checkbox.phtml:

1.  Add <?php $_defaultQty = $_selection->getSelectionQty()*1; ?> under <?php foreach($_selections as $_selection): ?>
2.  Find the <input> for the QTY field and change the value:  value="<?php echo $_selection->getSelectionId() ?>”

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
lkelly
Jr. Member
 
Total Posts:  6
Joined:  2010-11-30
 

Hi. Awesome work here btw-

I had been using this without much difficulty on Magento 1.4.1.0 - I recently upgraded to Magento 1.4.2.0 and it seems that when I add a product with a custom quantity (checkbox) the quantity no longer is reflected in the shopping cart. It always says 1 no matter what was originally selected.

I attempted to reinstall the module but that did not fix this new issue. Any thoughts?

http://store.mykeyport.com/index.php/individual-nodes.html is a link to a live page with this issue. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

Due to numerous issues that would cause many of my custom modules to break, I have not yet chosen to make my BundlePlus module compatible with Magento’s “stable” 1.4.2 release.

So until I see the need and I have enough time to evaluate all of the changes from 1.4.1.x to 1.4.2.x, my module with not be “fully” compatible with the 1.4.2 releases. I certainly entertain other developers to review the changes in 1.4.2 and contribute back. Sorry if you are displeased with this news. Sometimes, it’s hard to keep up with the evolution of Magento’s APIs.

As it is, it looks like the 1.5.0 branch will soon be making its way into “stable” status. All these changes that are quickly occurring do not exactly encourage developers to invest a lot of time into a particular branch that is just going to get broken again. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
lkelly
Jr. Member
 
Total Posts:  6
Joined:  2010-11-30
 
kabel - 19 January 2011 11:34 AM

Due to numerous issues that would cause many of my custom modules to break, I have not yet chosen to make my BundlePlus module compatible with Magento’s “stable” 1.4.2 release.

So until I see the need and I have enough time to evaluate all of the changes from 1.4.1.x to 1.4.2.x, my module with not be “fully” compatible with the 1.4.2 releases. I certainly entertain other developers to review the changes in 1.4.2 and contribute back. Sorry if you are displeased with this news. Sometimes, it’s hard to keep up with the evolution of Magento’s APIs.

As it is, it looks like the 1.5.0 branch will soon be making its way into “stable” status. All these changes that are quickly occurring do not exactly encourage developers to invest a lot of time into a particular branch that is just going to get broken again. smile

Looks like I will have to entertain the idea of downgrading to Magento 1.4.1. Thanks for the reply smile/

 
Magento Community Magento Community
Magento Community
Magento Community
 
kabel
Member
 
Avatar
Total Posts:  68
Joined:  2008-04-07
UNL, Lincoln, NE
 

For those following this thread and/or the development of the KAbel_BundlePlus module: I certainly have a vested interest in keeping my module (and my Magento installations) up to date.

If you feel compelled and/or willing to contribute back in the form of a small donation or code, I welcome you to PM me.

In the spirit of ensuring this post doesn’t conflict with the forum rules, it should not be interpreted as a “solicitation” but rather a statement that there are ways that you can help with development.

 
Magento Community Magento Community
Magento Community
Magento Community
 
balexandre
Member
 
Avatar
Total Posts:  60
Joined:  2009-04-13
København, Danmark
 

Hi kabel

Is there any code update now that 1.5.0.1 is out?

@Tuxi can you please repost the file, it’s goes to a blank page.

Thank’s

*** added ***

I installed the 1.4.1.1 version and all work fine except when I add the bundle product to the cart, I get this:

Fatal error: Unsupported operand types in \app\code\core\Mage\Bundle\Model\Product\Price.php on line 307

As read across this thread, the latest code should work fine with 1.4.1.1 correct? what am I missing then?

Thank you.

Price.php source from 1.4 branch see getSelectionPrice method

http://svn.magentocommerce.com/source/branches/1.4/app/code/core/Mage/Bundle/Model/Product/Price.php

line 307 is:

$selectionPrice $selectionProduct->getFinalPrice($selectionQty) * $selectionQty;

the problem is that if I print_r the $selectionQty and other vars like:

echo "multiplyQty --> $multiplyQty | selectionQty --> ";
print_r($selectionQty);
echo 
" | FinalPrice: " $selectionProduct->getFinalPrice($selectionQty);

I get:

multiplyQty --> selectionQty --> Array ( [1] => 20 [2] => 10 ) | FinalPrice100.0000

so, $selectionQty is an Array of values and therefor can’t be a multiplier.

my Product Bundle:

http://img4.imageshack.us/i/02032011115901.png

What am I missing?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top