Jump to content

Catalogue Sort Order Solved. Basket Sort Order Not Solved.


Transistor

Recommended Posts

I wanted to do two things.

1. Present the category views sorted by product code. I've succeeded doing this by adding "ORDER BY productCode" to line 166 of includes/content/viewCat.inc.php. See below:

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']

	."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM "

	.$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON "

	.$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE "

	.$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId'])

	." ORDER BY productCode";

(The line is one long line in the original script.)

2. Now I want to show the basket sorted by productCode but haven't figured it out yet. I think it would have to be a similar mod in includes/content/cart.inc.php. Any ideas anyone?

Many thanks.

Link to comment
Share on other sites

...show the basket sorted by productCode. I think it would have to be in includes/content/cart.inc.php.
You might think. But the best place might be in (1) cart.inc.php, or perhaps (2) add a new function to the cart class.

For each visitor, CC asks PHP to create a session. The session ID is stored in the database table "CubeCart_sessions". The basket contents are "serialized". You would need to do a lot of discovery to understand the serialization of the cart.

(1) You would need to write new code to sort $basket at about line 44 (or maybe near line 354). Or,

(2) You would need to write new code in the cart class to add a sort function to the class.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...