VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Payment VM 1.1 => PayPal / PayPal Pro VM 1.1 => Topic started by: carlacappai on October 11, 2013, 12:04:30 PM

Title: Confirmation Email with code
Post by: carlacappai on October 11, 2013, 12:04:30 PM
Hi, thank you for this great forum, you helped me fix many problems!
I'm having an issue with paypal module for payment. It seems nobody's had this problem before so it's probably a stupid mistake  :-[

The confirmation email sent after a purchase contains code.
It's annoying, cause many customers expect to find a paypal button or at least a plain link to paypal.

Logo, shipping address, list of purchased items... all this is correct. Then at the end of the email there's code. This is a screenshot of the email:

(http://i42.tinypic.com/ayxg1j.jpg)

What's wrong? This is the code I wrote in the configuration box:
<?php
$db1 
= new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);

$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round$db->f("order_total")-$db->f("order_shipping"), 2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,

"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( 
$page == "checkout.thankyou" ) {
$query_string "?";
foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" alt="Click to pay with 

PayPal - it is fast, free and secure!" />'
;

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>


I also tried writing the several codes found in this forum, including Soeren's tutorial http://forum.virtuemart.net/index.php?topic=39584.0, but I still get code in the email.
I use VirtueMart 1.1.5 stable and Joomla 1.5.24.

I hope someone can help me, thank you so much!
Title: Re: Confirmation Email with code
Post by: seyi on October 15, 2013, 19:37:52 PM
Hello,

Are you positive that code is coming from the configuration box?  If you set the configuration box blank and try it again do you get a blank screen without the code?
Title: Re: Confirmation Email with code
Post by: carlacappai on October 15, 2013, 20:44:26 PM
Hi Seyi, the code comes from the "payment type" page in virtuemart.
In virtuemart, shop, payment type, I select Paypal and switch to the "Configuration" tab. That's the correct path, right? I've seen screeshots around the forum as well. This is mine:
(http://i42.tinypic.com/o9pj6r.png)

If I leave the box blank, all I read in the email in the payment information box I previously showed is "Paypal" (which is just the name I gave to the payment type).
Title: Re: Confirmation Email with code
Post by: seyi on October 15, 2013, 22:11:34 PM
Ok, strange.  The paypal part is correct.  You will have to look directly at the email template.  You can find it here
www/components/com_virtuemart/themes/[default]/templates/order_emails/confirmation_email.tpl.php

[default] is your template.  If the file is not within your template, then look at the default template.   

the payment/shipping section should contain this:

  <tr bgcolor="#CCCCCC" class="sectiontableheader">
    <td><b class="Stil2"><?php echo $payment_info_lbl ?></b></td>
    <td><b class="Stil2"><?php echo $shipping_info_lbl ?></b></td>
  </tr>
  <tr>
    <td><?php echo $payment_info_details ?></td>
    <td><?php echo $shipping_info_details ?></td>
  </tr>



Nothing more
Title: Re: Confirmation Email with code
Post by: carlacappai on October 15, 2013, 23:43:48 PM
Thanks Seyi. I checked the email template and that code is at the end of the file. Before that there's this:
  <!-- end order items information -->
  <!-- begin customer note -->
  <tr class="sectiontableheader">
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr bgcolor="#CCCCCC" class="sectiontableheader">
    <td colspan="2"><b class="Stil2"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUSTOMER_NOTE'?>:</b></td>
  </tr>
  <tr>
    <td colspan="2">
        <?php echo $customer_note ?>
    </td>

  </tr>
  <tr class="sectiontableheader">
    <td colspan="2">&nbsp;</td>
  </tr>

then the code you pasted, and after that:
</table>
<br>
<p class="Stil2"></p>
<p class="Stil2">
<?php
// EMAIL FOOTER MESSAGE 
if( $is_email_to_shopper ) {
$footer_html "<br /><br />".$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER2')."<br />";

if( VM_REGISTRATION_TYPE != 'NO_REGISTRATION' ) {
$footer_html .= "<br /><a title=\"".$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5')."\" href=\"$order_link\">"
$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5')."</a>";
}
$footer_html .= "<br /><br />".$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER3')."<br />";
$footer_html .= $VM_LANG->_('CMN_EMAIL').": <a href=\"mailto:" $from_email."\">".$from_email."</a>";
// New in version 1.0.5
if( @VM_ONCHECKOUT_SHOW_LEGALINFO == '1' && !empty( $legal_info_title )) {
$footer_html .= "<br /><br />____________________________________________<br />";
$footer_html .= '<h5>'.$legal_info_title.'</h5>';
$footer_html .= $legal_info_html.'<br />';
}
} else {
$footer_html '<br /><br /><a title="'.$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5').'" href="'.$order_link.'">'
$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5').'</a>';
}
echo 
$footer_html;
?>

</p>
</body>
</html>

I wish I knew how to deal with this in a simpler way. Maybe I'll give up and just add a link, without any image buttons.
Title: Re: Confirmation Email with code
Post by: seyi on October 16, 2013, 21:49:19 PM
I dont see a problem there.  My last resort to solve this problem is to look at the variable that displays "paypal".  This is the variable: $payment_info_details.

This variable is created within the file
www/administrator/components/com_virtuemart/classes/ps_checkout.php, function email_receipt.  You can do a string search for the variable.  In my default installation, this is what the variable displays:

<?php
$payment_info_details $db_payment->f("payment_method_name");
if( !empty( $_SESSION['ccdata']['order_payment_name'] )
&& !empty($_SESSION['ccdata']['order_payment_number'])) {
   $payment_info_details .= '<br />'.$VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_NAMECARD',false).': '.$_SESSION['ccdata']['order_payment_name'].'<br />';
   $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_CCNUM',false).': '.$this->asterisk_pad($_SESSION['ccdata']['order_payment_number'], ).'<br />';
   $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_EXDATE',false).': '.$_SESSION['ccdata']['order_payment_expire_month'].' / '.$_SESSION['ccdata']['order_payment_expire_year'].'<br />';
   if( !empty($_SESSION['ccdata']['credit_card_code'])) {
   $payment_info_details .= 'CVV code: '.$_SESSION['ccdata']['credit_card_code'].'<br />';
   }
}
?>



So unless it is a credit card, it simply displays the name of the payment method from #__vm_order_payment table, column payment_method_name.