[Skip to main content](#vessel-content)

#   Access level is not assigned with 100% coupon

##

- **[Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")**
- [![Cenacchi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35849-cenacchi "View Cenacchi's Profile") Topic Author
- [ Offline](/forum/user/35849-cenacchi)

Less More

- Posts: 4
- Thank you received: 0
-
-

11 years 9 months ago [\#187853](#187853) by [Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")  *[Access level is not assigned with 100% coupon](/forum/46-discount-coupon/874456-access-level-is-not-assigned-with-100-coupon#187853 "-- HikaShop version -- : 1.5.8 -- Joomla version -- : 2.5.4  Hi,  I have an old version of Hikashop that I can't update at the moment. Anyhow, everything works perfectly except this scenario:  1) I have created a product (no category assigned) and I have set a specific user group to be assigned to the user AFTER the purchase. 2) When the user completes the payment everything works perfectly and the user is correctly assigned to the new user group. 3) If now I want to create a coupon that covers the whole price for the product (100% coupon) as a gift for certain users, once he/she has completed the payment (price set to 0 Euro and no redirect to Paypal) the order is correctly set to &quot;confirmet&quot; but the user IS NOT assigned to the &quot;after purchase access level&quot;.  Can you give some hints about how to solve this ?  Thanks  Elena")* was created by *[Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")*

-- HikaShop version -- : 1.5.8
-- Joomla version -- : 2.5.4

Hi,

I have an old version of Hikashop that I can't update at the moment.
Anyhow, everything works perfectly except this scenario:

1) I have created a product (no category assigned) and I have set a specific user group to be assigned to the user AFTER the purchase.
2) When the user completes the payment everything works perfectly and the user is correctly assigned to the new user group.
3) If now I want to create a coupon that covers the whole price for the product (100% coupon) as a gift for certain users, once he/she has completed the payment (price set to 0 Euro and no redirect to Paypal) the order is correctly set to "confirmet" but the user IS NOT assigned to the "after purchase access level".

Can you give some hints about how to solve this ?

Thanks

Elena

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84NzQ0NTYtYWNjZXNzLWxldmVsLWlzLW5vdC1hc3NpZ25lZC13aXRoLTEwMC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

11 years 9 months ago [\#187862](#187862) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Access level is not assigned with 100% coupon](/forum/46-discount-coupon/874456-access-level-is-not-assigned-with-100-coupon#187862 "-- HikaShop version -- : 1.5.8 -- Joomla version -- : 2.5.4  Hi,  I have an old version of Hikashop that I can't update at the moment. Anyhow, everything works perfectly except this scenario:  1) I have created a product (no category assigned) and I have set a specific user group to be assigned to the user AFTER the purchase. 2) When the user completes the payment everything works perfectly and the user is correctly assigned to the new user group. 3) If now I want to create a coupon that covers the whole price for the product (100% coupon) as a gift for certain users, once he/she has completed the payment (price set to 0 Euro and no redirect to Paypal) the order is correctly set to &quot;confirmet&quot; but the user IS NOT assigned to the &quot;after purchase access level&quot;.  Can you give some hints about how to solve this ?  Thanks  Elena")*

Hi,

Regarding the fact that HikaShop 1.5.8 has been release in May 2012 and we made a lot of improvements in HikaShop during this (nearly) 3 last years, it will be complicated to know.

I think that the issue is link to the "validate free order + group after purchase" plugin.
The two plugins are using same triggers but if the "validate free order" update the order after the "group" without relaunching a trigger ; the "group" plugin can't be notify that the order is confirmed (and so, update the user group).

Having more recent version of the plugins could be useful but I don't think that they would be compatible with HikaShop 1.5.8.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84NzQ0NTYtYWNjZXNzLWxldmVsLWlzLW5vdC1hc3NpZ25lZC13aXRoLTEwMC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")**
- [![Cenacchi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35849-cenacchi "View Cenacchi's Profile") Topic Author
- [ Offline](/forum/user/35849-cenacchi)

Less More

- Posts: 4
- Thank you received: 0
-
-

11 years 9 months ago [\#188174](#188174) by [Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")  Replied by *[Cenacchi](/forum/user/35849-cenacchi "View Cenacchi's Profile")* on topic *[Access level is not assigned with 100% coupon](/forum/46-discount-coupon/874456-access-level-is-not-assigned-with-100-coupon#188174 "-- HikaShop version -- : 1.5.8 -- Joomla version -- : 2.5.4  Hi,  I have an old version of Hikashop that I can't update at the moment. Anyhow, everything works perfectly except this scenario:  1) I have created a product (no category assigned) and I have set a specific user group to be assigned to the user AFTER the purchase. 2) When the user completes the payment everything works perfectly and the user is correctly assigned to the new user group. 3) If now I want to create a coupon that covers the whole price for the product (100% coupon) as a gift for certain users, once he/she has completed the payment (price set to 0 Euro and no redirect to Paypal) the order is correctly set to &quot;confirmet&quot; but the user IS NOT assigned to the &quot;after purchase access level&quot;.  Can you give some hints about how to solve this ?  Thanks  Elena")*

Hi,

Thanks for pointing me to the right (I think) direction. I solved in this way:

1) Inside the validate_free_orders plugin, file validate_free_orders.php I changed the status from "confirmed" to "free" inside the onAfterOrderCreate and onBeforeOrderCreate functions:
Code:

function onBeforeOrderCreate(&amp;$order,&amp;$send_email){ if(empty($order) &#124;&#124; !isset($order-&gt;order_full_price)) return; if(bccomp($order-&gt;order_full_price,0,5)==0){ //$order-&gt;order_status = 'confirmed'; Elena $order-&gt;order_status = 'free'; } } function onAfterOrderCreate(&amp;$order){ //if($order-&gt;order_status == 'confirmed'){ Elena if ($order-&gt;order_status == 'free') { $class = hikashop_get('class.cart'); $class-&gt;cleanCartFromSession(); } }

Then inside administrator/component/com_hikashop/classes/order.php I inserted a check for the "free" status after the onAfterOrderCreate trigger and, in that case, I inserted the change of the status to confirmed and the trigger of the onAfterOrderUpdate event, that is, at line 153 in my file:
Code:

$dispatcher-&gt;trigger( 'onAfterOrderCreate', array( &amp; $order,&amp;$send_email) ); //Elena if ($order-&gt;order_status == 'free') { $order-&gt;order_status = 'confirmed'; $dispatcher-&gt;trigger( 'onAfterOrderUpdate', array( &amp; $order,&amp;$send_email) ); } //Elena if($send_email){

In fact, the plugin that changes the group correctly wait that the payment is received: the order is pending when it's created and become confirmed after the payment, so the plugin is linked to the onAfterOrderUpdate event.
Instead, when the order is free, then it "is born" confirmed, and the onAfterOrderUpdate event is not triggered.

Now it works, but please let me know if you should see any possible problem arising from this solution.

Thanks again

Elena

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84NzQ0NTYtYWNjZXNzLWxldmVsLWlzLW5vdC1hc3NpZ25lZC13aXRoLTEwMC1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.138 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
