Author Topic: Problem while IF request in status mail to insert different text for payments  (Read 697 times)

daswirdwas

  • Beginner
  • *
  • Posts: 5
  • A beginner
Hello,
I'm real new with VM and php. I tried to implement the below code to mail_html_footer.php to add additional text to the send status mail for different payment method.
With the implemented php code I only get BOTH text echoed in mail... I tried to add SEF ID or paymentMethod ID without any effect.

I think that the syntax for getting paymentName may be wrong (Get this from tip within mail_html_shopper.php). Probably there is an syntax error in the complete php code... trying to include the whole if clauses into one php cause leads into an ERROR for the current code.
Due to the fact that I'm not realy familia with php istself I'm not shure where and which bracked has to be set where...

May one of the experts here could give me a fast answer?
Greetings from Germany
Andreas

Code: [Select]
   
<?php // #### Text für Zahlungsart ÜBERWEISUNG #### ?>
        <?php if ($this->cartData->paymentName ueberweisung) { ?>
        <?php echo '<p> TEXT 1 <br/>
     <strong>Als Verwendungszweck geben Sie bitte ihre Bestellnummer: '
?>

    <?php echo $this->orderDetails['details']['BT']->order_number ?>
    <?php echo '  an.</strong></p>'?>
        <?php ?>
   
    <?php // #### Text für Zahlungsart RECHNUNG #### ?>
        <?php if ($this->cartData->paymentName rechnung) { ?>
        <?php echo '<p> TEXT 2 </p>'?>
    <?php ?>

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10300
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
<?php if ($this->cartData->paymentName == "ueberweisung") { ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

daswirdwas

  • Beginner
  • *
  • Posts: 5
  • A beginner
Thanks for reply
the double equal I tried already ;-) but the double quotes had been missing :-(

BUT

... it does not help. With this changes NO Text will be printed. Probably an other mistake within the code? If there are more than one if cause is used, must there be an including php tag, opening before the first and closing after the last cause?

Sorry, but as you may mention, my 2 day php course is more than 5 years ago

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10300
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
if the tags were wrong it would throw an error and u would see nothing

are you sure this is correct?  $this->cartData->paymentName
does it show anything?

try

print 'Debug Line '.__LINE__.'$this->cartData->paymentName <pre>'; print_r ($this->cartData->paymentName); print "</pre><br />\n"; die();

if not try

print 'Debug Line '.__LINE__.'$this->cartData <pre>'; print_r ($this->cartData); print "</pre><br />\n"; die();

is the returned value ueberweisung etc?
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

daswirdwas

  • Beginner
  • *
  • Posts: 5
  • A beginner
Hi,

Both debug lines does not report anything
only the folowing Debug info shows up:
Debug Line 48$this->cartData_>paymentName
or for second request
Debug Line 48$this->cartData

seems like there is no cartData

daswirdwas

  • Beginner
  • *
  • Posts: 5
  • A beginner
debug for orderDetails with print 'Debug Line '.__LINE__.'$this->orderDetails <pre>'; print_r ($this->orderDetails); print "</pre><br />\n"; die(); will show up below informations

Tried to change to

if ($this->cardData->pamentName == "ueberweisung") {
to
if ($this->orderDetails->virtuemart_paymentmethod_id == '4') {

without success.

Using print 'Debug Line '.__LINE__.'$this->orderDetails <pre>'; print_r ($this->orderDetails->virtuemart_paymentmethod_id); print "</pre><br />\n"; die();
 
does not show anything again


Code: [Select]
Debug Line 47$this->orderDetails
Array
(
    [details] => Array
        (
            [BT] => stdClass Object
                (
                    [virtuemart_order_id] => 48
                    [virtuemart_user_id] => 0
                    [virtuemart_vendor_id] => 1
                    [order_note] =>
                    [order_number] => S37605
                    [customer_number] => nonreg_jodoin20210917_134127_
                    [order_pass] => p_3sSVao86
                    [order_create_invoice_pass] => 8afSywSc
                    [invoice_locked] => 0
                    [order_total] => 32
                    [order_salesPrice] => 26.00002
                    [order_billTaxAmount] => 5.10925
                    [order_billTax] => {
    "1": {
        "virtuemart_calc_id": 1,
        "calc_name": "MwSt. 19%",
        "calc_value": "19.0000",
        "result": 5.109242500000001
    }
}
                    [order_billDiscountAmount] => 0.00000
                    [order_discountAmount] => 0.00000
                    [order_subtotal] => 21.84875
                    [order_tax] => 4.15127
                    [order_shipment] => 5.04200
                    [order_shipment_tax] => 0.95798
                    [order_payment] => 0.00
                    [order_payment_tax] => 0.00000
                    [coupon_discount] => 0.00
                    [coupon_code] =>
                    [order_discount] => 0.00
                    [order_currency] => 47
                    [order_status] => P
                    [user_currency_id] => 47
                    [user_currency_rate] => 1.000000
                    [user_shoppergroups] => 1
                    [payment_currency_id] => 47
                    [payment_currency_rate] => 1.000000
                    [virtuemart_paymentmethod_id] => 2
                    [virtuemart_shipmentmethod_id] => 1
                    [delivery_date] => Identisch mit Rechnungsdatum
                    [order_language] => de-DE
                    [ip_address] => 2xx
                    [STsameAsBT] => 1
                    [paid] => 32
                    [paid_on] => 2021-09-17 14:15:17
                    [o_hash] => fda151a16ef04de7a0b1c3492bb085db
                    [created_on] => 2021-09-17 11:41:27
                    [created_by] => 0
                    [modified_on] => 2021-09-18 18:04:55
                    [modified_by] => 253
                    [locked_on] => 0000-00-00 00:00:00
                    [locked_by] => 0
                    [order_created] => 2021-09-17 11:41:27
                    [order_modified] => 2021-09-18 18:04:55
                    [order_modified_by] => 253
                    [virtuemart_order_userinfo_id] => 68
                    [address_type] => BT
                    [address_type_name] =>
                    [company] =>
                    [title] => Mr
                    [last_name] => doe
                    [first_name] => john
                    [middle_name] =>
                    [phone_1] =>
                    [phone_2] =>
                    [fax] =>
                    [address_1] => teststr. 55
                    [address_2] =>
                    [city] => teststadt
                    [virtuemart_state_id] => 0
                    [virtuemart_country_id] => 0
                    [zip] => 55555
                    [email] => info@daswirdwas.de
                    [agreed] =>
                    [tos] => 1
                    [customer_note] =>
                    [datenschutz_akzeptieren_DELETED_1627923695] =>
                    [Datenschutz] =>
                    [tos2_DELETED_1628073624] =>
                    [tos2_DELETED_1628073805] =>
                    [Datenschutz-1] =>
                    [privacy_policy] =>
                    [order_status_code] => P
                    [order_status_color] => #fab75f
                    [order_status_name] => COM_VIRTUEMART_ORDER_STATUS_PENDING
                    [order_status_description] =>
                    [order_stock_handle] => R
                    [ordering] => 10
                    [order_name] => john doe
                    [toPay] => 32
                )

...continued...

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10300
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
use  $this->orderDetails['details']['BT']->virtuemart_paymentmethod_id
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

daswirdwas

  • Beginner
  • *
  • Posts: 5
  • A beginner
Thank you so much

Many tries later and after changing the line to

<?php if ($this->orderDetails['details']['BT']->virtuemart_paymentmethod_id == '2') { ?>  --->removed second arrow  ;)

it works perfect for me  ;D

THANK YOU !!!

Final Code for two different messages by payment method is now:
Code: [Select]
<?php // #### Text for payment method 1 #### ?>
<?php if ($this->orderDetails['details']['BT']->virtuemart_paymentmethod_id == '1') { 
           echo 
'<p>TEXT 1 . Ordernumber:'
           echo 
$this->orderDetails['details']['BT']->order_number
     
?>


<?php // #### Text for payment method 2 #### ?>
<?php if ($this->orderDetails['details']['BT']->virtuemart_paymentmethod_id == '2') { 
              echo 
'<p>TEXT 2</p>';
     } 
?>


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10300
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Quote
removed second arrow

oops .. sorry .. edited
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation