Post by rgbworld » Wed Aug 08, 2012 7:19 am

Hi All,
I recently converted my site to use OpenCart. My site sells digital software downloads (Mac Desktop App). The software I am selling has an activation procedure that contacts my web server to validate a user, and count the number of purchases made of a specific product. The user is allowed to activate the software on 3 computers per purchased license. So if they have bought 1 license, they are allowed 3 activations.

With my old store/cart, during a post-purchase hook, I was storing the activation data in 2 custom tables (licenses and activations). The reason I store licenses in a separate tables, (rather than counting them from invoice purchases) is because if I ever delete or archive invoices, I still need the activation data to remain intact.

So, now I need to rewrite my software activation.php script to work with OpenCart. Here are my questions:

1) If I delete an order via OpenCart Admin, does it delete/affect a users associated downloads?
In other words, should I be pulling a users total licenses for a product directly from order_download table, or do I still need to maintain a completely de-normalized table (licenses) to store a users purchased quantity as I was doing with my old cart?

2) Similar question as above, but regarding activations table... Should I (still) keep all the activation data in my own table or would I be better to add the mac_addr, version, and date_activated fields to some existing table?

3) In my old store/cart, after a successful purchase (ipn success), I would add the license data to my custom table. Then whenever the App contacts server for activation, I would 1st validate the user, then get the total purchased product count for member_id. I would then retrieve that member_id/product_id combination from the activations table to confirm they have not exceeded allowed activations. Do I ultimately have to reproduce this exact behavior in OpenCart, or is there a better way?

My custom tables are:
licenses [license_id, invoice_id, member_id, product_id, product_qty, date_purchased]
activations [member_id, product_id, version, mac_addr, date_activated]

In OpenCart IPN success, I will need to add a record to licenses table. Is the data available in IPN success so I can add a record, given table structure above? Field names please :-)

In my new OpenCart activation.php script I need to:
a) Check for valid user given First Last, and email address, and retrieve the member/user id. How?

b) Use member_id/product_id to check activations table. I got this :-)

Any tips or psuedo-code would be a great help.
Thanks,
Chris

RGB World - FREE and Commercial Extensions
For custom work or support, please use our Contact Form or visit our Support Forum.

Favorite Quote: There are 10 types of people in the world. Those who understand binary and those who don't. 8)


User avatar
New member

Posts

Joined
Wed Aug 08, 2012 6:11 am

Post by MaxD » Thu Aug 09, 2012 4:02 am

It would be easier for you to integrate your existing activation code without modifying it much - use your own tables and routains you have done before. OpenCart doesn't have any activation shortcuts so far.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by rgbworld » Thu Aug 09, 2012 4:20 am

I agree. I have already rewritten my activation.php file to access data in respective OpenCart tables. It was quite easy.

The only thing I need help with is the post-purchase IPN portion.
When a successful order is placed, I need to fill in a record in this table...

licenses [license_id, invoice_id, member_id, product_id, product_qty, date_purchased]

What file do I add my post-purchase handling code to?
Is the information that I need in order to add a record to the table above available in the IPN success function?

Thanks again,
Chris

RGB World - FREE and Commercial Extensions
For custom work or support, please use our Contact Form or visit our Support Forum.

Favorite Quote: There are 10 types of people in the world. Those who understand binary and those who don't. 8)


User avatar
New member

Posts

Joined
Wed Aug 08, 2012 6:11 am

Post by MaxD » Thu Aug 09, 2012 4:31 am

What payment modules do you use?

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by rgbworld » Thu Aug 09, 2012 5:11 am

PayPal Standard.

Is the data available to add the record to my table?

licenses [license_id, invoice_id, member_id, product_id, product_qty, date_purchased]

Thanks!

RGB World - FREE and Commercial Extensions
For custom work or support, please use our Contact Form or visit our Support Forum.

Favorite Quote: There are 10 types of people in the world. Those who understand binary and those who don't. 8)


User avatar
New member

Posts

Joined
Wed Aug 08, 2012 6:11 am

Post by MaxD » Thu Aug 09, 2012 6:01 pm

By the way, have you seen my PayPal Digital? Its effective for impulse purchases (but doesn't support quantities).
Here's purchase process video - http://youtu.be/tbHF4cmOO3o

IPN processing for PayPal Standart resides at catalog\controller\payment\pp_standard.php
Some of the data you need may be not accessible thru variables there, but it's easy to get it with simple SQL query.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by rgbworld » Fri Aug 10, 2012 2:41 am

@MaxD
Yes, I saw the PayPal Digital downloads, and I was tempted to use it, but the instructions say it replaces ALL buttons with the instant checkout buttons, and I have some products that still need to use a cart. A demo of the admin would be helpful.

Will your extension allow only replacing the buttons for "some" products?
If so, I will consider using it in the future.

Regarding my questions... when querying OC tables for additional info while in pp_standard.php callback() function, I only need 5 values, and only for items purchased that have a digital download. Any assistance on where to get the other values is appreciated.

invoice_id - looks like I have this already in $order_id
customer_id
product_id
product_qty
date_purchased - can just be today, so that's easy

Thanks,
Chris

RGB World - FREE and Commercial Extensions
For custom work or support, please use our Contact Form or visit our Support Forum.

Favorite Quote: There are 10 types of people in the world. Those who understand binary and those who don't. 8)


User avatar
New member

Posts

Joined
Wed Aug 08, 2012 6:11 am

Post by MaxD » Fri Aug 10, 2012 3:48 pm

I havn't discovered some good logical way to make PayPal Digital coexist with cart and shippable products.

You have order_id, with this number you can get all order details from database.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by ericsyd » Fri May 06, 2016 1:06 pm

Did anyone come up woth a good hook point, perhaps after IPN from PayPal?

Newbie

Posts

Joined
Fri May 06, 2016 1:00 pm
Who is online

Users browsing this forum: No registered users and 61 guests