本文整理汇总了PHP中Carrier类的典型用法代码示例。如果您正苦于以下问题:PHP Carrier类的具体用法?PHP Carrier怎么用?PHP Carrier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Carrier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createDejalaCarrier
/**
* creates of a dejala carrier corresponding to $dejalaProduct
*/
public static function createDejalaCarrier($dejalaConfig, $dejalaProduct)
{
// MFR091130 - get id zone from the country used in the module (if the store zones were customized) - default is 1 (Europe)
$id_zone = 1;
$moduleCountryIsoCode = strtoupper($dejalaConfig->country);
$countryID = Country::getByIso($moduleCountryIsoCode);
if (intval($countryID)) {
$id_zone = Country::getIdZone($countryID);
}
$vatRate = floatval($dejalaProduct['vat']);
// MFR091130 - get or create the tax & attach it to our zone if needed
$id_tax = Tax::getTaxIdByRate($vatRate);
if (!$id_tax) {
$tax = new Tax();
$tax->rate = $vatRate;
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
$tax->name[$defaultLanguage] = $tax->rate . '%';
$tax->add();
$id_tax = Tax::getTaxIdByRate($vatRate);
}
if (!Tax::zoneHasTax($id_tax, $id_zone)) {
// MFR : direct call because $tax->addZone($id_zone) causes errors when called
Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'tax_zone` (`id_tax` , `id_zone`) VALUES (' . intval($id_tax) . ', ' . intval($id_zone) . ')');
}
$carrier = new Carrier();
$carrier->name = 'dejala';
$carrier->id_tax = $id_tax;
$carrier->url = 'http://tracking.dejala.' . $dejalaConfig->country . '/tracker/@';
$carrier->active = true;
$carrier->deleted = 0;
$carrier->shipping_handling = false;
$carrier->range_behavior = 0;
$carrier->is_module = 1;
$languages = Language::getLanguages(true);
foreach ($languages as $language) {
if ($language['iso_code'] == 'fr') {
$carrier->delay[$language['id_lang']] = utf8_encode('Quand vous voulez... Par coursier, ' . $dejalaProduct['timelimit'] . 'H');
}
if ($language['iso_code'] == 'en') {
$carrier->delay[$language['id_lang']] = utf8_encode('When you want... Dispatch rider, ' . $dejalaProduct['timelimit'] . 'H range');
}
if ($language['iso_code'] == 'es') {
$carrier->delay[$language['id_lang']] = utf8_encode('Cuando quiera... Por mensajero, ' . $dejalaProduct['timelimit'] . 'H');
}
}
$carrier->add();
$sql = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_zone` (`id_carrier` , `id_zone`) VALUES (' . intval($carrier->id) . ', ' . intval($id_zone) . ')';
Db::getInstance()->Execute($sql);
$rangeW = new RangeWeight();
$rangeW->id_carrier = $carrier->id;
$rangeW->delimiter1 = 0;
$rangeW->delimiter2 = $dejalaProduct['max_weight'];
$rangeW->add();
$vat_factor = 1 + $dejalaProduct['vat'] / 100;
$priceTTC = round($dejalaProduct['price'] * $vat_factor + $dejalaProduct['margin'], 2);
$priceHT = round($priceTTC / $vat_factor, 2);
$priceList = '(NULL' . ',' . $rangeW->id . ',' . $carrier->id . ',' . $id_zone . ',' . $priceHT . ')';
$carrier->addDeliveryPrice($priceList);
return new Carrier($carrier->id);
}
开发者ID:vincent,项目名称:theinvertebrates,代码行数:63,代码来源:dejalacarrierutils.php
示例2: deleteCarriers
public function deleteCarriers()
{
foreach ($this->getValue('carrierList') as $ck => $cn) {
$carrier = new \Carrier((int) \Configuration::get($ck));
$carrier->delete();
\Configuration::deleteByName($ck);
}
return true;
}
开发者ID:panvagenas,项目名称:acs-web-services-for-prestashop,代码行数:9,代码来源:ACSWSOptions.php
示例3: displayOrderStep
function displayOrderStep($params)
{
global $smarty, $cart, $cookie, $defaultCountry;
if ($isVirtualCart = $cart->isVirtualCart()) {
$cart->id_carrier = 0;
$cart->update();
}
$smarty->assign('virtual_cart', $isVirtualCart);
$address = new Address(intval($cart->id_address_delivery));
$id_zone = Address::getZoneById($address->id);
$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']));
if (Configuration::get('PS_SHIPPING_METHOD') and !$carrier->getMaxDeliveryPriceByWeight($id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !$carrier->getMaxDeliveryPriceByPrice($id_zone)) {
unset($result[$k]);
continue;
}
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);
}
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->getOrderTotalLC(true, 4), $id_zone)) {
unset($result[$k]);
continue;
}
}
$row['name'] = strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME');
$row['price'] = $cart->getOrderShippingCostLC(intval($row['id_carrier']));
$row['price_tax_exc'] = $cart->getOrderShippingCostLC(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' : '';
$row['extra'] = Module::hookExec('extraCarrierDetails', array("row" => $row, "carrier" => $carrier));
$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_exc = $wrapping_fees / (1 + floatval($wrapping_fees_tax->rate) / 100);
if (Validate::isUnsignedInt($cart->id_carrier)) {
$carrier = new Carrier(intval($cart->id_carrier));
if ($carrier->active and !$carrier->deleted) {
$checked = intval($cart->id_carrier);
}
}
if (!isset($checked)) {
$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')), '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), 'back' => strval(Tools::getValue('back')), 'total_wrapping' => number_format($wrapping_fees, 2, '.', ''), 'total_wrapping_tax_exc' => number_format($wrapping_fees_tax_exc, 2, '.', '')));
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';
echo $this->display(__FILE__, 'ordercarrier.tpl');
}
开发者ID:redb,项目名称:prestashop,代码行数:57,代码来源:ordercarrier.php
示例4: installCarriers
public function installCarriers()
{
$id_lang_default = Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'));
$carriers_list = array('MYMOD_CA_CLDE' => 'Classic delivery', 'MYMOD_CA_REPO' => 'Relay Point');
foreach ($carriers_list as $carrier_key => $carrier_name) {
if (Configuration::get($carrier_key) < 1) {
// Create new carrier
$carrier = new Carrier();
$carrier->name = $carrier_name;
$carrier->id_tax_rules_group = 0;
$carrier->active = 1;
$carrier->deleted = 0;
foreach (Language::getLanguages(true) as $language) {
$carrier->delay[(int) $language['id_lang']] = 'Delay ' . $carrier_name;
}
$carrier->shipping_handling = false;
$carrier->range_behavior = 0;
$carrier->is_module = true;
$carrier->shipping_external = true;
$carrier->external_module_name = $this->name;
$carrier->need_range = true;
if (!$carrier->add()) {
return false;
}
// Associate carrier to all groups
$groups = Group::getGroups(true);
foreach ($groups as $group) {
Db::getInstance()->insert('carrier_group', array('id_carrier' => (int) $carrier->id, 'id_group' => (int) $group['id_group']));
}
// Create price range
$rangePrice = new RangePrice();
$rangePrice->id_carrier = $carrier->id;
$rangePrice->delimiter1 = '0';
$rangePrice->delimiter2 = '10000';
$rangePrice->add();
// Create weight range
$rangeWeight = new RangeWeight();
$rangeWeight->id_carrier = $carrier->id;
$rangeWeight->delimiter1 = '0';
$rangeWeight->delimiter2 = '10000';
$rangeWeight->add();
// Associate carrier to all zones
$zones = Zone::getZones(true);
foreach ($zones as $zone) {
Db::getInstance()->insert('carrier_zone', array('id_carrier' => (int) $carrier->id, 'id_zone' => (int) $zone['id_zone']));
Db::getInstance()->insert('delivery', array('id_carrier' => (int) $carrier->id, 'id_range_price' => (int) $rangePrice->id, 'id_range_weight' => NULL, 'id_zone' => (int) $zone['id_zone'], 'price' => '0'));
Db::getInstance()->insert('delivery', array('id_carrier' => (int) $carrier->id, 'id_range_price' => NULL, 'id_range_weight' => (int) $rangeWeight->id, 'id_zone' => (int) $zone['id_zone'], 'price' => '0'));
}
// Copy the carrier logo
copy(dirname(__FILE__) . '/views/img/' . $carrier_key . '.jpg', _PS_SHIP_IMG_DIR_ . '/' . (int) $carrier->id . '.jpg');
// Save the carrier ID in the Configuration table
Configuration::updateValue($carrier_key, $carrier->id);
}
}
return true;
}
开发者ID:andregugliotti,项目名称:mymodcarrier,代码行数:56,代码来源:mymodcarrier.php
示例5: xdUninstall
public function xdUninstall()
{
foreach ($this->Options->getValue('carrierList') as $carrier_key => $carrier_name) {
$carrierId = \Configuration::get($carrier_key);
if ($carrierId > 0) {
$carrier = new \Carrier($carrierId);
$carrier->delete();
}
}
return true;
}
开发者ID:panvagenas,项目名称:elta-courier-for-prestashop,代码行数:11,代码来源:Installer.php
示例6: add
/**
* Override add to create delivery value for all zones
* @see classes/ObjectModelCore::add()
*
* @param bool $null_values
* @param bool $autodate
* @return bool Insertion result
*/
public function add($autodate = true, $null_values = false)
{
if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this)) {
return false;
}
$carrier = new Carrier((int) $this->id_carrier);
$price_list = array();
foreach ($carrier->getZones() as $zone) {
$price_list[] = array('id_range_price' => (int) $this->id, 'id_range_weight' => 0, 'id_carrier' => (int) $this->id_carrier, 'id_zone' => (int) $zone['id_zone'], 'price' => 0);
}
$carrier->addDeliveryPrice($price_list);
return true;
}
开发者ID:ekachandrasetiawan,项目名称:BeltcareCom,代码行数:21,代码来源:RangePrice.php
示例7: uninstall
public function uninstall()
{
if (!parent::uninstall()) {
return false;
}
$carrier = new Carrier(Configuration::get('MY_CARRIR_ID'));
$carrier->deleted = 1;
if (!$carrier->add()) {
return false;
}
if (!Configuration::deleteByName('MY_CARRIER_ID')) {
return false;
}
return true;
}
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:15,代码来源:MyCarrier.php
示例8: getContent
function getContent()
{
$configKeys = array('EBAY_SECURITY_TOKEN', 'PS_LANG_DEFAULT');
// Load prestashop ebay's configuration
$configs = Configuration::getMultiple($configKeys);
$profile_configs = $this->ebay_profile->getMultiple(array('EBAY_DELIVERY_TIME', 'EBAY_ZONE_NATIONAL', 'EBAY_ZONE_INTERNATIONAL'));
// Check if the module is configured
if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
$template_vars = array('error_form_shipping' => 'true');
return $this->display('error_paypal_email.tpl', $template_vars);
}
$nb_shipping_zones_excluded = DB::getInstance()->getValue('SELECT COUNT(*)
FROM ' . _DB_PREFIX_ . 'ebay_shipping_zone_excluded
WHERE `id_ebay_profile` = ' . (int) $this->ebay_profile->id);
if (!$nb_shipping_zones_excluded) {
EbayShippingZoneExcluded::loadEbayExcludedLocations($this->ebay_profile->id);
}
$module_filters = version_compare(_PS_VERSION_, '1.4.5', '>=') ? Carrier::CARRIERS_MODULE : 2;
//INITIALIZE CACHE
$psCarrierModule = $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT'], false, false, false, null, $module_filters);
$url_vars = array('id_tab' => '3', 'section' => 'shipping');
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$url_vars['controller'] = Tools::getValue('controller');
} else {
$url_vars['tab'] = Tools::getValue('tab');
}
$zones = Zone::getZones(true);
foreach ($zones as &$zone) {
$zone['carriers'] = Carrier::getCarriers($this->context->language->id, false, false, $zone['id_zone']);
}
$template_vars = array('eBayCarrier' => EbayShippingService::getCarriers($this->ebay_profile->ebay_site_id), 'psCarrier' => $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT']), 'psCarrierModule' => $psCarrierModule, 'existingNationalCarrier' => EbayShipping::getNationalShippings($this->ebay_profile->id), 'existingInternationalCarrier' => EbayShippingInternationalZone::getExistingInternationalCarrier($this->ebay_profile->id), 'deliveryTime' => $profile_configs['EBAY_DELIVERY_TIME'], 'prestashopZone' => Zone::getZones(), 'excludeShippingLocation' => EbayShippingZoneExcluded::cacheEbayExcludedLocation($this->ebay_profile->id), 'internationalShippingLocations' => EbayShippingLocation::getInternationalShippingLocations(), 'deliveryTimeOptions' => EbayDeliveryTimeOptions::getDeliveryTimeOptions(), 'formUrl' => $this->_getUrl($url_vars), 'ebayZoneNational' => isset($profile_configs['EBAY_ZONE_NATIONAL']) ? $profile_configs['EBAY_ZONE_NATIONAL'] : false, 'ebayZoneInternational' => isset($profile_configs['EBAY_ZONE_INTERNATIONAL']) ? $profile_configs['EBAY_ZONE_INTERNATIONAL'] : false, 'ebay_token' => $configs['EBAY_SECURITY_TOKEN'], 'id_ebay_profile' => $this->ebay_profile->id, 'newPrestashopZone' => $zones);
return $this->display('shipping.tpl', $template_vars);
}
开发者ID:kevindesousa,项目名称:ebay,代码行数:33,代码来源:EbayFormShippingTab.php
示例9: getOptionFields
protected function getOptionFields()
{
$forms = array();
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$carriers = Carrier::getCarriers($this->context->language->id, true);
$modules = Module::getModulesOnDisk(true);
$forms = array('payment' => array('title' => $this->l('Average bank fees per payment method'), 'id' => 'payment'), 'carriers' => array('title' => $this->l('Average shipping fees per shipping method'), 'id' => 'carriers'), 'other' => array('title' => $this->l('Other settings'), 'id' => 'other'));
foreach ($forms as &$form) {
$form['icon'] = 'tab-preferences';
$form['fields'] = array();
$form['submit'] = array('title' => $this->l('Save'));
}
foreach ($modules as $module) {
if (isset($module->tab) && $module->tab == 'payments_gateways' && $module->id) {
$moduleClass = Module::getInstanceByName($module->name);
if (!$moduleClass->isEnabledForShopContext()) {
continue;
}
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed in %1$s with %2$s.'), $currency->iso_code, $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed in %1$s with %2$s. It will be applied on the total paid with taxes.'), $currency->iso_code, $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
if (Currency::isMultiCurrencyActivated()) {
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed with a foreign currency with %s.'), $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed with a foreign currency with %s. It will be applied on the total paid with taxes.'), $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
}
}
foreach ($carriers as $carrier) {
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the domestic delivery costs in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP_OVERSEAS'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the overseas delivery costs in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
$forms['carriers']['description'] = $this->l('Method: Indicate the percentage of your carrier margin. For example, if you charge $10 of shipping fees to your customer for each shipment, but you really pay $4 to this carrier, then you should indicate "40" in the percentage field.');
$forms['other']['fields']['CONF_AVERAGE_PRODUCT_MARGIN'] = array('title' => $this->l('Average gross margin'), 'desc' => $this->l('You should calculate this percentage as follows: ((total sales revenue) - (cost of goods sold)) / (total sales revenue) * 100. This value is only used to calculate the Dashboard approximate gross margin, if you do not specify the wholesale price for each product.'), 'validation' => 'isPercentage', 'cast' => 'intval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['other']['fields']['CONF_ORDER_FIXED'] = array('title' => $this->l('Other fees per order'), 'desc' => $this->l('You should calculate this value by making the sum of all of your additional costs per order.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
return $forms;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:35,代码来源:AdminDashboardController.php
示例10: 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();
}
}
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:34,代码来源:CartController.php
示例11: getOptionFields
protected function getOptionFields()
{
$forms = array();
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$carriers = Carrier::getCarriers($this->context->language->id, true);
$modules = Module::getModulesOnDisk(true);
$forms = array('payment' => array('title' => $this->l('Average bank fees per payment method'), 'id' => 'payment'), 'carriers' => array('title' => $this->l('Average shipping fees per shipping method'), 'id' => 'carriers'), 'other' => array('title' => $this->l('Other settings'), 'id' => 'other'), 'expenses' => array('title' => $this->l('Other expenses (monthly)'), 'id' => 'expenses'));
foreach ($forms as &$form) {
$form['icon'] = 'tab-preferences';
$form['fields'] = array();
$form['submit'] = array('title' => $this->l('Save'));
}
foreach ($modules as $module) {
if ($module->tab == 'payments_gateways' && $module->id) {
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed in %1$s with %2$s.'), $currency->iso_code, $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed in %1$s with %2$s. It will be applied on the total paid with taxes.'), $currency->iso_code, $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
if (Currency::isMultiCurrencyActivated()) {
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed with a foreign currency with %s.'), $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed with a foreign currency with %s. It will be applied on the total paid with taxes.'), $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
}
}
foreach ($carriers as $carrier) {
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('%% of what you charged the customer for domestic delivery with %s.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP_OVERSEAS'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('%% of what you charged the customer for overseas delivery with %s.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
$forms['other']['fields']['CONF_AVERAGE_PRODUCT_MARGIN'] = array('title' => $this->l('Average gross margin (Selling price / Buying price)'), 'desc' => $this->l('Only used if you do not specify your buying price for each product.'), 'validation' => 'isPercentage', 'cast' => 'intval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['other']['fields']['CONF_ORDER_FIXED'] = array('title' => $this->l('Other fee per order'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$expense_types = array('hosting' => $this->l('Hosting'), 'tools' => $this->l('Tools (E-mailing, etc.)'), 'acounting' => $this->l('Accounting'), 'development' => $this->l('Development'), 'marketing' => $this->l('Marketing (Adwords, etc.)'), 'others' => $this->l('Others'));
foreach ($expense_types as $expense_type => $expense_label) {
$forms['expenses']['fields']['CONF_MONTHLY_' . strtoupper($expense_type)] = array('title' => $expense_label, 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
}
return $forms;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:34,代码来源:AdminDashboardController.php
示例12: _displayForm
private function _displayForm()
{
$this->_html .= '
<form method="post" action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">
<fieldset>
<legend><img src="' . $this->_path . 'logo.png" width="16" height="16"/>' . $this->l('Settings') . '</legend>
<label>' . $this->l('Carrier') . '</label>
<div class="margin-form">
<select name="STORE_DELIVERY_CARRIER">';
foreach (Carrier::getCarriers($this->context->language->id) as $carrier) {
$this->_html .= '<option value="' . $carrier['id_carrier'] . '"' . ($carrier['id_carrier'] == Configuration::get('STORE_DELIVERY_CARRIER') ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option>';
}
$this->_html .= '</select>
<p class="clear">' . $this->l('Choose here a carrier used for the delivery in store') . '</p>
</div>
<div class="clear"></div>
<label>' . $this->l('Send email to store to prevent new order') . '</label>
<div class="margin-form">
<input type="radio" name="STORE_DELIVERY_SEND_MAIL" id="sendmail_on" value="1" ' . (Configuration::get('STORE_DELIVERY_SEND_MAIL') == '1' ? 'checked="checked" ' : '') . '/>
<label class="t" for="sendmail_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="STORE_DELIVERY_SEND_MAIL" id="sendmail_off" value="0" ' . (Configuration::get('STORE_DELIVERY_SEND_MAIL') == '0' ? 'checked="checked" ' : '') . '/>
<label class="t" for="sendmail_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
<p class="clear">' . $this->l('You must enter email address in each store admin') . '</p>
</div>
<div class="clear"></div>
<label>' . $this->l('Display Google Map') . '</label>
<div class="margin-form">
<input type="radio" name="STORE_DELIVERY_DISPLAY_MAP" id="map_on" value="1" ' . (Configuration::get('STORE_DELIVERY_DISPLAY_MAP') == '1' ? 'checked="checked" ' : '') . '/>
<label class="t" for="map_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="STORE_DELIVERY_DISPLAY_MAP" id="map_off" value="0" ' . (Configuration::get('STORE_DELIVERY_DISPLAY_MAP') == '0' ? 'checked="checked" ' : '') . '/>
<label class="t" for="map_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
<p class="clear">' . $this->l("You can display a map of stores. Don't forgot to change default latitude/longitude in Store Contact page (under Preference/Store Contact admin page)") . '</p>
</div>
<div class="clear"></div>
<label>' . $this->l('Height of Google map') . '</label>
<div class="margin-form">
<input type="text" name="STORE_DELIVERY_HEIGHT_MAP" value="' . Configuration::get('STORE_DELIVERY_HEIGHT_MAP') . '"/>
<p class="clear">' . $this->l('Height of map in px (for exemple enter "300px")') . '</p>
</div>
<div class="clear"></div>
<label>' . $this->l('Width of Google map') . '</label>
<div class="margin-form">
<input type="text" name="STORE_DELIVERY_WIDTH_MAP" value="' . Configuration::get('STORE_DELIVERY_WIDTH_MAP') . '"/>
<p class="clear">' . $this->l('Width of map in px or % (for exemple enter "725px" or "100%"...)') . '</p>
</div>
<div class="clear"></div>
<div class="margin-form clear pspace">
<input type="submit" name="submitUpdate" value="' . $this->l('Update') . '" class="button" />
</div>
</fieldset>
</form>';
return $this->_html;
}
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:59,代码来源:storedelivery.php
示例13: upgrade_module_2_9_52
/**
* @param ShopGate $module
*
* @return bool
*/
function upgrade_module_2_9_52($module)
{
$shopgateCarrierId = Configuration::get('SG_CARRIER_ID');
/**
* set current shopgate carrier as deleted
*/
if ($shopgateCarrierId) {
/** @var CarrierCore $carrier */
$carrier = new Carrier($shopgateCarrierId);
$carrier->deleted = true;
$carrier->save();
}
$shopgateShippingModel = new ShopgateShipping($module);
$shopgateShippingModel->createShopgateCarrier();
$module->updateTables();
return true;
}
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:22,代码来源:Upgrade-2.9.52.php
示例14: __construct
/**
* Initializes the class.
*
* @param string $code The provider code.
*
* @return void
*/
public function __construct($code)
{
$providers = array_merge(self::$providers, Carrier::getCarriers());
if (!array_key_exists($code, $providers)) {
return false;
}
$this->code = $code;
$this->name = $providers[$code];
}
开发者ID:dsposito,项目名称:argo,代码行数:16,代码来源:Provider.php
示例15: getCarrierByName
public static function getCarrierByName($name)
{
global $cookie;
$carriers = Carrier::getCarriers($cookie->id_lang, true, false, false, NULL, ALL_CARRIERS);
foreach ($carriers as $carrier) {
if (!$carrier['deleted'] and $carrier['external_module_name'] == $name) {
return new Carrier($carrier['id_carrier']);
}
}
}
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:10,代码来源:dejalacarrierutils.php
示例16: getCarriersList
public function getCarriersList()
{
$carriers = Carrier::getCarriers($this->mCookie->id_lang);
$binded = unserialize(Configuration::get(self::KONFIG_PREFIX . self::KONFIG_POWIAZANIA_KURIEROW));
$list = array();
foreach ($carriers as $key => $c) {
$list[] = new BindedCarrier($c['id_carrier'], $c['name'], is_array($binded) && isset($binded[$c['id_carrier']]) ? $binded[$c['id_carrier']] : "false");
}
return $list;
}
开发者ID:nikuta,项目名称:paczkomaty,代码行数:10,代码来源:Pakomato14.php
示例17: installExternalCarrier
/**
*
* @param type $config
* @return boolean
*/
public function installExternalCarrier($config)
{
$check = Db::getInstance()->executeS("SELECT id_carrier FROM " . _DB_PREFIX_ . "carrier WHERE name = '" . $config['name'] . "' ");
if (is_array($check) && !empty($check)) {
return Db::getInstance()->autoExecute(_DB_PREFIX_ . 'carrier', array('deleted' => 0), 'UPDATE', ' name = "' . $config['name'] . '" ');
}
$carrier = new Carrier();
$carrier->name = $config['name'];
$carrier->url = $config['url'];
$carrier->id_tax_rules_group = $config['id_tax_rules_group'];
$carrier->id_zone = $config['id_zone'];
$carrier->active = $config['active'];
$carrier->deleted = $config['deleted'];
$carrier->delay = $config['delay'];
$carrier->shipping_handling = $config['shipping_handling'];
$carrier->range_behavior = $config['range_behavior'];
$carrier->is_module = $config['is_module'];
$carrier->shipping_external = $config['shipping_external'];
$carrier->external_module_name = $config['external_module_name'];
$carrier->need_range = $config['need_range'];
$languages = Language::getLanguages(true);
foreach ($languages as $language) {
$carrier->delay[(int) $language['id_lang']] = $config['delay']['br'];
}
if ($carrier->add()) {
$groups = Group::getGroups(true);
foreach ($groups as $group) {
Db::getInstance()->autoExecute(_DB_PREFIX_ . 'carrier_group', array('id_carrier' => (int) $carrier->id, 'id_group' => (int) $group['id_group']), 'INSERT');
}
$rangePrice = new RangePrice();
$rangePrice->id_carrier = $carrier->id;
$rangePrice->delimiter1 = '0';
$rangePrice->delimiter2 = '0';
$rangePrice->add();
$rangeWeight = new RangeWeight();
$rangeWeight->id_carrier = $carrier->id;
$rangeWeight->delimiter1 = '0';
$rangeWeight->delimiter2 = '30';
$rangeWeight->add();
$zones = Zone::getZones(true);
foreach ($zones as $zone) {
Db::getInstance()->autoExecute(_DB_PREFIX_ . 'carrier_zone', array('id_carrier' => (int) $carrier->id, 'id_zone' => (int) $zone['id_zone']), 'INSERT');
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_ . 'delivery', array('id_carrier' => (int) $carrier->id, 'id_range_price' => (int) $rangePrice->id, 'id_range_weight' => NULL, 'id_zone' => (int) $zone['id_zone'], 'price' => '0'), 'INSERT');
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_ . 'delivery', array('id_carrier' => (int) $carrier->id, 'id_range_price' => NULL, 'id_range_weight' => (int) $rangeWeight->id, 'id_zone' => (int) $zone['id_zone'], 'price' => '0'), 'INSERT');
}
Configuration::updateValue("PS_CORREIOS_CARRIER_{$carrier->id}", $config['cod_servico']);
// Copy Logo
if (!copy(dirname(__FILE__) . '/logos/' . $config['cod_servico'] . '.png', _PS_SHIP_IMG_DIR_ . '/' . (int) $carrier->id . '.jpg')) {
return false;
}
// Return ID Carrier
return (int) $carrier->id;
}
return false;
}
开发者ID:dlanileonardo,项目名称:correios,代码行数:60,代码来源:correios.php
示例18: renderForm
public function renderForm()
{
$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]);
}
}
$this->fields_form = array('legend' => array('title' => $this->l('Weight ranges'), 'icon' => 'icon-suitcase'), 'input' => array(array('type' => 'select', 'label' => $this->l('Carrier'), 'name' => 'id_carrier', 'required' => false, 'hint' => $this->l('You can apply this range to a different carrier by selecting its name.'), 'options' => array('query' => $carriers, 'id' => 'id_carrier', 'name' => 'name'), 'empty_message' => '<p class="alert alert-block">' . $this->l('There is no carrier available for this weight range.') . '</p>'), array('type' => 'text', 'label' => $this->l('From'), 'name' => 'delimiter1', 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'hint' => $this->l('Start range (included).')), array('type' => 'text', 'label' => $this->l('To'), 'name' => 'delimiter2', 'required' => true, 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'hint' => $this->l('End range (excluded).'))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'btn btn-default'));
return parent::renderForm();
}
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:11 |
请发表评论