我觉得 Magento 的灵活性可以解决我的问题,但我还没有找到任何东西。
所以基本上我需要获取可配置产品的子产品的属性值。到目前为止,我所能做的就是在 view.phtml 文件中:
if ($_product->getTypeId() == 'configurable')
{
$confAttributes = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
print_r($confAttributes);
}
但那是来自事物的父范围。基本上我的问题是我需要获取子产品的图像但是当我经历这样的循环时......
if ($_product->getTypeId() == 'configurable')
$_child_products = $_configurable_model->getUsedProducts(null, $_product);
for ($i = 0; $i < count ($_child_products); $i++){
<?php echo $this->helper('catalog/image')->init($_child_products[$i], 'image'); ?>
}
但现在这是从子产品的角度来看的范围。我需要以某种方式将子产品与它所采用的属性值相关联(用于 jQuery 和图像处理)。
那么有什么方法可以从 child_product 的角度获取一些可以将其链接到属性的信息?