Gift certificates with option for different amounts


  • Default avatar
    ellen5    
     3 years ago
    0

    I created a product in Hikashop for a Gift Card with 2 variants  for different amounts of a gift amount. When you go to the page in the front end you have a choice in a drop down of 2 different amounts. How do I set up the appropriate AWO coupon? Do I need 2 different ones? If I have Base Price set Price Calculation Type, is it whatever is selected?
  • Your avatar
    seyi    
     3 years ago
    0

    Yes correct.  Setting Price calculation type to base price will use the price of the product, you do not nee to setup multiple gift certificate products.
  • Default avatar
    ellen5    
     3 years ago
    0

    Thank you for your prompt response.
    One other question--I have set it up so that any balance of the Gift Certificate is applied automatically. When I make new purchase, it applies it properly, but I also get this message:

    Notice

    The coupon you entered cannot be used for the products in your cart

    It processes properly inspite of this message. What is triggering the message and how can I stop it?

  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    That warning is not coming from AwoCoupon, so not really sure.  Are you using a checkout extension?  If so can you disable it temporarily and try the process again?  Do you get the same error?
  • Default avatar
    ellen5    
     3 years ago
    0

    Thank you for your response. I contacted Hikashop and they gave me this answer:
    The error message indeed comes from the coupon system of HikaShop.
    However, if you're using AWOCoupon, it is supposed to replace the coupon interface of HikaShop for its own and thus it is supposed to handle the coupons and not HikaShop, and thus HikaShop shouldn't be called to check the coupon code and display that error.
    So despite the fact that the error message is displayed by HikaShop, I still think that there is something missing either in the configuration of AWOCoupon or in its code.
    Now I'm not sure how it works to handle the coupons instead of HikaShop. Does it have its own checkout view that you need to add to the checkout workflow of HikaShop instead of the normal "coupon" view of HikaShop ? If that's the case and you didn't replace the view, it would explain why HikaShop is displaying an error message, instead of AWOCoupon handling the coupon.

    Now as a dirty solution, you could change the line:
    return JText::_('COUPON_NOT_FOR_THOSE_PRODUCTS');

    return $error_message;
    in the file administrator/components/com_hikashop/classes/discount.php
    But since it's a core modification, you'll have to reapply it after each update.
    Also, since AWOCoupon is supposed to handle the coupons instead of HikaShop, if that code is called, then I believe there is something missing in AWOCoupon to handle that properly. So I would still recommend to check again with the AWOCoupon support.

    Is there a setting in the configuation of AWO that I should check?
  • Your avatar
    seyi    
     3 years ago
    0

    With AwoCoupon, you have the option.  It can replace Hikashop coupon, or you can have it work along side.

    In awocoupon > configuration > general tab, if 'enable store coupons' is set to no, then AwoCoupon disables hikashop coupons.
  • Default avatar
    ellen5    
     3 years ago
    0

    OK, so I changed the option to No and tested it again. Now I got this message:

    Error

    30+ back issues: The coupon you entered is not valid


    Is this an AWO message and what is triggering it?


  • Your avatar
    seyi    
     3 years ago
    0

    If that is an error message from AwoCoupon, then you entered the coupon code "30+ back issues"?

    Go to awocoupon > configuration > error messages, click debug and 'save'.  Then try the coupon again, it should tell you where it is failing.
  • Default avatar
    ellen5    
     3 years ago
    0

    I saved debug and ran the coupon again. I didn't see any debug messages on the front end but the same error message appeared. I don't have a coupon or a product called 30+ back issues, but I do have47 products in the category "back issues". If I give you access to the admin can you check my configurations?
  • Default avatar
    ellen5    
     3 years ago
    0

    I apologize
    I did have a coupon called 30+ in Hikashop. When I unpublished it, I no longer had the message.But I had to unpublish all earlier coupons because the error message just defaulted to another coupon.
    So does that mean any coupons I made in Hikashop (before I started using AWO) have to be unpublished to avoid the error message?
  • Default avatar
    ellen5    
     3 years ago
    0

    What does "Enable onAfterCartProductsLoad trigger when processing coupon" mean? When I enabled it, i was unable to delet applying the coupon.
  • Default avatar
    ellen5    
     3 years ago
    0

    Actually, I disabled Enable onAfterCartProductsLoad trigger when processing coupon and I still couldn't delete it. Then I disabled automatically applying the balance and still couldn't delete it.
    I really appreciate you helping me try to understand AWOCoupon better. I have so many questions and the documentation isn't enough.
    Any chance you can give me a video tutorial?
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    Ignore the onAfterCartProductsLoad option, that is really for legacy carts.

    You are right, currently if you try to delete a balance from the cart, it is not removed.  Here is some code that will fix this issue:

    in the file \administrator\components\com_awocoupon\awocoupon\library\class-awocoupon-library-discount.php, around line 4300 is this:

    <?php
            
    if ( empty( $coupon_id ) ) {
                $this->initialize_coupon(); // empty all coupon codes from cart.
    ?>

    Right after that add this:
    <?php
                AC
    ()->helper->set_session'site''awocoupon_balance_autocart_disable');
    ?>

    That should fix that issue.

  • Default avatar
    ellen5    
     3 years ago  last edited 3 years ago
    0

    I tried what you suggested. Maybe I didn't place it in the right place because it didn't work:

            $coupon_id = (int) $coupon_id;
            if ( empty( $coupon_id ) ) {
                $this->initialize_coupon(); // empty all coupon codes from cart.
                AC()->helper->set_session( 'site', 'awocoupon_balance_autocart_disable', 1 );//added to fix remove coupon button
                $this->checkdiscount_buyxy_deletefromcart();
                return;
            }


  • Your avatar
    seyi    
     3 years ago
    0

    No that's it.  Should work fine.  I would suggest, if you did not, logging out and logging back into your shop.
  • Your avatar
    seyi    
     3 years ago
    0

    Nevermind, does not work because Hikashop does not see a coupon in the cart
  • Default avatar
    ellen5    
     3 years ago
    0

    OK, I removed that code. Can this be resolved?
  • Your avatar
    seyi    
     3 years ago  last edited 3 years ago
    0

    Hello,

    You still need that code, so add it back.  As well as this:

    In the file \administrator\components\com_awocoupon\helper\estore\hikashop\class-awocoupon-helper-estore-hikashop-discount.php around line 250 is this:
    <?php
            $new_coupon 
    $coupon_session->coupon_code_internal;

            $cart2 $cartClass->initCart();
            $cart2->cart_coupon $new_coupon;
            if ( $cartClass->save$cart2 ) ) {
                JFactory::getApplication()->setUserStateHIKASHOP_COMPONENT '.coupon_code'$new_coupon );
            }
    ?>

    Delete that, and add this instead
    <?php
            
    if ( $coupon_session->use_customer_balance == false ) {
                return false;
            }

            if ( ! empty( $cart->cart_coupon ) ) {
                return true;
            }
            $cart->cart_coupon $this->coupon_code_balance;
            $cartClass->save$cart );
    ?>


  • Default avatar
    ellen5    
     3 years ago
    0

    I did a search for that code in the file and can't find it
  • Your avatar
    seyi    
     3 years ago
    0

    Wrong file, updated the answer
  • Default avatar
    ellen5    
     3 years ago
    0

    Yea! Thank you so much, that helped the remove button to work! I really appreciate you sticking with me while this got resolved. Thanks again for all your help.
  • Default avatar
    ellen5    
     3 years ago
    0

    Oops, I spoke to soon. I removed the coupon and proceeded to make the purchase. The purchase went through but it applied the coupon anyway. Is that because I have the setting for Automatically add balance to cart and Automatically add valid Gift Certificate to Balance on coupon usage to yes?If I change that to No, and add the coupon manually, I get this error:

    Error

    9BpXuAERvm: No record, unpublished or expired


  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    Not able to produce.  Are you still talking about store balances?  Because you should not have any specific coupon to apply.
  • Default avatar
    ellen5    
     3 years ago
    0

    Here is the situation:
    I have a GC, I apply it to a purchase. The purchase is less than the GC so the transaction goes through successfully, not charge to me. I log out. I log back in and I choose another product to purchase. It automatically applies the balance of the GC but because it is a small purchase, I want to save the balance for a larger purchase, so I remove the coupon by clicking on the X to remove it.It shows that the discount is removed. I proceed with the transaction and I incur no charge because it applied the coupon anyway.
    I thought it was because it was set to 'Automatically add balance to cart' and 'Automatically add valid Gift Certificate to Balance on coupon usage' to Yes.  I changed it to NO and tried  again.
    The balance was not applied automatically. But then I tried to add the GC balance by entering the GC code in the Coupon box and I got that error message. So if I don't have it set to Autimatically apply balance, then the balance is lost??


  • Your avatar
    seyi    
     3 years ago
    0

    Can't produce it.  Going to start with this part:

    I changed it to NO and tried  again.The balance was not applied automatically. But then I tried to add the GC balance by entering the GC code in the Coupon box and I got that error message. So if I don't have it set to Autimatically apply balance, then the balance is lost??

    You changed to No and tried again?  Changed both options?  By trying again, do you mean the whole process with a new gift certificate or trying to use the gift certificate you initially added to balance?  Because if you are trying to use the initial gift certificate it has already been converted to a balance and is no longer valid.  You can visually see this by looking at the coupon list, and filtering by balances.

    Otherwise, go to awocoupon > configuration > error messages, click debug and save and try the coupon to see why it is not working.