Post
by SXGuy » Sat Nov 06, 2010 6:34 pm
Thats a great addition, its a shame you cant include this as a plugin, and as its a huge mod, im guessing you wont be releasing any sort of how to either?
Been thinking about mailing coupon codes for a while, and like i said previously, it shouldnt be that hard.
As of now, we have the option to add coupon code names to the database, and give them a value.
If we create a controller that uses some sort of random generated hash, 5 lines or something like that.
It could be called when the user checksout, this could then produce a random unique coupon code. Use a model to insert the details into the coupon database table, and then post the coupon code out with the confirmation email.
So it would go something like this.
Between payment and sucess of processed order, page calls "gift.php in catalog/controller/checkout
gift.php generates a random hash of 4 or 5 digits long, then passes it to gift.php located in catalog/model/total
gift.php model file, inserts the generated coupon code, along with the required fields (i.e valid for 1 user, once upto X date)
Once done, passes back confirmation of submission, and details to store inside the confirmation of order / email.
In actual fact, this is something im now starting to wonder whether i may try and acheive when i get a chance. I really cant see it being a problem, the biggest issue would be passing the data between checkout and confirmation stages, and passing the details once confirmed.