我正在为我们的一位客户配置一个 magento 网上商店。他们有颜色代码,因此我必须设置可配置的产品。但是,在网上商店显示可配置产品之前,我需要选择一个属性来分配给它......
现在,如果我必须导入 +/- 800 种产品的整个目录,这真的很不方便......
我已经找到了下一个脚本来自动执行此操作,但我不知道将它放在哪里...我已经尝试在可配置的.php 文件中使用它,但没有用。请帮帮我!
    foreach($configAttrCodes as $attrCode){ 
        $super_attribute= Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product',$attrCode->code); 
        $configurableAtt = Mage::getModel('catalog/product_type_configurable_attribute')->setProductAttribute($super_attribute); 
        $newAttributes[] = array( 
           'id'             => $configurableAtt->getId(), 
           'label'          => $configurableAtt->getLabel(), 
           'position'       => $super_attribute->getPosition(), 
           'values'         => $configurableAtt->getPrices() ? $configProduct->getPrices() : array(), 
           'attribute_id'   => $super_attribute->getId(), 
           'attribute_code' => $super_attribute->getAttributeCode(), 
           'frontend_label' => $super_attribute->getFrontend()->getLabel(), 
        ); 
        echo "test ";
    } 
 echo "test2 ";
    if(empty($existingAtt) && !empty($newAttributes)){ 
        $configProduct->setCanSaveConfigurableAttributes(true); 
        $configProduct->setConfigurableAttributesData($newAttributes); 
        $configProduct->save();