【问题标题】:Magento : get attribute value phpMagento:获取属性值php
【发布时间】:2014-04-27 03:41:56
【问题描述】:

我有两个属性,如下图所示:

我想知道如何获得它的价值

________
_________
_________

谢谢!

【问题讨论】:

  • Mohit Kumar Arora 给出的答案应该有效
  • @DushyantJoshi 允许自定义价格只有是/否,但我也想添加 useconfig 选项,例如应用地图选择我该怎么做?
  • 你能把它作为不同的问题,以便其他人可以用你的尝试来回答吗?

标签: magento magento-1.7 magento-1.8


【解决方案1】:

首先加载产品模型:

$product = Mage::getModel('catalog/product')->load(<product_id>);

然后使用:

$allowCustomPrice = $product->getAttributeText('allow_custom_price');

$minPrice = $product->getMinPrice();

注意:我假设您将替换为原始产品ID,属性代码分别为“allow_custom_price”和“min_price”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-27
    相关资源
    最近更新 更多