Dear,
I tested this because I have to link to EZSHIP shipping page. EZSHIP offers an API, and I have to pass the required parameters to EZSHIP.
I wrote the code as follows:
<?php
defined('_JEXEC') or die('Restricted access');
header('Content-Type: text/html; charset=UTF-8');
?>
<?php
$user = hikashop_loadUser(true);
$address_type = 'billing_address'; // or 'billing_address'
$app =& JFactory::getApplication();
$address = $app->getUserState( HIKASHOP_COMPONENT.'.'.$address_type);
$cart = hikashop_get('class.cart');
$cart->loadAddress($order->cart, $address, 'object', 'billing'); // or 'billing'
$name=$order->cart->$address_type->address_firstname;
$vars["phone"]=$order->cart->$address_type->address_telephone;
$vars["email"]=$user->user_email;
$currencyClass = hikashop_get('class.currency');
$amount = $currencyClass->format($order->order_full_price,$order->order_currency_id);
$bill=$order->order_full_price;
$ship=array(
'su_id' => 'XXX',
'order_id'=> $order->order_number,
'rturl' => 'XXX.php',
'rv_name'=> $name,
'rv_email'=> $vars["email"],
'rv_mobil'=> $vars["phone"],
'rv_amount'=> $bill,
'webtemp'=> $amount
);
$ez_temp=$_GET['webtemp'];
$href='http://www.ezship.com.tw/emap/rv_request_web.jsp';
if($ez_temp=='')
{
echo '</br></br>';
echo 'NOW LINKING TO EZSHIP';
echo"<form id=ezship method=POST action='".$href."'>\n";
foreach($ship as $code => $text){
echo" <input type='hidden' name='".$code."' value='".$text."'>\n";
}
echo"</form>\n";
echo"<script>";
echo"document.forms['ezship'].submit();";
echo"</script>";
}
?>
The linking is almost okay. The only problem is that when I log in to EZSHIP account and I found the buyer's chinese name in the order records is garbled. I don't know how to fix the problem. Please help me.
BTW, I see the OpenCart has the component of EZSHIP, will Hikaship provide it in the near future?
Sincere thanks.