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


PHP Tax::getApplicableTax方法代码示例

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


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

示例1: productPriceRangeStrings

 function productPriceRangeStrings($prices = array(), $productAssoc = array(), $nbRange = 6)
 {
     if (count($this->productIds) > 0) {
         $productIdMin = array_search(min(count($prices) < 1 ? $this->productFinalPrices : $prices), count($productAssoc) < 1 ? $this->idFinalPriceAssoc : $productAssoc);
         $productIdMax = array_search(max(count($prices) < 1 ? $this->productFinalPrices : $prices), count($productAssoc) < 1 ? $this->idFinalPriceAssoc : $productAssoc);
         $productMin = new Product($productIdMin, TRUE, $this->lang);
         $productMax = new Product($productIdMax, TRUE, $this->lang);
         $min = $productMin->getPrice($this->inclTax);
         $max = $productMax->getPrice($this->inclTax);
         $this->minTax = Tax::getApplicableTax($productMin->id_tax, $productMin->tax_rate);
         $this->maxTax = Tax::getApplicableTax($productMax->id_tax, $productMax->tax_rate);
         $explicit = FALSE;
         $range = $retRanges = array();
         $mxAvg = (double) ($max / $nbRange);
         $mxAvg = $nbRange > 6 ? $mxAvg + 1 : $mxAvg;
         $minTmp = $explicit ? $min : floor($min);
         for ($i = 1; $i <= $nbRange; $i++) {
             $temp = $min + $mxAvg;
             if ($temp > $max) {
                 $temp = $max;
             }
             if ($minTmp != $min) {
                 $minTmp = $explicit ? $minTmp : round($minTmp);
             }
             if ($temp != $max) {
                 $temp = $explicit ? $temp : round($temp);
             }
             $range[$minTmp] = $min = $temp;
             $minTmp = $temp + 1;
         }
         $i = 0;
         $nbr = count($range) - 1;
         foreach ($range as $min => $max) {
             if ($i == 0) {
                 $minPer = 0;
             } else {
                 $minPer = round($min, strlen(intval($min)) < 4 ? -1 : -floor(log10($min)));
             }
             if ($i == $nbr) {
                 $maxPer = round($max, strlen(intval($max)) < 4 ? -1 : -floor(log10($max)) - $i == $nbr ? 1 : 0);
             } else {
                 $maxPer = round($max, strlen(intval($max)) < 4 ? -1 : -floor(log10($max))) - 0.01;
             }
             if ($explicit == TRUE) {
                 if ($min < $max) {
                     $retRanges[] = $min . ':' . $max . ':' . $this->productRangeCount($min, $max);
                 }
             } else {
                 if ($minPer < $maxPer) {
                     $retRanges[] = $minPer . ':' . $maxPer . ':' . $this->productRangeCount($minPer, $maxPer);
                 }
             }
             $i++;
         }
         return $retRanges;
     } else {
         return FALSE;
     }
 }
开发者ID:Eximagen,项目名称:3m,代码行数:59,代码来源:filtersearch.module.php

