Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Viewable Coupons Codes for Customers

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 08-19-2003, 04:54 AM
 
rodneyw rodneyw is offline
 

Senior Member
  
Join Date: Mar 2003
Posts: 162
 

Default Viewable Coupons Codes for Customers

My First "Mod" - if this already exists I apoligize.

As part of a marketing strategy I wanted to be able to let customers see what coupons the store had to offer. The catch was I need to be able to CHOOSE which ones I wanted them to see.

I have created a mod that will allow you to assign if a coupons can be viewable or not at the time of creation.

You then provide a link for the customer to view all the coupons that are available.

I still have to check the expiration date as I only want to show them what is active and I still have to clean the code up.

If anyone is interested let me know and I'll put together a "how to".

I have all the files zipped up and if anyone would like to take a look at them and let me know if I have breached any security I would appreciate it.
Reply With Quote
  #2  
Old 08-19-2003, 08:18 AM
 
rodneyw rodneyw is offline
 

Senior Member
  
Join Date: Mar 2003
Posts: 162
 

Default Does This Look 'Solid' ?

WORKS ON 3.4.4

Here is what I have and it seems to be working fine.
It will only show your coupons to customers WHEN....
[1] They are marked as VIEWABLE when created
[2] If they are ACTIVE
[3] They have NOT expired

I hope I have this documented well enough. If anyone see's any issues please let me know.


1
#######################
SQL DATABASE CHANGES
Need to add new field at the end of the discount coupons table
#######################

status_view` char(1) NOT NULL default 'N'

2
#######################
Add New text and label varibles in Language Library
#######################

lbl_promotions
txt_use_coupon


3
#######################
Create New Files
#######################

Save below code as: skin1/customer/coupons.tpl
Code:
{* $Id: coupons.tpl,v 1.10 2003/04/22 10:10:59 svowl Exp $ *} {include file="location.tpl" last_location="Store coupons"} {include file="main/popup_product_js.tpl"} {capture name=dialog} {if $coupons ne ""} <table width="100%" border=0> <tr><td class=TableHead>Coupon Code</td><td class=TableHead>Discount</td><td class=TableHead colspan=2>Expires</td></tr> {section name=prod_num loop=$coupons} <tr> <td> <font color="red">{$coupons[prod_num].coupon}</font> </td> <td>{if $coupons[prod_num].coupon_type eq "absolute"}{include file="currency.tpl" value=$coupons[prod_num].discount}{elseif $coupons[prod_num].coupon_type eq "percent"}{$coupons[prod_num].discount}%{else}Free ship.{/if}</td> <td nowrap> {$coupons[prod_num].expire|date_format:"%b/%d/%Y"} </td> <td></td> </tr> <tr> <td colspan=4> This coupon applies the discount on orders {if $coupons[prod_num].productid ne 0} which contain product #{$coupons[prod_num].productid} {elseif $coupons[prod_num].categoryid ne 0} which contain product(s) from category #{$coupons[prod_num].categoryid} {else} greater than {include file="currency.tpl" value=$coupons[prod_num].minimum} {/if} <hr size=1 noshade> </td> </tr> {/section} <tr> <td></td> </tr> </table> {$lng.txt_use_coupon} {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_promotions content=$smarty.capture.dialog extra="width=100%"}



Save below code as: customer/coupons.php
Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2002 Ruslan R. Fazliev. All rights reserved. | +-----------------------------------------------------------------------------+ | The Ruslan R. Fazliev forbids, under any circumstances, the unauthorized | | reproduction of software or use of illegally obtained software. Making | | illegal copies of software is prohibited. Individuals who violate copyright | | law and software licensing agreements may be subject to criminal or civil | | action by the owner of the copyright. | | | | 1. It is illegal to copy a software, and install that single program for | | simultaneous use on multiple machines. | | | | 2. Unauthorized copies of software may not be used in any way. This applies | | even though you yourself may not have made the illegal copy. | | | | 3. Purchase of the appropriate number of copies of a software is necessary | | for maintaining legal status. | | | | DISCLAIMER | | | | THIS SOFTWARE IS PROVIDED BY Ruslan R. Fazliev ``AS IS'' AND ANY | | EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | DISCLAIMED. IN NO EVENT SHALL Ruslan R. Fazliev OR ITS | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev. | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2002 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: coupons.php,v 1.16 2003/01/14 13:43:46 svowl Exp $ # require "../smarty.php"; require "../config.php"; require "./auth.php"; include "../include/categories.php"; $coupons = func_query("select * from $sql_tbl[discount_coupons] where status_view='Y' and status='A' and expire>".time()); $smarty->assign("coupons", $coupons); $smarty->assign("main","store_coupons"); $smarty->display("customer/home.tpl"); ?>


4
#######################
Modify Existing Files
#######################

TEMPLATE FILE: skin1/customer/home_main.tpl

Place following code:
Code:
{elseif $main eq "store_coupons"} {include file="customer/coupons.tpl"}




TEMPLATE FILE: skin1/modules/Discount_Coupons/coupons.tpl

REPLACE::
Code:
<form action="coupons.php" method="POST"> <tr><td class=TableHead>Coupon</td><td class=TableHead>Status</td><td class=TableHead>Disc.</td><td class=TableHead>Min.</td><td class=TableHead>Times</td><td class=TableHead colspan=2>Expires</td></tr> {section name=prod_num loop=$coupons} <tr> <td> {$coupons[prod_num].coupon} </td>

WITH::
Code:
<form action="coupons.php" method="POST"> <tr><td class=TableHead>Coupon</td><td class=TableHead>Viewable</td><td class=TableHead>Status</td><td class=TableHead>Disc.</td><td class=TableHead>Min.</td><td class=TableHead>Times</td><td class=TableHead colspan=2>Expires</td></tr> {section name=prod_num loop=$coupons} <tr> <td> {$coupons[prod_num].coupon} </td> <td>{$coupons[prod_num].status_view}</td> <td>




PHP FILE: provider/coupons.php

REPLACE::
Code:
db_query("insert into $sql_tbl[discount_coupons] (coupon, discount, coupon_type, minimum, times, expire, status, provider, productid, categoryid) values ('$coupon_new', '$discount_new', '$coupon_type_new', '$minimum_new', '$times_new', '$expire_new', '$status_new', '$login', '$productid_new', '$categoryid_new')");

WITH::
Code:
db_query("insert into $sql_tbl[discount_coupons] (coupon, discount, coupon_type, minimum, times, expire, status, provider, productid, categoryid, status_view) values ('$coupon_new', '$discount_new', '$coupon_type_new', '$minimum_new', '$times_new', '$expire_new', '$status_new', '$login', '$productid_new', '$categoryid_new', '$status_view')");


What I can't figure out is how to display the Category NAME intead of the category ID on the skin1/customer/coupons.tpl file
Reply With Quote
  #3  
Old 08-19-2003, 09:49 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Nice mod, this is type of mod is the perfect compliment to the "find customers who used coupon" search ability in our Marketing Manager xcart add on which lets you find customers who used the coupons, and email them with additional discount coupons and offer to use.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:29 PM.

   

 
X-Cart forums © 2001-2020