本文整理汇总了PHP中mslib_fe::calculateStaffelPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::calculateStaffelPrice方法的具体用法?PHP mslib_fe::calculateStaffelPrice怎么用?PHP mslib_fe::calculateStaffelPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mslib_fe
的用法示例。
在下文中一共展示了mslib_fe::calculateStaffelPrice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCart
//.........这里部分代码省略.........
break;
}
}
}
}
}
}
// PROTECTION WHEN PRODUCT MULTIPLICATION IS NOT A FLOAT WE HAVE TO CAST THE QUANTITY AS INTEGER
if (!$product['products_multiplication'] || (int) $product['products_multiplication'] == $product['products_multiplication']) {
$this->post['quantity'] = round($this->post['quantity'], 0);
$cart['products'][$shopping_cart_item]['qty'] = (int) $cart['products'][$shopping_cart_item]['qty'];
}
$cart['products'][$shopping_cart_item]['qty'] = round(number_format($cart['products'][$shopping_cart_item]['qty'], 2), 2);
$current_quantity = $cart['products'][$shopping_cart_item]['qty'];
if (!$this->post['tx_multishop_pi1']['cart_item']) {
$this->post['quantity'] = $current_quantity + $this->post['quantity'];
}
if ($product['maximum_quantity'] > 0 and $product['maximum_quantity'] < $this->post['quantity']) {
$this->post['quantity'] = $product['maximum_quantity'];
}
if ($product['minimum_quantity'] and $product['minimum_quantity'] > $this->post['quantity']) {
$this->post['quantity'] = $product['minimum_quantity'];
}
$product['qty'] = $this->post['quantity'];
$product['qty'] = round(number_format($product['qty'], 2), 2);
$this->post['quantity'] = round(number_format($this->post['quantity'], 2), 2);
// chk if the product has staffel price
if ($product['staffel_price'] && $this->ms['MODULES']['STAFFEL_PRICE_MODULE']) {
if ($this->post['quantity']) {
$quantity = $this->post['quantity'];
} else {
$quantity = $cart['products'][$shopping_cart_item]['qty'];
}
$product['final_price'] = mslib_fe::calculateStaffelPrice($product['staffel_price'], $quantity) / $quantity;
}
// custom hook that can be controlled by third-party plugin
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartProductPricePostHook'])) {
$params = array('shopping_cart_item' => $shopping_cart_item, 'product' => &$product);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartProductPricePostHook'] as $funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
// custom hook that can be controlled by third-party plugin eof
// add product to the cart (through form on products_detail page)
$product['description'] = '';
if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
//$product['country_tax']=mslib_fe::taxDecimalCrop(($product['final_price']*$product['country_tax_rate']), 2, false);
//$product['region_tax']=mslib_fe::taxDecimalCrop(($product['final_price']*$product['region_tax_rate']), 2, false);
$product['country_tax'] = round($product['final_price'] * $product['country_tax_rate'], 2);
$product['region_tax'] = round($product['final_price'] * $product['region_tax_rate'], 2);
if ($product['country_tax'] > 0 && $product['region_tax'] > 0) {
$product['tax'] = $product['country_tax'] + $product['region_tax'];
} else {
$product_tax = $product['final_price'] * $product['tax_rate'];
//$product['tax']=mslib_fe::taxDecimalCrop($product_tax, 2, false);
$product['tax'] = round($product_tax, 2);
}
} else {
$product['country_tax'] = mslib_fe::taxDecimalCrop($product['final_price'] * $product['country_tax_rate']);
$product['region_tax'] = mslib_fe::taxDecimalCrop($product['final_price'] * $product['region_tax_rate']);
if ($product['country_tax'] && $product['region_tax']) {
$product['tax'] = $product['country_tax'] + $product['region_tax'];
} else {
$product['tax'] = mslib_fe::taxDecimalCrop($product['final_price'] * $product['tax_rate']);
}
}
示例2: array
$options = array('caching' => true, 'cacheDir' => $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/cache/', 'lifeTime' => $this->ms['MODULES']['CACHE_TIME_OUT_SEARCH_PAGES']);
$Cache_Lite = new Cache_Lite($options);
$string = md5('ajax_products_staffelprice_search_' . $this->shop_pid . '_' . $_REQUEST['pid']);
}
if (!$this->ms['MODULES']['CACHE_FRONT_END'] or $this->ms['MODULES']['CACHE_FRONT_END'] and !($content = $Cache_Lite->get($string))) {
if ($_REQUEST['pid']) {
$this->get['pid'] = (int) $_REQUEST['pid'];
$this->get['qty'] = (int) $_REQUEST['qty'];
}
if ($_REQUEST['pid'] and strlen($_REQUEST['pid']) < 1) {
exit;
}
$product = mslib_fe::getProduct($this->get['pid'], '', '', 1, 1);
$quantity = $this->get['qty'];
if ($product['staffel_price']) {
$staffel_price['price'] = mslib_fe::calculateStaffelPrice($product['staffel_price'], $quantity) / $quantity;
} else {
$staffel_price['price'] = $product['final_price'];
}
//if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
$staffel_price['price_include_vat'] = $staffel_price['price'] + $staffel_price['price'] * $product['tax_rate'];
//}
$staffel_price['display_price'] = number_format($staffel_price['price'], 2, '.', '');
$staffel_price['display_price_include_vat'] = number_format($staffel_price['price_include_vat'], 2, '.', '');
//
$staffel_price['use_tax_id'] = true;
if (isset($this->get['oid']) && is_numeric($this->get['oid']) && $this->get['oid'] > 0) {
$orders = mslib_fe::getOrder($this->get['oid']);
$iso_customer = mslib_fe::getCountryByName($orders['billing_country']);
$iso_customer['country'] = $iso_customer['cn_short_en'];
$vat_id = $orders['billing_vat_id'];
示例3: final_products_price
public function final_products_price($product, $quantity = 1, $add_currency = 1, $ignore_minimum_quantity = 0, $priceColumn = 'final_price')
{
if (!$ignore_minimum_quantity) {
if ($quantity and $product['minimum_quantity'] > $quantity) {
// check if the product has a minimum quantity
$quantity = $product['minimum_quantity'];
// sum cause we dont want to show the individual price
$sum = 1;
}
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['finalPriceCalc'])) {
$params = array('product' => &$product, 'quantity' => &$quantity, 'add_currency' => &$add_currency, 'ignore_minimum_quantity' => &$ignore_minimum_quantity, 'priceColumn' => &$priceColumn);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['finalPriceCalc'] as $funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
// hook eof
if ($product['staffel_price']) {
$final_price = mslib_fe::calculateStaffelPrice($product['staffel_price'], $quantity) / $quantity;
$product[$priceColumn] = $final_price;
} else {
$final_price = $product[$priceColumn];
}
if ($sum and $product[$priceColumn] > 0) {
$final_price = $product[$priceColumn] * $quantity;
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['finalPriceCalcPostProc'])) {
$params = array('product' => &$product, 'quantity' => &$quantity, 'add_currency' => &$add_currency, 'ignore_minimum_quantity' => &$ignore_minimum_quantity, 'priceColumn' => &$priceColumn, 'final_price' => &$final_price);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['finalPriceCalcPostProc'] as $funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
// hook eof
if ($this->conf['disableFeFromCalculatingVatPrices'] != '1') {
if ($product['tax_rate'] and $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['SHOW_PRICES_WITH_AND_WITHOUT_VAT']) {
// in this mode the stored prices in the tx_multishop_products are excluding VAT and we have to add it manually
if ($product['country_tax_rate'] && $product['region_tax_rate']) {
$country_tax_rate = mslib_fe::taxDecimalCrop($final_price * $product['country_tax_rate']);
$region_tax_rate = mslib_fe::taxDecimalCrop($final_price * $product['region_tax_rate']);
$final_price = $final_price + ($country_tax_rate + $region_tax_rate);
} else {
$tax_rate = mslib_fe::taxDecimalCrop($final_price * $product['tax_rate']);
$final_price = $final_price + $tax_rate;
}
}
}
if ($add_currency) {
return mslib_fe::amount2Cents2($final_price);
} else {
return $final_price;
}
}
示例4:
$output['pagination'] = $pagination;
}
// products pagination module eof
$output['products_name'] .= $product['products_name'];
$output['products_name_marker'] = $product['products_name'];
$output['admin_link'] = '';
if ($this->ROOTADMIN_USER || $this->ADMIN_USER && $this->CATALOGADMIN_USER) {
$output['admin_link'] = '<div class="admin_menu"><a href="' . mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=edit_product&cid=' . $product['categories_id'] . '&pid=' . $product['products_id'] . '&action=edit_product', 1) . '" class="admin_menu_edit"><i class="fa fa-pencil"></i></a> <a href="' . mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=delete_product&cid=' . $product['categories_id'] . '&pid=' . $product['products_id'] . '&action=delete_product', 1) . '" class="admin_menu_remove" title="Remove"><i class="fa fa-trash-o"></i></a></div>';
$output['products_name'] .= $output['admin_link'];
}
$final_price = mslib_fe::final_products_price($product);
if ($product['tax_id']) {
$tax = mslib_fe::getTaxById($product['tax_id']);
if ($tax) {
if ($product['staffel_price'] > 0) {
$price_excl_vat = mslib_fe::calculateStaffelPrice($product['staffel_price'], $qty) / $qty;
} else {
$price_excl_vat = $product['final_price'];
}
//$price_excl_vat=mslib_fe::amount2Cents($price_excl_vat);
}
if ($product['tax_id'] && $this->ms['MODULES']['SHOW_PRICES_WITH_AND_WITHOUT_VAT']) {
if ($tax) {
$sub_content .= '<div class="price_excluding_vat">' . $this->pi_getLL('excluding_vat') . ' ' . mslib_fe::amount2Cents($price_excl_vat) . '</div>';
}
}
}
$staffel_price_hid = '';
if ($product['staffel_price'] && $this->ms['MODULES']['STAFFEL_PRICE_MODULE']) {
$staffel_price_hid = '<input type="hidden" name="staffel_price" id="staffel_price" value="' . $product['staffel_price'] . '" readonly/>';
}