Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default append product name if on special or sale or new

    I'd like to append the product name with "ON SALE" if the product is on sale, or "SPECIAL PRICE" if the product is on special, or "NEW" if the product is new. Can anyone tell me what codes I would need to use if an item is on sale, on special or new?

    What I want to do is this:

    Code:
    <!--bof Product Name-->
    <h1 id="productName" class="productGeneral"><?php echo $products_name; ?>
    <?php IF PRODUCT IS SPECIAL { echo 'SPECIAL PRICE'; } ?>
    <?php IF PRODUCT IS NEW { echo 'NEW'; } ?>
    <?php IF PRODUCT IS ON SALE { echo 'ON SALE'; } ?>
    </h1>
    <!--eof Product Name-->

  2. #2
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: append product name if on special or sale or new

    I still need help with the code to check if a product is on special or on sale.

    Here's what I have to check if a product is new and display "new" after the product name:
    Code:
    <?php 
    	$datesql = "select products_date_added from " . TABLE_PRODUCTS . " where products_id=" . (int)$_GET['products_id'] . ";";
    	$date_display = $db->Execute($datesql);
    	$prod_add_date = $date_display->fields['products_date_added'];
    	$nib_days = time() - ((int)NEW_ITEM_BADGE_DAYS * 86400);
    <?php if ((strtotime($prod_add_date) >= $nib_days)) { echo '<div class="productIcon new2">'.TITLE_TXT_NEW.'</div>'; } ?>
    To check if a product is in a specific category and display "clearance" after the product name:
    Code:
    	<?php $clearlink = zen_product_in_category($_GET['products_id'], 284);
    if ($clearlink == 1) { echo '<div class="productIcon disc">'.TITLE_TXT_CLEARANCE.'</div>'; }?>

  3. #3
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: append product name if on special or sale or new

    For specials:

    Code:
    <?php 	$specialsql = "select specials_id from " . TABLE_SPECIALS . " where products_id=" . (int)$_GET['products_id'] . ";";
    	$special_result = $db->Execute($specialsql);
    	if (isset($special_result->fields['specials_id']))  { echo '<div class="productIcon disc">'.TITLE_TXT_SALE.'</div>'; } ?>

  4. #4
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: append product name if on special or sale or new

    Oops. To check if a product is new and display "new" after the product name should be:
    Code:
    <?php 
            $datesql = "select products_date_added from " . TABLE_PRODUCTS . " where products_id=" . (int)$_GET['products_id'] . ";";
    	$date_display = $db->Execute($datesql);
    	$prod_add_date = $date_display->fields['products_date_added'];
    	$nib_days = time() - ((int)NEW_ITEM_BADGE_DAYS * 86400); ?>
    
    <?php if ((strtotime($prod_add_date) >= $nib_days)) { echo '<div class="productIcon new2">'.TITLE_TXT_NEW.'</div>'; } ?>

  5. #5
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Re: append product name if on special or sale or new

    For specials:
    Code:
    <?php 	
            $specialsql = "select specials_id from " . TABLE_SPECIALS . " where status = "1" products_id=" . (int)$_GET['products_id'] . ";";
    	$special_result = $db->Execute($specialsql);
    	if (isset($special_result->fields['specials_id']))  { echo '<div class="productIcon disc">'.TITLE_TXT_SALE.'</div>'; } ?>
    Have to specify that the special is active...

 

 

Similar Threads

  1. v151 Append or Add Product Media Clip Link to Product Listing
    By JenniferXO in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Apr 2014, 05:58 AM
  2. v151 I lost the font color of product name in special/new/featured sideboxes....
    By benxp in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 11 Oct 2013, 11:14 PM
  3. all products, product listing, featured, special and new product layout
    By rbarbour in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 1 Sep 2010, 01:27 AM
  4. Tab system for special/new/sale categories.
    By rpain in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 30 Apr 2010, 10:01 AM
  5. Special characters in Product Name
    By Stuff4Toys in forum General Questions
    Replies: 2
    Last Post: 8 Feb 2008, 08:21 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR