I've been trying to figure out a way to have one "sold out" image for one product type (general), and use a different one for another product type (music). Any hints would be appreciated. thanks!
I've been trying to figure out a way to have one "sold out" image for one product type (general), and use a different one for another product type (music). Any hints would be appreciated. thanks!
I take it there's no way to do this? I'm still very interested in a way if it's possible.
If you look at:
/includes/functions/functions_general.php
You could add IF statements to manage the Sold Out image used by products_type in the products table ...Code:Line #1148 : $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT, BUTTON_SOLD_OUT_ALT); Line #1150 : $return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
You would need to alter the function to get this field by changing the SELECT statement from:
to include the products_type field ...PHP Code:$button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
NOTE: there are no overrides on the function files ...
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!
Oh man, that's awesome. I'm glad there is a way to do it. I knew if there was, that it would have something to do with the /includes/functions/functions_general.php file, but I'm such a noob I just have no idea how to tweak it. I'm trying to read up on php and IF statements so I can take care of it myself, but it may be a few days before I can post back and let you know if I got it working. Thank you, Ajeh, for pointing me in the right direction. :)
You need to know the master_categories_id for the product when using this function to change the Sold Out image ...
This line selects the data:
if you change it to read:PHP Code:$button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
You now can identify the categories_id to change the sold out ... where $button_check->fields['master_categories_id'] is the categories_id to identify which one the Product uses as its main Category ...PHP Code:$button_check = $db->Execute("select product_is_call, products_quantity, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
This case statement manages the Sold Out settings:
The IF is managing which Sold Out image to send ...PHP Code:case ($button_check->fields['products_quantity'] <= 0 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):
if ($_GET['main_page'] == zen_get_info_page($product_id)) {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT, BUTTON_SOLD_OUT_ALT);
} else {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
}
break;
You need to customize that section based on the categories_id that you get from:
$button_check->fields['master_categories_id']
Does that help you some?![]()
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!
Thank you, Ajeh. I will be working on this some more as the week progresses. I will keep you updated as to my progress.
*sniff
I still don't get it. I have decided I am just not anywhere close to proficient enough with PHP to do this on my own. I have the feeling it's really easy and once I see it, I'll kick myself.
If anyone wants to volunteer more clues, I would be forever in their debt.
See if this doesn't steer you in the right direction ... it is just a quick fix but should work for your needs ...
PHP Code:$button_check = $db->Execute("select product_is_call, products_quantity, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
switch (true) {
// cannot be added to the cart
case (zen_get_products_allow_add_to_cart($product_id) == 'N'):
return $additional_link;
break;
case ($button_check->fields['product_is_call'] == '1'):
$return_button = '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a>';
break;
// configure to manage sold images out by categories_id via master_categories_id
case ($button_check->fields['products_quantity'] <= 0 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):
switch ((int)$button_check->fields['master_categories_id']) {
case (10):
if ($_GET['main_page'] == zen_get_info_page($product_id)) {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_10, BUTTON_SOLD_OUT_ALT_10);
} else {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL_10, BUTTON_SOLD_OUT_SMALL_ALT_10);
}
break;
case (27):
if ($_GET['main_page'] == zen_get_info_page($product_id)) {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_27, BUTTON_SOLD_OUT_ALT_27);
} else {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL_27, BUTTON_SOLD_OUT_SMALL_ALT_27);
}
break;
default:
if ($_GET['main_page'] == zen_get_info_page($product_id)) {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT, BUTTON_SOLD_OUT_ALT);
} else {
$return_button = zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
}
break;
}
// forgot one!
break;
default:
$return_button = $link;
break;
}
if ($return_button != $link and $additional_link != false) {
return $additional_link . '<br />' . $return_button;
} else {
return $return_button;
}
}
Last edited by Ajeh; 5 May 2008 at 06:09 AM. Reason: silly me ... forgot a break;
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!
Wow! Thank you, Ajeh/Linda for taking the time to help me. It is appreciated more than you know!
I am using the code you gave me (with my own category numbers and image settings), and it looks like it should be the answer to my situation, but now for some reason the sold out images aren't displaying at all. The add-to-cart option is still available, despite being set to display the sold out image instead when the item is out of stock.
Here are some links to my site so you can see what I mean:
registry link
regular item link
I have special (temporary) buttons made up for the registry items, and I'm trying to get the regular sold out images to show for the regular items.
I may have just missed something, but like I said before, it's beyond me. :)