Hi
I have simple question, I am implementing a ecommerce site using Joomla/Virtuemart and i have a payment gateway with Cybersource. Now i am implementing the payment thorugh cybersource Hosted order pages where in i just post variables from my site to the Cybersource and the payment processing is done on the cybersource site
Here is my code for implementing the Hosted order page method,
<?php include("HOP.php") ?>
<?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://orderpage.ic3.com/hop/orderform.jsp";
$taxAmount = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$amount = round( $db->f("order_subtotal")+$taxAmount-$discount_total, 2);
$post_variables = Array(
"cmd" => "ext-enter",
"merchantID" => "V9878987",
"upload" => "1",
"item_name" => $VM_LANG->('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"orderNumber" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round( $db->f("order_subtotal")+$taxAmount-$discount_total, 2),
"currency" => $_SESSION['vendor_currency'],
"billTo_firstName" => $dbbt->f('first_name'),
"billTo_lastName" => $dbbt->f('last_name'),
"billTo_street1" => $dbbt->f('address_1'),
"billTo_email" => $dbbt->f('user_email'),
"billTo_postalCode" => $dbbt->f('zip'),
"billTo_city" => $dbbt->f('city'),
"billTo_state" => $dbbt->f('state'),
"billTo_country" => $db1->f('country_2_code'),
"orderPage_buyButtonText" => "Pay",
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,
"orderPage_sendMerchantURLPost" => "true"
);
?>
<form action="https://orderpagetest.ic3.com/hop/orderform.jsp" method="post" target="_blank">
<?php InsertSignature3($amount,$currency, "sale")?>
<?php
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />'; }
?>
<input type="submit" value="Buy Now">
</form>
Now i want the above code which is in orange color to be replaced with the following code
<?php
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">';
<?php InsertSignature3($amount,"usd", "sale")?>
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>
The brown color line is showing a Parse error, Could anyone correct the code?
Thanks