当前位置: 首页>>代码示例>>PHP>>正文


PHP Carrier::getZone方法代码示例

本文整理汇总了PHP中Carrier::getZone方法的典型用法代码示例。如果您正苦于以下问题:PHP Carrier::getZone方法的具体用法?PHP Carrier::getZone怎么用?PHP Carrier::getZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carrier的用法示例。


在下文中一共展示了Carrier::getZone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayFormFees

    public function displayFormFees()
    {
        global $currentIndex;
        echo '<br /><br />
		<h2>' . $this->l('Fees by carrier, geographical zone, and ranges') . '</h2>
		<form action="' . $currentIndex . '&token=' . $this->token . '" id="fees" name="fees" method="post" class="width2">
			<fieldset>
				<legend><img src="../img/admin/delivery.gif" />' . $this->l('Fees') . '</legend>
				<b>' . $this->l('Carrier:') . ' </b>
				<select name="id_carrier2" onchange="document.fees.submit();">';
        $carriers = Carrier::getCarriers(intval(Configuration::get('PS_LANG_DEFAULT')));
        $id_carrier = Tools::getValue('id_carrier') ? intval(Tools::getValue('id_carrier')) : intval($carriers[0]['id_carrier']);
        $carrierSelected = new Carrier($id_carrier);
        foreach ($carriers as $carrier) {
            echo '<option value="' . intval($carrier['id_carrier']) . '"' . ($carrier['id_carrier'] == $id_carrier ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option>';
        }
        echo '
				</select><br />
				<table class="table space" cellpadding="0" cellspacing="0">
					<tr>
						<th>' . $this->l('Zone / Range') . '</th>';
        $shipping_method = intval(Configuration::get('PS_SHIPPING_METHOD'));
        $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
        $rangeObj = $shipping_method ? new RangeWeight() : new RangePrice();
        $rangeTable = $shipping_method ? 'range_weight' : 'range_price';
        $rangeIdentifier = 'id_' . $rangeTable;
        $ranges = $rangeObj->getRanges($id_carrier);
        $suffix = $shipping_method ? Configuration::get('PS_WEIGHT_UNIT') : $currency->sign;
        $delivery = Carrier::getDeliveryPriceByRanges($rangeTable);
        foreach ($delivery as $deliv) {
            $deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
        }
        foreach ($ranges as $range) {
            echo '<th style="font-size: 11px;">' . floatval($range['delimiter1']) . $suffix . ' ' . $this->l('to') . ' ' . floatval($range['delimiter2']) . $suffix . '</th>';
        }
        echo '</tr>';
        $zones = Zone::getZones(true);
        if (sizeof($ranges)) {
            foreach ($zones as $zone) {
                if (!$carrierSelected->getZone($zone['id_zone'])) {
                    continue;
                }
                echo '
						<tr>
							<th style="height: 30px;">' . $zone['name'] . '</th>';
                foreach ($ranges as $range) {
                    if (isset($deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]])) {
                        $price = $deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]];
                    } else {
                        $price = '0.00';
                    }
                    echo '<td class="center">' . $currency->getSign('left') . '<input type="text" name="fees_' . $zone['id_zone'] . '_' . $range[$rangeIdentifier] . '" value="' . $price . '" style="width: 45px;" />' . $currency->getSign('right') . '</td>';
                }
                echo '
						</tr>';
            }
        }
        echo '
					<tr>
						<td colspan="' . (sizeof($ranges) + 1) . '" class="center" style="border-bottom: none; height: 40px;">
							<input type="hidden" name="submitFees' . $this->table . '" value="1" />
					';
        if (sizeof($ranges)) {
            echo '	<input type="submit" value="' . $this->l('   Save   ') . '" class="button" />';
        } else {
            echo $this->l('No ranges set for this carrier');
        }
        echo '
						</td>
					</tr>';
        echo '
				</table>
				<p>' . $this->l('Prices are tax excluded.') . '</p>
			</fieldset>
			<input type="hidden" name="id_carrier" value="' . $id_carrier . '" />
		</form>';
    }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:77,代码来源:AdminShipping.php


注:本文中的Carrier::getZone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。