Results 1 to 6 of 6
  1. #1

    Default Display banner's Expiry date in store front

    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

  2. #2

    Default Re: Display banner's Expiry date in store front

    I think i might need to write a function in banner.php that will return the expiry date.

    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']


    I think it will look something similar to the above.
    And then i will call the function:
    PHP Code:
    <div id="bannerSix" class="banners"><?php echo zen_expire_date_banners($banner); ?></div>
    Any one care to share his thought?

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

    Default Re: Display banner's Expiry date in store front

    Try this for the function:
    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'];
    
    }
    Then at the bottom of the function zen_display_banner you could add something like:
    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']);
    Or clean that up to add the date as you want to display 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!

  4. #4

    Default Re: Display banner's Expiry date in store front

    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

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

    Default Re: Display banner's Expiry date in store front

    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!

  6. #6

    Default Re: Display banner's Expiry date in store front

    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

 

 

Similar Threads

  1. Date of expiry doesn't appear in front end
    By amrami in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 31 May 2011, 09:27 AM
  2. Product Expiry Date
    By dlangham in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 14 Oct 2009, 06:38 AM
  3. Specials Expiry Date
    By Cal in forum Setting Up Specials and SaleMaker
    Replies: 9
    Last Post: 5 Sep 2009, 04:21 AM
  4. Expiry Date - Blank Value
    By stehodges in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 6 Sep 2006, 03:23 AM

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