Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Different "Sold Out" images for each product type

    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!

  2. #2
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    I take it there's no way to do this? I'm still very interested in a way if it's possible.

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Different "Sold Out" images for each product type

    If you look at:
    /includes/functions/functions_general.php

    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 could add IF statements to manage the Sold Out image used by products_type in the products table ...

    You would need to alter the function to get this field by changing the SELECT statement from:
    PHP Code:
        $button_check $db->Execute("select product_is_call, products_quantity from " TABLE_PRODUCTS " where products_id = '" . (int)$product_id "'"); 
    to include the products_type field ...

    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!

  4. #4
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    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. :)

  5. #5
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    Quote Originally Posted by Ajeh View Post
    You could add IF statements to manage the Sold Out image used by products_type in the products table ...

    You would need to alter the function to get this field by changing the SELECT statement from:
    PHP Code:
        $button_check $db->Execute("select product_is_call, products_quantity from " TABLE_PRODUCTS " where products_id = '" . (int)$product_id "'"); 
    to include the products_type field ...
    Ok, I officially don't get it. I'll keep working on it, but if anyone out there want to take a stab at showing me what this should look like, I'd probably jump for joy.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Different "Sold Out" images for each product type

    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:
    PHP Code:
        $button_check $db->Execute("select product_is_call, products_quantity from " TABLE_PRODUCTS " where products_id = '" . (int)$product_id "'"); 
    if you change it to read:
    PHP Code:
        $button_check $db->Execute("select product_is_call, products_quantity, master_categories_id 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 ...

    This case statement manages the Sold Out settings:
    PHP Code:
        case ($button_check->fields['products_quantity'] <= 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_OUTBUTTON_SOLD_OUT_ALT);
          } else {
            
    $return_button zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALLBUTTON_SOLD_OUT_SMALL_ALT);
          }
          break; 
    The IF is managing which Sold Out image to send ...

    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!

  7. #7
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    Thank you, Ajeh. I will be working on this some more as the week progresses. I will keep you updated as to my progress.

  8. #8
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    *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.

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Different "Sold Out" images for each product type

    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'] <= 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_10BUTTON_SOLD_OUT_ALT_10);
            } else {
              
    $return_button zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL_10BUTTON_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_27BUTTON_SOLD_OUT_ALT_27);
            } else {
              
    $return_button zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL_27BUTTON_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_OUTBUTTON_SOLD_OUT_ALT);
            } else {
              
    $return_button zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALLBUTTON_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!

  10. #10
    Join Date
    Jul 2007
    Location
    Washington, MO
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different "Sold Out" images for each product type

    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. :)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Sold Out Button says "Sold Out SM".... Sophy Blue
    By huntleybill in forum Addon Templates
    Replies: 3
    Last Post: 28 Nov 2011, 05:32 AM
  2. Replies: 26
    Last Post: 19 Feb 2010, 02:56 AM
  3. Adding a "New" image to the product listing (similar to "Sold Out" image)
    By javaman in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 18 Feb 2010, 11:44 PM
  4. Show both "Add to Card" and "Sold Out" button
    By lgarner in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 4 Feb 2010, 04:16 AM
  5. Get rid of "More Info" link for sold out items
    By cloudstrife08 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 31 Jan 2010, 03:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg