• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Tax类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Tax类的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: testValidity

 /** @depends testConstructEmpty */
 public function testValidity()
 {
     $tax = new Tax("Cat", "Label", stdtimefstr("2001-01-01 00:00:00"), 0.2);
     $this->assertTrue($tax->isValid(stdtimefstr("2001-01-01 00:00:00")), "Tax recognised invalid at change date");
     $this->assertTrue($tax->isValid(stdtimefstr("2001-01-02 00:00:00")), "Tax recognised invalid after change date");
     $this->assertFalse($tax->isValid(stdtimefstr("2000-01-01 00:00:00")), "Tax recognised valid before change date");
 }
开发者ID:booko,项目名称:pasteque-server,代码行数:8,代码来源:TaxesTest.php


示例3: getTax

 public function getTax($request)
 {
     if ($this->checkDetails($request)) {
         $object = new Tax();
         $array = $object->getTaxes($request["restaurantID"]);
         return $array;
     }
 }
开发者ID:veron123,项目名称:BaseW,代码行数:8,代码来源:controller1.php


示例4: calcTax

 function calcTax($subTotal, $storeId)
 {
     $tax = new Tax();
     $rs = $tax->taxRate($storeId);
     if (isset($rs[0])) {
         $taxRate = $rs[0]['rate'];
         return number_format(floatval($subTotal) * floatval($taxRate / 100), 2, '.', ' ');
     } else {
         return number_format(0, 2, '.', ' ');
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:11,代码来源:ReceiptCalcs.php


示例5: getInstance

 /**
  * Setup the instance (singleton)
  *
  * @return Tax
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:Dirty-Butter,项目名称:v6,代码行数:12,代码来源:tax.class.php


示例6: initRuleForm

 public function initRuleForm()
 {
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('New tax rule'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'country', 'id' => 'country', 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'states[]', 'id' => 'states', 'multiple' => true, 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'hidden', 'name' => 'action'), array('type' => 'text', 'label' => $this->l('Zip/postal code range'), 'name' => 'zipcode', 'required' => false, 'hint' => $this->l('You can define a range of Zip/postal codes (e.g., 75000-75015) or simply use one Zip/postal code.')), array('type' => 'select', 'label' => $this->l('Behavior'), 'name' => 'behavior', 'required' => false, 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('This tax only')), array('id' => 1, 'name' => $this->l('Combine')), array('id' => 2, 'name' => $this->l('One after another'))), 'id' => 'id', 'name' => 'name'), 'hint' => array($this->l('You must define the behavior if an address matches multiple rules:') . '<br>', $this->l('- This tax only: Will apply only this tax') . '<br>', $this->l('- Combine: Combine taxes (e.g.: 10% + 5% = 15%)') . '<br>', $this->l('- One after another: Apply taxes one after another (e.g.: 0 + 10% = 0 + 5% = 5.5)'))), array('type' => 'select', 'label' => $this->l('Tax'), 'name' => 'id_tax', 'required' => false, 'options' => array('query' => Tax::getTaxes((int) $this->context->language->id), 'id' => 'id_tax', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('No Tax'))), 'hint' => sprintf($this->l('(Total tax: %s)'), '9%')), array('type' => 'select', 'label' => $this->l('Grupos'), 'name' => 'id_group', 'required' => false, 'options' => array('query' => Group::getGroups($this->default_form_language, true), 'id' => 'id_group', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('Default'))), 'hint' => sprintf($this->l('(Total tax: %s)'), '9%')), array('type' => 'text', 'label' => $this->l('Description'), 'name' => 'description')), 'submit' => array('title' => $this->l('Save and stay'), 'stay' => true));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_value = array('action' => 'create_rule', 'id_tax_rules_group' => $obj->id, 'id_tax_rule' => '');
     $this->getlanguages();
     $helper = new HelperForm();
     $helper->override_folder = $this->tpl_folder;
     $helper->currentIndex = self::$currentIndex;
     $helper->token = $this->token;
     $helper->table = 'tax_rule';
     $helper->identifier = 'id_tax_rule';
     $helper->id = $obj->id;
     $helper->toolbar_scroll = true;
     $helper->show_toolbar = true;
     $helper->languages = $this->_languages;
     $helper->default_form_language = $this->default_form_language;
     $helper->allow_employee_form_lang = $this->allow_employee_form_lang;
     $helper->fields_value = $this->getFieldsValue($this->object);
     $helper->toolbar_btn['save_new_rule'] = array('href' => self::$currentIndex . '&amp;id_tax_rules_group=' . $obj->id . '&amp;action=create_rule&amp;token=' . $this->token, 'desc' => 'Save tax rule', 'class' => 'process-icon-save');
     $helper->submit_action = 'create_rule';
     return $helper->generateForm($this->fields_form);
 }
开发者ID:banquito,项目名称:taxrulesbycustomergroup,代码行数:25,代码来源:AdminTaxRulesGroupController.php


示例7: getVat

 /** @return Tax */
 public function getVat()
 {
     if (!$this->tax) {
         return NULL;
     }
     return $this->tax->getVat()->getPercent();
 }
开发者ID:djdaca,项目名称:exchange,代码行数:8,代码来源:Exchange.php


示例8: update

 public function update($nullValues = false)
 {
     if (!$this->deleted && $this->isUsed()) {
         $historized_tax = new Tax($this->id);
         $historized_tax->historize();
         // remove the id in order to create a new object
         $this->id = 0;
         $res = $this->add();
         // change tax id in the tax rule table
         $res &= TaxRule::swapTaxId($historized_tax->id, $this->id);
         return $res;
     } elseif (parent::update($nullValues)) {
         return $this->_onStatusChange();
     }
     return false;
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:16,代码来源:Tax.php


示例9: __construct

 public function __construct()
 {
     global $cookie;
     $this->className = 'Configuration';
     $this->table = 'configuration';
     $max_upload = (int) ini_get('upload_max_filesize');
     $max_post = (int) ini_get('post_max_size');
     $upload_mb = min($max_upload, $max_post);
     $timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone');
     $taxes[] = array('id' => 0, 'name' => $this->l('None'));
     foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) {
         $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
     }
     $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
     $round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical')));
     $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
     foreach (CMS::listCms($cookie->id_lang) as $cms_file) {
         $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
     }
     $this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'maintenance_ip', 'size' => 30, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use of CMS page'), 'desc' => $this->l('Choose the Conditions of use of CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrap pricing'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Maximum attachment size'), 'desc' => $this->l('Set the maximum size of attached files (in Megabytes ).') . ' ' . $this->l('Maximum:') . ' ' . ((int) str_replace('M', '', ini_get('post_max_size')) > (int) str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Save cart content and re-display it at login'), 'desc' => $this->l('Recall and display contents of shopping cart following customer login'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_LIMIT_UPLOAD_FILE_VALUE' => array('title' => $this->l('Limit upload file value'), 'desc' => $this->l('Define the limit upload for a downloadable product, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'), 'PS_LIMIT_UPLOAD_IMAGE_VALUE' => array('title' => $this->l('Limit upload image value'), 'desc' => $this->l('Define the limit upload for an image, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'));
     if (function_exists('date_default_timezone_set')) {
         $this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name');
     }
     // No HTTPS activation if you haven't already.
     if (!Tools::usingSecureMode() && !_PS_SSL_ENABLED_) {
         $this->_fieldsGeneral['PS_SSL_ENABLED']['type'] = 'disabled';
         $this->_fieldsGeneral['PS_SSL_ENABLED']['disabled'] = '<a href="https://' . Tools::getShopDomainSsl() . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">' . $this->l('Please click here to use HTTPS protocol before enabling SSL.') . '</a>';
     }
     parent::__construct();
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:30,代码来源:AdminPreferences.php


示例10: total

 /**
  * Return the total of the item, with or without tax
  *
  * @param  boolean $includeTax Whether or not to include tax
  *
  * @return float              The total, as a float
  */
 public function total($includeTax = true)
 {
     $price = $this->price;
     if ($includeTax) {
         $price = $this->tax->add($price);
     }
     return (double) ($price * $this->quantity);
 }
开发者ID:voku,项目名称:cart,代码行数:15,代码来源:Item.php


示例11: testGetAllTaxes

 public function testGetAllTaxes()
 {
     $allTaxesCount = Tax::getTaxes()->getTotalRecordCount();
     $taxEnabled = Tax::getNewInstance('testing');
     $taxEnabled->save();
     $taxDisabled = Tax::getNewInstance('testing');
     $taxDisabled->save();
     $this->assertEqual(Tax::getTaxes()->getTotalRecordCount(), $allTaxesCount + 2);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:TaxTest.php


示例12: getTaxes

 public function getTaxes()
 {
     if (!empty(self::$Tax) && is_array(self::$Tax) && count(self::$Tax) > 0) {
         return self::$Tax;
     } else {
         self::$Tax = $this->find('all', array('fields' => array('tax_name', 'tax_percentage')));
         return self::$Tax;
     }
 }
开发者ID:sanily2j,项目名称:abc,代码行数:9,代码来源:tax.php


示例13: _assignSummaryInformations

 protected function _assignSummaryInformations()
 {
     $summary = $this->context->cart->getSummaryDetails();
     $customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
     // override customization tax rate with real tax (tax rules)
     if ($customizedDatas) {
         foreach ($summary['products'] as &$productUpdate) {
             $productId = (int) isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id'];
             $productAttributeId = (int) isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id'];
             if (isset($customizedDatas[$productId][$productAttributeId])) {
                 $productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             }
         }
         Product::addCustomizationPrice($summary['products'], $customizedDatas);
     }
     $cart_product_context = Context::getContext()->cloneContext();
     foreach ($summary['products'] as $key => &$product) {
         $product['quantity'] = $product['cart_quantity'];
         // for compatibility with 1.2 themes
         if ($cart_product_context->shop->id != $product['id_shop']) {
             $cart_product_context->shop = new Shop((int) $product['id_shop']);
         }
         $product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], _PS_PRICE_COMPUTE_PRECISION_, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context);
         /**
          * ABU edit: variable is_discount set à 1 à tord, calcul foireux de presta
          * @bugfix: https://github.com/PrestaShop/PrestaShop/commit/379e28b341730ea95c0b2d6567817305ea841b23
          * @perso: soustraction de l'ecotax au price_without_specific_price @else
          */
         if (Product::getTaxCalculationMethod()) {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
         } else {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'] - $product['ecotax'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
         }
     }
     // Get available cart rules and unset the cart rules already in the cart
     $available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0, true, true, true, $this->context->cart);
     $cart_cart_rules = $this->context->cart->getCartRules();
     foreach ($available_cart_rules as $key => $available_cart_rule) {
         if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], CartRule::BO_ORDER_CODE_PREFIX) === 0) {
             unset($available_cart_rules[$key]);
             continue;
         }
         foreach ($cart_cart_rules as $cart_cart_rule) {
             if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) {
                 unset($available_cart_rules[$key]);
                 continue 2;
             }
         }
     }
     $show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
     $this->context->smarty->assign($summary);
     $this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
     $this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
 }
开发者ID:ecSta,项目名称:prestanight,代码行数:56,代码来源:ParentOrderController.php


示例14: GetPrice

 public function GetPrice($objTaxCode, $intTaxStatus, $taxExclusive = false)
 {
     if ($taxExclusive) {
         return $this->price;
     } elseif (_xls_get_conf('TAX_INCLUSIVE_PRICING', '') == '1') {
         $arrPrice = Tax::calculatePricesWithTax($this->price, $objTaxCode->id, $intTaxStatus);
         return $arrPrice['fltSellTotalWithTax'];
     } else {
         return $this->price;
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:11,代码来源:ProductQtyPricing.php


示例15: tax

 public function tax()
 {
     if (isset($this->amount->tax)) {
         return $this->amount->tax;
     } elseif (isset($this->order->shipping)) {
         $tax = new Tax($this->order->shipping->country, $this->order->shipping->state, $this->order->basket);
         $this->amount->tax = $tax->amount();
         return $this->amount->tax;
     } else {
         return 0;
     }
 }
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:12,代码来源:Order.php


示例16: updateDiscountPercents

 /**
  * Update WEEE amounts discount percents
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  */
 public function updateDiscountPercents(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_weeeData->isEnabled()) {
         return $this;
     }
     $productCondition = $observer->getEvent()->getProductCondition();
     if ($productCondition) {
         $eventProduct = $productCondition;
     } else {
         $eventProduct = $observer->getEvent()->getProduct();
     }
     $this->_weeeTax->updateProductsDiscountPercent($eventProduct);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Observer.php


示例17: getPriceTax

 function getPriceTax($priceset_id, $product_id, $netto, $tax_id = -1)
 {
     $query = "SELECT * FROM " . $this->db->price_table . " WHERE priceset_id='" . $priceset_id . "' AND product_id='" . $product_id . "'";
     $tmp = $this->db->fetchRows($this->db->query($query));
     $price = $tmp[0][3];
     if ($tax_id == -1) {
         $product = new Product();
         $tmp_product = $product->get($product_id);
         if (count($tmp_product) > 0) {
             $tax_id = $tmp_product[0][4];
         } else {
             return 0;
         }
     }
     if ($netto) {
         $tax = new Tax();
         $tmp_tax = $tax->get($tax_id);
         if (count($tmp_tax) <= 0) {
             return 0;
         }
         $price = $price * (1 + $tmp_tax[0][2]);
     }
     return $price;
 }
开发者ID:nebulade,项目名称:faursprung_website,代码行数:24,代码来源:Price.php


示例18: assignPriceAndTax

 /**
  * Assign price and tax to the template
  */
 protected function assignPriceAndTax()
 {
     die('coucou');
     $id_customer = isset($this->context->customer) ? (int) $this->context->customer->id : 0;
     $id_group = (int) Group::getCurrent()->id;
     $id_country = $id_customer ? (int) Customer::getCurrentCountry($id_customer) : (int) Tools::getCountry();
     $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group);
     if ($group_reduction === false) {
         $group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
     }
     // Tax
     $tax = (double) $this->product->getTaxesRate(new Address((int) $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
     $this->context->smarty->assign('tax_rate', $tax);
     $product_price_with_tax = Product::getPriceStatic($this->product->id, true, null, 6) * 10;
     if (Product::$_taxCalculationMethod == PS_TAX_INC) {
         $product_price_with_tax = Tools::ps_round($product_price_with_tax, 2);
     }
     $product_price_without_eco_tax = (double) $product_price_with_tax - $this->product->ecotax;
     $ecotax_rate = (double) Tax::getProductEcotaxRate($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
     $ecotax_tax_amount = Tools::ps_round($this->product->ecotax, 2);
     if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
         $ecotax_tax_amount = Tools::ps_round($ecotax_tax_amount * (1 + $ecotax_rate / 100), 2);
     }
     $id_currency = (int) $this->context->cookie->id_currency;
     $id_product = (int) $this->product->id;
     $id_shop = $this->context->shop->id;
     $quantity_discounts = SpecificPrice::getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, null, true, (int) $this->context->customer->id);
     foreach ($quantity_discounts as &$quantity_discount) {
         if ($quantity_discount['id_product_attribute']) {
             $combination = new Combination((int) $quantity_discount['id_product_attribute']);
             $attributes = $combination->getAttributesName((int) $this->context->language->id);
             foreach ($attributes as $attribute) {
                 $quantity_discount['attributes'] = $attribute['name'] . ' - ';
             }
             $quantity_discount['attributes'] = rtrim($quantity_discount['attributes'], ' - ');
         }
         if ((int) $quantity_discount['id_currency'] == 0 && $quantity_discount['reduction_type'] == 'amount') {
             $quantity_discount['reduction'] = Tools::convertPriceFull($quantity_discount['reduction'], null, Context::getContext()->currency);
         }
     }
     $product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false) * 10;
     $address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
     $this->context->smarty->assign(array('quantity_discounts' => $this->formatQuantityDiscounts($quantity_discounts, $product_price, (double) $tax, $ecotax_tax_amount), 'ecotax_tax_inc' => $ecotax_tax_amount, 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotaxTax_rate' => $ecotax_rate, 'productPriceWithoutEcoTax' => (double) $product_price_without_eco_tax, 'group_reduction' => $group_reduction, 'no_tax' => Tax::excludeTaxeOption() || !$this->product->getTaxesRate($address), 'ecotax' => !count($this->errors) && $this->product->ecotax > 0 ? Tools::convertPrice((double) $this->product->ecotax) : 0, 'tax_enabled' => Configuration::get('PS_TAX') && !Configuration::get('AEUC_LABEL_TAX_INC_EXC'), 'customer_group_without_tax' => Group::getPriceDisplayMethod($this->context->customer->id_default_group)));
 }
开发者ID:ArnaudBenassy,项目名称:prestashop_test,代码行数:47,代码来源:ProductController.php


示例19: __construct

 public function __construct()
 {
     $this->className = 'Configuration';
     $this->table = 'configuration';
     parent::__construct();
     // List of CMS tabs
     $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
     foreach (CMS::listCms($this->context->language->id) as $cms_file) {
         $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
     }
     // List of order process types
     $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
     // Tax list
     $taxes[] = array('id' => 0, 'name' => $this->l('None'));
     foreach (Tax::getTaxes($this->context->language->id) as $tax) {
         $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
     }
     $this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'tab-preferences', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Guests can place an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate order'), 'desc' => $this->l('Set to 0 to disable this feature'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multi-shipping'), 'desc' => $this->l('Allow the customer to ship his order to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'desc' => $this->l('Allow the customer to split his order: one with the products currently "in stock", and another with the other products. This option will convert the customer\'s cart into two orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'tab-preferences', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')));
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:19,代码来源:AdminOrderPreferencesController.php


示例20: convert_product_price

function convert_product_price()
{
    $taxes = Tax::getTaxes();
    $taxRates = array();
    foreach ($taxes as $data) {
        $taxRates[$data['id_tax']] = (double) $data['rate'] / 100;
    }
    $resource = DB::getInstance()->ExecuteS('SELECT `id_product`, `price`, `id_tax` FROM `' . _DB_PREFIX_ . 'product`', false);
    while ($row = DB::getInstance()->nextRow($resource)) {
        if ($row['id_tax']) {
            $price = $row['price'] * (1 + $taxRates[$row['id_tax']]);
            $decimalPart = $price - (int) $price;
            if ($decimalP 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TaxManagerFactory类代码示例发布时间:2022-05-23
下一篇:
PHP Tasks类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap