Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Split Results Problem


mikotondria

Recommended Posts

Hi,

When I examine products in a catagory, and there are more results than my page allows and it splits the results using split_page_results, any page other than the first page displays seemingly random results..

See case in point:

http://www.rhythmicnyc.com/catalog/index.p...=12-vinyl-house

note the products are all ordered correctly by the catalog number, yet when you go to the second page at:

http://www.rhythmicnyc.com/catalog/index.p...=12-vinyl-house

the results are listed wrongly..

 

I have modded the main sql query on the index.php page so that the main query is ordered by the products 'Catalog Number', but my OOP is really not good enough to fully understand the splitPageResults constructor...

 

Does anyone have any general pointers on how I can debug this ?

When I echo the main query on the page, I get:

select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '25' order by pd.products_name

 

and when I echo out the query from within the splitPageResults constructor, I get:

 

select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '25' order by p.products_model limit 0, 32

 

yet when the limit at the end of that statement is '...limit 32,32', then the results are not in the correct order and even some are repeated.

 

Any help would be very welcome :)

 

Thanks.

Miko.

Link to comment
Share on other sites

The main query and split page results query have different ORDER BY fields - my guess is that you are not using the class correctly. Post the code that you are using to instantiate the class in your main page.

 

 

ah, I nailed it thanks..

 

In the series of case statements that builds the main query, for some reason it was picking up the 'order by p.products name' case and appending that to the query..

 

Its a bit of a hack, I know, but I just swapped wherever it said 'order by p.products_name' in that switch controller, to 'order by pd.products_model', as I dont think the products are ever required to be sorted by name in this particular site: The client always wanted to display the products by the catalog number (the products_model), so Im all working fine now.

 

Many thanks for taking the trouble to respond, I do appreciate it.

 

Mik.e

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...