示例2: foreach

                            }
                        }
                    }
                }
                foreach ($groups as &$group) {
                    natcasesort($group['attributes']);
                }
                foreach ($combinations as $id_product_attribute => $comb) {
                    $attributeList = '';
                    foreach ($comb['attributes'] as $id_attribute) {
                        $attributeList .= '\'' . intval($id_attribute) . '\',';
                    }
                    $attributeList = rtrim($attributeList, ',');
                    $combinations[$id_product_attribute]['list'] = $attributeList;
                }
                $smarty->assign(array('groups' => $groups, 'combinaisons' => $combinations, 'combinations' => $combinations, 'colors' => (sizeof($colors) and $product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages));
            }
        }
        $smarty->assign(array('no_tax' => Tax::excludeTaxeOption() or !Tax::getApplicableTax(intval($product->id_tax), 1), 'customizationFields' => $product->getCustomizationFields(intval($cookie->id_lang))));
        // Pack management
        $smarty->assign('packItems', Pack::getItemTable($product->id, intval($cookie->id_lang), true));
        $smarty->assign('packs', Pack::getPacksTable($product->id, intval($cookie->id_lang), true, 1));
    }
}
$smarty->assign(array('ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => intval(Configuration::get('PS_ORDER_OUT_OF_STOCK')), 'errors' => $errors, 'categories' => Category::getHomeCategories(intval($cookie->id_lang)), 'have_image' => Product::getCover(intval(Tools::getValue('id_product'))), 'tax_enabled' => Configuration::get('PS_TAX'), 'display_qties' => intval(Configuration::get('PS_DISPLAY_QTIES')), 'display_ht' => !Tax::excludeTaxeOption()));
if (file_exists(_PS_THEME_DIR_ . 'thickbox.tpl')) {
    $smarty->display(_PS_THEME_DIR_ . 'thickbox.tpl');
}
$smarty->assign(array('currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank));
$smarty->display(_PS_THEME_DIR_ . 'product.tpl');
include dirname(__FILE__) . '/footer.php';
开发者ID:vincent,项目名称:theinvertebrates,代码行数:31,代码来源:product.php

示例3: validateOrder


//.........这里部分代码省略.........
					(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `product_quantity_discount`, `product_ean13`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `discount_quantity_applied`, `download_deadline`, `download_hash`)
				VALUES ';
                $customizedDatas = Product::getAllCustomizedDatas(intval($order->id_cart));
                Product::addCustomizationPrice($products, $customizedDatas);
                foreach ($products as $key => $product) {
                    $outOfStock = false;
                    $productQuantity = intval(Product::getQuantity(intval($product['id_product']), $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL));
                    $quantityInStock = $productQuantity - intval($product['cart_quantity']) < 0 ? $productQuantity : intval($product['cart_quantity']);
                    if ($id_order_state != _PS_OS_CANCELED_ and $id_order_state != _PS_OS_ERROR_) {
                        if (($updateResult = Product::updateQuantity($product)) === false or $updateResult === -1) {
                            $outOfStock = true;
                        }
                        if (!$outOfStock) {
                            $product['stock_quantity'] -= $product['cart_quantity'];
                        }
                        Hook::updateQuantity($product, $order);
                    }
                    $price = Product::getPriceStatic(intval($product['id_product']), false, $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL, 6, NULL, false, true, $product['cart_quantity'], false, intval($order->id_customer), intval($order->id_cart), intval($order->id_address_delivery));
                    $price_wt = Product::getPriceStatic(intval($product['id_product']), true, $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL, 2, NULL, false, true, $product['cart_quantity'], false, intval($order->id_customer), intval($order->id_cart), intval($order->id_address_delivery));
                    // Add some informations for virtual products
                    $deadline = '0000-00-00 00:00:00';
                    $download_hash = NULL;
                    if ($id_product_download = ProductDownload::getIdFromIdProduct(intval($product['id_product']))) {
                        $productDownload = new ProductDownload(intval($id_product_download));
                        $deadline = $productDownload->getDeadLine();
                        $download_hash = $productDownload->getHash();
                    }
                    // Exclude VAT
                    if (Tax::excludeTaxeOption()) {
                        $product['tax'] = 0;
                        $product['rate'] = 0;
                        $tax = 0;
                    } else {
                        $tax = Tax::getApplicableTax(intval($product['id_tax']), floatval($product['rate']), intval($order->id_address_delivery));
                    }
                    $currentDate = date('Y-m-d H:m:i');
                    if ($product['reduction_from'] != $product['reduction_to'] and ($currentDate > $product['reduction_to'] or $currentDate < $product['reduction_from'])) {
                        $reduction_percent = 0.0;
                        $reduction_amount = 0.0;
                    } else {
                        $reduction_percent = floatval($product['reduction_percent']);
                        $reduction_amount = Tools::ps_round(floatval($product['reduction_price']) / (1 + floatval($tax) / 100), 6);
                    }
                    // Quantity discount
                    $reduc = 0.0;
                    if ($product['cart_quantity'] > 1 and $qtyD = QuantityDiscount::getDiscountFromQuantity($product['id_product'], $product['cart_quantity'])) {
                        $reduc = QuantityDiscount::getValue($price_wt, $qtyD->id_discount_type, $qtyD->value, new Currency(intval($order->id_currency)));
                    }
                    $query .= '(' . intval($order->id) . ',
						' . intval($product['id_product']) . ',
						' . (isset($product['id_product_attribute']) ? intval($product['id_product_attribute']) : 'NULL') . ',
						\'' . pSQL($product['name'] . ((isset($product['attributes']) and $product['attributes'] != NULL) ? ' - ' . $product['attributes'] : '')) . '\',
						' . intval($product['cart_quantity']) . ',
						' . $quantityInStock . ',
						' . floatval(Product::getPriceStatic(intval($product['id_product']), false, $product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL, Product::getTaxCalculationMethod(intval($order->id_customer)) == PS_TAX_EXC ? 2 : 6, NULL, false, false, $product['cart_quantity'], false, intval($order->id_customer), intval($order->id_cart), intval($order->id_address_delivery))) . ',
						' . floatval($reduction_percent) . ',
						' . floatval($reduction_amount) . ',
						' . floatval($reduc) . ',
						' . (empty($product['ean13']) ? 'NULL' : '\'' . pSQL($product['ean13']) . '\'') . ',
						' . (empty($product['reference']) ? 'NULL' : '\'' . pSQL($product['reference']) . '\'') . ',
						' . (empty($product['supplier_reference']) ? 'NULL' : '\'' . pSQL($product['supplier_reference']) . '\'') . ',
						' . floatval($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']) . ',
						\'' . (!$tax ? '' : pSQL($product['tax'])) . '\',
						' . floatval($tax) . ',
						' . floatval($product['ecotax']) . ',
						' . (int) QuantityDiscount::getDiscountFromQuantity(intval($product['id_product']), intval($product['cart_quantity'])) . ',
