敦煌网php接口,API接口

阅读: 评论:0

敦煌网php接口,API接口

敦煌网php接口,API接口

在产品显示页面,通常会根据产品的重量、用户选择产品的个数与目的地显示平邮与快递的价格,供用户参考。在集成过程中,可能调用我们的getRates获取ISHIP的所有可行的运费计算规则,然后搞照ISHIP的分类(China Postal Service,China Registered Postal,China Express Mail)取得第一个也就是价格最低的此类型的运输方式,供用户选择。

define('REQUIRECOUNTRYURL','');//http require URL for iship country

define('REQUIRERATE','');//http require URL for iship shipping Rates

$countryName = @$_POST['countryName'];

$quantity = @$_POST['quantity'];

if($quantity == null){

$quantity = 1;

}

if($countryName == null){

$countryName = "Canada";

}

$preItemFee = 18;

$preWeight = 0.125;

$profile = '?country='.$countryName.'&weight='.$preWeight * $quantity ;

?>

window.οnlοad=function(){

document.forms['form1'].quantity.value= '<?php echo $quantity ?>';

document.forms['form1'].countryName.value= '<?php echo $countryName ?>';

}

function shipincart_submit(country){

document.form1.submit();

}

Estimate Shipping Costs

Quantity:

1

2

3

4

5

6

7

8

9

10

Weight: <?php echo $preWeight * $quantity ;?> kgItem cost: <?php echo $preItemFee*$quantity ?> CNY
Shipping to(Country):

$doc = new DOMDocument();

$doc->load( REQUIRECOUNTRYURL );

$dataset = $doc->getElementsByTagName( "country" );

foreach( $dataset as $row ){

$countryNames = $row->getElementsByTagName( "englishname" );

$countryName = $countryNames->item(0)->nodeValue;

?>

}

?>

Available Shipping MethodsShipping CostTotal Cost

$doc1 = new DOMDocument();

$doc1->load( REQUIRERATE .$profile);

// Load the call and capture the document returned by sendfromchina API

$dataset = $doc1->getElementsByTagName( "rate" );

// Check to see if the response was loaded, else print an error

if(@$dataset->item(0)->nodeValue){

foreach( $dataset as $row ){

$classtypes = $row->getElementsByTagName( "classtype" );

$classtype = $classtypes->item(0)->nodeValue;

switch ($classtype){

case 'China Postal Service':

$key = 'CPS';

$name = 'Standard';

break;

case 'China Registered Postal':

$key = 'CRP';

$name = 'Registered';

break;

case 'China Express Mail':

$key = 'CEM';

$name = 'Expedited';

break;

}

if($Rates[$key] != ture){

$totalfees = $row->getElementsByTagName( "totalfee" );

$totalfee = $totalfees->item(0)->nodeValue;

$iftrackings = $row->getElementsByTagName( "iftracking" );

$byvolumes = $row->getElementsByTagName( "byvolume" );

$shiptypes = $row->getElementsByTagName( "shiptypename" );

$Rates[$key] = ture;

?>

<?php echo $name; ?><?php echo $totalfee ?> CNY<?php echo $totalfee + $preItemFee*$quantity ?> CNY

}

}

?>

//var_dump($Rates);

}

?>

本文发布于:2024-02-04 18:12:27,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170713383858159.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:敦煌   接口   php   API
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23