Gift certoficate - issue with right currency


  • Default avatar
    lukas2    
     a year ago
    0

    Hello, I am usiing multilangual eshop with two currencies. For currencies I use specific prices for each products. If my customer bought gift certificate in default shop currency everything is OK, but If customer bought gift certificate in other currency, awocoupon send voucher on default eshop currency. Do you have some advice for me?
    Thank you
  • Your avatar
    seyi    
     a year ago
    0

    Hello,

    AwoCoupon only supports the main currency for gift certificates.  If your main currency is euros and a customer purchases in dollars, the dollar value is converted to the euro equivalent and that is what the customer receives.
  • Default avatar
    lukas2    
     a year ago
    0

    Hello, and is it possible prepare for me special edit to send voucher in specific currency? I need differ currencies via order language, because I have set for specific language specific currency. Thank you
  • Your avatar
    seyi    
     a year ago
    0

    The values of coupon/gift certificate is stored in your default currency.  So that really would only work if your currency exchange rate never changes.
  • Default avatar
    lukas2    
     a year ago
    0

    Yes, it is no problem, because I set exchange rate on VM admin as stable rate.
  • Your avatar
    seyi    
     a year ago
    0

    Hello,

    Ok, to get this to work, you will need a few changes.

    In the file:
    /administrator/components/com_awocoupon/awocoupon/library/class-awocoupon-library-giftcert.php, around line 134 is this:
    <?php
                        $price 
    AC()->coupon->get_coupon_pricedisplay$coupon_row );
    ?>

    After that add this:
    <?php
    if ( in_array$coupon_row->coupon_value_type, array( 'amount''amount_per' ) ) && in_array$row->price_calc_type, [ 'product_price_notax''product_price' ] ) && isset( $row->{$row->price_calc_type} ) ) {
        $price AC()->storecurrency->format$row->{$row->price_calc_type}, $row->currency_id );
    }
    ?>

    And around line 208 is this:
    <?php
                    $row
    ['coupon_row']->coupon_price AC()->coupon->get_coupon_pricedisplay$row['coupon_row'] );
    ?>
    Change that line to
    <?php
                    $row
    ['coupon_row']->coupon_price $row['price'];
    ?>

    And around line 390 is this:
    <?php
                $price 
    AC()->coupon->get_coupon_pricedisplay$row );
    ?>
    Change that to this
    <?php
                $price 
    AC()->coupon->get_coupon_pricedisplay$coupon_row );
    if ( 
    in_array$coupon_row->coupon_value_type, array( 'amount''amount_per' ) ) && in_array$row->price_calc_type, [ 'product_price_notax''product_price' ] ) && isset( $row->{$row->price_calc_type} ) ) {
        $price AC()->storecurrency->format$row->{$row->price_calc_type}, $row->currency_id );
    }
    ?>

    I believe that should do it.  Please note this is untested, to run some tests and verify.
  • Default avatar
    lukas2    
     a year ago
    0

    Hello,
    I tried it, but without changes. I bought certificat in CZK but to email I get certificate in EUR. Price of buught certificate in CZK and exchange rate

    Email:
    Email with currecy

    And the second issue is language of the email. My order is on czech language but the email is in slovak language.


  • Your avatar
    seyi    
     a year ago
    0

    Hello,

    That email is from Virtuemart, not AwoCoupon.  You will need to modify or override Virtuemart email to display as you want.
  • Default avatar
    lukas2    
     a year ago  last edited a year ago
    0

    No, email is from awcoupon (first screen was from order detail in VM admin for illustration):
  • Your avatar
    seyi    
     a year ago  last edited a year ago
    0

    Ok, in the above modifications, change
    <?php
     $price 
    = AC()->storecurrency->format( $row->{$row->price_calc_type}, $row->currency_id ); 
    ?>

    to
    <?php
    $price 
    AC()->storecurrency->formatAC()->storecurrency->convert_from_default$row->{$row->price_calc_type}, $row->convert_to_currency_id ), $row->convert_to_currency_id );
    ?>

    In both places

    And in the file /administrator/components/com_awocoupon/helper/estore/virtuemart/class-awocoupon-helper-estore-virtuemart-giftcert.php, find all 3 occurences of
    ,o.order_currency AS currency_id

    And change to
    ,o.order_currency AS currency_id,o.user_currency_id AS convert_to_currency_id