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


PHP Carrier::getRangeSuffix方法代码示例

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


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

示例1: initContent

 public function initContent()
 {
     $array_carrier = array();
     $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
     foreach ($carriers as $key => $carrier) {
         if ($carrier['is_free']) {
             unset($carriers[$key]);
         } else {
             $array_carrier[] = $carrier['id_carrier'];
         }
     }
     $id_carrier = (int) Tools::getValue('id_carrier');
     if (count($carriers) && isset($array_carrier[0])) {
         if (!$id_carrier) {
             $id_carrier = (int) $array_carrier[0];
         }
         $carrierSelected = new Carrier((int) $id_carrier);
     } else {
         $carrierSelected = new Carrier((int) $id_carrier);
     }
     $currency = $this->context->currency;
     $rangeObj = $carrierSelected->getRangeObject();
     $rangeTable = $carrierSelected->getRangeTable();
     $suffix = $carrierSelected->getRangeSuffix();
     $rangeIdentifier = 'id_' . $rangeTable;
     $ranges = $rangeObj->getRanges($id_carrier);
     $delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
     $deliveryArray = array();
     foreach ($delivery as $deliv) {
         $deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
     }
     $this->context->smarty->assign(array('zones' => $carrierSelected->getZones(), 'carriers' => $carriers, 'ranges' => $ranges, 'currency' => $currency, 'deliveryArray' => $deliveryArray, 'carrierSelected' => $carrierSelected, 'id_carrier' => $id_carrier, 'suffix' => $suffix, 'rangeIdentifier' => $rangeIdentifier, 'action_fees' => self::$currentIndex . '&token=' . $this->token));
     parent::initContent();
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:34,代码来源:AdminShippingController.php

示例2: displayFormFees

    public function displayFormFees()
    {
        global $currentIndex;
        $carrierArray = array();
        $id_carrier = Tools::getValue('id_carrier');
        $carriers = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
        foreach ($carriers as $carrier) {
            if (!$carrier['is_free']) {
                $carrierArray[] = array('id' => $carrier['id_carrier'], 'display' => '<option value="' . (int) $carrier['id_carrier'] . '"' . ($carrier['id_carrier'] == $id_carrier ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option>');
            }
        }
        if (count($carrierArray)) {
            if (!$id_carrier) {
                $id_carrier = (int) $carrierArray[0]['id'];
            }
            $carrierSelected = new Carrier($id_carrier);
        }
        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">
			<fieldset>
				<legend><img src="../img/admin/delivery.gif" />' . $this->l('Fees') . '</legend>';
        if (!count($carrierArray)) {
            echo $this->l('You only have free carriers, there is no need to configure your delivery prices.');
        } else {
            echo '<b>' . $this->l('Carrier:') . ' </b>
				<select name="id_carrier2" onchange="document.fees.submit();">';
            foreach ($carrierArray as $carrierOption) {
                echo $carrierOption['display'];
            }
            echo '
				</select><br />
				<table class="table space" cellpadding="0" cellspacing="0">
					<tr>
						<th>' . $this->l('Zone / Range') . '</th>';
            $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
            $rangeObj = $carrierSelected->getRangeObject();
            $rangeTable = $carrierSelected->getRangeTable();
            $suffix = $carrierSelected->getRangeSuffix();
            $rangeIdentifier = 'id_' . $rangeTable;
            $ranges = $rangeObj->getRanges($id_carrier);
            $delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
            foreach ($delivery as $deliv) {
                $deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
            }
            if (!$carrierSelected->is_free) {
                foreach ($ranges as $range) {
                    echo '<th style="font-size: 11px;">' . (double) $range['delimiter1'] . $suffix . ' ' . $this->l('to') . ' ' . (double) $range['delimiter2'] . $suffix . '</th>';
                }
            }
            echo '</tr>';
            $zones = $carrierSelected->getZones();
            if (sizeof($ranges) && !$carrierSelected->is_free) {
                if (sizeof($zones) > 1) {
                    echo '
					<tr>
						<th style="height: 30px;">' . $this->l('All') . '</th>';
                    foreach ($ranges as $range) {
                        echo '<td class="center">' . $currency->getSign('left') . '<input type="text" id="fees_all_' . $range[$rangeIdentifier] . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if ((event.keyCode||event.which) != 9){ spreadFees(' . $range[$rangeIdentifier] . ') }" style="width: 45px;" />' . $currency->getSign('right') . '</td>';
                    }
                    echo '</tr>';
                }
                foreach ($zones as $zone) {
                    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" class="fees_' . $range[$rangeIdentifier] . '" onchange="this.value = this.value.replace(/,/g, \'.\');" name="fees_' . $zone['id_zone'] . '_' . $range[$rangeIdentifier] . '" onkeyup="clearAllFees(' . $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) && !$carrierSelected->is_free) {
                echo '	<input type="submit" value="' . $this->l('   Save   ') . '" class="button" />';
            } elseif ($carrierSelected->is_free) {
                echo $this->l('This is a free carrier');
            } else {
                echo $this->l('No ranges set for this carrier');
            }
            echo '
					</td>
				</tr>';
            echo '
			</table>
			<p>' . $this->l('Prices do not include tax.') . '</p>';
        }
        echo '
			</fieldset>
			<input type="hidden" name="id_carrier" value="' . $id_carrier . '" />
		</form>';
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:100,代码来源:AdminShipping.php


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