1

I did the following code: inside Model/Api.php.

      public function createLink ($bvitems, $bvselectionRawData, $bvproductId, $storeid ) {

        $selections = array();

        $selections = $bvselectionRawData;

        $productId = $bvproductId;
        $product    = Mage::getModel('catalog/product')->setStoreId($storeid);

        if ($productId) {
            $product->load($productId);
        }
        Mage::register('product', $product);
        Mage::register('current_product', $product);

        $product->setCanSaveConfigurableAttributes(false);
        $product->setCanSaveCustomOptions(true);

        $product->setBundleOptionsData($bvitems);
        $product->setBundleSelectionsData($selections);
        $product->setCanSaveCustomOptions(true);
        $product->setCanSaveBundleSelections(true);

        $product->save();
        return $product->getName();
       }

call it:

$proxy->call($session_id,'bvapi_products.createLink',array($items, $selectionRawData, $product_id, $store_id));

with this array:

    $items[0] = array('title' => 'Bundle Option',
        'option_id' => '',
        'delete' => '',
        'type' => 'radio',
        'required' => 1,
        'position' => 0);

    $selectionRawData[0][0] = array('selection_id' => '',
        'option_id' => '',
        'product_id' => 166,
        'delete' => '',
        'selection_price_value' => 0,
        'selection_price_type' => 0,
        'selection_qty' => 1,
        'is_default' => 1,
        'selection_can_change_qty' => 0,
        'position' => 0);

    $selectionRawData[0][1] = array('selection_id' => '',
        'option_id' => '',
        'product_id' => 167,
        'delete' => '',
        'selection_price_value' => 0,
        'selection_price_type' => 0,
        'selection_qty' => 1,
        'is_default' => 1,
        'selection_can_change_qty' => 0,
        'position' => 0);

    $items[1] = array('title' => 'Bundle Option 2',
        'option_id' => '',
        'delete' => '',
        'type' => 'select',
        'required' => 1,
        'position' => 0);

    $selectionRawData[1][0] = array('selection_id' => '',
        'option_id' => '',
        'product_id' => 151,
        'delete' => '',
        'selection_price_value' => 0,
        'selection_price_type' => 0,
        'selection_qty' => 1,
        'is_default' => 1,
        'selection_can_change_qty' => 0,
        'position' => 0);

    $selectionRawData[1][1] = array('selection_id' => '',
        'option_id' => '',
        'product_id' => 153,
        'delete' => '',
        'selection_price_value' => 0,
        'selection_price_type' => 0,
        'selection_qty' => 1,
        'is_default' => 1,
        'selection_can_change_qty' => 0,
        'position' => 0);

    $selectionRawData[1][2] = array('selection_id' => '',
        'option_id' => '',
        'product_id' => 148,
        'delete' => '',
        'selection_price_value' => 0,
        'selection_price_type' => 0,
        'selection_qty' => 1,
        'is_default' => 1,
        'selection_can_change_qty' => 0,
        'position' => 0);

my problem is product successfully updated but not showing into frontend.

Any help is appreciated.

  • finally did with $product->setPriceType(0); – Nilu Khair May 19 '15 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.