Add expiry date to email

  • Posts: 234
  • Thank you received: 4
9 years 3 months ago #228014

-- HikaShop version -- : 2.5.28
-- Joomla version -- : 2.5

Hello

How can I add the expiry date to the emails we receive when people place an order? I have tried the code
echo "\r\n".JText::_('expiry_date').' : '.$data->expiry_date->expiry_date;

but it hasn't worked.

Many thanks
Iain

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 3 months ago #228020

Hello Iain,
Firstly, can you tell me some screenshots of how you have configured your expiry date custom field via "Hikashop->Display->Custom Fields" ?
Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 234
  • Thank you received: 4
9 years 3 months ago #228124

Morning

I haven't set it up in the Custom Fields, this is from the payment plug in and calling it within the System>Emails section.

Cheers
Iain

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #228131

Hi,

The $data PHP object contain only elements of the order, so it contains the payment methods.
In the preload part of the email we get all the payment method params, so if the expiry date is stored in the payment params you can get them from the PHP object $payment->payment_params.

But I am not sure that the expiry date will be stored there.

Else as Mohamed Thelji said, you can use a custom order field, set the expiry date there and that way you can display it in the email thanks to the code: $data->cart->customfield_name

So basically it require PHP knowledges and you have to know exactly how the expiry date is set.

Please Log in or Create an account to join the conversation.

  • Posts: 234
  • Thank you received: 4
9 years 3 months ago #228389

Hello
Thank you for your reply. I don't fully understand. I do not want to create a custom field as this will not be within the credit card plugin? Unless you can help me create one. I have managed to get the title to show within the email "Expiry Date :" however it doesn't actually display the date.

Xavier, when you say i can get the payment params from $payment->payment_params. Can you please explain how to do that. What would be great would be to have a list of commands and what they returned so that I could add / remove ones without troubling you guys.

Once again, many thanks
Iain

Please Log in or Create an account to join the conversation.

  • Posts: 83806
  • Thank you received: 13571
  • MODERATOR
9 years 3 months ago #228408

Hi,

What I can see here is that both Xavier and you don't understand what the other is talking about.

Xavier thinks that you're talking about a payment gateway which would return the credit card data after the payment and so you would have to modify the code of the plugin to store the credit card data in order to then display it in the email.

From what I understand, it seems that you're actually not using a payment gateway but the "credit card" collect payment plugin which stores half of the credit card data in the order and send the other half in the order administrator notification email.
In that case, it's quite easy to add the date of the credit card in the email.
Just add such code in the HTML version:
<?php echo $data->credit_card_info->cc_year.'/'.$data->credit_card_info->cc_month; ?>

PS: make sure that you specify what you're talking about precisely in your messages (with screenshots if possible). That way, we can directly answer you with the answer you're looking for.

Please Log in or Create an account to join the conversation.

  • Posts: 234
  • Thank you received: 4
9 years 3 months ago #228514

Hi Guys

Thanks for that, I am using the "Credit Card" payment plugin and with a bit of adjustment I have the expiry date. Here is the code I used

echo "<br/>".JText::_('EXPIRY_DATE').' : '; echo $data->credit_card_info->cc_year.'/'.$data->credit_card_info->cc_month;

Once again, many thanks
Iain

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds
Powered by Kunena Forum