Jump to content

Adding a "Subscription" Modifier to a Product


jimmychang

Recommended Posts

Hi all,

 

So I'm interested in adding a subscription modifier to my products, expressed through a custom checkbox and select list on the front-facing pages of certain items. The desire is that a user would click this checkbox to indicate that they wish to buy the given product on a subscription basis, while choosing the frequency of the subscription with the select list. However, the product can still be bought as a one-time purchase.

 

Adding the checkbox and the select list to the HTML was easy enough, as I was able to hook into displayProductButtons and insert my template. However, it appears that my inputs have no bearing on the $_POST array that ends up making it to the postProcess function in CartController; in fact, I'm not entirely clear how the $_POST array in that controller is derived, as doing a var_dump() does not yield a 1-to-1 correspondence with the fields present in the buy_block form. Any new fields wedged into that form are patently ignored.

 

I've looked into ways to implement this through the back office, but you really can't consider subscriptions a Feature (since the same item can have multiple subscription durations), nor can you really consider them Attributes (a magazine that's purchased one time shouldn't be considered a different product from the same magazine, purchased on a monthly basis). I also understand there are Subscription Modules out there, but the desire is to go custom so that we can integrate it with our own payment module; most of those modules rely on periodically reminding the customer to pay up, which isn't an option.

 

Does anyone have any experience with modifying products in this way? I'd appreciate any insight you might have.

 

Thanks.

Link to comment
Share on other sites

Ah ha - I know where the $_POST array in CartController is coming from now, at least: when adding an item to a cart, ajax-cart.js in the Blockcart module is responsible for passing up form values to CartController. I'm looking into overriding this javascript file now, but if there's a clearer path than the meandering one I'm taking right now, definitely let me know.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...