Forums / Templates, Stylesheets, Page Layout / Sold New Products display Sold Out instead of price on index and products_new pages

Sold New Products display Sold Out instead of price on index and products_new pages

Started by dharma on 8 Oct 2008, 8:44 PM · Views: 11,060

Results 21 to 37 of 37
3 Aug 2009, 3:45 PM
#21
jamana avatar

jamana

New Zenner

Join Date:
Sep 2008
Posts:
9
Plugin Contributions:
0

Sold New Products display Sold Out instead of price on index and products_new pages

Hi, this fix above worked easily for me, and what I'm looking for is a tweak just beyond this: do this ONLY on the index products display - - not on any other page that shows products.

Any help or ideas?

Thanks so much,

Julia
http://www.skystonetrading.com
1.3.8a

30 Jan 2011, 8:21 AM
#22
timlo avatar

timlo

New Zenner

Join Date:
Jan 2008
Posts:
20
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Hi there,

I think this is useful, and is that possible to show the price also ?

If that is possible , how to change the code?

As i want customer also know the price of the sold out product .

Thanks you

Tim

4 Aug 2011, 1:10 PM
#23
rafcamera avatar

rafcamera

New Zenner

Join Date:
Mar 2006
Location:
Belarus
Posts:
63
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Hi!
I've quite different issue but decided to post here since related thread has been closed without solution years ago.
So, I need to keep both available and sold out items turned ON, but I want to have available items listed first in their categories. Is it possible to do this in auto mode without setting sort order manually (in most cases I'm satisfied with default alphabetical sort order)? Or it is necessary to create new option somewhere in Admin part of code and modify sorting methods?
Thanks.

6 Nov 2011, 9:18 AM
#24
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Hello,
Am wondering if there is a way to automatically after you sell a product it be transfered to a seperate foldaer that shoes sold items. I deal in one off items, but would like people to be able to view previoslu sold items. Any ideas

Was think ing could change pages 2,3,or 4 into this sold items picture gallery or something.

Is there a way to do it automatically, if not, how oould I go aheads doing it manually, just upload images to page 2? How would I do that though php's? if so ehat directory,
chjeers presh.

6 Nov 2011, 1:26 PM
#25
ajeh avatar

ajeh

Oba-san

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

Re: Sold New Products display Sold Out instead of price on index and products_new pages

You could customize your order.php class file around line 717 where the code reads:

          if ($stock_left <= 0) {
            // only set status to off when not displaying sold out

and set it to change the category that it is in for the table:
products_to_categories

and change the master_categories_id on the table:
products

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!

11 Nov 2011, 7:07 AM
#26
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

that sounds good :) I am currently a php beginner,
would it be easier to make a categorie in my products folder saying "sold out items" and move them there when they are sold. This is becasue I am unsure how to add pictures ect into the pages 1,2 and 3 extras.

If so how can I move them there when they are sold, can it be done automatically when sold?
what would I put in the php

if ($stock_left <= 0) {move to "sold out items"
// only set status to off when not displaying sold out

how can I change the above to "real"php? :)

Also, If I do have another categorie, can I enable that "sold out items" categorie to not show up when "all categories" is chosen?
Much thanks :) I am nearly at a point where I can add my stock :)

11 Nov 2011, 2:10 PM
#27
ajeh avatar

ajeh

Oba-san

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

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Products exist in the Category that they are set to in the table:
products_to_categories

If you change the setting of the field:
categories_id

to the Sold Out Category then that is where the Product will now be ...

Next, change the field:
master_categories_id

in the table:
products

to be the Sold Out Category ...

Then, to prevent those Products from showing in the All Products ... you would need to customize the SQL statement for the All Products to exclude the categories_id for the Sold Out Products ...

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!

12 Nov 2011, 12:52 AM
#28
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Hello Ajeh, Thank you very much for your help. I see there are a few steps to what I am trying to do. If I break it up the first step
I have called my category “Sold out items”

Products exist in the Category that they are set to in the table:
products_to_categories (can’t find this table,have found php file but still) ?

If you change the setting of the field:
categories_id

Ok… so where do I find categories_id to change the settings ????
What would I change????

Also, In the order.php you gave me earlier it looks like this. Is this still relevant to what I am trying to do? Should I add the bold bit.…
if ($stock_left <= 0) {
// only set status to off when not displaying sold out
if (SHOW_PRODUCTS_SOLD_OUT == '0') {Sold out items} (?????)
$db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");

And then I will concentrate on change the
finding the
table: products  to change the field:
master_categories_id to “Sold out items”

Please, I think I need direction. Can I access any from Zen admin or is it all through php's. I do a seaqrch for these words, and there are may hits, much thanks presh.

12 Nov 2011, 3:43 AM
#29
ajeh avatar

ajeh

Oba-san

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

Re: Sold New Products display Sold Out instead of price on index and products_new pages

To Remove the Product from all Categories and Move it to the Sold Out Category and fix the master_categories_id to the Sold Out Category ...

Assume we are using categories_id 70 for the Sold Out Category ... you will have to change that to match yours ...

Edit the file:
/includes/classes/order.php

and change the code to include the code in red:

          if ($stock_left <= 0) {

// bof: move Product to Sold Out Category categories_id 70
          // remove Product from all categories
          $db->Execute("DELETE from " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
          // add Product to Sold Out Category categories_id 70
          $db->Execute("INSERT into " . TABLE_PRODUCTS_TO_CATEGORIES . "
                      (products_id, categories_id)
                      values (" . (int)zen_get_prid($this->products[$i]['id']) . ", 70)");
          // update master_categories_id to be Sold Out Category 70
          $db->Execute("UPDATE " . TABLE_PRODUCTS . " SET master_categories_id = 70 WHERE products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
// eof: move Product to Sold Out Category categories_id

            // only set status to off when not displaying sold out
            if (SHOW_PRODUCTS_SOLD_OUT == '0') {
              $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
            }
          }

Make sure that in the Configuration ... Stock ... that the setting for the Product Status on Sold Out is set to 1:

Products status in Catalog when out of stock should be set to
Show Products when out of stock

0= set product status to OFF
1= leave product status ON

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!

27 Nov 2011, 12:59 AM
#30
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

:) yay thanks you that worked :) It sent sold items to the sold items category...
one question is though, I did njot see a "classics"folder in the classes/order.php folders and so I edited the original php without adding my custom folder as I was told you can only add your own custom folder if classics folder is there., Is that o.k..
Now I am onto the next thing nearly there, thank you so much :) presh.

27 Nov 2011, 1:10 AM
#31
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

:) ok ... so I did a search for all products and tried to find a relevant place to remove my category for "sold products"
you sent me this information in response to it

"Then, to prevent those Products from showing in the All Products ... you would need to customize the SQL statement for the All Products to exclude the categories_id for the Sold Out Products ... "

Can you please help to which php file that I can change to remove my category. cheers and thanks again presh.

27 Nov 2011, 1:35 AM
#32
ajeh avatar

ajeh

Oba-san

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

Re: Sold New Products display Sold Out instead of price on index and products_new pages

You would need to customize the file:
/includes/modules/pages/products_all/header_php.php

  $products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
                                    p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
                                    p.product_is_always_free_shipping, p.products_qty_box_status,
                                    p.master_categories_id
                             FROM " . TABLE_PRODUCTS . " p
                             LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             WHERE p.products_status = 1
                        AND p.master_categories_id != 70
                             AND p.products_id = pd.products_id
                             AND pd.language_id = :languageID " . $order_by;

again, change the 70 to your categories_id ...

NOTE: there is no override for this file ...

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!

28 Nov 2011, 9:01 AM
#33
presh avatar

presh

New Zenner

Join Date:
Oct 2011
Posts:
25
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

YES!! :):clap: Thank you so much :) I think my queries are slowly disapearing :) Thank you! I really really could not do it without you guys, Presh.

28 Nov 2011, 1:59 PM
#34
ajeh avatar

ajeh

Oba-san

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

Re: Sold New Products display Sold Out instead of price on index and products_new pages

You are most welcome ... thanks for the update that this worked for you ... :smile:

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!

26 May 2016, 7:28 PM
#35
pricediscrimination avatar

pricediscrimination

Zen Follower

Join Date:
May 2008
Posts:
401
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Want to say thanks for this thread and let everyone know it still works in 2016 with v1.5.5.

For anyone who wants more control over what is displayed, you can use this code to add text.

// return sold out vs price
  $products_quantity = zen_get_products_stock($products_id);
  if ($products_quantity <= 0) {
    return 'ADD ANY TEXT HERE';
  }  

To make it only show on the product listing pages and not on the product info pages, had to wrap the text in a span and then add an inline style to tpl_product_info_display.php to hide the span.

Was wondering if there is a cleaner way to do this without having to use the inline style?

26 May 2016, 8:01 PM
#36
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Sold New Products display Sold Out instead of price on index and products_new pages

pricediscrimination:

Want to say thanks for this thread and let everyone know it still works in 2016 with v1.5.5.

For anyone who wants more control over what is displayed, you can use this code to add text.

// return sold out vs price
$products_quantity = zen_get_products_stock($products_id);
if ($products_quantity <= 0) {
return 'ADD ANY TEXT HERE';
}

> 
> To make it only show on the product listing pages and not on the product info pages, had to wrap the text in a span and then add an inline style to tpl_product_info_display.php to hide the span. 
> 
> Was wondering if there is a cleaner way to do this without having to use the inline style?
Probably a cleaner way by using css. See the guidance on css files in includes/templates/template_default/css for file naming to apply the desired css to the "structure" to be modified.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

1 Jun 2016, 8:29 PM
#37
pricediscrimination avatar

pricediscrimination

Zen Follower

Join Date:
May 2008
Posts:
401
Plugin Contributions:
0

Re: Sold New Products display Sold Out instead of price on index and products_new pages

Will do, thank you.

mc12345678:

Probably a cleaner way by using css. See the guidance on css files in includes/templates/template_default/css for file naming to apply the desired css to the "structure" to be modified.