Post by ifone_developer » Sat Oct 02, 2010 1:02 pm

Hi frenz,
Whenever customer check out for gift certificates and after the order is over, a redemption code need to be generated( an autogenerated one) and it needs to be mailed to customer as well as store owner.
Please note, code should be generated only after the customer has paid for it.
Has anyone worked on this before?? Could u plz give me code or an idea ????
Tanx in advance

New member

Posts

Joined
Sat Jul 10, 2010 6:48 pm

Post by ifone_developer » Mon Oct 04, 2010 10:37 pm

Hi ppl,
I wanna random code to be generated for customers through EMail(for gift certificate checkout).
And so whenever customer clicks confirm button, he receives email with a random code added along with other details.
i have code with me but i dono how to add( as am a new bee :) )
For random generation,

Code: Select all

$Autogen = substr(md5(rand()), 0, 8);
To add with email text,

Code: Select all

$text .= "<b>Autogenerated code:</b>: ".$Autogen."\n\n";
(Its a hard coded one)
I think i should add this in model/checkout/order.php.
But i cudn't achieve it even after tryin many times.
Can anyone help me telling how to add??
Please Note:
Email with random code should go to customer as well as store owner

New member

Posts

Joined
Sat Jul 10, 2010 6:48 pm

Post by i2Paq » Mon Oct 04, 2010 10:41 pm

Topıcs merged.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by ifone_developer » Mon Oct 04, 2010 10:45 pm

ya thanks for doing this.Dint note whether i have posted this before. Thanks neways.
Could u help me knowing this??

New member

Posts

Joined
Sat Jul 10, 2010 6:48 pm

Post by SXGuy » Thu Oct 07, 2010 10:28 pm

If you look at the way coupons work, how they are added in the admin side, i.e values they have such as, how many times they can be used, period of time they are valid.

You are going to need to pass the generated code into your coupon database table, and use the generated code as the coupon code. As well as passing the correct data you need to assign the right details.

This should probably be done around the time of the confirmation email being sent.

It shouldnt be to hard to do to be honest, im sure there are a few people here who would create the modification for you for a small fee.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by superann » Sat Nov 06, 2010 10:48 am

I've modded OC to support e-gift certificates properly as a product. Unique codes are generated and emailed upon checkout (this is separate from coupons) and can be redeemed in part or in full. I've also created two admin panels for gift certificate products in the "Catalog" submenu and to manage existing gift certificates and generate unique codes manually as a "Sales" submenu. Complete gift certificate order and redemption history is also displayed for each activated gift certificate in Open Cart.

http://poketo.com/shop/gift-certificate

Overall this was a huge mod on an already heavily modified cart, so there's unfortunately really no way I can package this up as a plugin.

New member

Posts

Joined
Mon Sep 07, 2009 9:59 am


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.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am
Who is online

Users browsing this forum: No registered users and 4 guests