Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Subscriptions in shopping cart - hikashop

  • cjmicro
  • cjmicro
  • OFFLINE
  • Posts: 147
  • Thanks: 11
  • Karma: 1
3 years 9 months ago #323861 by cjmicro
We have CB Subs for our membership, and hikashop for our store. We want add to our shopping cart, because we have more people buying products. We would like to offer the subscription as an option to add to their cart along with their order.

How can we make that happen?

I can set up a product and have them pay, and then just add the membership to their account, but if they are checking out as a guest can't see how to make that work?

Any ideas?

Cheryl

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
3 years 9 months ago #323869 by krileon
Replied by krileon on topic Subscriptions in shopping cart - hikashop

How can we make that happen?

If Hikashop has Joomla events for when a specific product is purchased I suppose you could use CB Auto Actions to give them a subscription. You'd need to check with Hikashop regarding such events.

I can set up a product and have them pay, and then just add the membership to their account, but if they are checking out as a guest can't see how to make that work?

CBSubs requires registration as the subscription is tied to the user. If it creates a user after purchase process then answer would be same as the above where you need Joomla events in Hikashop for CB Auto Actions to act on. If it doesn't create a user then you won't be able to do this.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • cjmicro
  • cjmicro
  • OFFLINE
  • Posts: 147
  • Thanks: 11
  • Karma: 1
3 years 9 months ago #323879 by cjmicro
Replied by cjmicro on topic Subscriptions in shopping cart - hikashop
thank you i am checking with them!
Cheryl

Please Log in or Create an account to join the conversation.

  • cjmicro
  • cjmicro
  • OFFLINE
  • Posts: 147
  • Thanks: 11
  • Karma: 1
3 years 9 months ago #324017 by cjmicro
Replied by cjmicro on topic Subscriptions in shopping cart - hikashop
Hi Kyle,

Thanks for the info. I received this from the Hikashop developer:

I suppose they'll want to implement the events onAfterOrderCreate(&$order) and onAfterOrderUpdate(&$order) so that they can check the status of the order in $order->order_status (and for the update, compare it to the previous order_status in $order->old->order_status) so that when the order status is equal to "confirmed" they would create / extend the subscription in CB Subs.


Is there any way you can give me a little guidance on how to make it work with the Auto Actions?

Thanks!
Cheryl

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
3 years 9 months ago - 3 years 9 months ago #324035 by krileon
Replied by krileon on topic Subscriptions in shopping cart - hikashop
Probably will just need to use onAfterOrderUpdate. My best guess is the following.

Global
Triggers: onAfterOrderUpdate
Type: CB Paid Subscriptions
User: Specific
Specific User: [var1_order_user_id]
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var1_old_order_status]
Operator: Not Equal To
Value: [var1_order_status]
Condition 2
Field: Custom > Value
Custom Value: [var1_order_status]
Operator: Equal To
Value: confirmed
Action
Mode: Subscribe
Plans: SELECT_PLAN_HERE

A lot of this depends on what's available from the $order object. I've based the above example off their documentation for an order object as found below.

www.hikashop.com/support/documentation/156

I can't guarantee the above will work. You may need to remove Condition 1 as well if CB Auto Actions is unable to parse out whatever "old" is. As for figuring out what is being purchased that'll have to be pulled from the "cart" of the $order object. You will likely have to use a Code condition for that since it's too deep for CB Auto Actions to convert into substitutions. The below for example might work.

Field: Code
Code:
Code:
$order = $variables['var1']; if ( ! $order ) { return array(); } $cart = $order->cart; if ( ! $cart ) { return array(); } $products = $cart->products; if ( ! $products ) { return array(); } $productIds = array(); foreach ( $products as $product ) { $productIds[] = $product->product_id; } return $productIds;
Operator: Does Contain
Value: PRODUCT_ID_HERE

I put a substantial amount of IF checks in it that may not be necessary, but since I don't know the data I don't know what to expect. The code will return an array of product IDs that you can condition against.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 3 years 9 months ago by krileon.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum