【发布时间】:2012-01-06 07:12:03
【问题描述】:
我的 magento 分组产品有一个典型情况。 是否可以在前面的分组产品下显示关联产品的自定义属性(颜色下拉列表)。如下所示
考虑样品毯产品
如果我不清楚,请告诉我。 谢谢
【问题讨论】:
标签: magento
我的 magento 分组产品有一个典型情况。 是否可以在前面的分组产品下显示关联产品的自定义属性(颜色下拉列表)。如下所示
考虑样品毯产品
如果我不清楚,请告诉我。 谢谢
【问题讨论】:
标签: magento
你的问题不清楚,但我会给你一个小例子来获取文本字段、多选或下拉列表框值。
首先,我们应该加载产品集合:
<?php
// load the product that id 125, then show attributes of the product
$product = Mage::getModel('catalog/product')->load($this->getProduct()->getId(125));
echo $product->getCustomAttribute();
// lets say your custom attributes name is "size" and type is text field
echo $product->getSize();
// lets assume your custom attributes name is "product_size then
echo $product->getProductSize();
// lets assume your attribute type is drop-down, this will get array of attribute options instead of value that you selected
echo $product->getAttributeText(product_size);
// to get drop-down value that you selected
$attribute = $product->getAttributes();
$productSize = $attribute['product_size']->getFrontend()->getValue($product);
如果不符合您的要求,请告诉我。
【讨论】:
我已经找到了一个解决方案,3 个编辑过的文件。
但是这些文件是为以前版本的 Magento 编辑的,我不知道是哪个版本。
我已经在我的 Magento 1.7 上上传了这 3 个文件,它可以工作,但是当将产品添加到购物车时,它给出了一个错误 app/code/core/Mage/Sales/Model/Quote.php
这个文件:Quote.php 是编辑后的文件之一,当我上传原始的 Quote.php 时它可以工作。
看这张照片:http://s8.postimage.org/g8bvbth0z/Naamloos.png
但也许我将来会遇到更多错误,我没有任何想法..
我是一个菜鸟,如果有人可以查看编辑过的文件并检查他们是如何做到这一点的,并将其与 Magento 1.7 的最新文件进行比较,也许我们可以帮助很多人解决这个问题。
【讨论】: