Magento 自动选择可配置属性
我正在为我们的一个客户配置magento webshop。他们有颜色代码,因此我必须设置可配置的产品。然而,在可配置的产品显示在webshop上之前,我需要选择一个属性来分配给它 现在,如果我必须进口一整套+/-800产品,这真的很不方便 我已经找到了下一个脚本,使它自动,但我没有线索把它放在哪里。。。我已经尝试在configurable.php文件中使用它,但没有成功。请帮帮我Magento 自动选择可配置属性,magento,select,attributes,product,configurable,Magento,Select,Attributes,Product,Configurable,我正在为我们的一个客户配置magento webshop。他们有颜色代码,因此我必须设置可配置的产品。然而,在可配置的产品显示在webshop上之前,我需要选择一个属性来分配给它 现在,如果我必须进口一整套+/-800产品,这真的很不方便 我已经找到了下一个脚本,使它自动,但我没有线索把它放在哪里。。。我已经尝试在configurable.php文件中使用它,但没有成功。请帮帮我 foreach($configAttrCodes as $attrCode){ $sup
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();
此脚本最好作为shell脚本来为产品分配配置属性。它不完全是你。我必须在这个脚本中添加很多内容,比如能够为它提供产品ID,以及与可配置属性一起配置的属性代码 很难向您展示它缺少了什么,因为您需要的不仅仅是这个脚本来分配属性。我运行一个脚本,获取可配置产品的所有ID,然后用它们生成一个缓存文件。我使用另一个脚本将这些ID提供给上面的脚本,以便它可以配置它们。总共有3个脚本。然后我使用一个shell脚本来运行这个过程 这是由另一个用户发布的,目的是帮助您指出需要前进的方向,但这绝不是一个独立的脚本。我可以通过电子邮件向您发送我所有三个脚本的源文件,您可以将它们反转下来,看看我做了什么,如果这有帮助的话