Loaded Commerce Community

Banner


Board index » CRE Loaded Support » CRE Loaded 6.3

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Wed May 11, 2011 3:06 pm 
Offline
CRE Newbie

Joined: Tue May 10, 2011 9:47 am
Posts: 19
I want to sort products in order of quantity which I have done so in the config > product listing and selected quantity, however the default for this seems to be programmed in descending order so the lowest stocked is first
and there isn't anywhere to change this in the admin or config..

I found the section of the index.php file where I assume it sets the sort order to descending

case 'QUANTITY':
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;


So I changed this to: case 'QUANTITY':
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
break;

Assuming this alters the default descending sort order to ascending as obviously I want my stock to be listed with the highest quantity first...
However this changed nothing, Is there any other files I need to update or alter to acheive this? I am pulling my hair out any help or advice would be greatly appreciated!!!

Thanks

Expbiz


Top
 Profile  
 
 Post subject: Re: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Thu May 12, 2011 5:56 am 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2404
Location: New Zealand
Hi Expbiz

Yeah, you'd think so eh. Look a few lines up for this:

Code:
$sort_order = 'a';

And change it to :
Code:
$sort_order = 'd';


As long as you have 'Quantity' selected as the 'Product Listing Format' back in the Admin >> Configuration, you should be away.

(Could they not have made that a switch in the admin? Oath. And don't read the definition to the right of 'Row' and 'Column' product listing options - the definitions are right but the switches themselves are around the wrong way. Hilarity.)

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Thu May 12, 2011 4:50 pm 
Offline
CRE Newbie

Joined: Tue May 10, 2011 9:47 am
Posts: 19
That was the solution I was looking for! Thanks a lot Soundzgood2 :) Now whenever my stock snyc php script runs, the total quantity sets itself to zero (instead of the sum of the subproducts qty). all I have to do is click edit, then update but on each product this is a lengthy task...

Is there anyway of running that update on all my products at once?

Thanks again!
ExpBiz


Top
 Profile  
 
 Post subject: Re: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Fri May 13, 2011 7:17 am 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2404
Location: New Zealand
Sounds like your stock sync script isn't right - subprods have product_ids just like any other prod.
Get whoever wrote it to fix it.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Fri May 13, 2011 7:49 am 
Offline
CRE Newbie

Joined: Tue May 10, 2011 9:47 am
Posts: 19
No I'm pretty sure it's working, basically all I want to know is, what script/command is ran when you click 'update' after editing a product, as all I need to do is click that and the total quantity becomes the sum of the quantity of the all the sizes in my product. But doing this to each 100's of my prods after running the sync takes too long. if I could find out what script is ran when you click update and run it for all of them after my stock sync that would fix my problem! The stock sync matches the subproduct sizes fine. It's just the qty at the top is set to 0 after it, all the sizes of the product gets their quantity updated fine, just the total doesn't display until you have 'update'd it after editing. I don't need to change anything, simply click edit then straight to update.
Thanks again expbiz


Top
 Profile  
 
 Post subject: Re: SORT ORDER BY QUANITITY PROBLEM, DEFAULT DESCENDING?????
PostPosted: Fri May 13, 2011 5:41 pm 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2404
Location: New Zealand
So your script could total the subprod quantities and that figure gets assigned to the parent product_id (hence fix the script.) The parent product has it's own id ... why get complicated - this is all the update click is doing anyway, adding the subs together and writing this figure to the parent product_id.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

Board index » CRE Loaded Support » CRE Loaded 6.3

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Wed May 23, 2012 6:55 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy