【发布时间】:2015-03-18 17:29:38
【问题描述】:
我需要自定义属性(权重)的范围过滤器,例如价格范围过滤器
我在网址下方使用价格范围过滤器
domain/rings?&price=20000-30000 - working
与我用于重量范围过滤器的相同
domain/rings?&weight=-400-500 - not working
我该如何解决这个问题?
请提出任何过滤体重范围的想法
【问题讨论】:
我需要自定义属性(权重)的范围过滤器,例如价格范围过滤器
我在网址下方使用价格范围过滤器
domain/rings?&price=20000-30000 - working
与我用于重量范围过滤器的相同
domain/rings?&weight=-400-500 - not working
我该如何解决这个问题?
请提出任何过滤体重范围的想法
【问题讨论】:
用于更改属性类型而不删除它为此,您可以在 magento 的根文件夹中创建 .php 文件,然后放入以下代码并在进行所需更改后运行该文件。
<?php
require_once '../app/Mage.php';
Mage::app();
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $installer->getEntityTypeId('catalog_product');
// replace <my_attribute_code> with your attribute code
$idAttribute = $installer->getAttribute($entityTypeId, '<my_attribute_code>', 'attribute_id');
$installer->updateAttribute($entityTypeId, $idAttribute, array(
'frontend_input' => 'text',
'backend_type' => 'decimal',
));
// let's see if it worked
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', '<my_attribute_code>');
Zend_Debug::dump($attribute->getData()); ?>
【讨论】:
将分层导航中的使用设置为“可过滤(带有结果)”
将在搜索结果分层导航中使用权重属性设置为“是”。
【讨论】:
weight 属性的类型是什么?