洋红色中自定义属性的范围过滤器


Range filter for custom attribute in magento

我需要自定义属性(权重)的范围过滤器,如价格范围过滤器

我在下面的URL中使用了价格范围过滤器

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()); ?>

将"在分层导航中使用"设置为"可筛选(有结果)"

将权重属性的"在搜索结果中使用分层导航"设置为"是"。