Php 如何在产品列表页面的排序中设置最后一个空值产品?
你好,我主要有4种产品,比如Php 如何在产品列表页面的排序中设置最后一个空值产品?,php,magento,sorting,magento-1.7,Php,Magento,Sorting,Magento 1.7,你好,我主要有4种产品,比如 product_name attribute_name attribute_value ---------------------------------------------------------- test1 catname abc test2 catname ccc test3 catname ### t
product_name attribute_name attribute_value
----------------------------------------------------------
test1 catname abc
test2 catname ccc
test3 catname ###
test4 catname bbb
当我在产品列表页面上尝试按catname对产品进行排序时,首先得到的是空值产品test3,但最后需要它。我必须忽略null属性值
我在toolbar.phtml中尝试了asc和desc,但它不是我想要的
有人能帮我吗 您可以尽可能地尝试
ORDER BY if(attribute_value = '' or attribute_value is null,1,0),attribute_value ,product_name
你能给我解释一下在magento中把这段代码放在哪里吗?在maganto中,我猜它的addAttributeToSort()是在order by被添加的地方。我在马甘托不太好。但是,如果您能够添加上述代码,那么它将按照您的需要进行排序。