1

Hi I have related simple products attached to all my simple products. An example is I sell a teddybear, and the customer can optionally add a hat to the teddybear at an extra cost. Normally, then can see the hat on the right, and tick the checkbox before clicking Add to cart - which adds both the teddybear and the hat.

Problem is when I have custom options on the hat for different colours or sizes. The checkbox disappears from the related list.

Using Magento 1.8 Community, does anyone know how to add the dropdown choice next to the checkbox (and ensure the dropbox is chosen if checkbox is ticked before adding main product to cart)

Many thanks

2 Answers 2

1
+50

I think the product type you are looking for is bundled products. While that does cover it in Magento Go the system is similar in CE 1.8. Using that should allow you to then just add the various item type addons that you need and have them be drop down menus that add whatever simple products they added. Then you just need to style the bundles to look like however you want them to using CSS.

2
  • Thanks for your answer - the link doesn't work for me, could you possibly provide another? Many thanks Sep 14, 2014 at 12:56
  • Many thanks - this worked well. I used jQuery to re-create the "related items" on the right col (as the right col was outside the <form>). Sep 16, 2014 at 12:16
1

Creating a bundled product may be a better option, but if that is not possible then to use simple product going to require a lot of customization

  1. Add the select box to your related.phtml template for each product /app/design/frontend/default/[design]/template/catalog/product/list/related.phtml

    see How to get Custom Options Programmatically in Magento

    <select name="related-option[<?php echo $_item->getId() ?>]">

  2. Then you will need to extend the Cart Controller /app/code/core/Mage/Checkout/controllers/CartController.php

/**
 * Add product to shopping cart action
 */
public function addAction()
{
    ...
   $cart->addProduct($product, $params);
    if (!empty($related)) {
       //change this 
       //$cart->addProductsByIds(explode(',', $related));
       // to
       foreach($related as $r){
       // todo : figure out the $params from related-option[$r]
       $cart->addProduct($product, $params);
       }
    }
    ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.