我需要收集给定产品的所有可用属性,然后用它们创建一个多维数组。希望您可以创建一个多于二维的多维数组?生成的数组声明应如下所示:
$simpleArray[$child->getVendor()][$child->getColor()]=$child->getPrice();
首先,我收集所有属性,然后将它们添加到一个字符串中,稍后我可以调用每个属性:
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
//Gather all attribute labels for given product
foreach($_attributes as $_attribute){
$attributeString .= '[$child -> get' . ucfirst($_attribute->getLabel()) . '()]';
}
然后我试图将该字符串附加到数组中以声明它:
foreach($childProducts as $child) { //cycle through simple products to find applicable
//CAITLIN you are going to need way to search for other attributes, GET list of attributes
$simpleArray. $attributeString =$child->getPrice();
}
Mage::log('The attributeString is '. $simpleArray. $attributeString, null, 'caitlin.log'); //This is logging as "The attributeString is Array74"
有什么建议么?