[英]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()); ?>
將“在分層導航中使用”設置為“可過濾(帶結果)”
對於權重屬性,將“在搜索結果中使用分層導航”設置為“是”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.