News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Confirm email modification

Started by psm, May 16, 2017, 20:18:52 PM

Previous topic - Next topic

psm

Dear all,
I am trying to modificate email text after shopper order some product from my eshop.

VM 3.2.0, Joomla 3.6.5, php 5.4.46

I would like to show my payment data like bank account etc, just when shopper chose payment by "bank transfer".

So I add this "condition if" (in components/com_virtuemart/views/invoice/mail_html_shopper.php) before data which I want to show in email. But it is not functional. Please can you advice me why?

<?php if ($this->orderDetails['paymentName']=="bank transfer") { ?>

    <tr>
   <td width="35%" class=""><strong><?php echo "IBAN:"; ?></strong></td>
   <td align="left"><?php echo "XXXXXXXXXXXXXXXXX"; ?></td>
   <td></td>
   </td>
    </tr>
     <tr>
   <td width="35%" class=""><strong><?php echo "SWIFT:"; ?></strong></td>
   <td align="left"><?php echo "XXXXXXXXXXXXXXXXX"; ?></td>
   <td></td>
    </tr>

    <?php } ?>

GJC Web Design

Quote$this->orderDetails['paymentName']=="bank transfer"

what does this test as?  is the name correct?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

psm

#2
I would like to test if chosen payment name is the same as text "bank transfer" then it will show information below.

For example when customer will choose option "cash on delivery" this information will not be shown in confirmation email for him, becuase he will pay when he will receive product.

But I want to show this information in confirmation email just when customer wants to pay before he will receive product "payment by bank transfer".

Jörgen

Hello

Are You sure about the name ?

You now talk about "payment by bank transfer".

Find it with it with:

print_r($this->orderDetails['paymentName']);
or
print_r($this->orderDetails);

Then You can see available data.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

psm

Hello Jörgen,
I tried to use your suggested command print_r($this->orderDetails['paymentName']); and it print out the same "bank transfer" (in my language "platba prevodom").

I tried also another command print_r($this->orderDetails); nad it print out that it contains array "bank transfer".
[paymentName] => bank transfer

But this condition is still not working.

Do you know why?

thanks

Jörgen

The if statement looks OK, but test with something else instead of the table conetent. Otherwise check that the table syntax is correct for the output. If I remember correctly there is a switch now in VM to echo the order e-mails instead of sending them, but i don´t remember where I saw this mentioned. This could speed up testing.

By the way
<?php echo "IBAN:"; ?> would equal IBAN: wouldn´t it ? Why the echo ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

psm

Thanks. And pls, how to check if table syntax is correct? I am not very good in it. As you can see in 2nd question from you. I used worse option.
But I need to separate this two ways of payment in confirmation email somehow.

Jörgen

Hello

What error Do You get ? blank screen or no output, check the produced html and see if if contains any of Your added text.

You could also test to add:
<?php else 
           echo 
'not bank_transfer or bad test expression';
?>


To see if the if statement works or not

You could use the virtuemart_paymenymethod_id instead for a check, this is not language dependent and You can easily see the used id in the backend under payment methods. Try to see if it is available.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

psm

Dear Jörgen,
I get no output on showed page when I use this condition. And I tried else condition and it showed message from it. So condition if is not  met.

And when I use condiotion with "virtuemart_paymentmethod_id"
<?php if ($this->cart->virtuemart_paymentmethod_id == "5") { ?>
it shows me this error:

Notice: Undefined property: VirtuemartViewInvoice::$cart in /html/com_virtuemart/invoice/mail_html_shopper.php on line 67

Notice: Trying to get property of non-object in /html/com_virtuemart/invoice/mail_html_shopper.php on line 67

I do not know what I make wrong.

GJC Web Design

there is no $cart in this view

echo out $this->orderDetails and see whats there
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

psm

Sorry, I have little bit mess in it. Now I tried this condition and it is working fine.   ;)

<?php if ($this->orderDetails['details']['BT']->virtuemart_paymentmethod_id == "5") { ?>

So maybe I can use this condition. But for future I would like to ask you if there is some possibility how to overcome language problem in database?

Thank you

Jörgen

#11
Overcoming language is not hard. Only check for keys or strings that are not translated. As soon as you use strings that change value depending on language it will fail with another language. Using the key for payment id is not language dependent.

Regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

psm

Thanks, I will maybe need it in near future.