【问题标题】:How to add products with price as "Contact for Pricing" in magento如何在magento中添加价格为“联系定价”的产品
【发布时间】:2012-08-01 04:34:02
【问题描述】:

我有一个 Magento 网站。

我有许多产品要添加。

But some have price as "Contact for Pricing" or "Call for Pricing" so cant to add.

Because there has validation for the price.

那么我怎样才能添加这样的产品呢?

此类产品是否有任何模块?

我需要将此类产品的价格显示为“联系定价”或“致电定价”。

是否有免费下载“电话询价”的扩展?

【问题讨论】:

  • 如果没有扩展这个,我觉得自己做也不是太难。
  • 这类问题并不真正属于 Stack Overflow,因为它不是编程问题。你应该看看area51.stackexchange.com/proposals/25439/magento,看看如何找到一个合适的地方来提出这些问题

标签: magento product


【解决方案1】:

乔希的回答略有改善。感谢 Josh 提出使用属性的想法!

为此示例创建属性代码“call_4_price”。就像 Josh 建议的那样,将其设为 Yes/No 属性。默认值“否”。将其添加到您需要隐藏价格的属性集中。

查找“价格和添加到购物车按钮”所在的所有 .phtml 文件(模板 > 目录 > 产品 > view.phtml、price.phtml、list.phtml 等)

将此代码粘贴在价格代码之前。

        <!-- Call For Price - begin -->
        <?php $attribute = $_product->getResource()->getAttribute('call_4_price'); ?>
            <?php $attribute_value = $attribute ->getFrontend()->getValue($_product); ?>
            <?php if ($attribute_value == 'Yes'): ?>
                //Please Call for pricing
            <?php else: ?>

添加到购物车按钮之后。

            <?php endif; ?>
        <!-- Call For Price - end -->

【讨论】:

    【解决方案2】:

    为询价创建一个是/否属性。在创建产品时,在价格字段中添加一些内容以通过验证。

    现在修改您的模板文件,使其在“询价”设置为“是”时不显示价格。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-01
      相关资源
      最近更新 更多