0

I want to import configurable products in magento through xml. I have imported simple products.To create configurable product, I followed the process given here http://www.magentocommerce.com/boards/viewthread/46844/. It works. If I remove

$data=array('5791'=>array('0'=>array('attribute_id'=>'491','label'=>'vhs','value_index'=>'5','is_percent'=>0,'pricing_value'=>'')),'5792'=>array('0'=>           array('attribute_id'=>'491','label'=>'dvd','value_index'=>'6','is_percent'=>0,'pricing_value'=>'')));
$product->setConfigurableProductsData($data);

Still it works. and its good for me. But my problem is this code:

$data = array('0'=>array('id'=>NULL,'label'=>'Media Format','position'=> NULL,'values'=>array('0'=>array('value_index'=>852,'label'=>'vhs','is_percent'=>0,
  'pricing_value'=>'0','attribute_id'=>'182'),'1'=>array('value_index'=>853,'label'=>'dvd',
    'is_percent'=>0,'pricing_value'=>'0','attribute_id'=>'182')
),'attribute_id'=>182,'attribute_code'=>'media_format','frontend_label'=>'Media Format',
    'html_id'=>'config_super_product__attribute_0'));

Can't i use just $product->getTypeInstance()->setUsedProductAttributeIds(array(491)); to set super-Attributeid =491 for configurable product ? Why the detail of attribute is required here? Can anybody help me to find easiest way to create configurable product programmatically.

Mufaddal
  • 5,398
  • 7
  • 42
  • 57
smita
  • 33
  • 1
  • 6

1 Answers1

0

you have to see this link this is easiest way to create configurable product,

http://blog.omnisubsole.com/2009/07/01/configurable-products-in-magento/

goto app/design/frontend/default/your thme/template/catalog/product then open list.phtml

$product=Mage::getModel('catalog/product')->load($product_id);
$productType=$product->getTypeID();
//Simple Product
if($productType == 'simple')
{   
 //get simple product code here
}                           
//Configurable Product
if($productType == 'configurable')
{   
 //get Configurable Product code here
}
Pragnesh Rupapara
  • 782
  • 1
  • 12
  • 30
  • Gone through this link. The process is same as given here http://www.magentocommerce.com/boards/viewthread/46844/ . – smita May 08 '13 at 04:40
  • Imported configurable products. Products are visible from admin panel but not visible on front-end. Once i edit and save the configurable product from admin panel, it appears on front end. Please suggest... – smita May 10 '13 at 11:00
  • In front end which page you want to show configurable product view page or product list page? – Pragnesh Rupapara May 10 '13 at 17:26
  • After importing configurable product, if I do re-indexing then configurable product appears on front-end. Hence, i am re-indexing programmatically after import of products. Do you think its right way? – smita May 15 '13 at 08:18
  • no every time re indexing is not the proper solution, you can get configurable product in list.phtml using this link http://stackoverflow.com/questions/5280392/magento-load-only-configurable-products – Pragnesh Rupapara May 15 '13 at 08:54
  • If we create a configurable product manually from admin panel, it appears on front-end but imported products does not. I think it should appear automatically without making any change on list.phtml. Do you have any idea, what could be the reason behind this. – smita May 15 '13 at 10:49
  • yes it shows because product collection contain both simple and configurable product. – Pragnesh Rupapara May 15 '13 at 10:53
  • Then why do we need to update list.phtml for imported configurable products? – smita May 16 '13 at 11:21