Forums / General Questions / Sold Out Ta Back of Listing

Sold Out Ta Back of Listing

Started by renz on 12 Sep 2012, 8:01 AM · Views: 1,082

Results 1 to 12 of 12
12 Sep 2012, 8:01 AM
#1
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Sold Out Ta Back of Listing

Hi there
is there a code to make to sold out items appear last when searching eg
when on the product and using the next previous button I only show sold out units not whats in stock, I would think eventually I would get to the stock a few hundred clicks later but first and foremost I show sold out.
Thanks
Best Regards
Renz

12 Sep 2012, 3:33 PM
#2
joejoejoe avatar

joejoejoe

Zen Follower

Join Date:
Oct 2011
Location:
AZ
Posts:
383
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Quick answer is no, you can't sort by stock quantity. It's not one of the default sort orders. You can set it so that when an item is sold out it doesn't show at all, but if you want it to show but bump it to the bottom of the list then you'll have to find some way of coding it.

12 Sep 2012, 3:51 PM
#3
skrillnet avatar

skrillnet

New Zenner

Join Date:
May 2010
Location:
Arkansas
Posts:
33
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

I can do some coding for you if you would like. PM me and we can talk in more detail.

15 Sep 2012, 3:05 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sold Out Ta Back of Listing

You would need to alter the SELECT statements where you want this to happen ...

And example of how to make the Sold Out last would be:

SELECT  products_id, products_model, products_status, products_quantity,  (products_quantity > 0) AS sort_sold from products order by sort_sold  DESC, products_model

This pulls the fields products_id, products_model, products_status, products_quantity and creates a new one, sort_sold, and then in the ORDER the sort_sold DESC before the products_model of the ORDER statement puts the Sold Out Products, products with products_quantity <= 0, last ... but it is in the ORDER of the products_model ...

NOTE: products_quantity does not need to be part of the SELECT, it is just there to test this ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Sep 2012, 5:41 AM
#5
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Ajeh:

You would need to alter the SELECT statements where you want this to happen ...

And example of how to make the Sold Out last would be:

SELECT products_id, products_model, products_status, products_quantity, (products_quantity > 0) AS sort_sold from products order by sort_sold DESC, products_model

> 
> This pulls the fields  products_id, products_model, products_status, products_quantity and  creates a new one, sort_sold, and then in the ORDER the sort_sold DESC  before the products_model of the ORDER statement puts the Sold Out  Products, products with products_quantity <= 0, last ... but it is in the ORDER of the products_model ...
> 
> NOTE: products_quantity does not need to be part of the SELECT, it is just there to test this ...

Hi Ajeh,
could you please tell me where I would make those changes, is it in the admin or hard coding, if the latter could you psl give me the path.

Cheers
Renz
17 Sep 2012, 12:57 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sold Out Ta Back of Listing

You would need to add that to the store catalog SELECT statements where you want this to happen ...

There are a lot of SELECT statements, so you would need to be much more specific on where you want the Sold Out products to come last ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Sep 2012, 4:52 AM
#7
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Ajeh:

You would need to add that to the store catalog SELECT statements where you want this to happen ...

There are a lot of SELECT statements, so you would need to be much more specific on where you want the Sold Out products to come last ...

Hi Ajeh, thanks for your reply, I would basically like to show whats in stock when the customer presses the next button on the product page,where the three buttons are previous listing next.

When clicking next on mine it shows a couple of in stock items and then everything that is sold out or qty 0, which I still keep in the database but choose not to display, even after all the products, though it does bring them up for some reason when clicking next.

Cheers
Renz

18 Sep 2012, 5:29 AM
#8
fjtv avatar

fjtv

New Zenner

Join Date:
May 2011
Posts:
17
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Find:

$sql = "select p.products_id, p.products_model, p.products_price_sorter, pd.products_name, p.products_sort_order
from " . TABLE_PRODUCTS . " p, "
. TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " ptc
where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id= '" . (int)$_SESSION['languages_id'] . "' and p.products_id = ptc.products_id and ptc.categories_id = '" . (int)$current_category_id . "'" .
$prev_next_order;

Replace with:

$sql = "select p.products_id, p.products_model, p.products_price_sorter, pd.products_name, p.products_sort_order
from " . TABLE_PRODUCTS . " p, "
. TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " ptc
where p.products_status = '1' and p.products_quantity > '0' and p.products_id = pd.products_id and pd.language_id= '" . (int)$_SESSION['languages_id'] . "' and p.products_id = ptc.products_id and ptc.categories_id = '" . (int)$current_category_id . "'" .
$prev_next_order;

it should solve your problem. :)

18 Sep 2012, 5:31 AM
#9
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Thanks for that, where would i find that code, can you pls give me a path...
Regards
Renz

18 Sep 2012, 5:33 AM
#10
fjtv avatar

fjtv

New Zenner

Join Date:
May 2011
Posts:
17
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

catalog/includes/modules/product_prev_next.php

18 Sep 2012, 5:37 AM
#11
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

Thanks, what will this give me as a final result...the sold out not appearing period (preferred) or the sold out appearing at the end?
Cheers again
Renz

18 Sep 2012, 5:59 AM
#12
fjtv avatar

fjtv

New Zenner

Join Date:
May 2011
Posts:
17
Plugin Contributions:
0

Re: Sold Out Ta Back of Listing

The sold out will not appear. I guess this result is better so customers will only browse for available products to buy.

Im writing on zen cart tutorials and recently, i also did an advance search results showing only available items and sort them in best sellers too.

Making better customers buying experience. :)