Welcome, Guest. Please login or register.
Login with username, password and session length


It's a release candidate! VirtueMart 2.0 RC - the next generation VirtueMart - is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: Re: Coupon Start and Expiry Dates  (Read 5403 times)
willowtree
Hero Member
*****
Posts: 546


WWW
« on: July 13, 2008, 00:54:31 AM »

for vm 1.1, joomla 1.0.15

the language file is different as values are all held in an array, and i've changed some of the logic around as i was working  on it. BACKUP first.

Files to edit:
ps_coupon.php
I'm attaching my full file. As far as I can remember there are no other mods to this file from the standard install but I could be wrong.

coupon.coupon_form.php
I'm attaching my full file. As far as I know the only other mod to this file creates a random coupon code for you to use if you want.

Database Edits:
jos_vm_coupons - add following columns:
coupon_start_date
coupon_expiry_date
Code:

CREATE TABLE `jos_vm_coupons` (
  `coupon_id` int(16) NOT NULL auto_increment,
  `coupon_code` varchar(32) NOT NULL default '',
  `percent_or_total` enum('percent','total') NOT NULL default 'percent',
  `coupon_type` enum('gift','permanent') NOT NULL default 'gift',
  `coupon_value` decimal(12,2) NOT NULL default '0.00',
  `coupon_start_date` datetime default NULL,
  `coupon_expiry_date` datetime default NULL,
  PRIMARY KEY  (`coupon_id`)
) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=latin1 COMMENT='Used to store coupon codes'


Language file edits:
I changed PHP_SHOP_COUPON_CODE_INVALID TO PHPSHOP_COUPON_CODE_NOT_FOUND as I felt it was a better name as I needed to add:

Files to edit:
ps_coupon.php
I'm attaching my full file. As far as I can remember there are no other mods to this file from the standard install but I could be wrong.

coupon.coupon_form.php
I'm attaching my full file. As far as I know the only other mod to this file creates a random coupon code for you to use if you want.

Database Edits:
jos_vm_coupons - add following columns:
coupon_start_date
coupon_expiry_date
Code:

CREATE TABLE `jos_vm_coupons` (
  `coupon_id` int(16) NOT NULL auto_increment,
  `coupon_code` varchar(32) NOT NULL default '',
  `percent_or_total` enum('percent','total') NOT NULL default 'percent',
  `coupon_type` enum('gift','permanent') NOT NULL default 'gift',
  `coupon_value` decimal(12,2) NOT NULL default '0.00',
  `coupon_start_date` datetime default NULL,
  `coupon_expiry_date` datetime default NULL,
  PRIMARY KEY  (`coupon_id`)
) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=latin1 COMMENT='Used to store coupon codes'


Language file edits:
I changed PHP_SHOP_COUPON_CODE_INVALID TO PHPSHOP_COUPON_CODE_NOT_FOUND as I felt it was a better name as I needed to add:

PHPSHOP_COUPON_CODE_INVALID
PHPSHOP_COUPON_START
PHPSHOP_COUPON_EXPIRY

Code:

'PHPSHOP_COUPON_START' => 'Coupon Start Date',
'PHPSHOP_COUPON_EXPIRY' => 'Coupon Expiry Date',
'PHPSHOP_COUPON_CODE_INVALID' => 'Coupon code out of date. Please try an alternative.',
'PHPSHOP_COUPON_CODE_NOT FOUND' => 'Coupon code not found. Please try again.',


Notes:
You will need to edit all existing coupons in order for them to be valid otherwise if they do not have a start or expiry date they will appear as invalid

Attached Files
Files are attached as .txt files to allow upload. They just need renaming to .php to work.

* coupon.coupon_form.txt (5.03 KB - downloaded 451 times.)
* ps_coupon.txt (10.77 KB - downloaded 451 times.)
Logged

Please add your VM and Joomla Version to your signature to make it easier to help you:

Most of my code posted in the forum is for VirtueMart 1.0  -  not for 1.1
sobers_2002
Newbie
*
Posts: 44


« Reply #1 on: August 30, 2008, 03:12:30 AM »

at the risk of sounding annoying, is this available for Joomla 1.5.x ?
Logged
Pages: [1]   Go Up
Print
Jump to: