************************ Deal of the Day instructions ************************ This DEAL page automatically changes the random product and unique coupon code after midnight each day. The coupon expires at midnight and a new unique coupon is generated for the new product. The two modules used for this feature are the Emporium Plus Tool Kit v5.139 or newer and the Emporium Plus Coupon Redemption v5.042 or newer. In addition to the daily update, they also write a message (less than 140 characters) to a file. 1) Make sure you have the versions (or newer) of the Tool Kit and Coupon module listed above. If not, you can get the update from the store you got the original from. If from Emporium Plus or Design Extend, you will need to provide your order number and merchant url. 2) Create a new page in admin. The code should be DEAL and the name can be whatever, e.g. Deal of the Day. Due to a bug in Miva Merchant that is supposed to be fixed in core 18 release, you cannot just copy and paste the below page code into this new page. Instead save the blank page. Then copy and paste the below page template into the Template input and click Update. Locate these two lines which appear in two places in the template. They are used for the Twitter and Facebook message creation. Currently Twitter has removed the ability to update status directly. Go ahead and correct the code in case an application comes available at a later date. It won't actually send the message with this step. and In the first line, change the message and percent off to match your needs. Remember, you only get 140 characters in Twitter. It appears the Twitter API makes the url a short url similar to tinyurl. Change the YOURDOMAIN to your actual domain so it will go to your store. In the second line, it is exporting the message to a directory called s01. Most stores are store number 1 in your Miva Merchant mall so it is probably already correct. If you have a mall (multiple stores in Merchant) you will need to determine the store number and consequently the directory its data exports are saved to. You can go to most of the export modules and it tells you what directory it sent the files to. Click word "Items" at the top of the page. Assign the following items to this new page. If you forget this step the page will be nearly blank. head hdft store messages body mmui_messages category_tree navbar colors fonts buttons customerlink affiliatelink couponrd toolkit html_profile prodctgy_meta ** BEGINNING OF TEMPLATE CODE &mvt:store:name; Inquiry

The Deal of the Day for &mvte:key_product:name; has expired. That product is no longer available. See today's Deal of the Day.

Deal of the Day - &mvte:global:cmonth; &mvt:global:ndayofmonth;, &mvt:global:nyear;


&mvte:key_product:name;
&mvte:key_product:formatted_price;


Buy today, get 10% off this price. Coupon &mvte:global:Coupon_Generate_ID; will automatically be applied.
&mvte:key_product:inv_short;


** END OF TEMPLATE CODE The above template is fairly complex so here is an explanation of some of the lines. Tests for daylight savings time and then sets the time zone offset to -4 or -5 (eastern time USA) Checks to see if the deal of the day had run ever before Tests to see if the deal of the day has been run already today and Selects 10 random products from your inventory and finds the first one that has a full size image. If none are found, it runs another backup random selection of 1 and uses that product (image or not). Generates a unique coupon that begins with DEAL- and assigns the current product for its eligibility Deletes a file called Merchant5/s01/export/deal.dat and recreates it with day, product code, coupon code for today's deal Creates the 140 character or less message and saves it to a variable called msg. Deletes the old message file and replaces it with the new message and Copies the deal.msg file to the world readable directory where your index file normally resides, http://www.YOURDOMAIN.com/ If you are running a mall with multiple stores you are going to have to compensate for this as you can't copy them all to the same file name. So each template is going to have to have a separate name for the deal.msg in the world readable directory. You will then need to change the curl script below accordingly. If you don't have multiple stores, don't worry about this issue. Compares the product code in the Twitter link with the current products. It then displays an expired message if they don't match. Makes a hidden input in the add to basket form for an "instant" coupon and fills in the coupon code of the day. This way, when they add to basket, the coupon is added at the same time. You cannot use the regular basket coupons because they cannot be used with products that have attributes. Since this is a random product selection, there is the possiblity that a attribute type product would be selected for the deal of the day. 3) Now you need to create the coupon template that will generate the sub-coupon for the specific deal of the day product. On the DEAL page we have the render token The coupon setup that goes with this token has #22~DEAL- for its coupon code. It has the number 0 for the expires date, thus making it expire at midnight of the current day. Don't leave it blank; insert a 0. It has 10 for the value and is a percent discount coupon. You would change that to the discount amount you are going to use. For the products eligible it is blank as it will receive that value from the token. Make sure you check the box "Apply % Discount Only to the Above" so that only the dynamically inserted product will be discounted. Then check the box for Instant coupon since this will be an instant coupon type redemption, just not on the product page. 4) Now go to the DEAL screen in your store to see if it works. A product should display. When clicking the add to basket button, the product should be put in the basket along with the coupon discount as a separate line item. If you are not going to send a message to Twitter and Facebook, then you are done. The first visit to this page on any day will trigger the selection of a new product for the day along with its coupon code. That visit could be one second after midnight or 8AM. It matters not, the first person (or bot) that visits the page will trigger the event. If you want to publish (market) the deal of the day on Twitter and Facebook, read on. 5) Since you cannot wait until someone visits to publish the message, you need to set a specific time that the new product will be selected and coupon created. This requires that your host has provided you with cron and you have some knowledge on how to set that up. We are not experts with cron so if you need help with cron, you will need to get it from your host or the Miva forums. The cron task to select the product and create the coupon simply runs the http call that displays the DEAL screen. You'll probably run that at 1 minute after midnight. Here is an example of the cron task to visit the DEAL screen. wget --post-data='Screen=DEAL&Store_Code=YOURSTORECCODE' http://www.YOURDOMAIN.com/mm5/merchant.mvc >/dev/null 2>&1 Change the YOURDOMAIN and YOURSTORECODE to your actual data. The >/dev/null 2>&1 at the end of the line represses the cron task from sending an email when it runs. Two problems with the email. 1) If your task has a password in it, it is clearly shown in the subject of the non-secure email. 2) Half the time it says "denied" or some other term that makes you think it didn't work. That is not always correct. 6) At this time, the direct insert of status updates has been discontinued by Twitter. 7) This page told you how to create a dynamic Deal of the Day page, put a random product on it, and create a unique coupon. You can send your Deal page link out in newsletters. You can even have a link or button prominently displayed on your store front. While this presents a nice marketing scheme, it is not the only way to create a Deal of the Day. You could still make the DEAL page that would trigger the product selection and coupon generation. But instead of sending customers to a DEAL page that they become familiar with, you could just provide them with the coupon code and a link to the specific product's page in the message using the variables that are created (product and coupon code). The main drawback is they may not read the message that day or may bookmark the page, then when they come back, they waste time putting the product in the basket and trying to redeem a coupon that has expired. By having the single DEAL page, they clearly see that the product has changed since the original message was sent. This is to be expected since it is the Deal of the "Day".