Sending gift voucher to person other than purchaser.


  • Default avatar
    Techbot    
     13 years ago
    0

    Sending gift voucher to person other than purchaser.

    Hi Guys,

    I've noticed this request a few times in the comments and forum and of course need this functionality myself.

    My solution is to use the customer attributes list field in virtuemart

    Products -> [actual product] -> Product Status ->Custom Attribute List:

    Here I will place recipients name; email address; message

    So in the database -> table: jos_vm products ->column:custom_attribute

    I get Recipients Name; email; Message

    and

    database -> table: jos_vm_order_item ->column: product_attribute

    I get Recipients Name : bob[br/] email: bob@example.com[/br] message: ......

    So I'm hoping to use reg exp to extract the info between the ":" and [br/] to get the required info.

    With this info I intend to hack or override : function addRecipient in helpers/awomail.php so that the recipient is the new recipient instead of the original purchaser.


    Have you any comments, suggestions or warnings?
    I'm hoping that if I have 2 vouchers being purchased (each with it's own unique email message etc) that addRecipient will be called twice with the relevant data passed to it etc.

    I'm completely new to awo coupon (and programming/hacking virtuemart too) but I have decent php/joomla experience.

    yours
    Rob


  • Your avatar
    seyi    
     13 years ago
    0

    I was not aware of the custom attribute until you pointed it out. You will run into one major problem doing this, only 1 email with all the gift certificates are sent out. So you would need to rework ps_awo_giftcert.php. Now that I know about this, I might look into adding this into the pro version, on top of the email that already goes out to the customer.
  • Default avatar
    Techbot    
     13 years ago
    0

    thanks for the tip.

    I will email you everything I come up with, (it might save you a few hours, in the future).

    I'm going to start with the reg exp because I've never done it before.

    Rob
  • Default avatar
    Techbot    
     13 years ago
    0

    Hi Seyi,

    If this post is inappropriate or more suitable to pm, please let me know.

    I've been hacking away at awo coupon pro to familiarise myself with the code. So I made a new component and copied and pasted function sendmail from ps_awo_giftcert.php . It requires

    require_once JPATH_ADMINISTRATOR.'/components/com_awocoupon/helpers/awomail.php';

    so it looks as if I have all the code necessary to send a mail.

    I then manually populate (hardcode) each of the required parameters in a method called prepare($row)
    eg

    === EDIT - Removed Code ===
  • Default avatar
    Techbot    
     13 years ago
    0

    Stupid me

    I realise now that setSender is being called twice (no iteration)

    Sorry about the overly long post.

  • Your avatar
    seyi    
     13 years ago
    0

    setting recipient name, email, and message is now available in version 1.4.0.