本文整理汇总了PHP中Customer::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getGroups方法的具体用法?PHP Customer::getGroups怎么用?PHP Customer::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::getGroups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->init();
$this->preProcess();
if (Tools::getValue('ajax') == 'true') {
if (Tools::getIsset('summary')) {
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (self::$cookie->id_customer) {
$customer = new Customer((int) self::$cookie->id_customer);
$groups = $customer->getGroups();
} else {
$groups = array(1);
}
if ((int) self::$cart->id_address_delivery) {
$deliveryAddress = new Address((int) self::$cart->id_address_delivery);
}
$result = array('carriers' => Carrier::getCarriersForOrder((int) Country::getIdZone((isset($deliveryAddress) and (int) $deliveryAddress->id) ? (int) $deliveryAddress->id_country : (int) Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
}
$result['summary'] = self::$cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas((int) self::$cart->id);
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
die(Tools::jsonEncode($result));
} else {
$this->includeCartModule();
}
} else {
$this->setMedia();
$this->displayHeader();
$this->process();
$this->displayContent();
$this->displayFooter();
}
}
示例2: formEdit
/**
* Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param $id (int) Identificador del registro a ser editado.
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos
* a extraidos de la base de datos para ser editados
*/
function formEdit($id)
{
global $locate;
$asteriskcalls =& Customer::getRecordByID($id, 'asteriskcalls');
if ($_SESSION['curuser']['usertype'] == 'admin') {
$grouphtml .= '<select name="groupid" id="groupid" >
<option value=""></option>';
$res = Customer::getGroups();
while ($row = $res->fetchRow()) {
$grouphtml .= '<option value="' . $row['groupid'] . '"';
if ($row['groupid'] == $asteriskcalls['groupid']) {
$grouphtml .= ' selected ';
}
$grouphtml .= '>' . $row['groupname'] . '</option>';
}
$grouphtml .= '</select>';
} else {
$grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="f" id="f">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">' . $locate->Translate("Name") . ' *</td>
<td align="left"><input type="text" id="asteriskcallsname" name="asteriskcallsname" size="30" maxlength="50" value="' . $asteriskcalls['asteriskcallsname'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Dialout context") . '</td>
<td align="left"><input type="hidden" id="id" name="id" value="' . $asteriskcalls['id'] . '"><input type="text" id="dialoutcontext" name="dialoutcontext" size="30" maxlength="50" value="' . $asteriskcalls['outcontext'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Dialin context") . '</td>
<td align="left"><input type="text" id="dialincontext" name="dialincontext" size="30" maxlength="50" value="' . $asteriskcalls['incontext'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Dialin extension") . '</td>
<td align="left"><input type="text" id="dialinextension" name="dialinextension" size="30" maxlength="50" value="' . $asteriskcalls['inextension'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Group") . '</td>
<td align="left">' . $grouphtml . '</td>
</tr>
<tr>
<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
</tr>
</table>
';
$html .= '
</form>
' . $locate->Translate("obligatory_fields") . '
';
return $html;
}
示例3: getOrderShippingCost
/**
* Return shipping total
*
* @param integer $id_carrier Carrier ID (default : current carrier)
* @return float Shipping total
*/
function getOrderShippingCost($id_carrier = NULL, $useTax = true)
{
global $defaultCountry;
if ($this->isVirtualCart()) {
return 0;
}
// Checking discounts in cart
$products = $this->getProducts();
$discounts = $this->getDiscounts(true);
if ($discounts) {
foreach ($discounts as $id_discount) {
if ($id_discount['id_discount_type'] == 3) {
if ($id_discount['minimal'] > 0) {
$total_cart = 0;
$categories = Discount::getCategories(intval($id_discount['id_discount']));
if (sizeof($categories)) {
foreach ($products as $product) {
if (Product::idIsOnCategoryId(intval($product['id_product']), $categories)) {
$total_cart += $product['total_wt'];
}
}
}
if ($total_cart >= $id_discount['minimal']) {
return 0;
}
} else {
return 0;
}
}
}
}
// Order total without fees
$orderTotal = $this->getOrderTotal(true, 7);
// Start with shipping cost at 0
$shipping_cost = 0;
// If no product added, return 0
if ($orderTotal <= 0 and !intval(self::getNbProducts($this->id))) {
return $shipping_cost;
}
// Get id zone
if (isset($this->id_address_delivery) and $this->id_address_delivery) {
$id_zone = Address::getZoneById(intval($this->id_address_delivery));
} else {
$id_zone = intval($defaultCountry->id_zone);
}
// If no carrier, select default one
if (!$id_carrier) {
$id_carrier = $this->id_carrier;
}
if (empty($id_carrier)) {
if (Configuration::get('PS_SHIPPING_METHOD') and Carrier::checkDeliveryPriceByWeight(intval(Configuration::get('PS_CARRIER_DEFAULT')), $this->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and Carrier::checkDeliveryPriceByPrice(intval(Configuration::get('PS_CARRIER_DEFAULT')), $this->getOrderTotal(true, 4), $id_zone)) {
$id_carrier = intval(Configuration::get('PS_CARRIER_DEFAULT'));
}
}
if (empty($id_carrier)) {
if (intval($this->id_customer)) {
$customer = new Customer(intval($this->id_customer));
$result = Carrier::getCarriers(intval(Configuration::get('PS_LANG_DEFAULT')), true, false, intval($id_zone), $customer->getGroups());
unset($customer);
} else {
$result = Carrier::getCarriers(intval(Configuration::get('PS_LANG_DEFAULT')), true, false, intval($id_zone));
}
$resultsArray = array();
foreach ($result as $k => $row) {
if ($row['id_carrier'] == Configuration::get('PS_CARRIER_DEFAULT')) {
continue;
}
if (!isset(self::$_carriers[$row['id_carrier']])) {
self::$_carriers[$row['id_carrier']] = new Carrier(intval($row['id_carrier']));
}
$carrier = self::$_carriers[$row['id_carrier']];
// Get only carriers that are compliant with shipping method
if (Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or !Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
unset($result[$k]);
continue;
}
// If out-of-range behavior carrier is set on "Desactivate carrier"
if ($row['range_behavior']) {
// Get only carriers that have a range compatible with cart
if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->getOrderTotal(true, 4), $id_zone)) {
unset($result[$k]);
continue;
}
}
if (intval(Configuration::get('PS_SHIPPING_METHOD'))) {
$shipping = $carrier->getDeliveryPriceByWeight($this->getTotalWeight(), $id_zone);
if (!isset($tmp)) {
$tmp = $shipping;
}
if ($shipping <= $tmp) {
$id_carrier = intval($row['id_carrier']);
}
} else {
$shipping = $carrier->getDeliveryPriceByPrice($orderTotal, $id_zone);
//.........这里部分代码省略.........
示例4: getPackageShippingCost
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null)
{
if (!Configuration::get('LEGAL_SHIPTAXMETH')) {
return parent::getPackageShippingCost($id_carrier, $use_tax, $default_country, $product_list, $id_zone);
}
if ($this->isVirtualCart()) {
return 0;
}
if (!$default_country) {
$default_country = Context::getContext()->country;
}
if (!is_null($product_list)) {
foreach ($product_list as $key => $value) {
if ($value['is_virtual'] == 1) {
unset($product_list[$key]);
}
}
}
$complete_product_list = $this->getProducts();
if (is_null($product_list)) {
$products = $complete_product_list;
} else {
$products = $product_list;
}
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice') {
$address_id = (int) $this->id_address_invoice;
} elseif (count($product_list)) {
$prod = current($product_list);
$address_id = (int) $prod['id_address_delivery'];
} else {
$address_id = null;
}
if (!Address::addressExists($address_id)) {
$address_id = null;
}
$cache_id = 'getPackageShippingCost_' . (int) $this->id . '_' . (int) $address_id . '_' . (int) $id_carrier . '_' . (int) $use_tax . '_' . (int) $default_country->id;
if ($products) {
foreach ($products as $product) {
$cache_id .= '_' . (int) $product['id_product'] . '_' . (int) $product['id_product_attribute'];
}
}
if (Cache::isStored($cache_id)) {
return Cache::retrieve($cache_id);
}
// Order total in default currency without fees
$order_total = $this->getOrderTotal(true, Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING, $product_list);
// Start with shipping cost at 0
$shipping_cost = 0;
// If no product added, return 0
if (!count($products)) {
Cache::store($cache_id, $shipping_cost);
return $shipping_cost;
}
if (!isset($id_zone)) {
// Get id zone
if (!$this->isMultiAddressDelivery() && isset($this->id_address_delivery) && $this->id_address_delivery && Customer::customerHasAddress($this->id_customer, $this->id_address_delivery)) {
$id_zone = Address::getZoneById((int) $this->id_address_delivery);
} else {
if (!Validate::isLoadedObject($default_country)) {
$default_country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
}
$id_zone = (int) $default_country->id_zone;
}
}
if ($id_carrier && !$this->isCarrierInRange((int) $id_carrier, (int) $id_zone)) {
$id_carrier = '';
}
if (empty($id_carrier) && $this->isCarrierInRange((int) Configuration::get('PS_CARRIER_DEFAULT'), (int) $id_zone)) {
$id_carrier = (int) Configuration::get('PS_CARRIER_DEFAULT');
}
$total_package_without_shipping_tax_inc = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, $product_list);
if (empty($id_carrier)) {
if ((int) $this->id_customer) {
$customer = new Customer((int) $this->id_customer);
$result = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, (int) $id_zone, $customer->getGroups());
unset($customer);
} else {
$result = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, (int) $id_zone);
}
foreach ($result as $k => $row) {
if ($row['id_carrier'] == Configuration::get('PS_CARRIER_DEFAULT')) {
continue;
}
if (!isset(self::$_carriers[$row['id_carrier']])) {
self::$_carriers[$row['id_carrier']] = new Carrier((int) $row['id_carrier']);
}
$carrier = self::$_carriers[$row['id_carrier']];
// Get only carriers that are compliant with shipping method
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT && $carrier->getMaxDeliveryPriceByWeight((int) $id_zone) === false || $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE && $carrier->getMaxDeliveryPriceByPrice((int) $id_zone) === false) {
unset($result[$k]);
continue;
}
// If out-of-range behavior carrier is set on "Desactivate carrier"
if ($row['range_behavior']) {
$check_delivery_price_by_weight = Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->getTotalWeight(), (int) $id_zone);
$total_order = $total_package_without_shipping_tax_inc;
$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $total_order, (int) $id_zone, (int) $this->id_currency);
// Get only carriers that have a range compatible with cart
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT && !$check_delivery_price_by_weight || $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE && !$check_delivery_price_by_price) {
unset($result[$k]);
//.........这里部分代码省略.........
示例5: getOrderShippingCost
/**
* Return shipping total
*
* @param integer $id_carrier Carrier ID (default : current carrier)
* @return float Shipping total
*/
function getOrderShippingCost($id_carrier = NULL, $useTax = true)
{
global $defaultCountry;
if ($this->isVirtualCart()) {
return 0;
}
// Checking discounts in cart
$products = $this->getProducts();
$discounts = $this->getDiscounts(true);
if ($discounts) {
foreach ($discounts as $id_discount) {
if ($id_discount['id_discount_type'] == 3) {
if ($id_discount['minimal'] > 0) {
$total_cart = 0;
$categories = Discount::getCategories((int) $id_discount['id_discount']);
if (sizeof($categories)) {
foreach ($products as $product) {
if (Product::idIsOnCategoryId((int) $product['id_product'], $categories)) {
$total_cart += $product['total_wt'];
}
}
}
if ($total_cart >= $id_discount['minimal']) {
return 0;
}
} else {
return 0;
}
}
}
}
// Order total in default currency without fees
$order_total = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING);
// Start with shipping cost at 0
$shipping_cost = 0;
// If no product added, return 0
if ($order_total <= 0 and !(int) self::getNbProducts($this->id)) {
return $shipping_cost;
}
// Get id zone
if (isset($this->id_address_delivery) and $this->id_address_delivery and Customer::customerHasAddress($this->id_customer, $this->id_address_delivery)) {
$id_zone = Address::getZoneById((int) $this->id_address_delivery);
} else {
// This method can be called from the backend, and $defaultCountry won't be defined
if (!Validate::isLoadedObject($defaultCountry)) {
$defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
}
$id_zone = (int) $defaultCountry->id_zone;
}
// If no carrier, select default one
if (!$id_carrier) {
$id_carrier = $this->id_carrier;
}
if ($id_carrier && !$this->isCarrierInRange($id_carrier, $id_zone)) {
$id_carrier = '';
}
if (empty($id_carrier) && $this->isCarrierInRange(Configuration::get('PS_CARRIER_DEFAULT'), $id_zone)) {
$id_carrier = (int) Configuration::get('PS_CARRIER_DEFAULT');
}
if (empty($id_carrier)) {
if ((int) $this->id_customer) {
$customer = new Customer((int) $this->id_customer);
$result = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, (int) $id_zone, $customer->getGroups());
unset($customer);
} else {
$result = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, (int) $id_zone);
}
foreach ($result as $k => $row) {
if ($row['id_carrier'] == Configuration::get('PS_CARRIER_DEFAULT')) {
continue;
}
if (!isset(self::$_carriers[$row['id_carrier']])) {
self::$_carriers[$row['id_carrier']] = new Carrier((int) $row['id_carrier']);
}
$carrier = self::$_carriers[$row['id_carrier']];
// Get only carriers that are compliant with shipping method
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
unset($result[$k]);
continue;
}
// If out-of-range behavior carrier is set on "Desactivate carrier"
if ($row['range_behavior']) {
// Get only carriers that have a range compatible with cart
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->getTotalWeight(), $id_zone) or $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), $id_zone, (int) $this->id_currency)) {
unset($result[$k]);
continue;
}
}
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping = $carrier->getDeliveryPriceByWeight($this->getTotalWeight(), $id_zone);
} else {
$shipping = $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int) $this->id_currency);
}
if (!isset($minShippingPrice)) {
//.........这里部分代码省略.........
示例6: _assignCarrier
protected function _assignCarrier()
{
$customer = new Customer((int) self::$cookie->id_customer);
$address = new Address((int) self::$cart->id_address_delivery);
$id_zone = Address::getZoneById((int) $address->id);
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
$checked = 0;
if (Validate::isUnsignedInt(self::$cart->id_carrier) and self::$cart->id_carrier) {
$carrier = new Carrier((int) self::$cart->id_carrier);
if ($carrier->active and !$carrier->deleted) {
$checked = (int) self::$cart->id_carrier;
}
}
self::$smarty->assign(array('checked' => (int) $checked, 'carriers' => $carriers, 'default_carrier' => (int) Configuration::get('PS_CARRIER_DEFAULT'), 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)), 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))));
}
示例7: formEdit
function formEdit($id)
{
global $locate;
$diallist =& Customer::getRecordByID($id, 'diallist');
if ($_SESSION['curuser']['usertype'] == 'admin') {
$res = Customer::getGroups();
$groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
while ($row = $res->fetchRow()) {
$groupoptions .= '<option value="' . $row['groupid'] . '"';
if ($diallist['groupid'] == $row['groupid']) {
$groupoptions .= ' selected';
}
$groupoptions .= '>' . $row['groupname'] . '</option>';
}
$groupoptions .= '</select>';
} else {
$groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
}
$campaignlist = Customer::getAll("campaign", "groupid", $diallist['groupid']);
while ($row = $campaignlist->fetchRow()) {
$campaign_options .= '<option value="' . $row['id'] . '"';
if ($diallist['campaignid'] == $row['id']) {
$campaign_options .= ' selected';
}
$campaign_options .= '>' . $row['campaignname'] . '</option>';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="formDiallist" id="formDiallist">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">' . $locate->Translate("number") . '*</td>
<td align="left">
<input type="text" id="dialnumber" name="dialnumber" size="35" value="' . $diallist['dialnumber'] . '">
<input type="hidden" id="id" name="id" value="' . $diallist['id'] . '">
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Name") . '</td>
<td align="left">
<input type="text" id="customername" name="customername" value="' . $diallist['customername'] . '" size="35">
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Assign To") . '</td>
<td align="left">
<input type="text" id="assign" name="assign" size="35" value="' . $diallist['assign'] . '">
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Call Order") . '</td>
<td align="left">
<input type="text" id="callOrder" name="callOrder" size="35" value="' . $diallist['callOrder'] . '">
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Dialtime") . '</td>
<td align="left">
<input type="text" name="dialtime" id="dialtime" size="20" value="' . $diallist['dialtime'] . '">
<INPUT onclick="displayCalendar(document.getElementById(\'dialtime\'),\'yyyy-mm-dd hh:ii\',this,true)" type="button" value="' . $locate->Translate("Cal") . '">
</td>
</tr>';
$html .= '
<tr>
<td align="left" width="25%">' . $locate->Translate("Group Name") . '</td>
<td>' . $groupoptions . '</td>
</tr>';
$html .= '
<tr>
<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '</td>
<td><SELECT id="campaignid" name="campaignid">' . $campaign_options . '</SELECT></td>
</tr>';
$html .= '
<tr>
<td align="left" width="25%">' . $locate->Translate("Memo") . '</td>
<td><textarea id="memo" name="memo" cols="50" rows="8">' . $diallist['memo'] . '</textarea></td>
</tr>';
$html .= '
<tr>
<td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="xajax_update(xajax.getFormValues(\'formDiallist\'));return false;"></td>
</tr>
<table>
</form>
';
return $html;
}
示例8: displayCarrier
function displayCarrier()
{
global $smarty, $cart, $cookie, $defaultCountry, $link;
$address = new Address(intval($cart->id_address_delivery));
$id_zone = Address::getZoneById(intval($address->id));
if (isset($cookie->id_customer)) {
$customer = new Customer(intval($cookie->id_customer));
} else {
die(Tools::displayError($this->l('Fatal error: No customer')));
}
$result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone), $customer->getGroups());
if (!$result) {
$result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone));
}
$resultsArray = array();
foreach ($result as $k => $row) {
$carrier = new Carrier(intval($row['id_carrier']));
// Get only carriers that are compliant with shipping method
if (Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or !Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
unset($result[$k]);
continue;
}
// If out-of-range behavior carrier is set on "Desactivate carrier"
if ($row['range_behavior']) {
// Get id zone
if (isset($cart->id_address_delivery) and $cart->id_address_delivery) {
$id_zone = Address::getZoneById(intval($cart->id_address_delivery));
} else {
$id_zone = intval($defaultCountry->id_zone);
}
// Get only carriers that have a range compatible with cart
if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, 4), $id_zone)) {
unset($result[$k]);
continue;
}
}
$row['name'] = strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME');
$row['price'] = $cart->getOrderShippingCost(intval($row['id_carrier']));
$row['price_tax_exc'] = $cart->getOrderShippingCost(intval($row['id_carrier']), false);
$row['img'] = file_exists(_PS_SHIP_IMG_DIR_ . intval($row['id_carrier']) . '.jpg') ? _THEME_SHIP_DIR_ . intval($row['id_carrier']) . '.jpg' : '';
$resultsArray[] = $row;
}
// Wrapping fees
$wrapping_fees = floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax(intval(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + floatval($wrapping_fees_tax->rate) / 100);
if (Validate::isUnsignedInt($cart->id_carrier) and $cart->id_carrier) {
$carrier = new Carrier(intval($cart->id_carrier));
if ($carrier->active and !$carrier->deleted) {
$checked = intval($cart->id_carrier);
}
}
$cms = new CMS(3, intval($cookie->id_lang));
$link_conditions = $link->getCMSLink($cms, $cms->link_rewrite);
if (!strpos($link_conditions, '?')) {
$link_conditions .= '?content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
} else {
$link_conditions .= '&content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
}
if (!isset($checked) or intval($checked) == 0) {
$checked = intval(Configuration::get('PS_CARRIER_DEFAULT'));
}
$smarty->assign(array('checkedTOS' => intval($cookie->checkedTOS), 'recyclablePackAllowed' => intval(Configuration::get('PS_RECYCLABLE_PACK')), 'giftAllowed' => intval(Configuration::get('PS_GIFT_WRAPPING')), 'conditions' => intval(Configuration::get('PS_CONDITIONS')), 'link_conditions' => $link_conditions, 'recyclable' => intval($cart->recyclable), 'gift_wrapping_price' => floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE')), 'carriers' => $resultsArray, 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)), 'checked' => intval($checked), 'total_wrapping' => Tools::convertPrice($wrapping_fees_tax_inc, new Currency(intval($cookie->id_currency))), 'total_wrapping_tax_exc' => Tools::convertPrice($wrapping_fees, new Currency(intval($cookie->id_currency)))));
Tools::safePostVars();
$css_files = array(__PS_BASE_URI__ . 'css/thickbox.css' => 'all');
$js_files = array(__PS_BASE_URI__ . 'js/jquery/thickbox-modified.js');
include_once dirname(__FILE__) . '/header.php';
$smarty->display(_PS_THEME_DIR_ . 'order-carrier.tpl');
}
示例9: formEdit
/**
* Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param $id (int) Identificador del registro a ser editado.
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos
* a extraidos de la base de datos para ser editados
*/
function formEdit($id)
{
global $locate;
$account =& Customer::getRecordByID($id, 'astercrm_account');
if ($_SESSION['curuser']['usertype'] == 'admin') {
$grouphtml .= '<select name="groupid" id="groupid" >';
$res = Customer::getGroups();
while ($row = $res->fetchRow()) {
$grouphtml .= '<option value="' . $row['groupid'] . '"';
if ($row['groupid'] == $account['groupid']) {
$grouphtml .= ' selected ';
}
$grouphtml .= '>' . $row['groupname'] . '</option>';
}
$grouphtml .= '</select>';
} else {
$grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="f" id="f">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">' . $locate->Translate("username") . '*</td>
<td align="left"><input type="hidden" id="id" name="id" value="' . $account['id'] . '"><input type="text" id="username" name="username" size="25" maxlength="30" value="' . $account['username'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("password") . '*</td>
<td align="left"><input type="text" id="password" name="password" size="25" maxlength="30" value="' . $account['password'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("first name") . '*</td>
<td align="left"><input type="text" id="firstname" name="firstname" size="25" maxlength="15" value="' . $account['firstname'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("last name") . '*</td>
<td align="left"><input type="text" id="lastname" name="lastname" size="25" maxlength="15" value="' . $account['lastname'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("callerid") . '</td>
<td align="left"><input type="text" id="callerid" name="callerid" size="25" maxlength="30" value="' . $account['callerid'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("extension") . '*</td>
<td align="left"><input type="text" id="extension" name="extension" size="25" maxlength="15" value="' . $account['extension'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("dynamic agent") . '</td>
<td align="left"><input type="text" id="agent" name="agent" size="25" maxlength="15" value="' . $account['agent'] . '"></td>
</tr>
<tr><td nowrap align="left">' . $locate->Translate("extensions") . '</td>
<td align="left">';
if ($account['extensions'] == '') {
$html .= '<input type="text" id="extensions" name="extensions" size="25" maxlength="100" onclick="chkExtenionClick(this.value,this)" onblur="chkExtenionBlur(this.value,this)" style="color:#BBB" value="' . $locate->translate('extensions_input_tip') . '">';
} else {
$html .= '<input type="text" id="extensions" name="extensions" size="25" maxlength="100" onclick="chkExtenionClick(this.value,this)" onblur="chkExtenionBlur(this.value,this)" value="' . $account['extensions'] . '">';
}
$html .= '
<input type="radio" value="username" id="extensType" name="extensType" checked>' . $locate->Translate("username") . '<input type="radio" value="extension" id="extensType" name="extensType" >' . $locate->Translate("extension") . '</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("channel") . '</td>
<td align="left"><input type="text" id="channel" name="channel" size="25" maxlength="30" value="' . $account['channel'] . '"></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("usertype") . '*</td>
<td align="left">
<select id="usertypeSelect" onchange="usertypeChange(this)">
<option value="0" ';
if ($account['usertype'] == '') {
$html .= ' selected ';
}
$html .= '></option>
<option value="0"';
if ($account['usertype'] == 'agent') {
$html .= ' selected ';
}
$html .= ' >agent</option>
<option value="0"';
if ($account['usertype'] == 'groupadmin') {
$html .= ' selected ';
}
$html .= '>groupadmin</option>';
if ($_SESSION['curuser']['usertype'] == 'admin') {
$html .= '<option value="0"';
if ($account['usertype'] == 'admin') {
$html .= ' selected ';
}
$html .= '>admin</option>';
}
$userTyperesult = Customer::getAstercrmUsertype();
if (!empty($userTyperesult)) {
//.........这里部分代码省略.........
示例10: formAdd
//.........这里部分代码省略.........
} else {
$enable_html = '<tr>
<td colspan=2>
<input type="radio" value="1" id="radEnable" name="radEnable" >' . $locate->Translate("enable") . '
<input type="radio" value="0" id="radEnable" name="radEnable" checked>' . $locate->Translate("disable");
}
$enable_html .= '<input type="button" onclick="xajax_setSurvey(xajax.getFormValues(\'f\'));return false;" value="' . $locate->Translate("update") . '">
</td>
</tr>';
}
$options = Customer::getOptions($surveyid);
if ($options) {
$ind = 0;
while ($options->fetchInto($row)) {
$nameRow = "formDivRow" . $row['id'];
$nameCell = $nameRow . "Col" . $ind;
$html .= '<tr id="' . $nameRow . '" >' . "\n";
$item_html = "";
if ($row['optiontype'] == "text") {
} else {
$item_html = '(<a href=? onclick="showItem(\'' . $row['id'] . '\');return false;">' . $locate->Translate("Item") . '</a>)';
}
$option_item_number = astercrm::getCountByField("optionid", $row['id'], "surveyoptionitems");
$html .= '
<td align="left" width="25%">' . $locate->Translate("option") . '(<a href="?" onclick="xajax_edit(\'' . $surveyid . '\',\'' . $row['id'] . '\');return false;"><img src="skin/default/images/edit.png"></a><a href="?" onclick="deleteOption(\'' . $row['id'] . '\',\'' . $nameRow . '\');return false;"><img src="skin/default/images/trash.png"></a>)' . $item_html . '
</td><td id="' . $nameCell . '" >' . $row['surveyoption'] . "(" . $locate->Translate($row['optiontype']) . ", {$option_item_number} " . $locate->Translate('items') . ")" . '</td></tr>
<tr>
<td align="left" width="25%">' . $locate->Translate("Option Note") . '</td>
<td id="' . $nameCell . '_note">' . $row['optionnote'] . '</td>
</tr>
<tr><td colspan="2" height="1" bgcolor="#ccc"></td></tr>
';
$ind++;
}
}
$html .= '<tr><td colspan=2>
' . $locate->Translate("option") . '
</td></tr>';
if ($optionid == 0) {
$button_value = $locate->Translate("Add Option");
$optionid = 0;
} else {
$button_value = $locate->Translate("Update Option");
$option = astercrm::getRecordById($optionid, "surveyoptions");
$optiontype[$option['optiontype']] = "selected";
}
$html .= '<tr><td colspan=2>' . $locate->Translate("Title") . ':
<input type="text" size="50" maxlength="50" id="surveyoption" name="surveyoption" value="' . $option['surveyoption'] . '"/>
<SELECT id="optiontype" name="optiontype">
<option value="radio" ' . $optiontype['radio'] . '>' . $locate->Translate("Radio") . '</option>
<option value="checkbox" ' . $optiontype['checkbox'] . '>' . $locate->Translate("Checkbox") . '</option>
<option value="text" ' . $optiontype['text'] . '>' . $locate->Translate("Text") . '</option>
</SELECT>
</td></tr>';
$html .= '<tr><td colspan=2>' . $locate->Translate("Note") . ':
<input type="text" size="50" maxlength="254" id="optionnote" name="optionnote" value="' . $option['optionnote'] . '"/>
<input type="button" value="' . $button_value . '" onclick="addOption(\'f\',\'' . $optionid . '\');return false;">
</td></tr>';
$html .= $enable_html;
if ($_SESSION['curuser']['usertype'] == 'admin') {
$res = Customer::getGroups();
$groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
while ($row = $res->fetchRow()) {
$groupoptions .= '<option value="' . $row['groupid'] . '"';
if ($survey['groupid'] == $row['groupid']) {
$groupoptions .= ' selected';
}
$groupoptions .= '>' . $row['groupname'] . '</option>';
}
$groupoptions .= '</select>';
} else {
$groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
}
if ($survey['campaignid'] == 0) {
$campaignoptions = '<option value="0">' . $locate->Translate("All") . '</option>';
}
$campaignres = Customer::getRecordsByGroupid($survey['groupid'], "campaign");
while ($row = $campaignres->fetchRow()) {
$campaignoptions .= '<option value="' . $row['id'] . '"';
if ($survey['campaignid'] == $row['id']) {
$campaignoptions .= ' selected';
}
$campaignoptions .= '>' . $row['campaignname'] . '</option>';
}
$html .= '
<tr>
<td align="left" width="25%">' . $locate->Translate("Group Name") . '</td>
<td>' . $groupoptions . '</td>
</tr>
<tr>
<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '*</td>
<td><SELECT id="campaignid" name="campaignid">' . $campaignoptions . '</SELECT></td>
</tr>';
$html .= '
</table>
</form>
' . $locate->Translate("obligatory_fields") . '
';
return $html;
}
示例11: getCarriersByZoneID
function getCarriersByZoneID($id_zone)
{
global $cookie, $cart;
$id_groups = array(1);
$islogged = _PS_VERSION_ > '1.5' ? Context::getContext()->customer->isLogged() : $cookie->isLogged();
if ($islogged) {
$customer = new Customer((int) $cookie->id_customer);
$id_groups = $customer->getGroups();
}
$result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone), $id_groups, Carrier::ALL_CARRIERS);
$resultsArray = array();
foreach ($result as $k => $row) {
$carrier = new Carrier(intval($row['id_carrier']));
$shipping_method = $carrier->getShippingMethod();
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or $shipping_method == Carrier::SHIPPING_METHOD_PRICE and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
unset($result[$k]);
continue;
}
if ($row['range_behavior']) {
if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), $id_zone)) {
unset($result[$k]);
continue;
}
}
$row['name'] = strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME');
$method = $carrier->getShippingMethod();
$row['price'] = 0;
if ($method == Carrier::SHIPPING_METHOD_PRICE) {
$row['price'] = $carrier->getDeliveryPriceByPrice($cart->getOrderTotal(Cart::BOTH_WITHOUT_SHIPPING), $id_zone);
} else {
if ($method == Carrier::SHIPPING_METHOD_WEIGHT) {
$row['price'] = $carrier->getDeliveryPriceByWeight($cart->getTotalWeight(), $id_zone);
}
}
if ((int) $row['shipping_handling'] == 1) {
$row['price'] = (double) $row['price'] + (double) Configuration::get('PS_SHIPPING_HANDLING');
}
if ((int) $row['is_free']) {
$row['price'] = 0;
}
$row['price_tax_exc'] = $row['price'];
$address = new Address($cart->id_address_delivery);
$tax_rate = $carrier->getTaxesRate($address);
$currency = new Currency($cart->id_currency);
$row['price'] = $row['price'] * $currency->conversion_rate * (1 + (double) $tax_rate / 100);
$row['img'] = file_exists(_PS_SHIP_IMG_DIR_ . intval($row['id_carrier']) . '.jpg') ? _THEME_SHIP_DIR_ . intval($row['id_carrier']) . '.jpg' : '';
$resultsArray[] = $row;
}
return $resultsArray;
}
示例12: formDiallistAdd
function formDiallistAdd($userexten, $customerid)
{
global $locate;
// echo $userexten.$customerid;exit;
if ($_SESSION['curuser']['usertype'] == 'admin') {
$res = Customer::getGroups();
$groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
while ($row = $res->fetchRow()) {
$groupoptions .= '<option value="' . $row['groupid'] . '"';
$groupoptions .= '>' . $row['groupname'] . '</option>';
}
$groupoptions .= '</select>';
$assignoptions = '<input type="text" id="assign" name="assign" size="35"">';
} elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') {
$groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
$res = Customer::getRecordsByField('groupid', $_SESSION['curuser']['groupid'], 'astercrm_account');
$assignoptions .= '<select name="assign" id="assign">';
$assignoptions .= '<option value="">' . $locate->Translate("none") . '</option>';
while ($row = $res->fetchRow()) {
$assignoptions .= '<option value="' . $row['extension'] . '"';
$assignoptions .= '>' . $row['extension'] . '</option>';
}
$assignoptions .= '</select>';
} else {
$groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
$assignoptions = '<input type="text" id="assign" name="assign" size="35" value="' . $_SESSION['curuser']['extension'] . '" disabled><input type="hidden" id="assign" name="assign" value="' . $_SESSION['curuser']['extension'] . '">';
}
$customernamehtml = '';
if ($userexten != '' && $customerid > 0) {
$res_customer = astercrm::getRecordById($customerid, 'customer');
$res_contact = astercrm::getContactListByID($customerid);
$numberblank = '<select name="dialnumber" id="dialnumber">';
if ($res_customer['phone'] != '') {
$numberblank .= '<option value="' . $res_customer['phone'] . '">' . $res_customer['phone'] . '</option>';
}
if ($res_customer['mobile'] != '') {
$numberblank .= '<option value="' . $res_customer['mobile'] . '">' . $res_customer['mobile'] . '</option>';
}
while ($res_contact->fetchInto($row)) {
if ($row['phone'] != '') {
$numberblank .= '<option value="' . $row['phone'] . '">' . $row['phone'] . '</option>';
}
if ($row['phone1'] != '') {
$numberblank .= '<option value="' . $row['phone1'] . '">' . $row['phone1'] . '</option>';
}
if ($row['phone2'] != '') {
$numberblank .= '<option value="' . $row['phone2'] . '">' . $row['phone2'] . '</option>';
}
if ($row['mobile'] != '') {
$numberblank .= '<option value="' . $row['mobile'] . '">' . $row['mobile'] . '</option>';
}
}
$numberblank .= '</select>';
$saveHtml = '
<tr>
<td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="xajax_saveDiallist(xajax.getFormValues(\'formaddDiallist\'),\'' . $userexten . '\',\'' . $customerid . '\');return false;"></td>
</tr>
<table>
</form>
';
} else {
$numberblank = '<input name="dialnumber" id="dialnumber">';
$customernamehtml = '<tr>
<td nowrap align="left">' . $locate->Translate("Customer Name") . '</td>
<td align="left"><input name="customername" id="customername"></td>
</tr>';
$saveHtml = '
<tr>
<td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="saveDiallistMain(xajax.getFormValues(\'formaddDiallist\'));return false;"></td>
</tr>
<table>
</form>
';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="formaddDiallist" id="formaddDiallist">
<table border="1" width="100%" class="adminlist">' . $customernamehtml . '
<tr>
<td nowrap align="left">' . $locate->Translate("Dialnumber") . '*</td>
<td align="left">' . $numberblank . '</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Assign To") . '</td>
<td align="left">
' . $assignoptions . '
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Call Order") . '</td>
<td align="left">
<input type="text" id="callOrder" name="callOrder" size="20" value="1">
</td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Dialtime") . '</td>
<td align="left">
<input type="text" id="dialtime" name="dialtime" size="20" value="' . date("Y-m-d H:i", time()) . '">
<INPUT onclick="displayCalendar(document.getElementById(\'dialtime\'),\'yyyy-mm-dd hh:ii\',this,true)" type="button" value="Cal">
//.........这里部分代码省略.........
示例13: formEdit
/**
* Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param $id (int) Identificador del registro a ser editado.
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos
* a extraidos de la base de datos para ser editados
*/
function formEdit($id)
{
global $locate, $db;
$worktimes =& Customer::getRecordByID($id, 'worktimes');
if ($_SESSION['curuser']['usertype'] == 'admin') {
$grouphtml .= '<select name="groupid" id="groupid" >
<option value=""></option>';
$res = Customer::getGroups();
while ($row = $res->fetchRow()) {
$grouphtml .= '<option value="' . $row['groupid'] . '"';
if ($row['groupid'] == $worktimes['groupid']) {
$grouphtml .= ' selected ';
}
$grouphtml .= '>' . $row['groupname'] . '</option>';
}
$grouphtml .= '</select>';
} else {
$grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="f" id="f">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left"><input type="hidden" id= "id" name="id" value="' . $worktimes['id'] . '">' . $locate->Translate("Time") . '*</td>
<td align="left">' . $locate->Translate("From") . ': <input id="starttime" name="starttime" type="text" value="' . $worktimes['starttime'] . '" readonly onclick="showTimeList(\'timelist\');_SetTime(this)"/> ' . $locate->Translate("To") . ': <input id="endtime" name="endtime" type="text" value="' . $worktimes['endtime'] . '" readonly onclick="showTimeList(\'timelist\');_SetTime(this)"/><div id="timelist" ></div></td>
</tr>
<tr>
<td nowrap align="left">' . $locate->Translate("Week") . '*</td>
<td align="left">' . $locate->Translate("From") . ':
<SELECT id="startweek" name="startweek">
<OPTION value="1"';
if ($worktimes['startweek'] == 1) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Monday") . '</OPTION>
<OPTION value="2"';
if ($worktimes['startweek'] == 2) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Tuesday") . '</OPTION>
<OPTION value="3"';
if ($worktimes['startweek'] == 3) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Wednesday") . '</OPTION>
<OPTION value="4"';
if ($worktimes['startweek'] == 4) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Thursday") . '</OPTION>
<OPTION value="5"';
if ($worktimes['startweek'] == 5) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Friday") . '</OPTION>
<OPTION value="6"';
if ($worktimes['startweek'] == 6) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Saturday") . '</OPTION>
<OPTION value="7"';
if ($worktimes['startweek'] == 7) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Sunday") . '</OPTION>
</SELECT> ' . $locate->Translate("To") . ':
<SELECT id="endweek" name="endweek">
<OPTION value="1"';
if ($worktimes['endweek'] == 1) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Monday") . '</OPTION>
<OPTION value="2"';
if ($worktimes['endweek'] == 2) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Tuesday") . '</OPTION>
<OPTION value="3"';
if ($worktimes['endweek'] == 3) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Wednesday") . '</OPTION>
<OPTION value="4"';
if ($worktimes['endweek'] == 4) {
$html .= 'selected';
}
$html .= '>' . $locate->Translate("Thursday") . '</OPTION>
<OPTION value="5"';
if ($worktimes['endweek'] == 5) {
$html .= 'selected';
}
//.........这里部分代码省略.........
示例14: getCarriersListForCart
/**
* @return array
*/
public function getCarriersListForCart()
{
$carrier_list = array();
//$currency = Currency::getCurrency($this->cart->id_currency);
$country_code = Tools::strtoupper(Configuration::get('PS_LOCALE_COUNTRY'));
$country = new Country(Country::getByIso($country_code));
$cart_products = $this->cart->getProducts();
$free_shipping = false;
// turned off for 1.4
if (version_compare(_PS_VERSION_, '1.5', 'gt')) {
foreach ($this->cart->getCartRules() as $rule) {
if ($rule['free_shipping']) {
$free_shipping = true;
break;
}
}
}
if ($this->cart->id_carrier > 0) {
$selected_carrier = new Carrier($this->cart->id_carrier);
$shipping_method = $selected_carrier->getShippingMethod();
if ($free_shipping == false) {
if (version_compare(_PS_VERSION_, '1.5', 'lt')) {
$price = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $this->cart->getOrderShippingCost((int) $this->cart->id_carrier, true, $country, $cart_products);
//$price_tax_exc = ($shipping_method == Carrier::SHIPPING_METHOD_FREE
//? 0 : $this->cart->getOrderShippingCost((int)$this->cart->id_carrier, false, $country, $cart_products));
} else {
$price = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $this->cart->getPackageShippingCost((int) $this->cart->id_carrier, true, $country, $cart_products);
//$price_tax_exc = ($shipping_method == Carrier::SHIPPING_METHOD_FREE
//? 0 : $this->cart->getPackageShippingCost((int)$this->cart->id_carrier, false, $country, $cart_products));
}
//$tax_amount = $price - $price_tax_exc;
} else {
$price = 0;
//$price_tax_exc = 0;
//$tax_amount = 0;
}
if ((int) $selected_carrier->active == 1) {
$carrier_list['shippingMethods'][] = array('name' => $selected_carrier->name . ' (' . $selected_carrier->id . ')', 'country' => $country->iso_code, 'price' => $this->toAmount($price));
}
} else {
$i = 0;
if ((int) $this->context->cookie->id_customer > 0) {
$customer = new Customer((int) $this->context->cookie->id_customer);
$address = new Address((int) $this->cart->id_address_delivery);
$id_zone = Address::getZoneById((int) $address->id);
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
} else {
$carriers = Carrier::getCarriers((int) $this->cart->id_lang, true);
}
if ($carriers) {
foreach ($carriers as $carrier) {
$c = new Carrier((int) $carrier['id_carrier']);
$shipping_method = $c->getShippingMethod();
if ($free_shipping == false) {
if (version_compare(_PS_VERSION_, '1.5', 'lt')) {
$price = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $this->cart->getOrderShippingCost((int) $carrier['id_carrier'], true, $country, $cart_products);
//$price_tax_exc = ($shipping_method == Carrier::SHIPPING_METHOD_FREE
//? 0 : $this->cart->getOrderShippingCost((int)$carrier['id_carrier'], false, $country, $cart_products));
} else {
$price = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $this->cart->getPackageShippingCost((int) $carrier['id_carrier'], true, $country, $cart_products);
//$price_tax_exc = ($shipping_method == Carrier::SHIPPING_METHOD_FREE
//? 0 : $this->cart->getPackageShippingCost((int)$carrier['id_carrier'], false, $country, $cart_products));
}
//$tax_amount = $price - $price_tax_exc;
} else {
$price = 0;
//$price_tax_exc = 0;
//$tax_amount = 0;
}
if ($carrier['id_carrier'] != $this->cart->id_carrier) {
if ((int) $carrier['active'] == 1) {
$carrier_list['shippingMethods'][] = array('name' => $carrier['name'] . ' (' . $carrier['id_carrier'] . ')', 'country' => $country->iso_code, 'price' => $this->toAmount($price));
$i++;
}
}
}
}
}
return $carrier_list;
}
示例15: getCarriers
public function getCarriers()
{
global $cookie, $cart;
// code taken from ParentOrderController::_assignCarrier()
$customer = new Customer((int) $cookie->id_customer);
$address = new Address((int) $cart->id_address_delivery);
$id_zone = Address::getZoneById((int) $address->id);
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
return $carriers;
}