开发者ID:vincent,项目名称:theinvertebrates,代码行数:67,代码来源:PaymentModule.php

示例4: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = true;
     $tax = floatval(Tax::getApplicableTax(intval($row['id_tax']), floatval($row['rate'])));
     if (Tax::excludeTaxeOption() or !$tax) {
         $usetax = false;
     }
     $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . intval($usetax);
     if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
         return self::$producPropertiesCache[$cacheKey];
     }
     // Datas
     $link = new Link();
     $row['category'] = Category::getLinkRewrite($row['id_category_default'], intval($id_lang));
     $row['link'] = $link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = (isset($row['id_product_attribute']) and $row['id_product_attribute']) ? floatval(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic($row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6), 2);
     }
     $row['reduction'] = self::getReductionValue($row['reduction_price'], $row['reduction_percent'], $row['reduction_from'], $row['reduction_to'], $row['price'], $usetax, floatval($row['rate']));
     $row['price_without_reduction'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 6, NULL, false, false);
     $row['quantity'] = Product::getQuantity($row['id_product']);
     $row['id_image'] = Product::defineProductImage($row);
     $row['features'] = Product::getFrontFeaturesStatic(intval($id_lang), $row['id_product']);
     $row['attachments'] = Product::getAttachmentsStatic(intval($id_lang), $row['id_product']);
     $row['pack'] = Pack::isPack($row['id_product']);
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     self::$producPropertiesCache[$cacheKey] = $row;
     return self::$producPropertiesCache[$cacheKey];
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:46,代码来源:Product.php

