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, 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

Magento Forum

Configurable Products Inputs instead of Drop Downs
Jr. Member
Total Posts:  15
Joined:  2008-06-23

I have what seems to be a relatively unique situation in that one of my product types, which is configurable will only ever have 1 configurable attribute (size). As a result the client has requested that instead of a drop down with a single quantity input there be a series of inputs, one for each size.

The problem I was having was if I had sizes A, B and C and I entered a quantity of one each it added 3 to the cart for A and none for B and C. But if I added one at a time to each one, it worked fine. After digging around it seems the problem is caused by $_quote inside of Mage_Checkout_Model_Session. I’m not exactly sure why but it seems like Magento is only configured to allow adding one product at a time. The problem is Mage_Checkout_Model_Session::$_quote is protected, so to modify it I have to either:
a - make it public (not good)
b - modify the class to have a reset method for this property (works, but don’t want to modify core if I can avoid it)
c - use the unsetAll() method, which ends up wiping the entire session and with it the contents of the cart.

I’ve got it working by making the attribute public and resetting it to null manually, so resetting this attribute does seem to fix the problem. I don’t mind having to modify core code because I can just check core into SVN and document the change, I would just like to avoid doing so if possible. The other possibility is to spend more time digging around and try figuring out why this attribute is causing the problem and try to find some other work around but I get the feeling this is a design constraint and not a random issue that will be easily solved.

Just looking for some input from others in the event any one else has had this problem. And just to clarify, at this point in the game switching away from configurable products to something else like bundled isn’t an option.

Below is a snipped version of the code being used to add the product to cart, copied from Mage_Checkout_CartController::addAction() and modified accordingly.

$cart    $this->_getCart();
$params  $this->getRequest()->getParams();
$product $this->_initProduct();

      if (!
->_getSession()->addError('Unable to find product');

      foreach (
$params['super_attribute'][$attr_id] as $config_id => $config_qty{
if (!$config_qty)

$product_params = array('super_attribute' => array($attr_id => $config_id), 'qty' => $config_qty);

           * @TODO
           * Clean up, if there's no other way to reset this attribute put it BACK to protected
           * and put together a small reset method instead of leaving it public like this.
           * Attribute found in Mage_Checkout_Model_Session
$cart->getCheckoutSession()->_quote null;
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top