if (!count($plugins_extra_tab['tabs_header']) && !count($plugins_extra_tab['tabs_content'])) { $subpartArray['###LABEL_EXTRA_PLUGIN_TABS###'] = ''; $subpartArray['###CONTENT_EXTRA_PLUGIN_TABS###'] = ''; } else { $subpartArray['###LABEL_EXTRA_PLUGIN_TABS###'] = implode("\n", $plugins_extra_tab['tabs_header']); $subpartArray['###CONTENT_EXTRA_PLUGIN_TABS###'] = implode("\n", $plugins_extra_tab['tabs_content']); } $subpartArray['###ADMIN_LABEL_JS_PLEASE_SELECT_CATEGORY_FOR_THIS_PRODUCT###'] = $this->pi_getLL('admin_label_js_please_select_category_for_this_product'); $subpartArray['###ADMIN_LABEL_JS_PRODUCT_NAME_IS_EMPTY###'] = addslashes(htmlspecialchars($this->pi_getLL('admin_label_js_product_name_is_empty'))); $subpartArray['###ADMIN_LABEL_JS_DEFINE_PRODUCT_NAME_FIRST_IN_DETAILS_TABS###'] = addslashes(htmlspecialchars($this->pi_getLL('admin_label_js_define_product_name_first_in_details_tabs'))); $subpartArray['###ADMIN_LABEL_PRODUCT_NOT_LOADED_SORRY_WE_CANT_FIND_IT###'] = $this->pi_getLL('admin_label_product_not_loaded_sorry_we_cant_find_it'); if (!$this->ms['MODULES']['DISPLAY_MANUFACTURERS_ADVICE_PRICE_INPUT']) { $subpartArray['###MANUFACTURERS_ADVICE_PRICE###'] = ''; } else { $manufacturers_advice_price_tax = mslib_fe::taxDecimalCrop($product['manufacturers_advice_price'] * $product_tax_rate / 100); $manufacturers_advice_price_excl_vat_display = mslib_fe::taxDecimalCrop($product['manufacturers_advice_price'], 2, false); $manufacturers_advice_price_incl_vat_display = mslib_fe::taxDecimalCrop($product['manufacturers_advice_price'] + $manufacturers_advice_price_tax, 2, false); $subpartArray['###LABEL_MANUFACTURERS_ADVIES_PRICE###'] = $this->pi_getLL('admin_label_manufacturers_advice_price'); $subpartArray['###LABEL_EXCLUDING_VAT3###'] = $this->pi_getLL('excluding_vat'); $subpartArray['###LABEL_INCLUDING_VAT3###'] = $this->pi_getLL('including_vat'); $subpartArray['###LABEL_CURRENCY6###'] = mslib_fe::currency(); $subpartArray['###LABEL_CURRENCY7###'] = mslib_fe::currency(); $subpartArray['###VALUE_EXCL_VAT_MANUFACTURERS_ADVICE_PRICE###'] = $manufacturers_advice_price_excl_vat_display; $subpartArray['###VALUE_INCL_VAT_MANUFACTURERS_ADVICE_PRICE###'] = $manufacturers_advice_price_incl_vat_display; $subpartArray['###VALUE_ORIGINAL_MANUFACTURERS_ADVICE_PRICE###'] = $product['manufacturers_advice_price']; } $content .= $this->cObj->substituteMarkerArrayCached($subparts['template'], array(), $subpartArray); } else { $content .= $this->pi_getLL('admin_label_product_not_loaded_sorry_we_cant_find_it'); } }
$status .= '<a href="#" class="update_product_status" rel="' . $rs['products_id'] . '"><span class="admin_status_red disabled" alt="Disabled"></span></a>'; $status .= '<span class="admin_status_green" alt="Enable"></span>'; } $product_tax_rate = 0; $data = mslib_fe::getTaxRuleSet($rs['tax_id'], 0); $product_tax_rate = $data['total_tax_rate']; $product_tax_rate_js[] = 'product_tax_rate_js["' . $rs['products_id'] . '"]="' . $data['total_tax_rate'] . '";'; $product_tax = mslib_fe::taxDecimalCrop($rs['products_price'] * $product_tax_rate / 100); $product_price_display = mslib_fe::taxDecimalCrop($rs['products_price'], 2, false); $product_price_display_incl = mslib_fe::taxDecimalCrop($rs['products_price'] + $product_tax, 2, false); $special_tax = mslib_fe::taxDecimalCrop($rs['specials_new_products_price'] * $product_tax_rate / 100); $special_price_display = mslib_fe::taxDecimalCrop($rs['specials_new_products_price'], 2, false); $special_price_display_incl = mslib_fe::taxDecimalCrop($rs['specials_new_products_price'] + $special_tax, 2, false); $capital_tax = mslib_fe::taxDecimalCrop($rs['product_capital_price'] * $product_tax_rate / 100); $capital_price_display = mslib_fe::taxDecimalCrop($rs['product_capital_price'], 2, false); $capital_price_display_incl = mslib_fe::taxDecimalCrop($rs['product_capital_price'] + $capital_tax, 2, false); $markerArray = array(); $markerArray['ROW_TYPE'] = $switch; $markerArray['CATEGORY_ID0'] = $rs['categories_id']; $markerArray['CHECKBOX_COUNTER0'] = $s; $markerArray['CHECKBOX_COUNTER1'] = $s; $markerArray['CELL_NUMBER'] = $p * $this->ms['MODULES']['PRODUCTS_LISTING_LIMIT'] + $s + 1; $markerArray['PRODUCT_NAME'] = $rs['products_name'] ? $rs['products_name'] : $this->pi_getLL('no_name'); $markerArray['PRODUCT_CATEGORIES_CRUMBAR'] = $cat_crumbar; $markerArray['PRODUCT_MODEL'] = $rs['products_model']; $markerArray['PRODUCT_STATUS'] = $status; $markerArray['LINK_EDIT_CAT'] = $link_edit_cat; $markerArray['CATEGORY_NAME'] = $rs['categories_name']; $markerArray['VALUE_TAX_ID'] = $rs['tax_id']; $markerArray['CURRENCY0'] = mslib_fe::currency(); $markerArray['CURRENCY1'] = mslib_fe::currency();
</div> </div> </div>'; $row_counter++; } } $freeshippingcosts_above = false; $free_shippingcosts = 0; $fsc_price_display = 0; $fsc_price_display_incl = 0; if (!empty($row3['override_shippingcosts'])) { $freeshippingcosts_above = true; list($free_shippingcosts, ) = explode(':', $row3['override_shippingcosts']); $fsc_tax = mslib_fe::taxDecimalCrop($free_shippingcosts * $sc_tax_rate / 100); $fsc_price_display = mslib_fe::taxDecimalCrop($free_shippingcosts, 2, false); $fsc_price_display_incl = mslib_fe::taxDecimalCrop($free_shippingcosts + $fsc_tax, 2, false); } $content .= '<hr> <div class="form-group"> <label id="' . $zone_pid . '_NivLevel' . $i . '" class="control-label col-md-4 secondLabel"><div class="checkbox checkbox-success"><input type="checkbox" name="freeshippingcostsabove[' . $zone_pid . ']" id="freeshippingcostsabove[' . $zone_pid . ']" value="1"' . ($freeshippingcosts_above ? ' checked="checked"' : '') . ' /><label for="freeshippingcostsabove[' . $zone_pid . ']">' . $this->pi_getLL('free_shippingcosts_for_order_amount_above') . '</label></div></label> <div class="col-md-8"> <div class="msAttributesField"><div class="input-group"><span class="input-group-addon">' . mslib_fe::currency() . '</span><input type="text" id="display_name" name="display_name" class="form-control msProductsPriceExcludingVat priceInputDisplay" value="' . htmlspecialchars($fsc_price_display) . '" rel="' . $row['id'] . '" autocomplete="off"><span class="input-group-addon">' . $this->pi_getLL('excluding_vat') . '</span></div></div> <div class="msAttributesField"><div class="input-group"><span class="input-group-addon">' . mslib_fe::currency() . '</span><input type="text" name="display_name" id="display_name" class="form-control msProductsPriceIncludingVat priceInputDisplay" value="' . htmlspecialchars($fsc_price_display_incl) . '" rel="' . $row['id'] . '" autocomplete="off"><span class="input-group-addon">' . $this->pi_getLL('including_vat') . '</span></div></div> <div class="msAttributesField hidden"><input type="hidden" style="text-align:right" size="3" name="freeshippingcostsabove_value[' . $zone_pid . ']" class="priceInputReal" value="' . $free_shippingcosts . '"></div> </div> </div> '; $content .= '</div>'; $content .= '<script type="text/javascript">'; $content .= "</script>"; $content .= '</div>';
if (strpos($current_price, ':') !== false) { $price_list_format = explode(',', $current_price); $price_list_incl_tax = array(); foreach ($price_list_format as $price_format) { $price_excl = explode(':', $price_format); if ($price_excl[1] > 0) { $data = mslib_fe::getTaxRuleSet($tax_group_id, $price_excl[1], $to_tax_include); if ($to_tax_include == 'true') { $price_excl[1] = str_replace(',', '', $data['price_including_tax']); } else { $price_excl[1] = str_replace(',', '', $data['price_excluding_tax']); } } else { $price_excl[1] = 0; } $price_excl[1] = mslib_fe::taxDecimalCrop($price_excl[1]); $price_list_incl_tax[] = implode(':', $price_excl); } //$sc_price_display_incl = $row3['price']; if ($to_tax_include == 'true') { $data['price_including_tax'] = implode(',', $price_list_incl_tax); } else { $data['price_excluding_tax'] = implode(',', $price_list_incl_tax); } } else { if (strstr($current_price, ",")) { $current_price = str_replace(",", ".", $current_price); } $data = mslib_fe::getTaxRuleSet($tax_group_id, $current_price, $to_tax_include); $data['price_excluding_tax'] = str_replace(',', '', $data['price_excluding_tax']); }
break; default: $multiple = 0; $continue = 1; break; } if ($continue) { $array = array($attribute_values); foreach ($array as $item) { if ($product['tax_rate'] && $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { if ($value['country_tax_rate'] && $value['region_tax_rate']) { $country_tax_rate = mslib_fe::taxDecimalCrop($item['options_values_price'] * $value['country_tax_rate']); $region_tax_rate = mslib_fe::taxDecimalCrop($item['options_values_price'] * $value['region_tax_rate']); $item_tax_rate = $country_tax_rate + $region_tax_rate; } else { $item_tax_rate = mslib_fe::taxDecimalCrop($item['options_values_price'] * $value['tax_rate']); } $item['options_values_price'] = $item['options_values_price'] + $item_tax_rate; } else { $item['options_values_price'] = round($item['options_values_price'], 2); } if ($item['options_values_price'] > 0) { $subprices .= mslib_fe::amount2Cents($value['qty'] * ($item['price_prefix'] . $item['options_values_price'])); } $subprices .= '<br />'; $output['product_attributes'] .= '<div class="attributes-items"><span class="attribute-option">' . $item['products_options_name'] . ':</span><span class="attribute-value">' . $item['products_options_values_name'] . $t . '</span></div>'; $price = $price + $value['qty'] * ($item['price_prefix'] . $item['options_values_price']); } } } // loading the attributes eof
$payment_tax['payment_country_tax'] = mslib_fe::taxDecimalCrop($updateArray['payment_method_costs'] * $payment_method['country_tax_rate']); } else { $payment_tax['payment_country_tax_rate'] = 0; $payment_tax['payment_country_tax'] = 0; } if ($payment_method['region_tax_rate']) { $payment_tax['payment_region_tax_rate'] = $payment_method['region_tax_rate']; $payment_tax['payment_region_tax'] = mslib_fe::taxDecimalCrop($updateArray['payment_method_costs'] * $payment_method['region_tax_rate']); } else { $payment_tax['payment_region_tax_rate'] = 0; $payment_tax['payment_region_tax'] = 0; } if ($payment_tax['payment_region_tax'] && $payment_tax['payment_country_tax']) { $payment_tax['payment_tax'] = $payment_tax['payment_country_tax'] + $payment_tax['payment_region_tax']; } else { $payment_tax['payment_tax'] = mslib_fe::taxDecimalCrop($updateArray['payment_method_costs'] * $payment_method['tax_rate']); } } else { $payment_tax['payment_tax'] = 0; $payment_tax['payment_country_tax'] = 0; $payment_tax['payment_region_tax'] = 0; $payment_tax['payment_total_tax_rate'] = 0; $payment_tax['payment_country_tax_rate'] = 0; $payment_tax['payment_region_tax_rate'] = 0; } $updateArray['payment_method'] = $payment_method['code']; $updateArray['payment_method_label'] = $payment_method['name']; } if (isset($this->post['edit_discount_value'])) { $updateArray['discount'] = $this->post['edit_discount_value']; }
//var_dump($sql_option); $qry_option = $GLOBALS['TYPO3_DB']->sql_query($sql_option); $ctr = 0; if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_option) > 0) { while (($rs_option = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_option)) != false) { $product = mslib_fe::getProduct($this->get['pid'], '', '', 1, 1); $data = mslib_fe::getTaxRuleSet($product['tax_id'], $product['products_price']); $product_tax_rate = $data['total_tax_rate']; $attributes_tax = mslib_fe::taxDecimalCrop($rs_option['options_values_price'] * $product_tax_rate / 100); $attribute_price_display_incl = mslib_fe::taxDecimalCrop($rs_option['options_values_price'] + $attributes_tax, 2, false, false); $option_data[$ctr]['sort_order'] = (int) $rs_option['sort_order_option_name']; $option_data[$ctr]['optid'] = $this->get['optid']; $option_data[$ctr]['valid'] = $rs_option['options_values_id']; $option_data[$ctr]['valname'] = $rs_option['products_options_values_name']; $option_data[$ctr]['values_price'] = $rs_option['options_values_price']; $option_data[$ctr]['display_values_price'] = mslib_fe::taxDecimalCrop($rs_option['options_values_price'], 2, false, false); $option_data[$ctr]['display_values_price_including_vat'] = $attribute_price_display_incl; $option_data[$ctr]['price_prefix'] = $rs_option['price_prefix']; $ctr++; } } } $content = $option_data; $content = json_encode($content, ENT_NOQUOTES); if ($this->ms['MODULES']['CACHE_FRONT_END']) { $Cache_Lite->save($content); } //} echo $content; exit; }
} } $amount_handling_cost = str_replace('%', '', $row['handling_costs']); $data = mslib_fe::getTaxRuleSet($row['tax_id'], $amount_handling_cost); $cost_tax_rate = $data['total_tax_rate']; $cost_tax = mslib_fe::taxDecimalCrop($amount_handling_cost * $cost_tax_rate / 100); $cost_excl_vat_display = mslib_fe::taxDecimalCrop($amount_handling_cost, 2, false); $cost_incl_vat_display = mslib_fe::taxDecimalCrop($amount_handling_cost + $cost_tax, 2, false); $cart_minimum_amount = $row['cart_minimum_amount']; $cart_minimum_amount_cost_tax = mslib_fe::taxDecimalCrop($cart_minimum_amount * $cost_tax_rate / 100); $cart_minimum_amount_excl_vat_display = mslib_fe::taxDecimalCrop($cart_minimum_amount, 2, false); $cart_minimum_amount_incl_vat_display = mslib_fe::taxDecimalCrop($cart_minimum_amount + $cart_minimum_amount_cost_tax, 2, false); $cart_maximum_amount = $row['cart_maximum_amount']; $cart_maximum_amount_cost_tax = mslib_fe::taxDecimalCrop($cart_maximum_amount * $cost_tax_rate / 100); $cart_maximum_amount_excl_vat_display = mslib_fe::taxDecimalCrop($cart_maximum_amount, 2, false); $cart_maximum_amount_incl_vat_display = mslib_fe::taxDecimalCrop($cart_maximum_amount + $cart_maximum_amount_cost_tax, 2, false); $tmpcontent .= '<div class="form-group"> <label class="control-label col-md-2">' . $this->pi_getLL('code') . '</label> <div class="col-md-10"> <p class="form-control-static"> <input name="custom_code" id="custom_code" type="hidden" value="' . htmlspecialchars($row['code']) . '" /> ' . $row['code'] . ' </p> </div> </div>'; if (count($active_shop) > 1) { $tmpcontent .= '<div class="form-group"> <label for="related_shop_pid" class="control-label col-md-2">' . $this->pi_getLL('relate_shipping_to_shop', 'Relate this method to') . '</label> <div class="col-md-10"> <div class="radio radio-success radio-inline"><input name="related_shop_pid" id="related_shop_pid" type="radio" value="0"' . ($row['page_uid'] == 0 ? ' checked="checked"' : '') . ' /><label>' . $this->pi_getLL('relate_payment_to_all_shop', 'All shop') . '</label></div>'; foreach ($active_shop as $pageinfo) {
function getHtmlCartContents($sectionTemplateType = '') { if ($this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] = 1; } $disable_product_status_col = false; $content = ''; switch ($sectionTemplateType) { case 'adminNotificationPopup': if ($this->conf['order_details_table_adminNotificationPopup_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_adminNotificationPopup_tmpl_path']); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_adminNotificationPopup.tmpl'); } break; case 'ajaxGetMethodCosts': if ($this->conf['order_details_table_ajaxGetMethodCosts_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_ajaxGetMethodCosts_tmpl_path']); } else { $disable_product_status_col = true; if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site.tmpl'); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site_excluding_vat.tmpl'); } } break; default: if ($sectionTemplateType) { if ($this->conf['order_details_table_' . $sectionTemplateType . '_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_' . $sectionTemplateType . '_tmpl_path']); } else { $disable_product_status_col = true; $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site.tmpl'); } } else { if ($this->conf['order_details_table_site_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_site_tmpl_path']); } else { $disable_product_status_col = true; $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site.tmpl'); } } break; } // hook to rewrite the whole methods if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContents'])) { $params = array('sectionTemplateType' => &$sectionTemplateType, 'template' => &$template, 'disable_product_status_col' => &$disable_product_status_col, 'content' => &$content); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContents'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } else { $itemsWrapper = array(); $c = true; if (is_array($this->cart['products']) && count($this->cart['products'])) { foreach ($this->cart['products'] as $shopping_cart_item => $product) { $subPrices = ''; if (!$product['products_image']) { $image = '<div class="no_image_50"></div>'; } else { $image = '<img src="' . $product['products_image'] . '">'; } $item = array(); // ITEM CLASS $item['ITEM_CLASS'] = ($c = !$c) ? 'odd' : 'even'; // ITEM IMAGE if (!$product['products_image']) { $item['ITEM_IMAGE'] = '<div class="no_image_50"></div>'; } else { if (!strstr(mslib_befe::strtolower($product['products_image']), 'http://') and !strstr(mslib_befe::strtolower($product['products_image']), 'https://')) { $item['products_image'] = mslib_befe::getImagePath($product['products_image'], 'products', '50'); } $item['ITEM_IMAGE'] = '<img src="' . $product['products_image'] . '" title="' . htmlspecialchars($product['products_name']) . '">'; } // ITEM_NAME if ($this->ms['MODULES']['ADD_LINK_TO_PRODUCT_NAME_IN_CHECKOUT_REVIEW'] > 0) { $item['ITEM_NAME'] = '<a href="' . $product['link'] . '">' . $product['products_name'] . '</a>'; } else { $item['ITEM_NAME'] = $product['products_name']; } if ($product['products_model']) { $item['ITEM_NAME'] .= ' (' . $product['products_model'] . ') '; } /* if (!empty($product['ean_code'])) { $item['ITEM_NAME'] .= '<br/>EAN: '.$product['ean_code']; } if (!empty($product['sku_code'])) { $item['ITEM_NAME'] .= '<br/>SKU: '.$product['sku_code']; } if (!empty($product['vendor_code'])) { $item['ITEM_NAME'] .= '<br/>Vendor: '.$product['vendor_code']; }*/ //print_r($product['attributes']); if (is_array($product['attributes'])) { // loading the attributes foreach ($product['attributes'] as $attribute_key => $attribute_values) { $continue = 0; if (is_numeric($attribute_key)) { $str = "SELECT products_options_name,listtype from tx_multishop_products_options o where o.products_options_id='" . $attribute_key . "' "; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry); } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsAttributesIteratorPreType'])) { $params = array('attribute_key' => &$attribute_key, 'attribute_values' => &$attribute_values, 'row' => &$row); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsAttributesIteratorPreType'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } switch ($row['listtype']) { case 'checkbox': $item['ITEM_NAME'] .= '<br />' . $row['products_options_name'] . ': ' . $attribute_values['products_options_values_name']; $continue = 0; $total = count($attribute_values); $counter = 0; foreach ($attribute_values as $attribute_item) { $counter++; if ($product['tax_rate'] && $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $attribute_item['options_values_price'] = round($attribute_item['options_values_price'] * (1 + $product['tax_rate']), 2); } else { $attribute_item['options_values_price'] = round($attribute_item['options_values_price'], 2); } $item['ITEM_NAME'] .= trim($attribute_item['products_options_values_name']); $price = $price + ($attribute_item['price_prefix'] . $attribute_item['options_values_price']) * $product['qty']; if ($attribute_item['options_values_price'] > 0) { $subPrices .= mslib_fe::amount2Cents(($attribute_item['price_prefix'] . $attribute_item['options_values_price']) * $product['qty']); } $subPrices .= '<br />'; if (isset($attribute_values[$counter])) { $item['ITEM_NAME'] .= ', '; } } break; case 'input': $item['ITEM_NAME'] .= '<br />' . $row['products_options_name'] . ': ' . $attribute_values['products_options_values_name']; $multiple = 0; $continue = 0; break; default: $multiple = 0; $continue = 1; break; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsAttributesIteratorPostType'])) { $params = array('attribute_key' => &$attribute_key, 'attribute_values' => &$attribute_values, 'continue' => &$continue, 'multiple' => &$multiple, 'row' => &$row); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsAttributesIteratorPostType'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($continue) { $array = array($attribute_values); foreach ($array as $attribute_item) { if ($product['tax_rate'] && $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { if ($product['country_tax_rate'] && $product['region_tax_rate']) { $country_tax_rate = mslib_fe::taxDecimalCrop($attribute_item['options_values_price'] * $product['country_tax_rate']); $region_tax_rate = mslib_fe::taxDecimalCrop($attribute_item['options_values_price'] * $product['region_tax_rate']); $item_tax_rate = $country_tax_rate + $region_tax_rate; } else { $item_tax_rate = mslib_fe::taxDecimalCrop($attribute_item['options_values_price'] * $product['tax_rate']); } $attribute_item['options_values_price'] = $attribute_item['options_values_price'] + $item_tax_rate; } else { $attribute_item['options_values_price'] = round($attribute_item['options_values_price'], 2); } if ($attribute_item['options_values_price'] > 0) { $subPrices .= mslib_fe::amount2Cents($product['qty'] * ($attribute_item['price_prefix'] . $attribute_item['options_values_price'])); } $subPrices .= '<br />'; $item['ITEM_NAME'] .= '<div class="attributes-items"><span class="attribute-option">' . $row['products_options_name'] . ':</span><span class="attribute-value">' . $attribute_values['products_options_values_name'] . '</span></div>'; $price = $price + ($attribute_item['price_prefix'] . $attribute_item['options_values_price']) * $product['qty']; } } } // loading the attributes eof } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsItemPricePreProc'])) { $params = array('product' => &$product, 'cart' => &$this->cart, 'c' => &$c, 'subPrices' => &$subPrices, 'sectionTemplateType' => &$sectionTemplateType); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsItemPricePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($subPrices) { $subPrices = '<div class="attribute_prices">' . $subPrices . '</div>'; } // ITEM NAME EOF // ITEM_MODEL $item['ITEM_MODEL'] = $product['products_model']; // ITEM_QUANTITY $item['SHOPPING_CART_KEY'] = $shopping_cart_item; $item['ITEM_LINK'] = $product['link']; $item['ITEM_ORDER_UNIT_CODE'] = $product['order_unit_code']; $item['ITEM_ORDER_UNIT_NAME'] = $product['order_unit_name']; $item['ITEM_MANUFACTURERS_NAME'] = $product['manufacturers_name']; $item['ITEM_QUANTITY'] = round($product['qty'], 14); $item['ITEM_VAT_RATE'] = str_replace('.00', '', number_format($product['tax_rate'] * 100, 2)) . '%'; // ITEM_SKU $item['ITEM_SKU'] = $product['sku_code']; // ITEM_TOTAL if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $totalPrice = $product['total_price_including_vat']; } else { $totalPrice = $product['total_price']; } if ($product['tax_rate'] && $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $product['final_price'] = round($product['final_price'] * (1 + $product['tax_rate']), 2); } if ($subPrices) { $totalPrice = $product['final_price'] * $product['qty']; } $item['ITEM_TOTAL'] = mslib_fe::amount2Cents($totalPrice) . $subPrices; $item['ITEM_PRICE_SINGLE'] = mslib_fe::amount2Cents($product['final_price']); //.$subPrices; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsItemPreProc'])) { $params = array('item' => &$item, 'product' => &$product, 'cart' => &$this->cart, 'c' => &$c, 'sectionTemplateType' => &$sectionTemplateType); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['getHtmlCartContentsItemPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $itemsWrapper[] = $item; } } // MERGE TO TEMPLATE // Extract the subparts from the template $subparts = array(); $subparts['template'] = $this->cObj->getSubpart($template, '###TEMPLATE###'); $subparts['ITEMS_HEADER_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###ITEMS_HEADER_WRAPPER###'); $subparts['ITEMS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###ITEMS_WRAPPER###'); $subparts['SUBTOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SUBTOTAL_WRAPPER###'); $subparts['SHIPPING_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SHIPPING_COSTS_WRAPPER###'); $subparts['PAYMENT_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###PAYMENT_COSTS_WRAPPER###'); $subparts['GRAND_TOTAL_EXCLUDING_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###GRAND_TOTAL_EXCLUDING_VAT_WRAPPER###'); $subparts['GRAND_TOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###GRAND_TOTAL_WRAPPER###'); $subparts['TAX_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###TAX_COSTS_WRAPPER###'); $subparts['DISCOUNT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###DISCOUNT_WRAPPER###'); $subparts['NEWSUBTOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###NEWSUBTOTAL_WRAPPER###'); // remove the status col if ($disable_product_status_col) { $subProductStatusPart = array(); $subProductStatusPart['ITEMS_HEADER_PRODUCT_STATUS_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_HEADER_WRAPPER'], '###ITEMS_HEADER_PRODUCT_STATUS_WRAPPER###'); $subProductStatus = array(); $subProductStatus['###ITEMS_HEADER_PRODUCT_STATUS_WRAPPER###'] = ''; $subparts['ITEMS_HEADER_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEMS_HEADER_WRAPPER'], array(), $subProductStatus); $subProductStatusPart = array(); $subProductStatusPart['ITEMS_PRODUCT_STATUS_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_WRAPPER'], '###ITEMS_PRODUCT_STATUS_WRAPPER###'); $subProductStatus = array(); $subProductStatus['###ITEMS_PRODUCT_STATUS_WRAPPER###'] = ''; $subparts['ITEMS_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEMS_WRAPPER'], array(), $subProductStatus); } // end of remove $subpartArray = array(); //ITEMS_HEADER_WRAPPER $markerArray['HEADING_PRODUCTS_NAME'] = ucfirst($this->pi_getLL('product')); $markerArray['HEADING_QUANTITY'] = $this->pi_getLL('qty'); $markerArray['HEADING_PRICE'] = $this->pi_getLL('price'); if (!$this->cart['summarize']['grand_total_vat']) { $markerArray['HEADING_TOTAL'] = ucfirst($this->pi_getLL('total_excl_vat')); } else { $markerArray['HEADING_TOTAL'] = $this->pi_getLL('total'); } $markerArray['HEADING_VAT_RATE'] = $this->pi_getLL('vat'); $subpartArray['###ITEMS_HEADER_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['ITEMS_HEADER_WRAPPER'], $markerArray, '###|###'); //ITEMS_HEADER_WRAPPER EOF //ITEMS_WRAPPER $keys = array(); $keys[] = 'ITEM_CLASS'; $keys[] = 'ITEM_IMAGE'; $keys[] = 'ITEM_NAME'; $keys[] = 'ITEM_MODEL'; $keys[] = 'ITEM_QUANTITY'; $keys[] = 'ITEM_LINK'; $keys[] = 'SHOPPING_CART_KEY'; $keys[] = 'ITEM_MANUFACTURERS_NAME'; $keys[] = 'ITEM_ORDER_UNIT_CODE'; $keys[] = 'ITEM_ORDER_UNIT_NAME'; $keys[] = 'ITEM_SKU'; $keys[] = 'ITEM_VAT_RATE'; $keys[] = 'ITEM_TOTAL'; $keys[] = 'ITEM_PRICE_SINGLE'; if (is_array($itemsWrapper) && count($itemsWrapper)) { foreach ($itemsWrapper as $item) { $markerArray = array(); foreach ($keys as $key) { $markerArray[$key] = $item[$key]; } foreach ($item as $key => $val) { // hooked plugins wants to add more types. lets find them and add them if (!in_array($key, $keys)) { $markerArray[$key] = $item[$key]; } } $contentItem .= $this->cObj->substituteMarkerArray($subparts['ITEMS_WRAPPER'], $markerArray, '###|###'); } } $subpartArray['###ITEMS_WRAPPER###'] = $contentItem; //ITEMS_WRAPPER EOF //SUBTOTAL_WRAPPER $key = 'SUBTOTAL_WRAPPER'; $markerArray = array(); $markerArray['PRODUCTS_TOTAL_PRICE_LABEL'] = $this->pi_getLL('total_price'); $markerArray['PRODUCTS_SUB_TOTAL_PRICE_LABEL'] = $this->pi_getLL('subtotal'); $markerArray['PRODUCTS_TOTAL_PRICE_INCLUDING_VAT_LABEL'] = $this->pi_getLL('subtotal'); $markerArray['PRODUCTS_TOTAL_PRICE_INCLUDING_VAT'] = mslib_fe::amount2Cents($this->cart['summarize']['sub_total_including_vat']); $markerArray['PRODUCTS_TOTAL_PRICE'] = mslib_fe::amount2Cents($this->cart['summarize']['sub_total']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //SUBTOTAL_WRAPPER EOF //SHIPPING_COSTS_WRAPPER $key = 'SHIPPING_COSTS_WRAPPER'; //if ($this->cart['user']['shipping_method_costs_including_vat']>0) { if ($this->cart['user']['shipping_method_label']) { $markerArray = array(); $shipping_price_value = $order['shipping_method_costs'] + $order['orders_tax_data']['shipping_tax']; $markerArray['SHIPPING_COSTS_INCLUDING_VAT_LABEL'] = $this->pi_getLL('shipping_costs') . ' (' . $this->cart['user']['shipping_method_label'] . ')'; $markerArray['SHIPPING_COSTS_INCLUDING_VAT'] = mslib_fe::amount2Cents($this->cart['user']['shipping_method_costs_including_vat']); $markerArray['SHIPPING_COSTS'] = mslib_fe::amount2Cents($this->cart['user']['shipping_method_costs']); $shippingCostsLineContent = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); if (!$this->cart['user']['shipping_method_costs']) { if ($this->ms['MODULES']['CHECKOUT_HIDE_ZERO_SHIPPING_COSTS_IN_SUMMARY'] == '1') { $shippingCostsLineContent = ''; } } $subpartArray['###' . $key . '###'] = $shippingCostsLineContent; } else { $subpartArray['###' . $key . '###'] = ''; } //SHIPPING_COSTS_WRAPPER EOF //PAYMENT_COSTS_WRAPPER $key = 'PAYMENT_COSTS_WRAPPER'; //if ($this->cart['user']['payment_method_costs_including_vat']>0) { if ($this->cart['user']['payment_method_label']) { $markerArray = array(); $markerArray['PAYMENT_COSTS_INCLUDING_VAT_LABEL'] = $this->pi_getLL('payment_costs') . ' (' . $this->cart['user']['payment_method_label'] . ')'; $markerArray['PAYMENT_COSTS_INCLUDING_VAT'] = mslib_fe::amount2Cents($this->cart['user']['payment_method_costs_including_vat']); $markerArray['PAYMENT_COSTS'] = mslib_fe::amount2Cents($this->cart['user']['payment_method_costs']); $paymentCostsLineContent = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); if (!$this->cart['user']['payment_method_costs']) { if ($this->ms['MODULES']['CHECKOUT_HIDE_ZERO_PAYMENT_COSTS_IN_SUMMARY'] == '1') { $paymentCostsLineContent = ''; } } $subpartArray['###' . $key . '###'] = $paymentCostsLineContent; } else { $subpartArray['###' . $key . '###'] = ''; } //PAYMENT_COSTS_WRAPPER EOF //GRAND_TOTAL_WRAPPER $key = 'GRAND_TOTAL_WRAPPER_EXCLUDING_VAT'; $markerArray['GRAND_TOTAL_COSTS_EXCLUDING_VAT_LABEL'] = ucfirst($this->pi_getLL('grand_total_excluding_vat')); //$markerArray['GRAND_TOTAL_COSTS_EXCLUDING_VAT']=mslib_fe::amount2Cents(($this->cart['summarize']['grand_total']-$this->cart['total_orders_tax_including_discount'])); $markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_PRICE'] = mslib_fe::amount2Cents($this->cart['summarize']['grand_total'] - $this->cart['summarize']['grand_total_vat']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); // Duplicate to make all tmpl files consistent $key = 'GRAND_TOTAL_EXCLUDING_VAT_WRAPPER'; $markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_LABEL'] = ucfirst($this->pi_getLL('grand_total_excluding_vat')); //$markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_PRICE']=mslib_fe::amount2Cents(($this->cart['summarize']['grand_total']-$this->cart['total_orders_tax_including_discount'])); $markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_PRICE'] = mslib_fe::amount2Cents($this->cart['summarize']['grand_total'] - $this->cart['summarize']['grand_total_vat']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //GRAND_TOTAL_WRAPPER $key = 'GRAND_TOTAL_WRAPPER'; if (!$this->cart['summarize']['grand_total_vat']) { $markerArray['GRAND_TOTAL_COSTS_LABEL'] = ucfirst($this->pi_getLL('total_excl_vat')); } else { $markerArray['GRAND_TOTAL_COSTS_LABEL'] = ucfirst($this->pi_getLL('total')); } // $markerArray['GRAND_TOTAL_COSTS'] = mslib_fe::amount2Cents($subtotal+$order['orders_tax_data']['total_orders_tax']+$order['payment_method_costs']+$order['shipping_method_costs']-$order['discount']); $markerArray['GRAND_TOTAL_COSTS'] = mslib_fe::amount2Cents($this->cart['summarize']['grand_total']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //GRAND_TOTAL_WRAPPER EOF /* //DISCOUNT_WRAPPER $key='DISCOUNT_WRAPPER'; if ($this->cart['discount_amount'] > 0) { $DISCOUNT_WRAPPER = ' <tr> <td class="msFrontGrandTotalDiscountLabel">'.$this->pi_getLL('discount').':</td> <td class="msFrontGrandTotalDiscountValue">'.mslib_fe::amount2Cents($this->cart['discount_amount']).'</td> </tr>'; $subpartArray['###'.$key.'###'] = $DISCOUNT_WRAPPER; } else { $subpartArray['###'.$key.'###'] = ''; } */ //DISCOUNT_WRAPPER EOF // new //error_log(print_r($this->cart,1)); // still not good. having partials of orders class //DISCOUNT_WRAPPER $key = 'DISCOUNT_WRAPPER'; if ($this->cart['discount_amount'] > 0) { $this->cart['summarize']['total_orders_tax_including_discount'] = $this->cart['summarize']['total_orders_tax_including_discount'] - $this->cart['discount_amount']; $this->cart['summarize']['grand_total'] = round($this->cart['summarize']['grand_total'] - $row['discount'], 2); $markerArray = array(); $markerArray['DISCOUNT_LABEL'] = $this->pi_getLL('discount'); $markerArray['DISCOUNT'] = mslib_fe::amount2Cents($this->cart['discount_amount']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); // trick to reduce TAX costs //if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { //$this->cart['summarize']['grand_total_vat']=(1-($this->cart['discount_amount']/$this->cart['summarize']['sub_total_including_vat']))*$this->cart['summarize']['grand_total_vat']; //} } else { $subpartArray['###' . $key . '###'] = ''; $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = ''; } if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { // new subtotal $markerArray = array(); $markerArray['PRODUCTS_NEWSUB_TOTAL_PRICE_LABEL'] = $this->pi_getLL('new_subtotal_excl_vat'); $new_subtotal_amount = $this->cart['summarize']['sub_total'] - $this->cart['discount_amount'] + $this->cart['user']['shipping_method_costs'] + $this->cart['user']['payment_method_costs']; $markerArray['PRODUCTS_NEWTOTAL_PRICE'] = mslib_fe::amount2Cents($new_subtotal_amount); $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['NEWSUBTOTAL_WRAPPER'], $markerArray, '###|###'); } else { $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = ''; } // error_log(print_r($this->cart['summarize'],1)); //DISCOUNT_WRAPPER EOF //TAX_COSTS_WRAPPER $key = 'TAX_COSTS_WRAPPER'; if ($this->cart['summarize']['grand_total_vat']) { $markerArray = array(); $markerArray['TAX_RATE_LABEL'] = $this->pi_getLL('vat'); $markerArray['INCLUDED_TAX_RATE_LABEL'] = $this->pi_getLL('included_vat_amount'); $markerArray['TAX_COSTS'] = mslib_fe::amount2Cents($this->cart['summarize']['grand_total_vat']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); } else { $subpartArray['###' . $key . '###'] = ''; } // new //TAX_COSTS_WRAPPER /* $key='TAX_COSTS_WRAPPER'; if ($order['orders_tax_data']['total_orders_tax'] > 0) { $TAX_COSTS_WRAPPER = ' <tr> <td class="msFrontGrandTotalVatLabel">'.$this->pi_getLL('included_vat','Included VAT').'</td> <td class="msFrontGrandTotalVatValue">'.mslib_fe::amount2Cents($this->cart['summarize']['grand_total_vat']).'</td> </tr>'; $subpartArray['###'.$key.'###'] = $TAX_COSTS_WRAPPER; } else { $subpartArray['###'.$key.'###'] = ''; } */ //TAX_COSTS_WRAPPER EOF // finally convert global markers and return output $content = $this->cObj->substituteMarkerArrayCached($subparts['template'], null, $subpartArray); } return $content; }
public function productFeedGeneratorGetShippingCosts($products, $countries_id, $shipping_method_id) { if (!is_array($products) && count($products)) { return false; } if (!is_numeric($countries_id)) { return false; } if (!is_numeric($shipping_method_id)) { return false; } $str3 = $GLOBALS['TYPO3_DB']->SELECTquery('sm.shipping_costs_type, sm.handling_costs, c.price, c.override_shippingcosts, c.zone_id', 'tx_multishop_shipping_methods sm, tx_multishop_shipping_methods_costs c, tx_multishop_countries_to_zones c2z', 'sm.id=c.shipping_method_id and c.zone_id=c2z.zone_id and c.shipping_method_id=\'' . $shipping_method_id . '\' and (sm.page_uid=0 or sm.page_uid=\'' . $this->shop_pid . '\') and c2z.cn_iso_nr=\'' . $countries_id . '\'', '', '', ''); $qry3 = $GLOBALS['TYPO3_DB']->sql_query($str3); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry3)) { $row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry3); $shipping_method = mslib_fe::getShippingMethod($shipping_method_id, 's.id', $countries_id); //hook to let other plugins further manipulate the settings if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['productFeedGeneratorGetShippingCosts'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['productFeedGeneratorGetShippingCosts'] as $funcRef) { $params['row3'] =& $row3; $params['shipping_method'] =& $shipping_method; $params['countries_id'] =& $countries_id; \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if ($row3['shipping_costs_type'] == 'weight') { $total_weight = $products['products_weight']; $steps = explode(",", $row3['price']); $current_price = ''; foreach ($steps as $step) { $cols = explode(":", $step); if (isset($cols[1])) { $current_price = $cols[1]; } if ($total_weight <= $cols[0]) { $current_price = $cols[1]; break; } } $shipping_cost = $current_price; $shipping_cost_method_box = $current_price; } elseif ($row3['shipping_costs_type'] == 'quantity') { $total_quantity = 1; $steps = explode(",", $row3['price']); $current_price = ''; foreach ($steps as $step) { $cols = explode(":", $step); if (isset($cols[1])) { $current_price = $cols[1]; } if ($total_quantity <= $cols[0]) { $current_price = $cols[1]; break; } } $shipping_cost = $current_price; $shipping_cost_method_box = $current_price; } else { if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['productFeedGeneratorGetShippingCostsCustomType'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['productFeedGeneratorGetShippingCostsCustomType'] as $funcRef) { $params['products'] =& $products; $params['row3'] =& $row3; $params['countries_id'] =& $countries_id; $params['shipping_method'] =& $shipping_method; $params['shipping_method_id'] =& $shipping_method_id; $params['shipping_cost'] =& $shipping_cost; $params['shipping_cost_method_box'] =& $shipping_cost_method_box; \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } else { $shipping_cost = $row3['price']; $shipping_cost_method_box = $row3['price']; } } // // calculate total costs $subtotal = $products['final_price']; if (strstr($subtotal, ",")) { $subtotal = str_replace(',', '.', $subtotal); } // if (!empty($row3['override_shippingcosts'])) { $old_shipping_costs = $shipping_cost; $shipping_cost = $row3['override_shippingcosts']; // custom code to change the shipping costs based on cart amount if (strstr($shipping_cost, ",") || strstr($shipping_cost, ":")) { $steps = explode(",", $shipping_cost); $count = 0; if (is_array($steps) && count($steps)) { foreach ($steps as $step) { // example: the value 200:15 means below 200 euro the shipping costs are 15 euro, above and equal 200 euro the shipping costs are 0 euro // example setting: 0:6.95,50:0 $split = explode(":", $step); if (is_numeric($split[0])) { if ($subtotal > $split[0] and isset($split[1])) { $shipping_cost = $split[1]; $shipping_cost_method_box = $split[1]; continue; } else { $shipping_cost = $old_shipping_costs; $shipping_cost_method_box = $old_shipping_costs; } } $count++; } } } } // custom code to change the shipping costs based on cart amount if (strstr($shipping_cost, ",") || strstr($shipping_cost, ":")) { $steps = explode(",", $shipping_cost); $count = 0; foreach ($steps as $step) { // example: the value 200:15 means below 200 euro the shipping costs are 15 euro, above and equal 200 euro the shipping costs are 0 euro // example setting: 0:6.95,50:0 $split = explode(":", $step); if (is_numeric($split[0])) { if ($count == 0) { if (isset($split[1])) { $shipping_cost = $split[1]; $shipping_cost_method_box = $split[1]; } else { $shipping_cost = $split[0]; $shipping_cost_method_box = $split[0]; continue; } } if ($subtotal > $split[0] and isset($split[1])) { $shipping_cost = $split[1]; $shipping_cost_method_box = $split[0]; continue; } } $count++; } } // custom code to change the shipping costs based on cart amount if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $shipping_cost = round($shipping_cost, 2); $shipping_cost_method_box = round($shipping_cost_method_box, 2); } // shipping costs only for shipping method box display if ($shipping_cost_method_box) { if ($shipping_method['tax_id'] && $shipping_cost_method_box) { $shipping_method_box_total_tax_rate = $shipping_method['tax_rate']; if ($shipping_method['country_tax_rate']) { $shipping_method_box_country_tax_rate = $shipping_method['country_tax_rate']; $shipping_method_box_country_tax = mslib_fe::taxDecimalCrop($shipping_cost_method_box * $shipping_method['country_tax_rate']); } else { $shipping_method_box_country_tax_rate = 0; $shipping_method_box_country_tax = 0; } if ($shipping_method['region_tax_rate']) { $shipping_method_box_region_tax_rate = $shipping_method['region_tax_rate']; $shipping_method_box_region_tax = mslib_fe::taxDecimalCrop($shipping_cost_method_box * $shipping_method['region_tax_rate']); } else { $shipping_method_box_region_tax_rate = 0; $shipping_method_box_region_tax = 0; } if ($shipping_method_box_region_tax && $shipping_method_box_country_tax) { $shipping_method_box_tax = $shipping_method_box_country_tax + $shipping_method_box_region_tax; } else { $shipping_method_box_tax = mslib_fe::taxDecimalCrop($shipping_cost_method_box * $shipping_method['tax_rate']); } } } if ($shipping_cost) { if ($shipping_method['tax_id'] && $shipping_cost) { $shipping_total_tax_rate = $shipping_method['tax_rate']; if ($shipping_method['country_tax_rate']) { $shipping_country_tax_rate = $shipping_method['country_tax_rate']; $shipping_country_tax = mslib_fe::taxDecimalCrop($shipping_cost * $shipping_method['country_tax_rate']); } else { $shipping_country_tax_rate = 0; $shipping_country_tax = 0; } if ($shipping_method['region_tax_rate']) { $shipping_region_tax_rate = $shipping_method['region_tax_rate']; $shipping_region_tax = mslib_fe::taxDecimalCrop($shipping_cost * $shipping_method['region_tax_rate']); } else { $shipping_region_tax_rate = 0; $shipping_region_tax = 0; } if ($shipping_region_tax && $shipping_country_tax) { $shipping_tax = $shipping_country_tax + $shipping_region_tax; } else { $shipping_tax = mslib_fe::taxDecimalCrop($shipping_cost * $shipping_method['tax_rate']); } } } $handling_cost = 0; $handling_tax = 0; if (!empty($row3['handling_costs'])) { $handling_cost = $row3['handling_costs']; if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $handling_cost = round($row3['handling_costs'], 2); } $percentage_handling_cost = false; if (strpos($handling_cost, '%') !== false) { $handling_cost = str_replace('%', '', $handling_cost); $percentage_handling_cost = true; } if ($percentage_handling_cost) { $tmp_handling_cost = $handling_cost; if ($products['tax_rate'] && $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $products['final_price'] = $products['final_price'] * (1 + $products['tax_rate']); } $subtotal = $products['final_price']; if ($subtotal) { $handling_cost = $subtotal / 100 * $tmp_handling_cost; if ($total_include_vat && $shipping_method['tax_rate']) { $handling_cost = $handling_cost / (1 + $shipping_method['tax_rate']); } } } //var_dump($shipping_method['tax_rate']); //die(); if ($shipping_method['tax_id'] && $handling_cost) { $handling_total_tax_rate = $shipping_method['tax_rate']; if ($shipping_method['country_tax_rate']) { $handling_country_tax_rate = $shipping_method['country_tax_rate']; $handling_country_tax = mslib_fe::taxDecimalCrop($handling_cost * $shipping_method['country_tax_rate']); } else { $handling_country_tax_rate = 0; $handling_country_tax = 0; } if ($shipping_method['region_tax_rate']) { $handling_region_tax_rate = $shipping_method['region_tax_rate']; $handling_region_tax = mslib_fe::taxDecimalCrop($handling_cost * $shipping_method['region_tax_rate']); } else { $handling_region_tax_rate = 0; $handling_region_tax = 0; } if ($handling_region_tax && $handling_country_tax) { $handling_tax = $handling_country_tax + $handling_region_tax; } else { $handling_tax = mslib_fe::taxDecimalCrop($handling_cost * $shipping_method['tax_rate']); } } } $shipping_cost += $handling_cost; $shipping_tax += $handling_tax; $shipping_cost_method_box += $handling_cost; $shipping_method_box_tax += $handling_tax; $shipping_method['shipping_costs_method_box'] = $shipping_cost_method_box; $shipping_method['shipping_costs_method_box_including_vat'] = $shipping_cost_method_box + $shipping_method_box_tax; $shipping_method['shipping_costs'] = $shipping_cost; $shipping_method['shipping_costs_including_vat'] = $shipping_cost + $shipping_tax; return $shipping_method; } else { return false; } }
function printOrderDetailsTable($order, $template_type = 'site') { $subtotalIncludingVatArray = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order.php']['printOrderDetailsTablePreHook'])) { $params = array('order' => &$order, 'template_type' => &$template_type); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order.php']['printOrderDetailsTablePreHook'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } switch ($template_type) { case 'site': case 'order_history_site': if ($this->conf['order_details_table_site_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_site_tmpl_path']); } else { if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site_excluding_vat.tmpl'); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_site.tmpl'); } } break; case 'email': if ($this->conf['order_details_table_email_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_email_tmpl_path']); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_email.tmpl'); } break; case 'pdf': if ($this->conf['order_details_table_pdf_tmpl_path']) { $template = $this->cObj->fileResource($this->conf['order_details_table_pdf_tmpl_path']); } else { $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_pdf.tmpl'); } break; } $itemsWrapper = array(); $c = true; foreach ($order['products'] as $product) { if ($product['products_id']) { $product_db = mslib_fe::getProduct($product['products_id']); } $subprices = ''; $price = $product['qty'] * $product['final_price']; $item = array(); // ITEM CLASS $item['ITEM_CLASS'] = ($c = !$c) ? 'odd' : 'even'; // ITEM IMAGE if (!$product_db['products_image']) { $item['ITEM_IMAGE'] = '<div class="no_image_50"></div>'; } else { if (!strstr(mslib_befe::strtolower($product_db['products_image']), 'http://') and !strstr(mslib_befe::strtolower($product_db['products_image']), 'https://')) { $product_db['products_image'] = mslib_befe::getImagePath($product_db['products_image'], 'products', '50'); } if (!file_exists($product_db['products_image'])) { $item['ITEM_IMAGE'] = '<div class="no_image_50"></div>'; } else { $item['ITEM_IMAGE'] = '<img src="' . $product_db['products_image'] . '" title="' . htmlspecialchars($product['products_name']) . '">'; } } // ITEM_NAME $tmp_item_name = array(); $tmp_item_name['products_name'] = htmlspecialchars($product['products_name']); $tmp_item_name['products_model'] = ''; if ($this->ms['MODULES']['DISPLAY_PRODUCTS_MODEL_IN_ORDER_DETAILS'] == '1' && !empty($product['products_model'])) { $tmp_item_name['products_model'] = ' (' . htmlspecialchars($product['products_model']) . ') '; } // for virtual product download link if ($template_type == 'email' && $order['mail_template'] == 'email_order_paid_letter' && $order['paid'] == 1 && isset($product['file_download_code']) && !empty($product['file_download_code'])) { $download_link = '<br/><a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink(",2002", '&tx_multishop_pi1[page_section]=get_micro_download&orders_id=' . $order['orders_id'] . '&code=' . $product['file_download_code'], 1) . '" alt="' . htmlspecialchars($product['products_name']) . '" title="' . htmlspecialchars($product['products_name']) . '">Download product</a>'; $tmp_item_name['download_link'] = $download_link; } if ($product['products_description']) { $tmp_item_name['products_description'] = '<br/>' . nl2br(htmlspecialchars($product['products_description'])); } if ($this->ms['MODULES']['DISPLAY_EAN_IN_ORDER_DETAILS'] == '1' && !empty($product['ean_code'])) { $tmp_item_name['products_ean'] = '<br/>EAN: ' . htmlspecialchars($product['ean_code']); } if ($this->ms['MODULES']['DISPLAY_SKU_IN_ORDER_DETAILS'] == '1' && !empty($product['sku_code'])) { $tmp_item_name['products_sku'] = '<br/>' . $this->pi_getLL('sku_number', 'SKU') . ': ' . htmlspecialchars($product['sku_code']); } if ($this->ms['MODULES']['DISPLAY_VENDOR_IN_ORDER_DETAILS'] == '1' && !empty($product['vendor_code'])) { $tmp_item_name['products_vendor_code'] = '<br/>' . htmlspecialchars($this->pi_getLL('label_order_details_vendor_code', 'Vendor code')) . ': ' . htmlspecialchars($product['vendor_code']); } if (count($product['attributes'])) { foreach ($product['attributes'] as $tmpkey => $options) { $subprices .= '<BR>'; if ($this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $tmp_tax = round($options['options_values_price'] * ($product['products_tax'] / 100), 2); $attribute_price = +$options['options_values_price'] + $tmp_tax; } else { if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $attribute_price = round($options['options_values_price'] * ($product['products_tax'] / 100), 4) + $options['options_values_price']; } else { $attribute_price = $options['options_values_price']; } } $tmp_item_name['products_attributes'][] = '<BR>' . htmlspecialchars($options['products_options']) . ': ' . htmlspecialchars($options['products_options_values']); $price = $price + $product['qty'] * ($options['price_prefix'] . $options['options_values_price']); if ($price < 0) { $price = 0; } if ($options['options_values_price'] > 0) { $subprices .= mslib_fe::amount2Cents($product['qty'] * ($options['price_prefix'] . $attribute_price)); } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableItemNamePreProc'])) { $params = array('item_name' => &$tmp_item_name, 'order' => &$order, 'product' => &$product, 'template_type' => &$template_type); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableItemNamePreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $item_name = ''; if (is_array($tmp_item_name) && count($tmp_item_name)) { foreach ($tmp_item_name as $array_item_name) { if (is_array($array_item_name) && count($array_item_name)) { $item_name .= implode('', $array_item_name); } else { $item_name .= $array_item_name; } } } $item['ITEM_NAME'] = $item_name; $item['ITEM_MODEL'] = htmlspecialchars($product_db['products_model']); // ITEM NAME EOF // ITEM_QUANTITY $item['ITEM_QUANTITY'] = round($product['qty'], 14); // ITEM_SKU $item['ITEM_SKU'] = htmlspecialchars($product_db['sku_code']); // ITEM_TOTAL if ($this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) { $tmp_tax = round($product['final_price'] * ($product['products_tax'] / 100), 2); $final_price = $product['qty'] * ($product['final_price'] + $tmp_tax); $item['ITEM_PRICE_SINGLE'] = mslib_fe::amount2Cents($product['final_price'] + $tmp_tax); } else { if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $final_price = $product['qty'] * $product['final_price']; $final_price = round($final_price * ($product['products_tax'] / 100), 4) + $final_price; $item['ITEM_PRICE_SINGLE'] = mslib_fe::amount2Cents(round($product['final_price'] * ($product['products_tax'] / 100), 4) + $product['final_price']); } else { $final_price = $product['qty'] * $product['final_price']; $item['ITEM_PRICE_SINGLE'] = mslib_fe::amount2Cents($product['final_price']); } } $item['ITEM_TOTAL'] = mslib_fe::amount2Cents($final_price) . $subprices; if ($this->ms['MODULES']['ADMIN_EDIT_ORDER_DISPLAY_ORDERS_PRODUCTS_STATUS'] > 0 && $template_type == 'order_history_site') { $item['ITEM_PRODUCT_STATUS'] = htmlspecialchars(mslib_fe::getOrderStatusName($product['status'])); } $item['ITEM_VAT_RATE'] = str_replace('.00', '', number_format($product['products_tax'], 2)) . '%'; // GRAND TOTAL CALCULATIONS $subtotal = $subtotal + $price; $subtotal_tax = $subtotal_tax + $product['products_tax_data']['total_tax'] + $product['products_tax_data']['total_attributes_tax']; $subtotalIncludingVatArray[] = $product['total_price']; if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { $subtotalIncludingVatArray[] = mslib_fe::taxDecimalCrop($product['qty'] * $product['products_tax_data']['total_tax'], 2, true); } else { $subtotalIncludingVatArray[] = mslib_fe::taxDecimalCrop($product['qty'] * $product['products_tax_data']['total_tax'], 2, false); } $subtotalIncludingVatArray[] = $product['qty'] * $product['products_tax_data']['total_attributes_tax']; // GRAND TOTAL CALCULATIONS EOF //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableItemPreProc'])) { $params = array('item' => &$item, 'order' => &$order, 'product' => &$product, 'template_type' => &$template_type, 'product_db' => $product_db); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableItemPreProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $itemsWrapper[] = $item; } // MERGE TO TEMPLATE // Extract the subparts from the template $subparts = array(); $subparts['template'] = $this->cObj->getSubpart($template, '###TEMPLATE###'); $subparts['ITEMS_HEADER_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###ITEMS_HEADER_WRAPPER###'); $subparts['ITEMS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###ITEMS_WRAPPER###'); $subparts['SUBTOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SUBTOTAL_WRAPPER###'); $subparts['SHIPPING_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SHIPPING_COSTS_WRAPPER###'); $subparts['PAYMENT_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###PAYMENT_COSTS_WRAPPER###'); $subparts['GRAND_TOTAL_EXCLUDING_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###GRAND_TOTAL_EXCLUDING_VAT_WRAPPER###'); $subparts['GRAND_TOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###GRAND_TOTAL_WRAPPER###'); $subparts['TAX_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###TAX_COSTS_WRAPPER###'); $subparts['DISCOUNT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###DISCOUNT_WRAPPER###'); $subparts['NEWSUBTOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###NEWSUBTOTAL_WRAPPER###'); if (!$this->ms['MODULES']['ADMIN_EDIT_ORDER_DISPLAY_ORDERS_PRODUCTS_STATUS'] || $template_type != 'order_history_site') { $subProductStatusPart = array(); $subProductStatusPart['ITEMS_HEADER_PRODUCT_STATUS_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_HEADER_WRAPPER'], '###ITEMS_HEADER_PRODUCT_STATUS_WRAPPER###'); $subProductStatus = array(); $subProductStatus['###ITEMS_HEADER_PRODUCT_STATUS_WRAPPER###'] = ''; $subparts['ITEMS_HEADER_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEMS_HEADER_WRAPPER'], array(), $subProductStatus); $subProductStatusPart = array(); $subProductStatusPart['ITEMS_PRODUCT_STATUS_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_WRAPPER'], '###ITEMS_PRODUCT_STATUS_WRAPPER###'); $subProductStatus = array(); $subProductStatus['###ITEMS_PRODUCT_STATUS_WRAPPER###'] = ''; $subparts['ITEMS_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEMS_WRAPPER'], array(), $subProductStatus); } $subpartArray = array(); //ITEMS_HEADER_WRAPPER $markerArray = array(); $markerArray['HEADING_PRODUCTS_ID'] = ucfirst($this->pi_getLL('products_id')); $markerArray['HEADING_PRODUCTS_NAME'] = ucfirst($this->pi_getLL('product')); $markerArray['HEADING_SKU'] = $this->pi_getLL('sku', 'SKU'); $markerArray['HEADING_QUANTITY'] = $this->pi_getLL('qty'); $markerArray['HEADING_PRICE'] = $this->pi_getLL('price'); if (!$order['orders_tax_data']['total_orders_tax']) { $markerArray['HEADING_TOTAL'] = ucfirst($this->pi_getLL('total_excl_vat')); } else { $markerArray['HEADING_TOTAL'] = $this->pi_getLL('total'); } $markerArray['HEADING_TOTAL'] = $this->pi_getLL('total'); $markerArray['HEADING_VAT_RATE'] = $this->pi_getLL('vat'); if ($this->ms['MODULES']['ADMIN_EDIT_ORDER_DISPLAY_ORDERS_PRODUCTS_STATUS'] > 0 && $template_type == 'order_history_site') { $markerArray['HEADING_PRODUCT_STATUS'] = $this->pi_getLL('order_product_status'); } //hook to let other plugins further manipulate the replacers if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableHeaderPostProc'])) { $params = array('markerArray' => &$markerArray, 'order' => &$order, 'template_type' => &$template_type); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTableHeaderPostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } $subpartArray['###ITEMS_HEADER_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['ITEMS_HEADER_WRAPPER'], $markerArray, '###|###'); //ITEMS_HEADER_WRAPPER EOF //ITEMS_WRAPPER $keys = array(); $keys[] = 'ITEM_CLASS'; $keys[] = 'ITEM_IMAGE'; $keys[] = 'ITEM_NAME'; $keys[] = 'ITEM_QUANTITY'; $keys[] = 'ITEM_SKU'; $keys[] = 'ITEM_VAT_RATE'; $keys[] = 'ITEM_TOTAL'; $keys[] = 'ITEM_PRICE_SINGLE'; if ($this->ms['MODULES']['ADMIN_EDIT_ORDER_DISPLAY_ORDERS_PRODUCTS_STATUS'] > 0 && $template_type == 'order_history_site') { $keys[] = 'ITEM_PRODUCT_STATUS'; } foreach ($itemsWrapper as $item) { $markerArray = array(); foreach ($keys as $key) { $markerArray[$key] = $item[$key]; } foreach ($item as $key => $val) { // hooked plugins wants to add more types. lets find them and add them if (!in_array($key, $keys)) { $markerArray[$key] = $item[$key]; } } $contentItem .= $this->cObj->substituteMarkerArray($subparts['ITEMS_WRAPPER'], $markerArray, '###|###'); } $subpartArray['###ITEMS_WRAPPER###'] = $contentItem; //ITEMS_WRAPPER EOF //SUBTOTAL_WRAPPER $key = 'SUBTOTAL_WRAPPER'; $markerArray = array(); $markerArray['SUBTOTAL_LABEL'] = $this->pi_getLL('subtotal'); $markerArray['PRODUCTS_TOTAL_PRICE_LABEL'] = $this->pi_getLL('total_price'); $markerArray['PRODUCTS_TOTAL_PRICE_INCLUDING_VAT_LABEL'] = $this->pi_getLL('total_price'); $markerArray['PRODUCTS_SUB_TOTAL_PRICE_LABEL'] = $this->pi_getLL('subtotal'); // rounding is problem with including vat shops. $markerArray['PRODUCTS_TOTAL_PRICE_INCLUDING_VAT'] = mslib_fe::amount2Cents(mslib_fe::taxDecimalCrop(array_sum($subtotalIncludingVatArray), 2, true)); //$markerArray['PRODUCTS_TOTAL_PRICE_INCLUDING_VAT']=mslib_fe::amount2Cents(array_sum($subtotalIncludingVatArray)); $markerArray['PRODUCTS_TOTAL_PRICE'] = mslib_fe::amount2Cents($subtotal); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //SUBTOTAL_WRAPPER EOF //SHIPPING_COSTS_WRAPPER $key = 'SHIPPING_COSTS_WRAPPER'; if ($order['shipping_method_label']) { $markerArray = array(); $markerArray['SHIPPING_COSTS_LABEL'] = $this->pi_getLL('shipping_costs') . ' (' . $order['shipping_method_label'] . ')'; $markerArray['SHIPPING_COSTS'] = mslib_fe::amount2Cents($order['shipping_method_costs']); $markerArray['SHIPPING_COSTS_INCLUDING_VAT_LABEL'] = $this->pi_getLL('shipping_costs') . ' (' . $order['shipping_method_label'] . ')'; $markerArray['SHIPPING_COSTS_INCLUDING_VAT'] = mslib_fe::amount2Cents($order['shipping_method_costs'] + $order['orders_tax_data']['shipping_tax']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); if ($order['shipping_method_costs'] == '0') { if ($this->ms['MODULES']['CHECKOUT_HIDE_ZERO_SHIPPING_COSTS_IN_SUMMARY'] == '1') { $subpartArray['###' . $key . '###'] = ''; } } } else { $subpartArray['###' . $key . '###'] = ''; } //SHIPPING_COSTS_WRAPPER EOF //PAYMENT_COSTS_WRAPPER $key = 'PAYMENT_COSTS_WRAPPER'; if ($order['payment_method_label']) { $markerArray = array(); $markerArray['PAYMENT_COSTS_LABEL'] = $this->pi_getLL('payment_costs') . ' (' . $order['payment_method_label'] . ')'; $markerArray['PAYMENT_COSTS'] = mslib_fe::amount2Cents($order['payment_method_costs']); $markerArray['PAYMENT_COSTS_INCLUDING_VAT_LABEL'] = $this->pi_getLL('payment_costs') . ' (' . $order['payment_method_label'] . ')'; $markerArray['PAYMENT_COSTS_INCLUDING_VAT'] = mslib_fe::amount2Cents($order['payment_method_costs'] + $order['orders_tax_data']['payment_tax']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); if ($order['payment_method_costs'] == '0') { if ($this->ms['MODULES']['CHECKOUT_HIDE_ZERO_PAYMENT_COSTS_IN_SUMMARY'] == '1') { $subpartArray['###' . $key . '###'] = ''; } } } else { $subpartArray['###' . $key . '###'] = ''; } //PAYMENT_COSTS_WRAPPER EOF //GRAND_TOTAL_EXCLUDING_VAT_WRAPPER $key = 'GRAND_TOTAL_EXCLUDING_VAT_WRAPPER'; $markerArray = array(); $markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_LABEL'] = $this->pi_getLL('grand_total_excluding_vat'); $markerArray['PRODUCTS_GRAND_TOTAL_EXCLUDING_VAT_PRICE'] = mslib_fe::amount2Cents($order['grand_total_excluding_vat']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //GRAND_TOTAL_EXCLUDING_VAT_WRAPPER EOF //GRAND_TOTAL_WRAPPER $key = 'GRAND_TOTAL_WRAPPER'; $markerArray = array(); if (!$order['orders_tax_data']['total_orders_tax']) { $markerArray['GRAND_TOTAL_COSTS_LABEL'] = ucfirst($this->pi_getLL('total_excl_vat')); } else { $markerArray['GRAND_TOTAL_COSTS_LABEL'] = ucfirst($this->pi_getLL('total')); } // $markerArray['GRAND_TOTAL_COSTS'] = mslib_fe::amount2Cents($subtotal+$order['orders_tax_data']['total_orders_tax']+$order['payment_method_costs']+$order['shipping_method_costs']-$order['discount']); $markerArray['GRAND_TOTAL_COSTS'] = mslib_fe::amount2Cents($order['orders_tax_data']['grand_total']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); //GRAND_TOTAL_WRAPPER EOF //DISCOUNT_WRAPPER $key = 'DISCOUNT_WRAPPER'; if ($order['discount'] > 0) { $markerArray = array(); $markerArray['DISCOUNT_LABEL'] = $this->pi_getLL('discount'); $markerArray['DISCOUNT'] = mslib_fe::amount2Cents($order['discount']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); } else { $subpartArray['###' . $key . '###'] = ''; $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = ''; } //DISCOUNT_WRAPPER EOF if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { // new subtotal $markerArray = array(); $markerArray['PRODUCTS_NEWSUB_TOTAL_PRICE_LABEL'] = $this->pi_getLL('new_subtotal_excl_vat'); $new_subtotal_amount = $subtotal - $order['discount'] + $order['shipping_method_costs'] + $order['payment_method_costs']; $markerArray['PRODUCTS_NEWTOTAL_PRICE'] = mslib_fe::amount2Cents($new_subtotal_amount); $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['NEWSUBTOTAL_WRAPPER'], $markerArray, '###|###'); } else { $subpartArray['###NEWSUBTOTAL_WRAPPER###'] = ''; } //TAX_COSTS_WRAPPER $key = 'TAX_COSTS_WRAPPER'; if ($order['orders_tax_data']['total_orders_tax']) { $markerArray = array(); $markerArray['TAX_RATE_LABEL'] = $this->pi_getLL('vat'); $markerArray['INCLUDED_TAX_RATE_LABEL'] = $this->pi_getLL('included_vat_amount'); $markerArray['TAX_COSTS'] = mslib_fe::amount2Cents($order['orders_tax_data']['total_orders_tax']); $subpartArray['###' . $key . '###'] = $this->cObj->substituteMarkerArray($subparts[$key], $markerArray, '###|###'); } else { $subpartArray['###' . $key . '###'] = ''; } // finally convert global markers and return output //hook to let other plugins further manipulate the replacers $content = $this->cObj->substituteMarkerArrayCached($subparts['template'], null, $subpartArray); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTablePostProc'])) { $params = array('content' => &$content, 'order' => &$order, 'template_type' => &$template_type, 'subparts' => &$subparts, 'subpartArray' => &$subpartArray); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_order']['printOrderDetailsTablePostProc'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } return $content; }
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { $data[] = array('id' => $row['products_options_values_id'], 'text' => $row['products_options_values_name']); } } else { if (isset($this->get['preselected_id']) && !empty($this->get['preselected_id'])) { $data[] = array('id' => $this->get['preselected_id'], 'text' => $this->get['preselected_id']); } else { $data[] = array('id' => $this->get['q'], 'text' => $this->get['q']); } } $content = json_encode($data); break; // all calculation are based on excluding vat // all calculation are based on excluding vat case 'get_product_discount_price': $return_data = array(); $discount_percentage = $this->get['discount_percentage']; $current_price = $this->get['current_price']; $return_data['status'] = 'NOTOK'; if (isset($discount_percentage) && is_numeric($discount_percentage) && $discount_percentage > 0 && $current_price > 0) { $discount_amount = mslib_fe::taxDecimalCrop($current_price * $discount_percentage / 100, 2, false); $return_data['status'] = 'OK'; $return_data['discount_amount'] = $discount_amount; $return_data['price_after_discount'] = $current_price - $discount_amount; $return_data['price_after_discount_format'] = mslib_fe::amount2Cents($current_price - $discount_amount); } $content = json_encode($return_data); break; } echo $content; exit;
break; case 'products_old_price_excluding_vat': //$tmpcontent .= $row['products_price']; $tmpcontent .= round($row['products_price'], 14); break; case 'products_old_price': $final_price = mslib_fe::final_products_price($row); $old_product_price = $row['products_price']; if ($row['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 ($row['country_tax_rate'] && $row['region_tax_rate']) { $country_tax_rate = mslib_fe::taxDecimalCrop($final_price * $row['country_tax_rate']); $region_tax_rate = mslib_fe::taxDecimalCrop($final_price * $row['region_tax_rate']); $old_product_price = $old_product_price + ($country_tax_rate + $region_tax_rate); } else { $tax_rate = mslib_fe::taxDecimalCrop($row['products_price'] * $row['tax_rate']); $old_product_price = $old_product_price + $tax_rate; } } if ($old_product_price != $final_price) { //$tmpcontent .= round($old_product_price,14); $tmpcontent .= round($old_product_price, 2); } else { $tmpcontent .= ''; } break; case 'products_price_excluding_vat': $tmpcontent .= round($row['final_price'], 14); break; case 'products_price': $tmpcontent .= mslib_fe::final_products_price($row);
} else { $order_products_body_data['products_normal_price']['value']='<div class="msAttributesField">'.mslib_fe::currency().' <input type="text" id="display_name" name="display_name_excluding_vat" class="msStaffelPriceExcludingVat" value="'.$order_products_price_display.'"><label for="display_name_excluding_vat">'.$this->pi_getLL('excluding_vat').'</label></div>'; $order_products_body_data['products_normal_price']['value'].='<div class="msAttributesField">'.mslib_fe::currency().' <input type="text" name="display_name" id="display_name_including_vat" class="msStaffelPriceIncludingVat" value="'.($order_products_price_display_incl).'"><label for="display_name_including_vat">'.$this->pi_getLL('including_vat').'</label></div>'; $order_products_body_data['products_normal_price']['value'].='<div class="msAttributesField hidden"><input class="text" style="width:44px" type="hidden" name="product_price" id="product_price" value="'.$order['final_price'].'" /></div>'; }*/ if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) { // products vat col $order_products_body_data['products_vat']['align'] = 'right'; $order_products_body_data['products_vat']['class'] = 'cellVat'; $order_products_body_data['products_vat']['value'] = $vat_sb; } if ($this->ms['MODULES']['ENABLE_DISCOUNT_ON_EDIT_ORDER_PRODUCT']) { $order_products_body_data['products_discount']['class'] = 'cellPrice cellNoWrap'; //$order_products_body_data['products_discount']['value']=$this->pi_getLL('discount') . ' input'; $order_products_discount_amount_display = mslib_fe::taxDecimalCrop($order['discount_amount'], 2, false); $order_products_discount_amount_display_incl = mslib_fe::taxDecimalCrop($order['discount_amount'] + $order['discount_amount'] * $order['products_tax'] / 100, 2, false); $percentage_sb = '<div class="discount_percentage_wrapper"> <select name="product_discount_percentage" id="product_discount_percentage" style="width:210px"> <option value="">' . $this->pi_getLL('use_discount_amount') . '</option> '; $selected_percentage = str_replace('.00', '', $order['discount_percentage']); for ($p = 1; $p <= 100; $p++) { if ($selected_percentage == $p) { $percentage_sb .= '<option value="' . $p . '" selected="selected">' . $p . '%</option>'; } else { $percentage_sb .= '<option value="' . $p . '">' . $p . '%</option>'; } } $percentage_sb .= '</select> </div>'; $order_products_body_data['products_discount']['value'] = $percentage_sb . '<div class="msAttributesField"><div class="input-group"><span class="input-group-addon">' . mslib_fe::currency() . '</span><input type="text" id="display_name_discount_excluding_vat" name="display_name_discount_excluding_vat" class="form-control msOrderProductPriceExcludingVat priceInputDisplay" value="' . $order_products_discount_amount_display . '" autocomplete="off"><span class="input-group-addon">' . $this->pi_getLL('excluding_vat') . '</span></div></div>';