J2.5.2 & VM2.0.6 | Diverting VM2 Product From Cart to Akeeba Subscriptions |

Started by paulzero, May 28, 2012, 10:34:49 AM

Previous topic - Next topic

paulzero

Hi folks ! need to offer an Akeeeba subscription on a version of a product I'm selling thru VM2.

This is the situation:

I need the Customer to be able to choose whether to buy "Product A" outright (if so normal "Add to cart" VM2 etc), or buy "Product A" using a subscription. What I've done is create two identical products, "Product A1" & "Product A2" - same spec & price etc. Both appear as products side by side in the appropriate VM2 category, so the Customer can see from the each products "Short Description" that "Product A1" is an outright purchase, & "Product A2" is subscription based purchase.

If the customer chooses to buy "Product A2" (Subscription option) I need to divert him/her away from VM2's product details page & send him/her to an Article I've created which will contain an Akeeba Sub's module featuring a subscription package just for that product.

I thought the easiest way to achive this diversion would be to use the "URL" field in "Product A2's" "Product Information Page" to hold a URL route to the target Article.

OK so now I click "Product A2" in a VM2 category index. VM2 begins to load its "default.php" Product_details page - As the page loads & processing begins I need to write some code to divert the Customer to the Subscription Article - code perhapes something like this :

* Lookup "Product A2" in DB table "virtuemart_products".

* Then look & see if there is a URL stored in "Product A2's" "product_URL" field.

* IF THERE IS A URL stored in "Product A2's" "product_URL" field, stop processing "default.php" and load the page specified in the URL - BUT IF THERE IS NO URL in "Product A2's" "product_URL" field, then continue processing "default.php"

Does this sound OK ? Are there any VM2 functions that reference the "product_url" value that might be effected ? How would you code this ?

Cheers !