Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在产品列表页面的排序中设置最后一个空值产品?_Php_Magento_Sorting_Magento 1.7 - Fatal编程技术网

Php 如何在产品列表页面的排序中设置最后一个空值产品?

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

你好,我主要有4种产品,比如

     product_name  attribute_name attribute_value
----------------------------------------------------------
     test1           catname        abc
     test2           catname        ccc
     test3           catname        ###
     test4           catname        bbb
当我在产品列表页面上尝试按catname对产品进行排序时,首先得到的是空值产品test3,但最后需要它。我必须忽略null属性值

我在toolbar.phtml中尝试了ascdesc,但它不是我想要的

有人能帮我吗

您可以尽可能地尝试

 ORDER BY if(attribute_value = '' or attribute_value is null,1,0),attribute_value ,product_name

你能给我解释一下在magento中把这段代码放在哪里吗?在maganto中,我猜它的addAttributeToSort()是在order by被添加的地方。我在马甘托不太好。但是,如果您能够添加上述代码,那么它将按照您的需要进行排序。