Customer Group termination

  • Posts: 332
  • Thank you received: 6
8 years 2 months ago #248521

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.5.36
-- Browser(s) name and version -- : FF,Chrome - both most recent

I have it setup that when an order is confirmed that they are added to a particular ACL group. Works fine. However, is there anyway to set a time-limit to 60 days? I know there is a HikaSerial Group Association plugin but does this take into account the 'End Date' field of the HikaShop Coupon that was generated and when that 'End Date' has passed, then they are removed from the group?

Last edit: 8 years 2 months ago by LukeDouglas.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #248524

Hi,

If you want to do so, you need a subscription system.
And HikaShop is not a subscription system but it have some integrations with some (see "integrations" in the doc).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 332
  • Thank you received: 6
8 years 2 months ago #248568

Jerome,

As you may remember, I tried to get the AWOCoupon to work but it couldn't meet our needs and that was one thing that it couldn't do. I do not want to go through another application like Community Builder as I have done one site with it and, while it is great, it is just too much for what we need. I think I'll just see what I can actually develop myself or have the client to simply mark in her calendar to manually remove them from their ACL group while I look for a better solution.

Just thinking 'out loud' but I'm wondering if I could create a plugin that could be run daily via a cron job to check coupons for expiration dates. When it finds a coupon who's expiration date has passed, then find the order that the coupon was used, see the product that was purchased (there are only two) and based on that, then find the customer record in the ACL table with the pertinent ACL group and delete it. That sound's logical to me. Does it sound like a good routine to you?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #248586

Hi,

It sure sounds like a good solution if you can code.
You can even use the onHikashopCronTrigger trigger of plugins of the group "hikashop" in your plugin:
www.hikashop.com/support/documentation/6...nHikashopCronTrigger
So that it will be plugged onto the cron of HikaShop.

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

  • Posts: 332
  • Thank you received: 6
8 years 2 months ago #248595

Nicholas,

As you know HikaShop like the back of your hand, :lol: , see if what I have outlined should work as a plugin.

  1. onHikashopCronTrigger(&$resultsTrigger)
    1. Check #_hikashop_discount.discount_end field and see if time has expired
  2. Find order that discount code was used:
    1. #_hikashop_discount.discount_code = #_hikashop_order.order_discount_code
  3. Find product(s) id's that are in that order:
    1. #_hikashop_order.order_id = #_hikashop_order_product.order_id
    2. Store #_hikashop_order.order_user_id
  4. Find product(s) that were in that order:
    1. #_hikashop_order_product.product_id = #_hikashop_product.product_id
    2. Store #_hikashop_product.product_group_after_purchase
  5. Use stored #_hikashop_order.order_user_id and #_hikashop_product.product_group_after_purchase variables to find assigned group
    1. #_hikashop_order.order_user_id = #_user_usergroup_map.user_id
      #_hikashop_product.product_group_after_purchase = #_user_usergroup_map.group_id
  6. If found, delete #_user_usergroup_map record

If this looks fine to you, where would be the best place to put this 'custom' plugin PHP file?

Last edit: 8 years 2 months ago by LukeDouglas.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #248621

Hi,

That looks fine to me yes.
I would recommend to make a new plugin for that.
So the files will be in plugins/hikashop/XXX/ where XXX is the name of your custom plugin.
You'll have a PHP file with your plugin class and the onHikashopCronTrigger function in it, and a XML file defining the plugin.
You can base yourself on other plugins in plugins/hikashop

Also, the joomla documentation on how to write plugins:
docs.joomla.org/Portal:Plugin_Development

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

Time to create page: 0.049 seconds
Powered by Kunena Forum