Closed (fixed)
Project:
Commerce Kickstart
Version:
7.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
25 Dec 2012 at 21:32 UTC
Updated:
28 Feb 2014 at 15:49 UTC
Jump to comment: Most recent
Hi , i am using Drupal Commerce Kickstart 2.0 and when clicking on the sort by 'price' button on the 'all products' page i get the following error:
Trying to sort on field field_product:commerce_price:amount_decimal of illegal type list<decimal>.
When i googled the error, i found some other websites with the same error, for example:
http://www.mbelektronik.hr/products?sort=field_product%3Acommerce_price%...
I think the problem is that by clicking on sort by price you get
'sort=field_product%3Acommerce_price%3Aamount_decimal&order=asc'
which is obviously not working because of the ' : ' which are not working in the url
Can someone tell me how to fix this?
Comments
Comment #1
cn313 commentedOk , i found out that you can change the sorts at admin/config/search/search_api/index/product_display/sorts ,
but i can't remove 'Price' (and the Price button in my search block) because it's not on that list.
The fields 'Date created' ('Latest') and 'Title' ('Title') are available and enabled by default so i can see those Buttons in my search block but how come there is a Price button in my search block although there is no price field enabled in the sorts list?
I can enable another Price field (Product » Price » Amount (decimal) (Max)) and name it Price so it creates a button in my search block which does exactly what the default Price button failed to do, but i dont know how to get rid of the other not working price button which was there from the beginnig.
Comment #2
maxplus commentedHi,
I experienced the same problem and also solved it the same way as you did, just created an extra sort on another price field.
The only way to hide the wrong price sort button is to hide it with CSS i think...
Comment #3
cn313 commentedThere must be another way of hiding that wrong price button but i will use the CSS method untill i find out.
Comment #4
majikthise commentedI've also had this problem with Commerce Kickstart v 7.x-2.0 and I think I've got it sorted.
The way I got rid if the price sort button was to manually delete the offending row from the search_api_sort database table. However on second thoughts It would probably have been better to set "enabled" to 0 (zero) instead. I can see that the Kickstart install process tries to get rid of any duff sort buttons based on un-indexed fields (function commerce_kickstart_update_7209) but it obviously hasn't worked in this case.
It's quite easy to spot which row is causing the problem as there shouldn't be many rows in the table (mine had 3 rows and the row for the price sort button was no 2, but it's not safe to assume it will be the same on all installations). The row for the button will have "Price" in the "name" column and "commerce_kickstart_search" in the "module" column.
Once the duff "Price" sort button is gone, you can replace it as already described.
Comment #5
majikthise commentedI think I've found the bug.
In commerce_kickstart_search.module, function commerce_kickstart_search_default_search_api_sort, the line:
seems to mean that a "price" sort will be set up against non - existent field "field_product:commerce_price:amount_decimal" unless full demo store functionality is being installed. I'm not sure what this code is actually trying to achieve and anyway in practical terms it's too late to do anything about it once the commerce_kickstart_search module has been installed, so manually updating the database looks like the best option for now.
Comment #6
jsacksick commentedThe bug is indeed coming from Kickstart and not Commerce Search API, it has been introduced since the change of the cardinality of the product reference field (#1835922: Set default allowed number of product variations to Unlimited (currently: 1) on "no demo store").
Comment #7
jsacksick commentedIt has been fixed and commited. Thanks https://code.drupalcommerce.org/#/c/598/
Comment #8
majikthise commentedCor! That was quick, thanks.
Comment #9
cn313 commentedWorks perfectly, thanks to majikthise and jsacksick.
For those who have that bug on their sites:
Apply the changes from #7 to modules/commerce_kickstart/commerce_kickstart_search/commerce_kickstart_search.module
and clear your site's cache, no need to hack the database ;)
Comment #10.0
(not verified) commentedNothing important
Comment #11
sin commentedPrice sort is not working for me for multi value field, this helps:
https://drupal.org/comment/7119722#comment-7119722