1

The site I will be building soon will require permissions for various parts of the site, documents, videos, etc. I am planning on using Zoo Visitor & Categories to simulate multiple member groups. I'm planning to use Exp:resso Store to somehow be the means of purchasing products and applying categories of the products to the member, too, upon purchase.

Has anything like this been done? If not, what hooks would I use to check a product's category/categories so I might apply it to a member?

Also the price of a product may be dependent on permissions/products the member already has, so say if they have Product A, they can get Product B at a discounted price, or if they have any number of the following products they automatically get Product X. To accomplish this and other types of discounts I'm thinking of using another Channel (e.g. a "Price Modifier Channel") that links products together via Playa fields and a field with the discount type/value. At some point a custom add-on will go through all related entries of a product to see if any discounts are applicable, if so, apply them (price modifiers can be made up on the fly, right?).

I just wanted to see if I've got the right idea to proceed with, regardless, I'm open to suggestions.

Also it's not very clear which of Store's hooks I'd be using to do any of these things. I guess since the template is in charge of presenting the product along with price modifier it could just be in the custom add-on itself via a module, no need for hook?

Sorry I couldn't be any more brief/specific, not my forte. Thanks.

1

If you want to make changes to a member after an order has been placed, the best hook to use is store_order_complete_end:

https://exp-resso.com/docs/extension_hooks.html#store_order_complete_end

This runs when an order is "completed", which means it was either paid in full or paid with the manual payment gateway (either way, it stops becoming a cart when it is completed).

If you want to edit the price of items depending on the current user, there are various ways of approaching this. The easiest way would be to use the store_order_item_recalculate_end hook, which runs inside the cart when the cart is updated. There you are able to adjust the price of the item.

https://exp-resso.com/docs/extension_hooks.html#store_order_item_recalculate_end

| improve this answer | |
  • Thanks Adrian. Already did development for assigning "member categories" using precisely that hook. I just checked the docs I have for 1.6.1 (I think I'm at 1.6.4) and it doesn't have store_order_item_recalculate_end, it's a 2.x thing only? – notacouch Nov 1 '13 at 18:55
  • 1
    Ah yes. In 1.6 the equivalent store_cart_item_update_end. – Adrian Macneil Nov 1 '13 at 19:34
  • Good timing, may need this soon. We want to support PayPal Subscriptions, which seems to work with SCM already, any clues on how to integrate this with Store? Should I make a new question out of this comment? – notacouch Nov 3 '13 at 16:36
  • Yeah that's probably big enough for a new question. Subscriptions will take a fair bit of custom development. – Adrian Macneil Nov 3 '13 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.