The problem with the sorting of products

Phoca Cart - complex e-commerce extension
NickS
Phoca Member
Phoca Member
Posts: 21
Joined: 25 Mar 2020, 23:54

The problem with the sorting of products

Post 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

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: The problem with the sorting of products

Post 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
If you find Phoca extensions useful, please support the project
NickS
Phoca Member
Phoca Member
Posts: 21
Joined: 25 Mar 2020, 23:54

Re: The problem with the sorting of products

Post by NickS »

Thank you so much for your work!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: The problem with the sorting of products

Post by Jan »

If you find Phoca extensions useful, please support the project
NickS
Phoca Member
Phoca Member
Posts: 21
Joined: 25 Mar 2020, 23:54

Re: The problem with the sorting of products

Post by NickS »

Updated to phocacart 3.5.2 today - sorting works perfectly!
Thank you again for your work!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: The problem with the sorting of products

Post by Jan »

Ok, great to hear it.

Jan
If you find Phoca extensions useful, please support the project
Post Reply