News:

Support the VirtueMart project and become a member

Main Menu

Paypal_extra_payment_Info_script: Parse error, unexpected T_STRING ...?

Started by hhtmp88, January 07, 2010, 05:38:21 AM

Previous topic - Next topic

hhtmp88

Dear all,

I am setting up my store with the paypal payment, but get the following error when "confirm order":
***********************************
Parse error: syntax error, unexpected T_STRING in /home/yogapd/domains/mfyoga.org/public_html/mfy/components/com_virtuemart/themes/default/templates/pages/account.order_details.tpl.php(55) : eval()'d code on line 29
***************************************



When I click on "Order Information" under the above error, I find this additional information:
==============================================
Error: The code of the payment method PayPal 或 信用卡 [ VISA | Master Card ] (PP) contains a Parse Error!
Please correct that first
==============================================

my Paypal_extra_payment_Info_script is:
<?php


$order_id 
$db->f("order_id");
$dboi = new ps_DB;
$q_oi "SELECT * FROM #__vm_order_item ";
$q_oi .= "WHERE #__vm_order_item.order_id='$order_id'";
$dboi->query($q_oi);
$description "your shop";
$row_num $dboi->num_rows();
$i=1;
while(
$dboi->next_record()) {
   
    
$supp_var['item_name_' $i] = $dboi->f("order_item_name");
    
$supp_var['quantity_' $i] = $dboi->f("product_quantity");
    
$supp_var['amount_' $i] = round($dboi->f("product_final_price"),2);
    
$i++;
}

/**** Fix to add shipping as item:
$dbsi = new ps_DB;
$q_si = "SELECT ship_method_id FROM #__vm_orders ";
$q_si .= "WHERE #__vm_orders.order_id='$order_id'";
$dbsi->query($q_si);
$shipInfo = split("\|", $dbsi->f("ship_method_id"));
$supp_var['item_name_' . $i] = "Shipping - " . $shipInfo[1] . " - " . $shipInfo[2];
$supp_var['quantity_' . $i] = "1";
$supp_var['amount_' . $i] = sprintf("%.2f", $db->f("order_shipping"));
******/
End Ship Fix

// insert paypal url here
//$url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; //Test mode
$url "https://www.paypal.com/cgi-bin/webscr";

$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$post_variables = Array(
    
"cmd" => "_cart",
    
"upload" => "1",
    
"business" => PAYPAL_EMAIL,
    
"receiver_email" => PAYPAL_EMAIL,
    
// "item_name" => $VM_LANG->_PHPSHOP_ORDER_PRINT_PO_NUMBER.": ". $db->f("order_id"),
    // "item_name_1" => "Basket total for your order: ". $db->f("order_id"),
"item_name" => $description,
    
"order_id" => $db->f("order_id"),
    
"invoice" => $db->f("order_number"),

    
// "amount_1" => round( $db->f("order_subtotal")+$tax_total, 2),
 
    
"shipping_1" => sprintf("%.2f"$db->f("order_shipping")),
    
"currency_code" => $_SESSION['vendor_currency'],
"email" => $dbbt->f('user_email'),

"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" => $user->state,
"country" => $dbbt->f('country'),
"night_phone_c" => $dbbt->f('phone_1'),

    
"image_url" => $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) ."&"; }

    if (
is_array($supp_var) && count($supp_var)) 
    
{ foreach($supp_var as $name => $value
    
$query_string .= $name"=" urlencode($value) ."&"; }
      }
    
mosRedirect$url $query_string );
}
else 
{
    echo 
'<form action="'.$url.'" method="post" target="_blank">';
    echo 
'<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';

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

if(is_array($supp_var) && count($supp_var)) 
{ foreach($supp_var as $name => $value
{ echo '<input type="hidden" name="'.$name.'" value="'.$value.'" />'; }
}

    echo 
'</form>';

//end else
?>


So what's wrong?

Thanks for any kind of help!
JMY(晉明夷)
http://mfyoga.org -- Mindfulness Yoga Association 靜觀瑜伽協會
http://yogajm.com -- YogaJM 晉明瑜伽
http://jinmy.me -- JMY 晉明日誌
http://jm3ime.com -- JinMing 3-Key Chinese Input Method 晉明三鍵輸入法

hhtmp88

Parse Error Corrected by correcting the last line of:
===============================
/**** Fix to add shipping as item:
$dbsi = new ps_DB;
$q_si = "SELECT ship_method_id FROM #__vm_orders ";
$q_si .= "WHERE #__vm_orders.order_id='$order_id'";
$dbsi->query($q_si);
$shipInfo = split("\|", $dbsi->f("ship_method_id"));
$supp_var['item_name_' . $i] = "Shipping - " . $shipInfo[1] . " - " . $shipInfo[2];
$supp_var['quantity_' . $i] = "1";
$supp_var['amount_' . $i] = sprintf("%.2f", $db->f("order_shipping"));
******/End Ship Fix
=================================
-> to "*********/"
-> and next line "//End Ship Fix"


but then
*********************************
Fatal error: Call to undefined function mosRedirect() in /home/yogapd/domains/mfyoga.org/public_html/mfy/components/com_virtuemart/themes/default/templates/pages/checkout.thankyou.tpl.php(61) : eval()'d code on line 85
**********************************

any clue what's wrong?

Thanks for any kind of help!
Rgds,
JMY(晉明夷)
http://mfyoga.org -- Mindfulness Yoga Association 靜觀瑜伽協會
http://yogajm.com -- YogaJM 晉明瑜伽
http://jinmy.me -- JMY 晉明日誌
http://jm3ime.com -- JinMing 3-Key Chinese Input Method 晉明三鍵輸入法

hhtmp88

JMY(晉明夷)
http://mfyoga.org -- Mindfulness Yoga Association 靜觀瑜伽協會
http://yogajm.com -- YogaJM 晉明瑜伽
http://jinmy.me -- JMY 晉明日誌
http://jm3ime.com -- JinMing 3-Key Chinese Input Method 晉明三鍵輸入法