If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / Automatically show "Call for Price" when items go out of stock

Automatically show "Call for Price" when items go out of stock

Started by wwrepair on 22 Jun 2012, 8:10 PM · Views: 1,473

Results 1 to 8 of 8
22 Jun 2012, 8:10 PM
#1
wwrepair avatar

wwrepair

New Zenner

Join Date:
Jun 2012
Posts:
92
Plugin Contributions:
0

Automatically show "Call for Price" when items go out of stock

Hello, I am new to zen-cart and the forums have been very helpful. Is there a way for it to automatically put items that are out of stock to show "call for price" (without the price showing)? Or do I have to manually go into the out of stock items and change them all to "call for price" (and also manually remove the price)? It would be great if I could have the system automatically do this for me. The parts we order are always changing in cost - so I didn't want to mislead someone into thinking they were guaranteed a certain price on an out of stock item.

My second question is where do I go to change the .php to show "call for price" & "sold out" picture when an item is out of stock. I found a similar forum, but it didn't specifically say where to go OR if I was just adding the new description or overwritting some phrases. I apologize I am new, but if you can give the correct folder route I would greatly appreciate it!!

Thanks in advance to anyone who has suggestions!

23 Jun 2012, 2:26 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Automatically show "Call for Price" when items go out of stock

A quick way to do this is to customize the functions zen_get_buy_now_button and zen_get_products_display_price and change the tpl_product_info_display.php ...

In the file:
/includes/functions/functions_general.php

around line 1134 add the code in RED:

    case ($button_check->fields['products_quantity'] <= 0 || $button_check->fields['product_is_call'] == '1'):

In the file:
/includes/functions/functions_prices.php

around the line 193 add the code in RED:

    $product_check = $db->Execute("select products_quantity, products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");
if ($product_check->fields['products_quantity'] <= 0) {
  return '';
}

/includes/templates/your_template_dir/templates/tpl_product_info_display.php

around the line 132 add the code in RED:

  if ($products_quantity > 0 && $pr_attr->fields['total'] > 0) {

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 Sep 2012, 11:22 PM
#3
wwrepair avatar

wwrepair

New Zenner

Join Date:
Jun 2012
Posts:
92
Plugin Contributions:
0

Re: Automatically show "Call for Price" when items go out of stock

You are amazing! Thank you!

11 Sep 2012, 11:32 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Automatically show "Call for Price" when items go out of stock

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!

1 Apr 2013, 6:07 PM
#5
wwrepair avatar

wwrepair

New Zenner

Join Date:
Jun 2012
Posts:
92
Plugin Contributions:
0

Re: Automatically show "Call for Price" when items go out of stock

Ajeh,
I changed my site to show the out of stock item, but I've had to change it back to show the sold out button, but I cannot seem to get it to show "call for price" instead of the price. The price is gone which is good, but can I add a call for price image or text instead of having nothing there? Apparently I am missing something. Can you help?

1 Apr 2013, 11:45 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Automatically show "Call for Price" when items go out of stock

You could try editing the function file:
/includes/functions/functions_prices.php

and around 192 add the code in RED:

    // $new_fields = ', product_is_free, product_is_call, product_is_showroom_only';
    $product_check = $db->Execute("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type[B], products_quantity[/B] from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");

[B]if ($product_check->fields['products_quantity'] <= 0) {
  $return_button = '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
  return $return_button;
}
[/B]
    // no prices on Document General

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!

1 Apr 2013, 11:57 PM
#7
wwrepair avatar

wwrepair

New Zenner

Join Date:
Jun 2012
Posts:
92
Plugin Contributions:
0

Re: Automatically show "Call for Price" when items go out of stock

Ajeh, You have saved me more than once. You are amazing! Thank you again!!

2 Apr 2013, 12:00 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Automatically show "Call for Price" when items go out of stock

Most welcome ... thanks for the update that this was able to work for you ... :smile:

Remember the Zen Cart Team when you are rich and famous! :cool:

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!