VirtueMart Forum

VirtueMart 2 + 3 => General Questions => Topic started by: daswirdwas on September 17, 2021, 12:34:49 pm

Title: Problem while IF request in status mail to insert different text for payments
Post by: daswirdwas on September 17, 2021, 12:34:49 pm
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 ?>
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: GJC Web Design on September 17, 2021, 15:24:11 pm
<?php if ($this->cartData->paymentName == "ueberweisung") { ?>
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: daswirdwas on September 17, 2021, 16:32:20 pm
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
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: GJC Web Design on September 17, 2021, 19:43:45 pm
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?
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: daswirdwas on September 18, 2021, 19:51:24 pm
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
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: daswirdwas on September 18, 2021, 20:17:32 pm
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...
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: GJC Web Design on September 18, 2021, 22:26:29 pm
use  $this->orderDetails['details']['BT']->virtuemart_paymentmethod_id
Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: daswirdwas on September 19, 2021, 13:49:25 pm
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>';
     } 
?>

Title: Re: Problem while IF request in status mail to insert different text for payments
Post by: GJC Web Design on September 19, 2021, 15:58:58 pm
Quote
removed second arrow

oops .. sorry .. edited