LearnWebDesignOnline.com is proudly hosted by Hostmonster.com

In this tutorial, we show you one way in which you can create a customizable promotional message that shows up on the front page of ZenCart. Example of such text might be. "Free shipping with orders of $100 or more". The store owner will be able to set this text via the Admin Control panel in an EZPage.
1. First we will set up an EZPage with the title "Front Page Promo Message". You can set the options radio buttons to "No" as shown. And add our promotional text ...

2. The promo text can be retrieved from the database by this SQL statement...
SELECT pages_html_text FROM zen_ezpages WHERE pages_title = 'Front Page Promo Message';
But in PHP code we write ...

with zen_ezpages replaced by TABLE_EZPAGES (a constant defined in /includes/database_tables.php) because we do not want to hard-code the table name as it can be different depending on what "db prefix" the user had entered when installing. Note that we also variablized the EZPage title that we are looking for.
3. Define that function "getPromoText" in a new file called "customfunctions.php" in
includes/functions/extra_functions
4. Go to the code of the page where you want to display the promo text. For exampple, it could be ...
/includes/languages/english/html_includes/example/define_main_page.php
where "example" is your template folder.
5. Insert the call to our function...
<?php
echo getPromoText('Front Page Promo Message');
?>
6. Now store owner can change the EZPage content and it will be reflected in the page via the echo state above.
Note: This tutorial is applicable to version 1.3.8 of Zen-Cart.
