VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: gba on April 13, 2015, 17:22:40 PM

Title: Payment method in order confirmation e-mail
Post by: gba on April 13, 2015, 17:22:40 PM
Hi all!

Does anyone have an idea, how to achieve that:
I want to display the payment method name, description and info in the order confirmation e-mail.
But: The only data I have in the order details object is the virtuemart_paymentmethod_id.

Thank you very much for any useful hint!

Kind regards,
Gerald
Title: Re: Payment method in order confirmation e-mail
Post by: gba on April 15, 2015, 11:24:20 AM
Hello all!

Seems as this would be a bit difficult...
I found out, there is also a field paymentName in the order details object, containing HTML code for payment method name and description (@VM team: a bit dirty hugh? ;) ).
Out of this HTML code I extracted the payment method name.
Also dirty - but it works for me :)

Any cleaner suggestions are very welcome!

Best regards,
Gerald
Title: Re: Payment method in order confirmation e-mail
Post by: antonino78 on April 15, 2015, 11:27:46 AM
Hello,
Also I have the same problem.
Do you mind indicate how you solved?
Title: Re: Payment method in order confirmation e-mail
Post by: gba on April 15, 2015, 11:36:42 AM
Hi!

$tmp = $this->orderDetails['paymentName']; //contains string '<span class="vmpayment_name">Name</span><span class="vmpayment_description">Description</span>
$startpos = strpos($tmp,">") + 1;
$stoppos = strpos($tmp,"<",$startpos);
echo substr($tmp,$startpos,$stoppos - $startpos);
Very dirty though...  ;)

Kind regards,
Gerald
Title: Re: Payment method in order confirmation e-mail
Post by: gba on September 29, 2016, 15:26:47 PM
Quote from: gba on April 15, 2015, 11:24:20 AM
Any cleaner suggestions are very welcome!

Kind regards,
Gerald
Title: Re: Payment method in order confirmation e-mail
Post by: GJC Web Design on September 30, 2016, 17:27:56 PM
In VM3.0.18 ( IMHO many vers before) the full info is in the email

Title: Re: Payment method in order confirmation e-mail
Post by: Jörgen on September 30, 2016, 19:05:28 PM
Hello GJC

You are right, the full info is in the e-mail. But breaking it apart and getting the string vmCartPaymentLogo, payment_name, payment_description and payment_info You have to add something like that gba suggests.
Just printing out $this->orderDetails['paymentName'] gives the whole shebang. Omitting or rearranging is impossible without breaking the tagged html string apart.

If You have a better idea extracting the data, please suggest :)

regards

Jörgen @ Kreativ Fotografi
Title: Re: Payment method in order confirmation e-mail
Post by: GJC Web Design on September 30, 2016, 20:56:36 PM
yes.. true .. the whole thing is simply stored in the DB order

perhaps to make it easier just over ride the protected function renderPluginName ($plugin) in what ever payment you use then u can control how the name etc is made up and stored