Page 1 of 1
[BUG] Products duplicating?
Posted: Mon Sep 12, 2011 12:06 am
by MatthewB
Hi
i have noticed that some products are duplicating on my website, for example i have a photo frame under "gifts for children" on page 1 then when i go to page 2 the same product is on that page further down the product list, the same is happening for a few products
i have checked "links" in backoffice and i only have that category selected, does anyone have a clue?
Re: Products duplicating
Posted: Mon Sep 12, 2011 9:08 pm
by uksitebuilder
it is due to the ordering of products.
by default the order the products are returned from the database is by sort order.
Many people will not enter this when editing/adding a product and so essentially every product has the same sort order.
When page 2 is clicked in the product list, the query is run again and consequently returns different results.
This fix may work,
in catalog/model/catalog/product.php
find:
change to:
Code: Select all
$sql .= " ORDER BY p.sort_order ASC p.product_id";
catalog/controller/catalog/category.php
find
change to
Code: Select all
$sort = 'p.sort_order ASC p.product_id';
You may need to repeat the last change above in search.php, manufacturer.php and special.php
Re: Products duplicating
Posted: Tue Sep 13, 2011 1:34 am
by MatthewB
Hi Simon
Thank you so much, you've saved the day yet again, i've lost count how much you've helped me with my sites haha
Re: Products duplicating
Posted: Wed Sep 14, 2011 6:27 pm
by MatthewB
For some reason the problem is back again.
I've not done anything other than add more products.
Re: Products duplicating
Posted: Wed Sep 14, 2011 6:49 pm
by uksitebuilder
Check the file still has those changes in my post above
Re: Products duplicating
Posted: Wed Sep 14, 2011 6:57 pm
by MatthewB
uksitebuilder wrote:Check the file still has those changes in my post above
Hi
i've checked and file still has code change, it is working on some products but i've noticed there is still a few that appear on different pages of the same category
Re: Products duplicating
Posted: Tue Nov 01, 2011 3:00 am
by aledmann
Did you ever get to the bottom of this? I'm having the exact same problem!!

Re: Products duplicating
Posted: Tue Nov 01, 2011 3:31 am
by MatthewB
The above coding seemed to work, i also changed the "number of products displayed" in admin
Re: Products duplicating
Posted: Tue Nov 01, 2011 3:59 am
by aledmann
Damn really? That code didn't work for me. I'm running 1.5.1.1
I really have too many products to go back and sort order them all. I can't really see this being feasible moving forward either.
Has anyone got a recommended fix for this? We were hoping to launch our site this week and only found this glaringly obvious bug today!!
Thank you in advance.
Re: Products duplicating
Posted: Tue Nov 01, 2011 4:29 am
by uksitebuilder
edited my post above
Re: Products duplicating
Posted: Tue Nov 01, 2011 5:31 am
by MatthewB
aledmann wrote:I really have too many products to go back and sort order them all. I can't really see this being feasible moving forward either.
All you have to do is in admin settings/edit/option then type a high number for number of product displayed on page.
for mine i typed 10 as i don't have more than ten products per page in each categories
Re: Products duplicating
Posted: Sat Nov 05, 2011 2:50 am
by AnonyMoose
uksitebuilder wrote:
in catalog/model/catalog/product.php
find:
change to:
Code: Select all
$sql .= " ORDER BY p.sort_order ASC p.product_id";
This kind of fixed my sorting issues, but after few page reloads it repeats again..
uksitebuilder wrote:
catalog/controller/catalog/category.php
find
change to
Code: Select all
$sort = 'p.sort_order ASC p.product_id';
You may need to repeat the last change above in search.php, manufacturer.php and special.php
Did you mean catalog/controller/product/category.php ? Done this part and got this error when browsing to any category:
Code: Select all
Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p.product_id ASC LIMIT 0,15' at line 1
Error No: 1064
SELECT p.product_id, (SELECT AVG(rating) AS total FROM review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating FROM product p LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pd.language_id = '1' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '0' AND p2c.category_id = '66' GROUP BY p.product_id ORDER BY p.sort_order ASC p.product_id ASC LIMIT 0,15 in /home/seventea/public_html/system/database/mysql.php on line 49
Re: Products duplicating
Posted: Sat Nov 05, 2011 2:56 am
by AnonyMoose
Just a thought:
$sql .= " ORDER BY p.sort_order"; appears twice in catalog/model/catalog/product.php, so I changed both entries..
Re: Products duplicating
Posted: Mon Nov 07, 2011 11:27 pm
by AnonyMoose
Tried again - changed both
$sql .= " ORDER BY p.sort_order" entries in catalog/model/catalog/product.php and
$sort = 'p.sort_order'; in catalog/controller/product/category.php (my guess as catalog/controller/catalog/category.php doesn't exist).
Still got those SQL errors in random categories, so no joy. This fix also $#@%&( up google base product feed - got SQL error too..

Any suggestions or signs of fixing this in 1.3.1.4?
Re: [BUG] Products duplicating?
Posted: Tue Nov 08, 2011 2:38 am
by i2Paq
I think that the sort-order field when entering a product should be mandatory.
Or a fix in the code preventing this from happening.
Re: [BUG] Products duplicating?
Posted: Tue Nov 08, 2011 3:39 am
by AnonyMoose
i2Paq wrote:I think that the sort-order field when entering a product should be mandatory.
Or a fix in the code preventing this from happening.
And if I have 852 products, remove three in the middle and then want to add one, remove few more and add some tomorrow, will you re-edit sort order on all of them for me please? :-)
Re: [BUG] Products duplicating?
Posted: Tue Nov 08, 2011 3:54 am
by i2Paq
AnonyMoose wrote:will you re-edit sort order on all of them for me please? :-)
Sure

Re: [BUG] Products duplicating?
Posted: Tue Nov 08, 2011 4:45 am
by AnonyMoose
i2Paq wrote:AnonyMoose wrote:will you re-edit sort order on all of them for me please? :-)
Sure

Got screenshot, you have no excuses now! ;P
Re: [BUG] Products duplicating?
Posted: Tue Nov 08, 2011 3:25 pm
by i2Paq
AnonyMoose wrote:i2Paq wrote:AnonyMoose wrote:will you re-edit sort order on all of them for me please? :-)
Sure

Got screenshot, you have no excuses now! ;P
I wonder who banned you

Re: [BUG] Products duplicating?
Posted: Fri Dec 30, 2011 11:29 pm
by jhebb
Was there any fix for the code changes suggested? I was getting the same SQL error too.