Page 1 of 1

The problem with the sorting of products

Posted: 18 May 2020, 12:21
by NickS
I created a category and created several products in it.
When I try to set the order of products, it is not saved. It is also not displayed correctly in the frontend.

I opened the browser console and saw that the request is sent to the address:
'...administrator/index.php?option=com_phocacart&task=phocacartitems.saveOrderAjax&tmpl=component'

Here is the request body:
{"filter[search]":"","list[fullordering]":"pc.ordering+ASC","list[limit]":"20","filter[published]":"","filter[category_id]":"2","filter[language]":"","order[]":["1","2","3","4","5","6"],"cid[]":["10","7","9","10","8","11","12"],"limitstart":"0","batch[assetgroup_id]":"","batch[language_id]":"","batch[category_id]":"","batch[move_copy]":"m","batch[copy_all_cats]":"0","batch[skip_creating_unique_name]":"0","batch[copy_download_files]":"0","batch[copy_attributes_download_files]":"0","copy_attributes":"","copy_attributes_download_files":"0","boxchecked":"1","c09de0f5a69192bc1533528f3f01bbfb":"1","original_order_values":""}

I found the saveOrderAjax() function in "controllers/phocacartcommons.php"

I replaced the string
(41) if ($return) { echo "1";}
with the string
if ($return) { print_r($pks);}
or the string
if ($return) { print_r($order);}

Now I see the answer in the console:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )
or
Array ( [0] => 7 [1] => 9 [2] => 10 [3] => 8 [4] => 11 [5] => 12 )

This way data is correctly received and sent to the function "saveorder($pks = null, $order = null)" in the file models/phocacartitem.php

The Function should save data to the "#_phocacart_product_categories " table - but nothing is saved!

What could be the error?

P.S.
I manually changed the order of products in the category via phpMyAdmin - everything was displayed correctly in the admin panel and on the site. It seems that the problem is in the function "saveorder($pks = null, $order = null)" in the file models/phocacartitem.php

Re: The problem with the sorting of products

Posted: 18 May 2020, 13:48
by Jan
Hi, thank you for the info, this is related to changes in version 3.5.1 (added new filter functions based on Joomla! filter features - the form field name was changed).

It will be fixed in version 3.5.2 (hopefully I will release it today).

Jan

Re: The problem with the sorting of products

Posted: 18 May 2020, 14:02
by NickS
Thank you so much for your work!

Re: The problem with the sorting of products

Posted: 19 May 2020, 15:02
by Jan

Re: The problem with the sorting of products

Posted: 21 May 2020, 11:18
by NickS
Updated to phocacart 3.5.2 today - sorting works perfectly!
Thank you again for your work!

Re: The problem with the sorting of products

Posted: 21 May 2020, 22:39
by Jan
Ok, great to hear it.

Jan