0
votes

I am trying to setup a bundle product within Magento. This product should allow the customer to select 4 free products to include with the bundle. These products can be all different or 4 of the same product.

For example

Free Product 1 Free Product 2 Free Product 3

A customer could select four of Free Product 1, or one of Free Product 1 & 2, with two of Free Product 3.

I am using 4 drop-down input types which each have all three Free products as options. So a customer can choose any of the three products for each Free Gift line item.

Magento is only displaying one of the drop-down select lists, I believe due to the fact that each drop-down contains the same product list.

Where would I need to look to stop Magento from checking if the product options are already listed in a previous selection?

1

1 Answers

0
votes

Unless you're doing this programmatically (that is writing the code), there's no way to do this.

When Magento adds a product, it first looks into the quote / shopping cart to see if one already exists. If one does, it pulls that one and adds to the quantity. There is no way to turn this off.

Programmatically, you very manually add an item to a shopping cart. This is how...

$cart = Mage::getSingleton("checkout/cart");

foreach ($products_to_add as $product_id => $custom_options) {
  $product = Mage::getModel("catalog/product")->load($product_id);
  $options = new Varien_Object(array("options" => $custom_options,
                                     "qty" => 1));

  // some products may result in multiple products getting added to cart
  // I beleive this pulls them all and sets the custom options accordingly
  $add_all = $product->getTypeInstance(true)
      ->prepareForCartAdvanced($options, $product, Mage_Catalog_Model_Product_Type_Abstract::PROCESS_MODE_FULL);

  foreach ($add_all as $add_me) {
    $item = Mage::getModel('sales/quote_item');
    $item->setStoreId(Mage::app()->getStore()->getId());
    $item->setOptions($add_me->getCustomOptions())
      ->setProduct($add_me);

    $item->setQty(1);
    $cart->getQuote()->addItem($item);
  }
}

// when done adding all the items, finally call save on the cart
$cart->save();