📄 shipping_select.ihtml
字号:
<?php
eval(load_class("ISshipping", "ps_intershipper"));
$ps_intershipper = new ps_intershipper;
$db = new ps_DB;
$prices = array();
$q = "SELECT * FROM ISshipping ";
$q .= "WHERE ship_publish='Y' ";
$q .= "AND vendor_id='$ps_vendor_id' ";
$q .= "ORDER BY ship_carrier_name ASC";
$db->query($q);
if ($db->num_rows() > 0) {
if ($db->num_rows() == 1) {
$db->next_record(); ?>
<INPUT TYPE="hidden" NAME="ship_method_id" VALUE="<?php $db->sp("ship_method_id"); ?>"><?php
} else { ?>
<TABLE BORDER=0 WIDTH=100% CELLPADDING=2 CELLSPACING=0>
<TR BGCOLOR="#FFCC33">
<TD> <B>选择送货方式</B> </TD>
</TR>
<TR>
<TD>
<SELECT NAME="ship_method_id">
<?php
/* Pass previous forms results to fetch_quote() function.
* If previous form identified a ship to address, the function
* will return a quote. Otherwise, it will not.
*/
if (!($prices = $ps_intershipper->fetch_quote($vars))) {
/* If we're unable to get a quote, display
* a ship method select list without shipping costs.
*/
echo "ERROR: $ps_intershipper->error<BR>";
while ($db->next_record()) {
echo " <OPTION VALUE=" . $db->f("ship_method_id");
if ($ship_method_id) {
echo " SELECTED>" . $db->f("ship_carrier_name");
echo " " . $db->f("ship_method_name") . "</OPTION>\r\n";
}
else {
echo ">" . $db->f("ship_carrier_name") . " ";
echo $db->f("ship_method_name") . "</OPTION>\r\n";
}
}
} else {
/* We were able to get a quote. So, display a ship
* method select list with ship prices.
*/
while ($db->next_record()) {
reset($prices);
while (list($key,$val)=each($prices)) {
if (strcmp($key,$db->f("ship_method_id")) == 0) {
echo " <OPTION VALUE=$key";
if ($ship_method_id && (strcmp($ship_method_id,$db->f("ship_method_id")) == 0)) {
echo " SELECTED>" . $db->f("ship_carrier_name");
echo " " . $db->f("ship_method_name") . " - ". $prices[$key]["rate"];
echo "</OPTION>\r\n";
}
else {
echo ">" . $db->f("ship_carrier_name") . " " . $db->f("ship_method_name");
echo " - ". $prices[$key]["rate"] . "</OPTION>\r\n";
}
}
}
}
}
?>
</SELECT>
</TD>
</TR>
</TABLE><?php
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -