2013-05-06 58 views
0

我想通过xml在magento中导入可配置产品。我导入了简单的产品。为了创建可配置的产品,我遵循了这里给出的过程http://www.magentocommerce.com/boards/viewthread/46844/。 它的工作原理。如果我删除如何以编程方式创建可配置产品

$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); 

仍然有效。对我有好处。但我的问题是这样的代码:

$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')); 

我不能只使用$product->getTypeInstance()->setUsedProductAttributeIds(array(491)); 设置超属性Id = 491配置的产品?为什么在这里需要属性的细节? 任何人都可以帮助我找到以编程方式创建可配置产品的最简单方法。

回答

0

你必须看到这个链接是创建配置的产品的最简单的方法,

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

转到应用程序/设计/前端/缺省的/你的论略/模板/目录/产品然后打开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 
} 
+0

浏览此链接。该过程与此处http://www.magentocommerce.com/boards/viewthread/46844/中给出的相同。 – smita 2013-05-08 04:40:50

+0

导入的可配置产品。产品从管理面板可见,但在前端看不到。一旦我从管理面板编辑并保存可配置产品,它就会出现在前端。请建议... – smita 2013-05-10 11:00:59

+0

在您想要显示可配置产品查看页面或产品列表页面的页面的前端? – 2013-05-10 17:26:54

相关问题