cancel
Showing results for 
Search instead for 
Did you mean: 

Configurable Products with Custom Options (Programmatically)

Configurable Products with Custom Options (Programmatically)

Hi guys,

Trying to decide the best way to do this.

Selling frames for glasses and trying to decide if going configurable (with color being the variant for associated simple products) is the best way to go.

The problem is that there needs to be some custom options (lens coating) and some others.

 

I can get most of the way through the process as I am doing some other stuff programmatically so I am trying to add to the basket via a script but I am encountering "Please specify product option(s)" as my magento error.

Should I add the custom options to the simple product or the configurable or is there a better way to do this?

I should also add that some custom options will affect the price of the item.

 

This is my code:

$cart = Mage::getModel('checkout/cart');
    $cart->init();
    $params = array(
        'qty' => $qty,
        'super_attribute' => $super_attribute,
        'options' => $custom_options,
    );
    $cart->addProduct($product, new Varien_Object($params));

    // $session->setCartWasUpdated(true);
    $cart->save();

super attributes contains the simple product variant data and some attribute data and the options contains the custom options

2 REPLIES

Re: Configurable Products with Custom Options (Programmatically)

 yes you have to add the custom options in your configurable product because you are adding the configurable product to cart

Re: Configurable Products with Custom Options (Programmatically)

Hi,

Yes in the end I wrote a script to add custom options programmatically to specified products (whether they are simple or configurable)

There is an in-between step where a user then enters their glasses prescription (custom options) and all data is stored correctly programmatically and added (and displayed) in the cart correctly.

Think we ended up with a more elegant solution to our custom add to basket issue.