- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Super product attributes configuration
Hi,
I am new to magento hope so someone has a solution for my proble mentioned below:
I have created a site which contains configurable products whose price changes every day so have created a script to change the price programatically, actially using setPrice() option am able to change the price of configurable product but am not able to update the price in super product attribute field which fetches the price to cart.
I would be so happy if anyone could help.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Super product attributes configuration
Hi @rekha_devi
There is a lot of data associated with saving configrable data. There is a few ways of doing this. The simples being fetching the configurable data from the typeinstance on the product and then setting it again before saving.
// Mage_Catalog_Model_Product $product $configurableAttribtues = $product->getTypeInstance() ->getConfigurableAttributesAsArray();
This code will return an array contain all attronites amd the values for them. You can mod what you need and set it again dirrectly on the product object, and then save
$product->setConfigurableAttributesData($configurableAttributes); try { $product->save(); } catch(Exception $e) { Mage::logException($e); }
I hope this helps :-)