示例5: hookProductFooter

    function hookProductFooter($params)
    {
        global $smarty, $cookie;
        $priceFormat = Configuration::get('PRODUCT_ATTRIB_NC_PRICE_FORMAT');
        $fullPrice = Configuration::get('PRODUCT_ATTRIB_NC_FULL_PRICE');
        $product = new Product(intval($_GET['id_product']), true, intval($cookie->id_lang));
        if ($priceFormat > 1) {
            // Tax
            $tax_datas = Db::getInstance()->getRow('
			SELECT p.`id_tax`, t.`rate`
			FROM `' . _DB_PREFIX_ . 'product` p
			LEFT JOIN `' . _DB_PREFIX_ . 'tax` AS t ON t.`id_tax` = p.`id_tax`
			WHERE p.`id_product` = ' . intval($product->id));
            $tax = floatval(Tax::getApplicableTax(intval($tax_datas['id_tax']), floatval($tax_datas['rate'])));
        }
        /* Attributes / Groups & colors */
        $colors = array();
        $attributesGroups = Db::getInstance()->ExecuteS('
			SELECT ag.`id_attribute_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name,
			a.`color` AS attribute_color, pa.`id_product_attribute`, pa.`quantity`, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`
			FROM `' . _DB_PREFIX_ . 'product_attribute` pa
			LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute` a ON a.`id_attribute` = pac.`id_attribute`
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON a.`id_attribute` = al.`id_attribute`
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group`
			WHERE pa.`id_product` = ' . intval($product->id) . '
			AND al.`id_lang` = ' . intval($cookie->id_lang) . '
			AND agl.`id_lang` = ' . intval($cookie->id_lang) . '
			ORDER BY agl.`public_name`');
        if (Db::getInstance()->numRows()) {
            foreach ($attributesGroups as $k => $row) {
                /* Color management */
                if (isset($row['attribute_color']) and $row['attribute_color'] and $row['id_attribute_group'] == $product->id_color_default) {
                    $colors[$row['id_attribute']]['value'] = $row['attribute_color'];
                    $colors[$row['id_attribute']]['name'] = $row['attribute_name'];
                }
                $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name'];
                if (strpos($row['public_group_name'], '|') !== FALSE) {
                    $label = explode('|', $row['public_group_name'], 2);
                    $groups[$row['id_attribute_group']]['label'] = $label[0];
                    $groups[$row['id_attribute_group']]['name'] = $label[1];
                } else {
                    $groups[$row['id_attribute_group']]['name'] = $row['public_group_name'];
                }
                if ($row['default_on']) {
                    $groups[$row['id_attribute_group']]['default'] = intval($row['id_attribute']);
                }
                if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) {
                    $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
                }
                $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += intval($row['quantity']);
            }
            $smarty->assign(array('col_img_dir' => _PS_COL_IMG_DIR_, 'reductionPrice' => $product->reduction_price, 'reductionPercent' => $product->reduction_percent, 'reductionFrom' => $product->reduction_from, 'reductionTo' => $product->reduction_to, 'groupReduction' => (100 - Group::getReduction(intval($cookie->id_customer))) / 100, 'groups' => $groups, 'attributeImpacts' => Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'attribute_impact` WHERE `id_product` = ' . intval($_GET['id_product'])), 'fullPrice' => $fullPrice, 'price' => $fullPrice ? number_format($product->price * (1 + $tax * 0.01), 2, '.', '') : 0, 'priceFormat' => $priceFormat, 'hideZeros' => Configuration::get('PRODUCT_ATTRIB_NC_HIDE_ZEROS'), 'weight' => $product->weight, 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT'), 'displayWeight' => Configuration::get('PRODUCT_ATTRIB_NC_DISPLAY_WEIGHT'), 'displayImage' => Configuration::get('PRODUCT_ATTRIB_NC_DISPLAY_IMAGE'), 'displayDescription' => Configuration::get('PRODUCT_ATTRIB_NC_DISPLAY_DESC')));
            if ($priceFormat > 1) {
                $smarty->assign(array('tax' => 1 - $tax / 100));
            }
        }
        return $this->display(__FILE__, 'productattributesnc.tpl');
    }
开发者ID:Eximagen,项目名称:3m,代码行数:60,代码来源:productattributesnc.php

示例6: getOrderTotal

 /**
  * This function returns the total cart amount
  *
  * type = 1 : only products
  * type = 2 : only discounts
  * type = 3 : both
  * type = 4 : both but without shipping
  * type = 5 : only shipping
  * type = 6 : only wrapping
  * type = 7 : only products without shipping
  *
  * @param boolean $withTaxes With or without taxes
  * @param integer $type Total type
  * @return float Order total
  */
 public function getOrderTotal($withTaxes = true, $type = 3)
 {
     if (!$this->id) {
         return 0;
     }
     $type = intval($type);
     if (!in_array($type, array(1, 2, 3, 4, 5, 6, 7))) {
         die(Tools::displayError());
     }
     // no shipping cost if is a cart with only virtuals products
     $virtual = $this->isVirtualCart();
     if ($virtual and $type == 5) {
         return 0;
     }
     if ($virtual and $type == 3) {
         $type = 4;
     }
     $shipping_fees = ($type != 4 and $type != 7) ? $this->getOrderShippingCost(NULL, intval($withTaxes)) : 0;
     if ($type == 7) {
         $type = 1;
     }
     $products = $this->getProducts();
     $order_total = 0;
     if (Tax::excludeTaxeOption()) {
         $withTaxes = false;
     }
     foreach ($products as $product) {
         if ($this->_taxCalculationMethod == PS_TAX_EXC) {
             // Here taxes are computed only once the quantity has been applied to the product price
             $price = Product::getPriceStatic(intval($product['id_product']), false, intval($product['id_product_attribute']), 2, NULL, false, true, $product['cart_quantity'], false, intval($this->id_customer) ? intval($this->id_customer) : NULL, intval($this->id), intval($this->id_address_delivery) ? intval($this->id_address_delivery) : NULL);
             $total_price = $price * intval($product['cart_quantity']);
             if ($withTaxes) {
                 $total_price = Tools::ps_round($total_price * (1 + floatval(Tax::getApplicableTax(intval($product['id_tax']), floatval($product['rate']))) / 100), 2);
             }
         } else {
             $price = Product::getPriceStatic(intval($product['id_product']), $withTaxes, intval($product['id_product_attribute']), 6, NULL, false, true, $product['cart_quantity'], false, intval($this->id_customer) ? intval($this->id_customer) : NULL, intval($this->id), intval($this->id_address_delivery) ? intval($this->id_address_delivery) : NULL);
             if (!$withTaxes) {
                 $total_price = Tools::ps_round($price * intval($product['cart_quantity']), 2);
             } else {
                 $total_price = Tools::ps_round($price, 2) * intval($product['cart_quantity']);
             }
         }
         $order_total += $total_price;
     }
     $order_total_products = $order_total;
     if ($type == 2) {
         $order_total = 0;
     }
     // Wrapping Fees
     $wrapping_fees = 0;
     if ($this->gift) {
         $wrapping_fees = floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
         if ($withTaxes) {
             $wrapping_fees_tax = new Tax(intval(Configuration::get('PS_GIFT_WRAPPING_TAX')));
             $wrapping_fees *= 1 + floatval($wrapping_fees_tax->rate) / 100;
         }
         $wrapping_fees = Tools::convertPrice(Tools::ps_round($wrapping_fees, 2), new Currency(intval($this->id_currency)));
     }
     if ($type != 1) {
         $discounts = array();
         /* Firstly get all discounts, looking for a free shipping one (in order to substract shipping fees to the total amount) */
         if ($discountIds = $this->getDiscounts(true)) {
             foreach ($discountIds as $id_discount) {
                 $discount = new Discount(intval($id_discount['id_discount']));
                 if (Validate::isLoadedObject($discount)) {
                     $discounts[] = $discount;
                     if ($discount->id_discount_type == 3) {
                         foreach ($products as $product) {
                             $categories = Discount::getCategories($discount->id);
                             if (count($categories) and Product::idIsOnCategoryId($product['id_product'], $categories)) {
                                 if ($type == 2) {
                                     $order_total -= $shipping_fees;
                                 }
                                 $shipping_fees = 0;
                                 break;
                             }
                         }
                     }
                 }
             }
             /* Secondly applying all vouchers to the correct amount */
             foreach ($discounts as $discount) {
                 if ($discount->id_discount_type != 3) {
                     $order_total -= Tools::ps_round(floatval($discount->getValue(sizeof($discounts), $order_total_products, $shipping_fees, $this->id, intval($withTaxes))), 2);
                 }
//.........这里部分代码省略.........
开发者ID:vincent,项目名称:theinvertebrates,代码行数:101,代码来源:Cart.php

示例7: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     $link = new Link();
     // Tax
     $usetax = true;
     $tax = floatval(Tax::getApplicableTax(intval($row['id_tax']), floatval($row['rate'])));
     if (Tax::excludeTaxeOption() or !$tax) {
         $usetax = false;
     }
     // Datas
     $row['category'] = Category::getLinkRewrite($row['id_category_default'], intval($id_lang));
     $row['link'] = $link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])) {
         $row['id_product_attribute'] = $ipa_default;
     }
     $row['attribute_price'] = isset($row['id_product_attribute']) and $row['id_product_attribute'] ? floatval(Product::getProductAttributePrice($row['id_product_attribute'])) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic($row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2);
     $row['price'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2);
     $row['reduction'] = self::getReductionValue($row['reduction_price'], $row['reduction_percent'], $row['reduction_from'], $row['reduction_to'], $row['price'], $usetax, floatval($row['rate']));
     $row['price_without_reduction'] = Product::getPriceStatic($row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? intval($row['id_product_attribute']) : NULL, 2, NULL, false, false);
     $row['quantity'] = Product::getQuantity($row['id_product']);
     $row['id_image'] = Product::defineProductImage($row);
     $row['features'] = Product::getFrontFeaturesStatic(intval($id_lang), $row['id_product']);
     $row['attachments'] = Product::getAttachmentsStatic(intval($id_lang), $row['id_product']);
     $row['pack'] = Pack::isPack($row['id_product']);
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     return $row;
 }
开发者ID:sealence,项目名称:local,代码行数:33,代码来源:Product.php


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