Hi There,
I want to use my main banner as a limited time deal offer.
When creating a banner i can set an expiry date for it.
Can anyone help me with writing a code that will show that expiry date somewhere in the front end of the store?
Thanks
Hi There,
I want to use my main banner as a limited time deal offer.
When creating a banner i can set an expiry date for it.
Can anyone help me with writing a code that will show that expiry date somewhere in the front end of the store?
Thanks
I think i might need to write a function in banner.php that will return the expiry date.
I think it will look something similar to the above.PHP Code:
function zen_expire_date_banners($identifier) {
$banner = $identifier;
global $db;
$banners_query = "select b.banners_id, b.expires_date, b.expires_impressions,
sum(bh.banners_shown) as banners_shown
from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh
where b.status = 1
and b.banners_id = bh.banners_id
group by b.banners_id, b.expires_date, b.expires_impressions";
$banners = $db->Execute($banners_query);
return $banners->fields['expires_date']
}
And then i will call the function:
Any one care to share his thought?PHP Code:
<div id="bannerSix" class="banners"><?php echo zen_expire_date_banners($banner); ?></div>
Try this for the function:
Then at the bottom of the function zen_display_banner you could add something like:Code:function zen_expire_date_banners($identifier) { global $db; $banners_query = "select b.banners_id, b.expires_date, b.expires_impressions from " . TABLE_BANNERS . " b where b.banners_id = '" . $identifier . "'"; $banners = $db->Execute($banners_query); return $banners->fields['expires_date']; }
Or clean that up to add the date as you want to display it ...Code:$chk_banner_expires = zen_expire_date_banners($banner->fields['banners_id']); $banner_string .= '<br>ID: ' . $banner->fields['banners_id'] . ' Expires on: ' . $chk_banner_expires; zen_update_banner_display_count($banner->fields['banners_id']);
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: v1.5.5]
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!
Thanks Ajeh,
This is working great. :)
I have implemented a jquery countdown to show the remaining time for the banner
you can see the development here: http://www.vibesdesign.com.au/tradies
That looks pretty snazzy ... nice job!
Something like that I bet others would love to know how you did it ...
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: v1.5.5]
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!
Thanks!
first i have downloaded this free jquery countdown script:
http://www.littlewebthings.com/proje...tdown-html.zip
Than i have placed all the jscript/css elements in my Zen Cart template folder.
Once this is done, i have placed the countdown html code into my tpl_header.php or wherever you like to show it.
In banner.php as discussed before i have added the functions posted by "Ajeh"
And tweaked them a bit to show "year", "month" and "Day" in seperate variables
Finally, replace the expiry date variables with the countdown script. ENJOY
Hope it was clear enough
Bookmarks