【问题标题】:How to show region specific products magento?如何显示特定地区的产品 magento?
【发布时间】:2015-08-03 06:08:17
【问题描述】:

如何根据选定的州和城市在 Magento 中显示产品?是 此功能有可用的扩展程序吗?或者我怎样才能实现 这个?

【问题讨论】:

  • 产品统计或产品城市是什么意思?客户的城市/州?计费?航运?制造产品的城市/州?
  • 当客户访问网站时,他首先会收到一个弹出窗口,然后他应该选择州和城市,在此基础上他可以看到分配到特定州或城市的产品,是否可以在magento中做这种功能,有没有可用的扩展?或者我该如何构建这个?
  • 请求扩展是 Stack Overflow 上的话题。也许你应该把它发到magento.stackexchange.com 上?

标签: magento magento-1.9 product region magento-1.9.1


【解决方案1】:

您可以在产品模型中添加一个(城市)或两个(州和城市)属性(通过后台面板)。

您的新闻属性可以包含列表(在示例字符串中以逗号分隔)以及允许销售产品的州/城市列表。

要检索您的州/城市允许列表,您可以:

<?php 

// id product is 12345
// the city allowed list attribute code is 'city_list'

$id = 12345;
$product = Mage::getModel('catalog/product')->load($id);

$cityList = $product->getAttributeText('city_list');

var_dump($cityList);

输出如下内容:

string(38) "Los Angeles, New Delhi, Caen, etc, etc"

如果catalog/product 模型没有检索到属性,您可能会在load($id) 之后添加-&gt;getAttributeToSelect('city_list')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多