If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Displaying Sold Out Image in place of Add to Cart

Displaying Sold Out Image in place of Add to Cart

Started by kenshirou on 23 Apr 2013, 8:19 AM · Views: 2,514

Results 1 to 20 of 39
23 Apr 2013, 8:19 AM
#1
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Displaying Sold Out Image in place of Add to Cart

Hi all, I have a slight problem with getting this to work, I have attempted to enable this within the admin on my template, however because of the custom template it does not appear to work. Ideally I need some help on modding the correct php files to show this icon because I am really pulling my hair out over this.

23 Apr 2013, 8:22 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Displaying Sold Out Image in place of Add to Cart

because of the custom template it does not appear to work.
When you reply - -scroll up and read - then provide the additional information and a link to your site

Zen-Venom Get Bitten

23 Apr 2013, 10:52 AM
#3
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

KenshiroU:

Hi all, I have a slight problem with getting this to work, I have attempted to enable this within the admin on my template, however because of the custom template it does not appear to work. Ideally I need some help on modding the correct php files to show this icon because I am really pulling my hair out over this.

Okay, when a product is out of stock, my site does not display the Sold Out Image in place of Add To Cart. This allows customers to still place an item in the basket and then it displays the message of OUT OF STOCK. I wish to display the Sold Out Image over the add to cart stopping customers to from placing items into the basket when stock is zero. Here is a link to my site http://www.kidsartandcraft.co.uk/

thanks

23 Apr 2013, 1:58 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

Check your setting in the Configuration ... Stock ... for:

Show Sold Out Image in place of Add to Cart
Show Sold Out Image instead of Add to Cart Button

0= off
1= on

Is that already set correctly?

If you switch to the Classic Template ... does it show that Sold Out in place of the Add to Cart correctly?

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!

23 Apr 2013, 3:13 PM
#5
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Ajeh:

Check your setting in the Configuration ... Stock ... for:

Is that already set correctly?

If you switch to the Classic Template ... does it show that Sold Out in place of the Add to Cart correctly?

Yes, it is enabled, however I can only view site map in classic view.

23 Apr 2013, 3:43 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

I am not understanding your answer about only viewing site map in Classic ... what do you mean by that?

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!

23 Apr 2013, 3:55 PM
#7
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

when I switch to classic, I cannot see anything but the site map.

23 Apr 2013, 4:20 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

Unless you deleted the files for the Classic Template or changed core Zen Cart files, you should be able to switch from your template to Classic and back again ...

When set to Classic, on the Site Map, do you see links to categories or any other page?

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!

24 Apr 2013, 7:54 AM
#9
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Yes I see categories to other pages, but if I click these will not work.

However I did some searching and found this:

'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a class="thumbnail" href="'. zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><h3>') .'<a href="' .

zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">'. $featured_products->fields['products_name'] .'</a></h3><p class="wrap_price">'. $products_price.'</p><p class="submit**"> <a class="add2cart medium_button" href="'. zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id'])."&action=buy_now" . '">Add to Cart</a></p>'); **

24 Apr 2013, 8:20 AM
#10
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

// product is in stock or customers may add it to cart anyway
($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 1) ) {
$how_many++;

Is there a way to put in Out of Stock, rather than show image?

24 Apr 2013, 9:02 AM
#11
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Further investigating into the template I also found this

<div class="grid_item_left"> <?php echo ($list_box_contents[$row][1]['head']); ?> <?php echo ($list_box_contents[$row][1]['price2']); ?> <p class="desc"> <?php echo ($list_box_contents[$row][1]['text']); ?> <p class="submit"> <input type="button" class="add2cart medium_button" onclick="window.location.href='<?php echo ($list_box_contents[$row][1]['link'])."&action=buy_now"; ?>';" value="Add to Cart"/> </p>

I believe that could be where the answer lies. This was found in tpl_tabular_display. If I change the 'Add to Card' then it changes all the text on the product listings.

24 Apr 2013, 1:14 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

If you want text there, you would need to customize the function file:
/includes/functions/functions_general.php

and change the code around line 1118 to read:

    case ($button_check->fields['products_quantity'] <= 0 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):
      if ($_GET['main_page'] == zen_get_info_page($product_id)) {
[B]//[/B]        $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT, BUTTON_SOLD_OUT_ALT);
[B]$return_button = 'Out of Stock';
[/B]      } else {
[B]//[/B]        $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
[B]$return_button = 'Out of Stock';
[/B]      }
      break;
    default:

NOTE: there is no overrides file for this and you will need to remember to make this change next time you upgrade ...

NOTE: you could also make your own Sold Out image for Out of Stock and just load that in your templates and overrides for the file:
/includes/templates/your_template_dir/buttons/english/button_sold_out.gif

this would allow you to use templates and overrides and not have to change core Zen Cart files that do not have overrides ...

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!

24 Apr 2013, 2:40 PM
#13
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Ajeh:

If you want text there, you would need to customize the function file:
/includes/functions/functions_general.php

and change the code around line 1118 to read:

case ($button_check->fields['products_quantity'] <= 0 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):
  if ($_GET['main_page'] == zen_get_info_page($product_id)) {

[B]//[/B] $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT, BUTTON_SOLD_OUT_ALT);
[B]$return_button = 'Out of Stock';
[/B]
} else {
[B]//[/B] $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
[B]$return_button = 'Out of Stock';
[/B]
}
break;
default:

> 
> NOTE: there is no overrides file for this and you will need to remember to make this change next time you upgrade ...
> 
> NOTE: you could also make your own Sold Out image for Out of Stock and just load that in your templates and overrides for the file:
> /includes/templates/your_template_dir/buttons/english/button_sold_out.gif
> 
> this would allow you to use templates and overrides and not have to change core Zen Cart files that do not have overrides ...

I added in the code, however it its still displaying 'Add to Cart' on the product listing level. Thats mainly where I wish to change that text found in tpl_tabular_display.
24 Apr 2013, 2:53 PM
#14
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

My knowledge of PHP is limited, but the 'Add to Cart' is not an actual button image. Its partly generated by the CSS within the style sheet. Ts it possible to write an IF statement to change the text from 'Add to Cart' to 'Out of Stock' when a product reaches 0.

<div class="list_wrapper list_wrapperle"> <?php for($row=1; $row<sizeof($list_box_contents); $row++) { $xtra = ""; if ($row == 3 || $row == 6 || $row == 9 || $row == 12 || $row == 15 || $row == 18 || $row == 21 || $row == 24 || $row == 27 || $row == 30) $xtra = "last_item"; ?> <div class="list_item list_item_1 smaller odd <?php echo $xtra ?>"> <?php $disp1 = ereg_replace('<a href="', '<a class="thumbnail" href="', $list_box_contents[$row][0]['text']); echo $disp1; ?> <div class="grid_item_left"> <?php echo ($list_box_contents[$row][1]['head']); ?> <?php echo ($list_box_contents[$row][1]['price2']); ?> <p class="desc"> <?php echo ($list_box_contents[$row][1]['text']); ?> <p class="submit"> <input type="button" class="add2cart medium_button" onclick="window.location.href='<?php echo ($list_box_contents[$row][1]['link'])."&action=buy_now"; ?>';" value="Add to Cart"/> </p> </div> </div> <?php } ?> </div>
24 Apr 2013, 3:56 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

You appear to have an add on there, do you know what it is?

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!

25 Apr 2013, 7:47 AM
#16
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Ajeh:

You appear to have an add on there, do you know what it is?

where is that? and sorry don't know what that is either. :dontgetit

25 Apr 2013, 8:39 AM
#17
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Displaying Sold Out Image in place of Add to Cart

where is that? and sorry don't know what that is either
From your code posting these div classes are all not part of the default ZenCart code base

<div class="list_wrapper list_wrapperle">
<div class="list_item list_item_1 smaller odd <?php echo $xtra ?>">
<div class="grid_item_left"> 

So which addon(s) are they from?

Zen-Venom Get Bitten

25 Apr 2013, 9:03 AM
#18
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

I don't think they're from an addon, they were just in the template file.

25 Apr 2013, 12:46 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Displaying Sold Out Image in place of Add to Cart

Could you Zip the file from post #14 and attach it to your post? Maybe seeing the whole thing would be of help ...

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!

25 Apr 2013, 12:50 PM
#20
kenshirou avatar

kenshirou

Zen Follower

Join Date:
Oct 2012
Posts:
109
Plugin Contributions:
0

Re: Displaying Sold Out Image in place of Add to Cart

Ajeh:

Could you Zip the file from post #14 and attach it to your post? Maybe seeing the whole thing would be of help ...

As requested