在这里,我从可配置产品($ full_product)获取相关产品系列。我想获得相关的产品属性,但我尝试过的所有方法都不起作用。我想循环遍历属性数组。
$associated_products = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$full_product);
foreach($_attributes as $_attribute) {
}
以下不起作用:
$_attributes = Mage::getModel('catalog/product_type_configurable')->getUsedProductAttributes($associated_products);
$_attributes = $associated_products->getTypeInstance(true)->getConfigurableAttributes($associated_products);
答案 0 :(得分:0)
请尝试以下.......
$Product=Mage::getModel('catalog/product')->load($congiProdID);
$attributes = $Product->getTypeInstance(true)
->getConfigurableAttributes($Product);
if (count($attributes)) {
foreach ($attributes as $attribute) {
/** @var Mage_Catalog_Model_Product_Type_Configurable_Attribute $attribute */
echo "<pre>";
print_r($attribute->getData());
echo "</pre>"
}}
// for getting all assocated products
$allProducts = $Product->getTypeInstance(true)
->getUsedProducts(null, $Product);
foreach ($allProducts as $product) {
}