ordering 2 certificates in one order


  • Default avatar
    karl18    
     8 years ago
    0

    Hello - I use the AWO coupon to send gift certificates.

    When a user purchases more than 1 gift certificate in the one order I get 2 individual certificates, but both have the same (Name and message) on them and the total of the whole order is on the certificate where it should just be the value of the individual certificate.


    It should have

    Gift certificate 1.
    Name 1
    Message 1
    Value 1


    Gift certificate 2
    Name 2
    Message 2
    Value 2

    Also my certificate isn't getting sent to the recipient email - it's only being sent to the person purchasing, it even though I have the custom field type set as receiver email for the product in question

    Could you please advise how I can fix this
    regards Karl
  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    Are you referring to the gift certificate images? If so, then the value used is setup in the "value" field, and this will display the individual value of that gift certificate.

    The name/message should work fine if individual emails were going out to the recipient email and not the purchaser. The purchaser automatically receives the email if for some reason it cannot find or determine the recipient email.

    Can you double check the the recipient_email custom_field_id is correctly set in awocoupon->configuration->gift certificate tab?
  • Default avatar
    karl18    
     8 years ago
    0

    Hi Seyi - Yes I am referring to the images generated
    I have done some more testing and now the email is being sent to the recipient

    But.

    If I purchase more than one certificate in the one order - both images have the same recipient name and message as the last certificate added to the cart

    for example - here are the details I enter for the certificates


    Test Gift Voucher v4
    Receiver Name karl 4
    Receiver Email email@email.com
    Receiver Message test 4 message

    Test Gift Voucher v3
    Receiver Name karl 3
    Receiver Email email@email.com
    Receiver Message test 3 message

    When I receive the certificates of which is receive 2 they both say

    Receiver Name karl 3
    Receiver Message test 3 message
    Product: purchased: Test Gift Voucher v4, Test Gift Voucher v3

    Can you please help me fix this.

    ta Karl
  • Default avatar
    karl18    
     8 years ago
    0

    Hello - Can you please advise when you can help with this problem
  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    The system sends out 1 email pre recipient, no matter the contents. And using {recipient_name}, {recipient_email}, {message} does not work well in just one email message. So the solution here is to break it out and send out 2 different emails. Here are changes you can make, all in the file:

    www/administrator/components/com_awocoupon/helpers/estore/estoregiftcerthandler.php

    line 67
    <?php
                $this_mail_key 
    $this->getproductattributes($row);
                
    $mail_key[$this_mail_key['email']] = $this_mail_key;
    ?>

    Change to
    <?php
                $this_mail_key 
    $this->getproductattributes($row);
                
    $this_mail_item_key $this_mail_key['email'].'-'.$this_mail_key['recipient_name'].'-'.base64_encode($this_mail_key['message']);
                
    $mail_key[$this_mail_item_key] = $this_mail_key;
    ?>


    Line 123:
    <?php
    $allcodes
    [$this_mail_key['email']][] = array(
    ?>


    Change to
    <?php
    $allcodes
    [$this_mail_item_key][] = array(
    ?>


    Line 161:
    <?php
    $allcodes
    [$this_mail_key['email']][] = $crow;
    ?>


    Change to
    <?php
    $allcodes
    [$this_mail_item_key][] = $crow;
    ?>


    Line 217:
    <?php
                
    if (!JMailHelper::isEmailAddress($this_mail_key)) {
    ?>


    Change to
    <?php
                
    if (!JMailHelper::isEmailAddress($mycodes[0]['email'])) {
    ?>

    ?>

    Line 261
    <?php
                                        $this_mail_key
    ,
    ?>


    Change to
    <?php
                                        $mycodes
    [0]['email'],
    ?>


    Line 275
    <?php
                $coupon_rows 
    awoLibrary::profile_sendEmail($user,$mycodes['coupon_rows'],$profile,$dynamic_tags,false,$this_mail_key,$this->is_entry_new);
    ?>


    Change to
    <?php
                $coupon_rows 
    awoLibrary::profile_sendEmail($user,$mycodes['coupon_rows'],$profile,$dynamic_tags,false,$mycodes[0]['email'],$this->is_entry_new);
    ?>


    Thats it
  • Default avatar
    karl18    
     8 years ago
    0

    Thanks for this Seyi - this is now separating out the coupons to 2 emails which is great. Displaying the correct info in each.

    Once little problem though - the recipient didn't get the emails only the buyer.

    Even though they received it previously
    Is there something else I need to do?
  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    in the same file, around line 130 is this:
    <?php
                            
    'email'=>$row->email,
    ?>


    Chagne it to this:
    <?php
                            
    'email'=>$this_mail_key['email'],
    ?>


    That should fix it.