Forums / Setting Up Categories, Products, Attributes / Add a sticker for featured products

Add a sticker for featured products

Locked

Views: 952

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
5 Sep 2009, 3:32 PM
#1
hengxi avatar

hengxi

New Zenner

Join Date:
Jun 2009
Posts:
13
Plugin Contributions:
0

Add a sticker for featured products

Hello,

I have find this code for put a sticker on the news products. This work fine but i want to have the same system for the featured products.

I am 0 in PHP ; this is the code:

<?php $datesql = "select products_date_added from products where products_id = ". (int)$_GET['products_id'] ." "; $date_display = $db->Execute($datesql); $newdate = $date_display->fields['products_date_added']; $newdate2 = $newdate–30; function reformatDate($newdate) { list($day, $month, $year, $hour, $min, $sec) = split( '[: -]', $newdate); return "$day-$month-$year"; } $dateA=$newdate; $theDate=reformatDate($dateA); $thirty_days_ago = mktime()-2592000; if ($theDate >= date('d-m-Y', $thirty_days_ago)) { echo '<div class="new"></div>'; } ?>

Can you help me ? Thank you.

6 Sep 2009, 3:40 AM
#2
hengxi avatar

hengxi

New Zenner

Join Date:
Jun 2009
Posts:
13
Plugin Contributions:
0

Re: Add a sticker for featured products

I have find the solution and you can use if you want to put a sticker on featured products:

1°) in the stylesheet css, add a class:

.new {
background-image:url(../images/stickers.png );

width: 232px;
height: 40px;

}

2°) In the tpl_product_info_display.php, add this where you want the sticker (You must to find the good place):

<?php $base= "select products_id from products where products_id = ". (int)$_GET['products_id'] ." "; $base2 = $db->Execute($base); $base3 = $base2->fields['products_id']; $base4= "select products_id from featured where products_id = '$base3' "; $base5 = $db->Execute($base4); $base6 = $base5->fields['products_id']; if ($base3=$base6){ echo '<div class="new"></div>'; } ?>

It's all

After this, all your's featured products have a sticker. :clap: