osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Sort the items in shopping cart, in Descending Order

This is a discussion on Sort the items in shopping cart, in Descending Order within the osCMax v2 Features Discussion forums, part of the osCMax v2.0 Forums category; I've been trying to sort the items in the shopping cart box and in page in descending order, means the ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Features Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 12-27-2006, 07:37 AM
Lurker
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
sarath26
Arrow Sort the items in shopping cart, in Descending Order

I've been trying to sort the items in the shopping cart box and in page in descending order, means the the last add items top of the box followed by the ones added before them...I'm able to achieve this when the customer is logged in by making the following changes in the classes/shopping_cart.php

under this function:
function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)

at the end of this function i added the following :

$this->reset(false);
$products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' order by customers_basket_id DESC ");
while ($products = tep_db_fetch_array($products_query)) {

$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
}
}
----

but my problem is this works well when a customer is signed in... but if he isnt, he is not able to add anything into the cart...
i suspect this codeis to be blamed for:
$this->reset(false);

---- so i checked the reset function in the same page

function reset($reset_database = false) {
global $customer_id;
$this->contents = array();
$this->total = 0;
$this->weight = 0;
//LINE ADDED: MOD - indvship
$this->shiptotal = 0;
$this->content_type = false;

if (tep_session_is_registered('customer_id') && ($reset_database == true)) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
}

unset($this->cartID);
if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
}
----------

i dont know how to fix this, anyhelp will be appreciated and plus i feel this a cool feature, because like my site having more than 4000 items and if there are more than 10 items in the cart, its easy for customer to see what they added last.... thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
The Following User Says Thank You to sarath26 For This Useful Post:
santaya (04-08-2008)
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Template Help "Shopping Cart 0 items" ALElder osCMax v2 Customization/Mods 4 10-22-2006 04:33 PM
Product Sort Order davem osCMax v2 Customization/Mods 4 05-21-2006 04:33 PM
Add items to shopping cart outside store. akasharkbow osCMax v2 Customization/Mods 0 03-12-2006 12:16 PM
Can not add items to shopping cart sjleather osCMax v1.7 Installation 8 10-10-2005 10:53 AM
sort order to pot!! moreduff osCMax v1.7 Discussion 0 04-12-2005 04:57 AM


All times are GMT -8. The time now is 09:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax