}
             }
         }
     }
 } else {
     if (isset($this->get['valid'])) {
         $sql_option = "select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.options_values_id, pa.price_prefix from tx_multishop_products_attributes pa, tx_multishop_products_options_values pov, tx_multishop_products_options_values_to_products_options povp where pa.products_id = '" . $this->get['pid'] . "' and pa.page_uid='" . $this->showCatalogFromPage . "' and pa.options_id = '" . $this->get['optid'] . "' and pa.options_values_id='" . $this->get['valid'] . "' and pov.language_id = '" . $this->sys_language_uid . "' and pa.options_values_id = pov.products_options_values_id and povp.products_options_values_id=pov.products_options_values_id order by pa.sort_order_option_name asc, pa.sort_order_option_value asc";
     } else {
         $sql_option = "select pa.sort_order_option_name, pa.sort_order_option_value, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.options_values_id, pa.price_prefix from tx_multishop_products_attributes pa, tx_multishop_products_options_values pov, tx_multishop_products_options_values_to_products_options povp where pa.products_id = '" . $this->get['pid'] . "' and pa.page_uid='" . $this->showCatalogFromPage . "' and pa.options_id = '" . $this->get['optid'] . "' and pov.language_id = '" . $this->sys_language_uid . "' and povp.products_options_id='" . $this->get['optid'] . "' and pa.options_values_id = pov.products_options_values_id and povp.products_options_values_id=pov.products_options_values_id and povp.products_options_id=pa.options_id order by pa.sort_order_option_name asc, pa.sort_order_option_value asc";
     }
     //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++;
         }
     }
Beispiel #2
0
    foreach ($cart['products'] as $shopping_cart_item => $value) {
        if (!isset($value['products_id']) || isset($value['products_id']) && !$value['products_id']) {
            $count_product = 0;
        }
    }
}
if ($count_product > 0) {
    $output['shopping_cart_form_action_url'] = mslib_fe::typolink($this->conf['shoppingcart_page_pid'], '&tx_multishop_pi1[page_section]=shopping_cart');
    $output['col_header_shopping_cart_product'] = ucfirst($this->pi_getLL('product'));
    $output['col_header_shopping_cart_qty'] = ucfirst($this->pi_getLL('qty'));
    $output['col_header_shopping_cart_total'] = ucfirst($this->pi_getLL('total'));
    $contentItem = '';
    foreach ($cart['products'] as $shopping_cart_item => $value) {
        if (is_numeric($value['products_id'])) {
            $ordered_qty = $value['qty'];
            $product_info = mslib_fe::getProduct($value['products_id']);
            $products_id = $value['products_id'];
            $product = $value;
            if (!$output['product_row_type'] || $output['product_row_type'] == 'even') {
                $output['product_row_type'] = 'odd';
            } else {
                $output['product_row_type'] = 'even';
            }
            if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                if ($value['country_tax_rate'] && $value['region_tax_rate']) {
                    $country_tax_rate = mslib_fe::taxDecimalCrop($value['final_price'] * $value['country_tax_rate']);
                    $region_tax_rate = mslib_fe::taxDecimalCrop($value['final_price'] * $value['region_tax_rate']);
                    $tax_rate = $country_tax_rate + $region_tax_rate;
                } else {
                    $tax_rate = mslib_fe::taxDecimalCrop($value['final_price'] * $value['tax_rate']);
                }
Beispiel #3
0
 // lets create the products sitemap
 if (!$this->get['skip_products']) {
     $filterProducts = array();
     $filterProducts[] = 'products_status=1';
     $filterProducts[] = 'page_uid=' . $this->showCatalogFromPage;
     // hook
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_sitemap_generator.php']['sitemapGeneratorProductsQueryFilter'])) {
         $params = array('filterProducts' => &$filterProducts);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_sitemap_generator.php']['sitemapGeneratorProductsQueryFilter'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     // hook eof
     $qry = $GLOBALS['TYPO3_DB']->sql_query("SELECT products_id from tx_multishop_products where " . implode(" and ", $filterProducts));
     while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) {
         $product = mslib_fe::getProduct($row['products_id']);
         $where = '';
         if ($product['categories_id']) {
             // get all cats to generate multilevel fake url
             $level = 0;
             $cats = mslib_fe::Crumbar($product['categories_id']);
             $cats = array_reverse($cats);
             if (count($cats) > 0) {
                 foreach ($cats as $cat) {
                     $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                     $level++;
                 }
                 $where = substr($where, 0, strlen($where) - 1);
                 $where .= '&';
             }
             // get all cats to generate multilevel fake url eof
                    $tmpcontent .= '<td align="right" class="cell_products_normal_price" id="edit_order_product_price">';
                    if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                        $tmpcontent .= '<input class="text" style="width:44px" type="text" id="display_product_price" value="' . ($order['final_price'] + $order_products_tax_data['total_tax']) . '" />
						<input type="hidden" name="product_price" id="product_price" value="' . $order['final_price'] . '" />';
                    } else {
                        $tmpcontent .= '<input class="text" style="width:44px" type="text" name="product_price" id="product_price" value="' . $order['final_price'] . '" />';
                    }
                    $tmpcontent .= '</td>';
                    if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                        $tmpcontent .= $vat_input_row_col;
                    }
                    $tmpcontent .= $total_product_row_col;
                } else {
                    $row = array();
                    $where = '';
                    $product = mslib_fe::getProduct($order['products_id']);
                    if ($product['categories_id']) {
                        // get all cats to generate multilevel fake url
                        $level = 0;
                        $cats = mslib_fe::Crumbar($product['categories_id']);
                        $cats = array_reverse($cats);
                        $where = '';
                        if (count($cats) > 0) {
                            foreach ($cats as $cat) {
                                $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                                $level++;
                            }
                            $where = substr($where, 0, strlen($where) - 1);
                            $where .= '&';
                        }
                        // get all cats to generate multilevel fake url eof
 $return_data['option_id'] = $option_id;
 $return_data['option_value_id'] = $option_value_id;
 $return_data['option_name'] = mslib_fe::getRealNameOptions($option_id);
 $return_data['option_value_name'] = mslib_fe::getNameOptions($option_value_id);
 $return_data['data_id'] = $this->post['data_id'];
 $return_data['delete_status'] = 'notok';
 $have_entries_in_pa_table = false;
 if ($option_value_id > 0) {
     $str = "select products_id from tx_multishop_products_attributes where options_id='" . $option_id . "' and options_values_id=" . $option_value_id;
     $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
     $total_product = $GLOBALS['TYPO3_DB']->sql_num_rows($qry);
     if ($total_product > 0) {
         $ctr = 0;
         $return_data['products'] = array();
         while ($rs = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
             $product = mslib_fe::getProduct($rs['products_id'], '', '', 1);
             if (!empty($product['products_name'])) {
                 $return_data['products'][$ctr]['name'] = $product['products_name'];
                 $return_data['products'][$ctr]['link'] = mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $rs['products_id'] . '&cid=' . $product['categories_id'] . '&action=edit_product');
                 $ctr++;
             } else {
                 $have_entries_in_pa_table = true;
                 $total_product--;
             }
         }
     }
     if (!$total_product && $have_entries_in_pa_table) {
         $this->get['force_delete'] = 1;
     }
     if (isset($this->get['force_delete']) && $this->get['force_delete'] == 1) {
         //if (!$total_product) {
 function updateCart()
 {
     if (!$this->ms['MODULES']['ALLOW_ORDER_OUT_OF_STOCK_PRODUCT']) {
         $product_id = $this->post['products_id'];
         if (is_numeric($this->get['products_id']) and $this->get['tx_multishop_pi1']['action'] == 'add_to_cart') {
             $product_id = $this->get['products_id'];
         }
         if (is_numeric($product_id)) {
             $product = mslib_fe::getProduct($product_id);
             if ($product['products_quantity'] < 1 && !$this->ms['MODULES']['ALLOW_ORDER_OUT_OF_STOCK_PRODUCT']) {
                 if ($product['categories_id']) {
                     // get all cats to generate multilevel fake url
                     $level = 0;
                     $cats = mslib_fe::Crumbar($product['categories_id']);
                     $cats = array_reverse($cats);
                     $where = '';
                     if (count($cats) > 0) {
                         foreach ($cats as $cat) {
                             $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                             $level++;
                         }
                         $where = substr($where, 0, strlen($where) - 1);
                     }
                 }
                 $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $product_id . '&tx_multishop_pi1[page_section]=products_detail');
                 header("Location: " . $this->FULL_HTTP_URL . $link);
                 exit;
             }
         }
     }
     // error_log("bastest");
     // hook
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCart'])) {
         $params = array();
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCart'] as $funcRef) {
             $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     } else {
         // 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']['updateCartPreHook'])) {
             $params = array('get' => &$this->get, 'post' => &$this->post);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartPreHook'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         // custom hook that can be controlled by third-party plugin eof
         $GLOBALS['dont_update_cart'] = 1;
         //$cart=$GLOBALS['TSFE']->fe_user->getKey('ses', $this->cart_page_uid);
         require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php';
         $mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
         $mslib_cart->init($this);
         $cart = $mslib_cart->getCart();
         if (is_numeric($this->get['products_id']) and $this->get['tx_multishop_pi1']['action'] == 'add_to_cart') {
             $this->post['products_id'] = $this->get['products_id'];
         }
         if (is_numeric($this->post['products_id'])) {
             $shopping_cart_item = $this->post['products_id'];
             if ($this->post['tx_multishop_pi1']['cart_item']) {
                 $shopping_cart_item = $this->post['tx_multishop_pi1']['cart_item'];
             } elseif (is_array($this->post['attributes'])) {
                 $shopping_cart_item = md5($this->post['products_id'] . serialize($this->post['attributes']));
             }
             // 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']['updateCartSetShoppingCartItemPostProc'])) {
                 $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']['updateCartSetShoppingCartItemPostProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             // custom hook that can be controlled by third-party plugin eof
             if (is_numeric($cart['products'][$shopping_cart_item]['products_id'])) {
                 $products_id = $cart['products'][$shopping_cart_item]['products_id'];
             } else {
                 $products_id = $this->post['products_id'];
             }
             $product = mslib_fe::getProduct($products_id);
             if ($product['products_id']) {
                 $product['products_shortdescription_raw'] = $product['products_shortdescription'];
                 $product['products_description_raw'] = $product['products_description'];
                 if ($product['products_image']) {
                     $product['products_image_200'] = mslib_befe::getImagePath($product['products_image'], 'products', '200');
                     $product['products_image'] = mslib_befe::getImagePath($product['products_image'], 'products', '50');
                 }
                 //
                 $query = $GLOBALS['TYPO3_DB']->SELECTquery('pa.*', 'tx_multishop_products_attributes pa, tx_multishop_products_options po', 'pa.products_id="' . addslashes($product['products_id']) . '" and pa.page_uid=\'' . $this->showCatalogFromPage . '\' and po.hide!=1 and po.hide_in_cart!=1 and po.language_id=' . $this->sys_language_uid . ' and po.products_options_id=pa.options_id', '', 'pa.sort_order_option_name asc, pa.sort_order_option_value asc', '');
                 $product_attributes = array();
                 $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                         $product_attributes[$row['options_id']][] = $row['options_values_id'];
                     }
                 }
                 //
                 //if (mslib_fe::ProductHasAttributes($product['products_id']) and !count($this->post['attributes'])) {
                 if (is_array($product_attributes) && count($product_attributes) && !count($this->post['attributes'])) {
                     // Product has attributes. We need to redirect the customer to the product detail page so the attributes can be selected
                     if ($product['categories_id']) {
                         // get all cats to generate multilevel fake url
                         $level = 0;
                         $cats = mslib_fe::Crumbar($product['categories_id']);
                         $cats = array_reverse($cats);
                         $where = '';
                         if (count($cats) > 0) {
                             foreach ($cats as $cat) {
                                 $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                                 $level++;
                             }
                             $where = substr($where, 0, strlen($where) - 1);
                             //								$where.='&';
                         }
                         // get all cats to generate multilevel fake url eof
                     }
                     $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $product['products_id'] . '&tx_multishop_pi1[page_section]=products_detail');
                     header("Location: " . $this->FULL_HTTP_URL . $link);
                     exit;
                 }
                 if ($this->post['quantity'] and strstr($this->post['quantity'], ",")) {
                     $this->post['quantity'] = str_replace(",", ".", $this->post['quantity']);
                 }
                 if (!$this->post['quantity'] or $this->post['quantity'] and !is_numeric($this->post['quantity'])) {
                     $this->post['quantity'] = 1;
                 }
                 if ($this->post['quantity'] < 0) {
                     $this->post['quantity'] = 0;
                 }
                 if (is_numeric($product['minimum_quantity']) && $product['minimum_quantity'] > 0 && $product['minimum_quantity'] > $this->post['quantity']) {
                     $this->post['quantity'] = $product['minimum_quantity'];
                 }
                 if ($product['products_multiplication']) {
                     $ctr_end = $product['maximum_quantity'] > 0 ? $product['maximum_quantity'] : 9999;
                     $qty_start = $product['minimum_quantity'];
                     if ($this->post['quantity'] > $qty_start) {
                         $low_number = $qty_start;
                         $high_number = $qty_start;
                         for ($ctr_start = $qty_start; $ctr_start <= $ctr_end; $ctr_start++) {
                             if ($ctr_start > $qty_start) {
                                 $low_number = $high_number;
                                 $high_number += $product['products_multiplication'];
                             } else {
                                 $low_number = $ctr_start;
                                 $high_number += $product['products_multiplication'];
                             }
                             if ($this->post['quantity'] > $low_number && $this->post['quantity'] < $high_number) {
                                 if (round($this->post['quantity'], 2) == round($low_number, 2)) {
                                     $this->post['quantity'] = $low_number;
                                     break;
                                 } else {
                                     if (round($this->post['quantity'], 2) == round($high_number, 2)) {
                                         $this->post['quantity'] = $high_number;
                                         break;
                                     } else {
                                         $low_remainder = $this->post['quantity'] - $low_number;
                                         $high_remainder = $this->post['quantity'] - $high_number;
                                         $this->post['quantity'] = $low_number;
                                         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']);
                     }
                 }
                 $cart['products'][$shopping_cart_item] = $product;
                 // add possible micro download
                 $str = "select p.file_number_of_downloads, pd.file_remote_location, pd.file_label, pd.file_location from tx_multishop_products p, tx_multishop_products_description pd where p.products_id='" . $product['products_id'] . "' and pd.language_id='" . $this->sys_language_uid . "' and p.products_id=pd.products_id";
                 $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
                     // use current account
                     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                     $cart['products'][$shopping_cart_item]['file_label'] = $row['file_label'];
                     $cart['products'][$shopping_cart_item]['file_location'] = $row['file_location'];
                     $cart['products'][$shopping_cart_item]['file_remote_location'] = $row['file_remote_location'];
                     $cart['products'][$shopping_cart_item]['file_number_of_downloads'] = $row['file_number_of_downloads'];
                 }
                 // add possible micro download eof
                 $attributes_tax = 0;
                 if (is_array($this->post['attributes'])) {
                     foreach ($this->post['attributes'] as $key => $value) {
                         if (is_numeric($key)) {
                             $str = "SELECT * from tx_multishop_products_options o where o.products_options_id='" . $key . "' and language_id='" . $this->sys_language_uid . "'";
                             $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
                             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                             $continue = 0;
                             switch ($row['listtype']) {
                                 case 'checkbox':
                                     $multiple = 1;
                                     $continue = 1;
                                     break;
                                 case 'hidden_field':
                                 case 'textarea':
                                 case 'input':
                                 case 'date':
                                 case 'datetime':
                                 case 'dateofbirth':
                                 case 'datecustom':
                                     $cart['products'][$shopping_cart_item]['attributes'][$key] = $row;
                                     $cart['products'][$shopping_cart_item]['attributes'][$key]['options_id'] = $key;
                                     $cart['products'][$shopping_cart_item]['attributes'][$key]['products_options_values_name'] = $value;
                                     $continue = 0;
                                     $multiple = 0;
                                     break;
                                 default:
                                     $continue = 1;
                                     $multiple = 0;
                                     break;
                             }
                             if ($continue) {
                                 if (is_array($value)) {
                                     $array = $value;
                                 } else {
                                     if ($value) {
                                         $array = array($value);
                                     }
                                 }
                                 if (count($array)) {
                                     if ($multiple) {
                                         // reset first
                                         unset($cart['products'][$shopping_cart_item]['attributes'][$key]);
                                     }
                                     $products_id = $this->post['products_id'];
                                     $getAtributesFromProductsId = $products_id;
                                     // hook to let other plugins further manipulate the option values display
                                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartAttributesPreProc'])) {
                                         $params = array('products_id' => &$products_id, 'getAtributesFromProductsId' => &$getAtributesFromProductsId);
                                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartAttributesPreProc'] as $funcRef) {
                                             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                                         }
                                     }
                                     // hook
                                     foreach ($array as $item) {
                                         $str = "SELECT * from tx_multishop_products_attributes a, tx_multishop_products_options o, tx_multishop_products_options_values ov where a.products_id='" . $getAtributesFromProductsId . "' and a.options_id='" . $key . "' and a.options_values_id='" . $item . "' and a.page_uid='" . $this->showCatalogFromPage . "' and (o.hide_in_cart=0 or o.hide_in_cart is null) and a.options_id=o.products_options_id and o.language_id='" . $this->sys_language_uid . "' and ov.language_id='" . $this->sys_language_uid . "' and a.options_values_id=ov.products_options_values_id";
                                         $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
                                         if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry) > 0) {
                                             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                                             // hook to let other plugins further manipulate the option values display
                                             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['cartAttributesArray'])) {
                                                 $params = array('product_id' => $getAtributesFromProductsId, 'options_id' => &$key, 'row' => &$row);
                                                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['cartAttributesArray'] as $funcRef) {
                                                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                                                 }
                                             }
                                             // hook
                                             if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
                                                 //$row['country_tax']=mslib_fe::taxDecimalCrop(($row['price_prefix'].$row['options_values_price'])*$product['country_tax_rate'], 2, false);
                                                 //$row['region_tax']=mslib_fe::taxDecimalCrop(($row['price_prefix'].$row['options_values_price'])*$product['region_tax_rate'], 2, false);
                                                 $row['country_tax'] = round(($row['price_prefix'] . $row['options_values_price']) * $product['country_tax_rate'], 2);
                                                 $row['region_tax'] = round(($row['price_prefix'] . $row['options_values_price']) * $product['region_tax_rate'], 2);
                                                 if ($row['country_tax'] && $row['region_tax']) {
                                                     $row['tax'] = $row['country_tax'] + $row['region_tax'];
                                                 } else {
                                                     //$row['tax']=mslib_fe::taxDecimalCrop(($row['price_prefix'].$row['options_values_price'])*($product['tax_rate']), 2, false);
                                                     $row['tax'] = round(($row['price_prefix'] . $row['options_values_price']) * $product['tax_rate'], 2);
                                                 }
                                             } else {
                                                 $row['country_tax'] = mslib_fe::taxDecimalCrop(($row['price_prefix'] . $row['options_values_price']) * $product['country_tax_rate']);
                                                 $row['region_tax'] = mslib_fe::taxDecimalCrop(($row['price_prefix'] . $row['options_values_price']) * $product['region_tax_rate']);
                                                 if ($row['country_tax'] && $row['region_tax']) {
                                                     $row['tax'] = $row['country_tax'] + $row['region_tax'];
                                                 } else {
                                                     $row['tax'] = mslib_fe::taxDecimalCrop(($row['price_prefix'] . $row['options_values_price']) * $product['tax_rate']);
                                                 }
                                             }
                                             //											$attributes_tax += $row['tax'] * $product['qty'];
                                             $attributes_tax += $row['tax'];
                                             if ($multiple) {
                                                 $cart['products'][$shopping_cart_item]['attributes'][$key][] = $row;
                                             } else {
                                                 $cart['products'][$shopping_cart_item]['attributes'][$key] = $row;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         // end if $key
                     }
                 }
                 if (count($_FILES['attributes']['name'])) {
                     foreach ($_FILES['attributes'] as $file_key => $file_data) {
                         foreach ($file_data as $optid => $val) {
                             if (is_numeric($optid) && $_FILES['attributes']['error'][$optid] == 0 && $file_key == 'name') {
                                 $str = "SELECT products_options_name,listtype from tx_multishop_products_options o where o.products_options_id='" . $optid . "' and language_id='" . $this->sys_language_uid . "'";
                                 $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
                                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                                 if ($row['products_options_name']) {
                                     if (strpos($_FILES['attributes']['name'][$optid], '.php') !== false || strpos($_FILES['attributes']['name'][$optid], '.php3') !== false || strpos($_FILES['attributes']['name'][$optid], '.php4') !== false || strpos($_FILES['attributes']['name'][$optid], '.py') !== false || strpos($_FILES['attributes']['name'][$optid], '.php5') !== false) {
                                         $_FILES['attributes']['name'][$optid] .= '.protected';
                                     }
                                     $target = $this->DOCUMENT_ROOT . 'uploads/tx_multishop/order_resources/' . $_FILES['attributes']['name'][$optid];
                                     move_uploaded_file($_FILES['attributes']['tmp_name'][$optid], $target);
                                     $cart['products'][$shopping_cart_item]['attributes'][$optid]['products_options_name'] = $row['products_options_name'];
                                     $cart['products'][$shopping_cart_item]['attributes'][$optid]['products_options_values_name'] = $_FILES['attributes']['name'][$optid];
                                     $cart['products'][$shopping_cart_item]['attributes'][$optid]['options_id'] = $optid;
                                     $continue = 0;
                                     $multiple = 0;
                                 }
                             }
                         }
                     }
                 }
                 if ($product['categories_id']) {
                     // get all cats to generate multilevel fake url
                     $level = 0;
                     $cats = mslib_fe::Crumbar($product['categories_id']);
                     $cats = array_reverse($cats);
                     $where = '';
                     if (count($cats) > 0) {
                         foreach ($cats as $cat) {
                             $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                             $level++;
                         }
                         $where = substr($where, 0, strlen($where) - 1);
                         $where .= '&';
                     }
                     // get all cats to generate multilevel fake url eof
                 }
                 //					$cart['products'][$shopping_cart_item]['link']=mslib_fe::typolink($product['page_uid'],'&'.$where.'&products_id='.$products_id.'&tx_multishop_pi1[page_section]=products_detail&tx_multishop_pi1[cart_item]='.$shopping_cart_item);
                 $cart['products'][$shopping_cart_item]['link'] = mslib_fe::typolink($this->conf['products_detail_page_pid'], $where . '&products_id=' . $products_id . '&tx_multishop_pi1[page_section]=products_detail&tx_multishop_pi1[cart_item]=' . $shopping_cart_item);
                 $cart['products'][$shopping_cart_item]['total_attributes_tax'] = $attributes_tax;
                 // 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']['updateCartProductPreHook'])) {
                     $params = array('shopping_cart_item' => $shopping_cart_item, 'array' => &$cart['products'][$shopping_cart_item], 'cart' => &$cart);
                     foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartProductPreHook'] as $funcRef) {
                         \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                     }
                 }
                 // custom hook that can be controlled by third-party plugin eof
                 /*
                 $GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
                 if ($this->ms['eID']) {
                 	$GLOBALS['TSFE']->fe_user->storeSessionData();
                 } else {
                 	$GLOBALS['TSFE']->storeSessionData();
                 }
                 */
                 tx_mslib_cart::storeCart($cart);
             }
             if ($this->post['winkelwagen']) {
                 // if products relatives are selected
                 foreach ($this->post['winkelwagen'] as $key => $value) {
                     if ($value) {
                         $rel_products_id = $this->post['relation_products_id'][$key];
                         $rel_id = $this->post['relation_id'][$key];
                         $rel_carty_quantity = $this->post['relation_cart_quantity'][$key];
                         if ($rel_carty_quantity < 0) {
                             $rel_carty_quantity = 0;
                         }
                         if ($rel_carty_quantity and strstr($rel_carty_quantity, ",")) {
                             $rel_carty_quantity = str_replace(",", ".", $rel_carty_quantity);
                         }
                         //$cart=$GLOBALS['TSFE']->fe_user->getKey('ses', $this->cart_page_uid);
                         require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php';
                         $mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
                         $mslib_cart->init($this);
                         $cart = $mslib_cart->getCart();
                         if (preg_match("/^[0-9]+\$/", $rel_products_id)) {
                             $product = mslib_fe::getProduct($rel_products_id);
                             if ($product['products_id']) {
                                 $product['products_shortdescription_raw'] = $product['products_shortdescription'];
                                 $product['products_description_raw'] = $product['products_description'];
                                 if ($product['products_image']) {
                                     $product['products_image_200'] = mslib_befe::getImagePath($product['products_image'], 'products', '200');
                                     $product['products_image'] = mslib_befe::getImagePath($product['products_image'], 'products', '50');
                                 }
                                 if ($product['categories_id']) {
                                     // get all cats to generate multilevel fake url
                                     $level = 0;
                                     $cats = mslib_fe::Crumbar($product['categories_id']);
                                     $cats = array_reverse($cats);
                                     $where = '';
                                     if (count($cats) > 0) {
                                         foreach ($cats as $cat) {
                                             $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                                             $level++;
                                         }
                                         $where = substr($where, 0, strlen($where) - 1);
                                         $where .= '&';
                                     }
                                     // get all cats to generate multilevel fake url eof
                                 }
                                 $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $product['products_id'] . '&tx_multishop_pi1[page_section]=products_detail');
                                 if (mslib_fe::ProductHasAttributes($product['products_id'])) {
                                     // Product has attributes. We need to redirect the customer to the product detail page so the attributes can be selected
                                     header("Location: " . $this->FULL_HTTP_URL . $link);
                                     exit;
                                 }
                                 // chk if the product has staffel price
                                 if ($product['staffel_price'] && $this->ms['MODULES']['STAFFEL_PRICE_MODULE']) {
                                     $product['final_price'] = mslib_fe::calculateStaffelPrice($product['staffel_price'], 1);
                                 }
                                 if ($product['products_id']) {
                                     // add product to the cart (through from on products_detail page)
                                     $product['description'] = '';
                                     $current_quantity = $cart['products'][$product['products_id']]['qty'];
                                     $cart['products'][$product['products_id']] = $product;
                                     $cart['products'][$product['products_id']]['qty'] = $current_quantity + $rel_carty_quantity;
                                     // 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']) {
                                         $cart['products'][$product['products_id']]['qty'] = (int) $cart['products'][$product['products_id']]['qty'];
                                     }
                                     $cart['products'][$product['products_id']]['link'] = $link;
                                     if ($product['minimum_quantity'] > $cart['products'][$product['products_id']]['qty']) {
                                         $cart['products'][$product['products_id']]['qty'] = $product['minimum_quantity'];
                                     }
                                     //
                                     if ($product['products_multiplication']) {
                                         $ctr_end = $product['maximum_quantity'] > 0 ? $product['maximum_quantity'] : 9999;
                                         $qty_start = $product['minimum_quantity'];
                                         if ($cart['products'][$product['products_id']]['qty'] > $qty_start) {
                                             $low_number = $qty_start;
                                             $high_number = $qty_start;
                                             for ($ctr_start = $qty_start; $ctr_start <= $ctr_end; $ctr_start++) {
                                                 if ($ctr_start > $qty_start) {
                                                     $low_number = $high_number;
                                                     $high_number += $product['products_multiplication'];
                                                 } else {
                                                     $low_number = $ctr_start;
                                                     $high_number += $product['products_multiplication'];
                                                 }
                                                 if ($cart['products'][$product['products_id']]['qty'] > $low_number && $cart['products'][$product['products_id']]['qty'] < $high_number) {
                                                     if (round($cart['products'][$product['products_id']]['qty'], 2) == round($low_number, 2)) {
                                                         $cart['products'][$product['products_id']]['qty'] = $low_number;
                                                         break;
                                                     } else {
                                                         if (round($cart['products'][$product['products_id']]['qty'], 2) == round($high_number, 2)) {
                                                             $cart['products'][$product['products_id']]['qty'] = $high_number;
                                                             break;
                                                         } else {
                                                             $low_remainder = $cart['products'][$product['products_id']]['qty'] - $low_number;
                                                             $high_remainder = $cart['products'][$product['products_id']]['qty'] - $high_number;
                                                             $cart['products'][$product['products_id']]['qty'] = $low_number;
                                                             break;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                     /*
                                     $GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
                                     if ($this->ms['eID']) {
                                     	$GLOBALS['TSFE']->fe_user->storeSessionData();
                                     } else {
                                     	$GLOBALS['TSFE']->storeSessionData();
                                     }
                                     */
                                     tx_mslib_cart::storeCart($cart);
                                 }
                             }
                         }
                     }
                 }
             }
             // send notification message to admin
             if ($product['products_id']) {
                 $where = '';
                 if ($product['categories_id']) {
                     // get all cats to generate multilevel fake url
                     $level = 0;
                     $cats = mslib_fe::Crumbar($product['categories_id']);
                     $cats = array_reverse($cats);
                     $where = '';
                     if (count($cats) > 0) {
                         foreach ($cats as $cat) {
                             $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                             $level++;
                         }
                         $where = substr($where, 0, strlen($where) - 1);
                         $where .= '&';
                     }
                     // get all cats to generate multilevel fake url eof
                 }
                 $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $product['products_id'] . '&tx_multishop_pi1[page_section]=products_detail');
                 if ($GLOBALS['TSFE']->fe_user->user['username']) {
                     $customer_name = $GLOBALS['TSFE']->fe_user->user['username'];
                     $customer_edit_link = mslib_fe::typolink($this->shop_pid . ',2003', '&tx_multishop_pi1[page_section]=edit_customer&tx_multishop_pi1[cid]=' . $GLOBALS['TSFE']->fe_user->user['uid'] . '&action=edit_customer');
                 } else {
                     $customer_name = $this->pi_getLL('customer');
                     $customer_edit_link = '';
                 }
                 $message = sprintf($this->pi_getLL('customer_added_productx_to_the_shopping_cart'), '<a href="' . $customer_edit_link . '">' . $customer_name . '</a>', '<a href="' . $link . '">' . $product['products_name'] . '</a>') . '.';
                 if (count($cart['products']) > 0) {
                     if (!$sub_tr_type or $sub_tr_type == 'even') {
                         $sub_tr_type = 'odd';
                     } else {
                         $sub_tr_type = 'even';
                     }
                     $mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
                     $mslib_cart->init($this);
                     $cart = $mslib_cart->getCart();
                     $cart_content .= '<br />' . $this->pi_getLL('content') . ':<br />' . $mslib_cart->getHtmlCartContents('adminNotificationPopup');
                     $message .= $cart_content;
                 }
                 mslib_befe::storeNotificationMessage($this->pi_getLL('customer_action'), $message);
             }
             // end of notification
         } elseif ($this->get['delete_products_id']) {
             $shopping_cart_item = $this->get['delete_products_id'];
             if (is_array($cart['products'][$shopping_cart_item])) {
                 // remove the cart item
                 unset($cart['products'][$shopping_cart_item]);
                 //$GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
                 //$GLOBALS['TSFE']->storeSessionData();
                 tx_mslib_cart::storeCart($cart);
                 tx_mslib_cart::getCart();
             }
         } elseif (is_array($this->post['qty'])) {
             // add/update products in cart (from shopping cart page)
             foreach ($cart['products'] as $shopping_cart_item => $value) {
                 if (!isset($value['products_id']) || isset($value['products_id']) && !$value['products_id']) {
                     unset($cart['products'][$shopping_cart_item]);
                 }
             }
             foreach ($this->post['qty'] as $shopping_cart_item => $qty) {
                 if ($qty and strstr($qty, ",")) {
                     $qty = str_replace(",", ".", $qty);
                 }
                 if ($qty and !is_numeric($qty)) {
                     $qty = 1;
                 }
                 if (!$qty or $qty < 0.01) {
                     unset($cart['products'][$shopping_cart_item]);
                 } else {
                     $products_id = $cart['products'][$shopping_cart_item]['products_id'];
                     $product = mslib_fe::getProduct($products_id);
                     $product['maximum_quantity'] = str_replace('.00', '', $product['maximum_quantity']);
                     $product['minimum_quantity'] = str_replace('.00', '', $product['minimum_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']['updateCartByShoppingCartPreProc'])) {
                         $params = array('shopping_cart_item' => $shopping_cart_item, 'products_id' => &$products_id, 'product' => &$product, 'cart' => &$cart, 'qty' => &$qty);
                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartByShoppingCartPreProc'] as $funcRef) {
                             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                         }
                     }
                     // custom hook that can be controlled by third-party plugin eof
                     // chk if the product has staffel price
                     if ($product['staffel_price'] && $this->ms['MODULES']['STAFFEL_PRICE_MODULE']) {
                         $cart['products'][$shopping_cart_item]['final_price'] = mslib_fe::calculateStaffelPrice($product['staffel_price'], $qty) / $qty;
                     }
                     $cart['products'][$shopping_cart_item]['qty'] = $qty;
                     // PROTECTION WHEN PRODUCT MULTIPLICATION IS NOT A FLOAT WE HAVE TO CAST IT AS INTEGER
                     if (!$product['products_multiplication'] || (int) $product['products_multiplication'] == $product['products_multiplication']) {
                         $cart['products'][$shopping_cart_item]['qty'] = (int) $cart['products'][$shopping_cart_item]['qty'];
                     }
                     if ($product['minimum_quantity'] > $cart['products'][$shopping_cart_item]['qty']) {
                         $cart['products'][$shopping_cart_item]['qty'] = $product['minimum_quantity'];
                     }
                     if ($product['maximum_quantity'] > 0 && $qty > $product['maximum_quantity']) {
                         $cart['products'][$shopping_cart_item]['qty'] = $product['maximum_quantity'];
                     }
                     if ($product['products_multiplication']) {
                         $ctr_end = $product['maximum_quantity'] > 0 ? $product['maximum_quantity'] : 9999;
                         $qty_start = $product['minimum_quantity'];
                         if ($cart['products'][$shopping_cart_item]['qty'] > $qty_start) {
                             $low_number = $qty_start;
                             $high_number = $qty_start;
                             for ($ctr_start = $qty_start; $ctr_start <= $ctr_end; $ctr_start++) {
                                 if ($ctr_start > $qty_start) {
                                     $low_number = $high_number;
                                     $high_number += $product['products_multiplication'];
                                 } else {
                                     $low_number = $ctr_start;
                                     $high_number += $product['products_multiplication'];
                                 }
                                 if ($cart['products'][$shopping_cart_item]['qty'] > $low_number && $cart['products'][$shopping_cart_item]['qty'] < $high_number) {
                                     if (round($cart['products'][$shopping_cart_item]['qty'], 2) == round($low_number, 2)) {
                                         $cart['products'][$shopping_cart_item]['qty'] = $low_number;
                                         break;
                                     } else {
                                         if (round($cart['products'][$shopping_cart_item]['qty'], 2) == round($high_number, 2)) {
                                             $cart['products'][$shopping_cart_item]['qty'] = $high_number;
                                             break;
                                         } else {
                                             $low_remainder = $cart['products'][$shopping_cart_item]['qty'] - $low_number;
                                             $high_remainder = $cart['products'][$shopping_cart_item]['qty'] - $high_number;
                                             $cart['products'][$shopping_cart_item]['qty'] = $low_number;
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             //die();
             //$GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
             //$GLOBALS['TSFE']->storeSessionData();
             tx_mslib_cart::storeCart($cart);
         }
         // group discount
         if ($GLOBALS['TSFE']->fe_user->user['uid']) {
             $discount = mslib_fe::getUserGroupDiscount($GLOBALS['TSFE']->fe_user->user['uid']);
             if ($discount) {
                 $cart['coupon_discount'] = $discount;
                 $cart['discount'] = $discount;
                 $cart['discount_type'] = 'percentage';
                 //$GLOBALS['TSFE']->fe_user->setKey('ses', $this->cart_page_uid, $cart);
                 //$GLOBALS['TSFE']->storeSessionData();
                 tx_mslib_cart::storeCart($cart);
             }
         }
         // store cart contents for later analyses
         $cart_store_content = $mslib_cart->getCart();
         //$cart_store_content=$GLOBALS['TSFE']->fe_user->getKey('ses', $this->cart_page_uid);
         mslib_befe::storeCustomerCartContent($cart_store_content);
         // 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']['updateCartPostHook'])) {
             $params = array('cart' => &$cart);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateCartPostHook'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         // custom hook that can be controlled by third-party plugin eof
         if ($product['products_id'] and $this->ms['MODULES']['REDIRECT_BACK_TO_PRODUCTS_DETAIL_PAGE_AFTER_ADD_TO_CART']) {
             $where = '';
             if ($product['categories_id']) {
                 // get all cats to generate multilevel fake url
                 $level = 0;
                 $cats = mslib_fe::Crumbar($product['categories_id']);
                 $cats = array_reverse($cats);
                 $where = '';
                 if (count($cats) > 0) {
                     foreach ($cats as $cat) {
                         $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                         $level++;
                     }
                     $where = substr($where, 0, strlen($where) - 1);
                     $where .= '&';
                 }
                 // get all cats to generate multilevel fake url eof
             }
             $link = mslib_fe::typolink($this->conf['products_detail_page_pid'], '&' . $where . '&products_id=' . $product['products_id'] . '&tx_multishop_pi1[page_section]=products_detail');
             if ($link) {
                 header("Location: " . $this->FULL_HTTP_URL . $link);
                 exit;
             }
         }
     }
 }
Beispiel #7
0
 public function checkoutValidateProductStatus($product_id)
 {
     $product = mslib_fe::getProduct($product_id, '', '', 1, 1);
     if (!$product || !$product['products_status']) {
         return false;
     }
     return true;
 }
Beispiel #8
0
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
$output = array();
$js_detail_page_triggers = array();
if ($this->ADMIN_USER) {
    $include_disabled_products = 1;
} else {
    $include_disabled_products = 0;
}
$product = mslib_fe::getProduct($this->get['products_id'], $this->get['categories_id'], '', $include_disabled_products);
if (!$product['products_id']) {
    header('HTTP/1.0 404 Not Found');
    $output_array['http_header'] = 'HTTP/1.0 404 Not Found';
    // set custom 404 message
    $page = mslib_fe::getCMScontent('product_not_found_message', $GLOBALS['TSFE']->sys_language_uid);
    if ($page[0]['name']) {
        $content = '<div class="main-title"><h1>' . $page[0]['name'] . '</h1></div>';
    } else {
        $content = '<div class="main-title"><h1>' . $this->pi_getLL('the_requested_product_does_not_exist') . '</h1></div>';
    }
    if ($page[0]['content']) {
        $content .= $page[0]['content'];
    }
} else {
    if ($this->conf['imageWidth']) {
        $this->imageWidth = $this->conf['imageWidth'];
    }
    if (!$this->imageWidth) {
 function getOrderWeight($orders_id)
 {
     if (is_numeric($orders_id)) {
         $weight = 0;
         $order = mslib_fe::getOrder($orders_id);
         foreach ($order['products'] as $product) {
             if (is_numeric($product['products_id'])) {
                 $product_db = mslib_fe::getProduct($product['products_id']);
                 $weight = $weight + $product['qty'] * $product_db['products_weight'];
             }
         }
         return $weight;
     }
 }
// 1.23 corrected to 1.2
$qty_decimal_correction = '';
if (strstr($qty, ".")) {
    $decimals = explode('.', $qty);
    if (strlen($decimals[1]) > 1) {
        $decimals[1] = $decimals[1][0];
        $qty = implode('.', $decimals);
        $qty_decimal_correction = $qty;
    }
}
// caller marker for the mslib_fe::getProduct
$this->post['caller_script'] = 'get_staffel_price';
if ($this->ADMIN_USER) {
    $product = mslib_fe::getProduct($products_id, '', '', 1);
} else {
    $product = mslib_fe::getProduct($products_id);
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/get_staffel_price.php']['getProductPostProc'])) {
    $params = array('products_id' => &$products_id, 'product' => &$product);
    foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/get_staffel_price.php']['getProductPostProc'] as $funcRef) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
    }
}
// hook eof
$disableFeFromCalculatingVatPrices = $this->conf['disableFeFromCalculatingVatPrices'];
$this->conf['disableFeFromCalculatingVatPrices'] = 1;
$exclude_vat_price = mslib_fe::final_products_price($product, $qty, 0) * $qty;
$this->conf['disableFeFromCalculatingVatPrices'] = $disableFeFromCalculatingVatPrices;
// count normal price
$price = mslib_fe::final_products_price($product, $qty, 0) * $qty;
Beispiel #11
0
			<tr class="' . $tr_type . '">
				<th valign="top">Qty</td>
				<th valign="top">Product</td>
			</tr>
		';
        $total_amount = 0;
        while (($product = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) {
            if (!$tr_type or $tr_type == 'even') {
                $tr_type = 'odd';
            } else {
                $tr_type = 'even';
            }
            $where = '';
            if (!$product['categories_id']) {
                // fix fold old orders that did not have categories id in orders_products table
                $tmpProduct = mslib_fe::getProduct($product['products_id']);
                $product['categories_id'] = $tmpProduct;
            }
            if ($product['categories_id']) {
                // get all cats to generate multilevel fake url
                $level = 0;
                $cats = mslib_fe::Crumbar($product['categories_id']);
                $cats = array_reverse($cats);
                $where = '';
                if (count($cats) > 0) {
                    foreach ($cats as $cat) {
                        $where .= "categories_id[" . $level . "]=" . $cat['id'] . "&";
                        $level++;
                    }
                    $where = substr($where, 0, strlen($where) - 1);
                }
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php';
$mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
$mslib_cart->init($this);
$data = array();
if ($this->post['products_id']) {
    $product = mslib_fe::getProduct($this->post['products_id']);
    if ($product['products_id']) {
        $mslib_cart->updateCart();
        $data['added_product']['products_name'] = $product['products_name'];
        $data['added_product']['products_model'] = $product['products_model'];
    }
}
//$cart = $GLOBALS['TSFE']->fe_user->getKey('ses',$this->cart_page_uid);
$cart = $mslib_cart->getCart();
$totalitems = 0;
if (count($cart['products']) > 0) {
    foreach ($cart['products'] as $product) {
        if ($product['qty'] > 0) {
            $totalitems = $totalitems + $product['qty'];
        }
    }
}
$totalitems = ceil($totalitems);
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/products_to_basket.php']['CartItemsCountLabelPostHook'])) {
    $params = array('cart' => &$cart, 'totalitems' => &$totalitems);
                            mslib_befe::enableProduct($rs_product['products_id']);
                        }
                    }
                }
                if ($rs_product['products_status'] == '1' && $rs_product['endtime'] > 0) {
                    if ($rs_product['endtime'] <= $current_tstamp) {
                        mslib_befe::disableProduct($rs_product['products_id']);
                    }
                }
            }
        }
    }
}
if (is_numeric($this->get['products_id'])) {
    // overwrite multishop settings loaded from the product
    $product = mslib_fe::getProduct($this->get['products_id'], $this->get['categories_id'], 'p.custom_settings', 1, 1);
    if ($product['custom_settings']) {
        mslib_fe::updateCustomSettings($product['custom_settings']);
    }
}
// overwrite multishop settings loaded from the content element
if ($this->customSettings) {
    mslib_fe::updateCustomSettings($this->customSettings);
}
// overwrite multishop settings loaded from the content element eof
if (!$this->conf['admin_template_folder']) {
    $this->conf['admin_template_folder'] = 'admin_multishop';
}
// reset the fileadmin admin folder to local plugin location
if (!$this->conf['search_page_pid']) {
    $this->conf['search_page_pid'] = $this->shop_pid;
Beispiel #14
0
 function printInvoiceOrderDetailsTable($order, $invoice_number, $prefix = '', $display_currency_symbol = 1, $table_type = 'invoice')
 {
     switch ($table_type) {
         case 'invoice':
             if ($this->conf['order_details_table_invoice_pdf_tmpl_path']) {
                 $template = $this->cObj->fileResource($this->conf['order_details_table_invoice_pdf_tmpl_path']);
             } else {
                 $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_invoice_pdf.tmpl');
             }
             break;
         case 'packingslip':
             if ($this->conf['order_details_table_packingslip_pdf_tmpl_path']) {
                 $template = $this->cObj->fileResource($this->conf['order_details_table_packingslip_pdf_tmpl_path']);
             } else {
                 $template = $this->cObj->fileResource(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop') . 'templates/order_details_table_packingslip_pdf.tmpl');
             }
             break;
     }
     if (is_array($order['products']) && count($order['products'])) {
         $contentItem = '';
         $displayDiscountColumn = 0;
         // First check if orders products rows have an discount amount
         foreach ($order['products'] as $product) {
             if ($product['discount_amount'] > 0) {
                 $displayDiscountColumn = 1;
                 break;
             }
         }
     }
     $customer_currency = 1;
     // Extract the subparts from the template
     $subparts = array();
     $subparts['template'] = $this->cObj->getSubpart($template, '###TEMPLATE###');
     $subparts['HEADER_NORMAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###HEADER_NORMAL_WRAPPER###');
     $subparts['HEADER_INCLUDE_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###HEADER_INCLUDE_VAT_WRAPPER###');
     $subparts['HEADER_EXCLUDE_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###HEADER_EXCLUDE_VAT_WRAPPER###');
     // items wrapper
     $subparts['ITEMS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###ITEMS_WRAPPER###');
     $subparts['ITEM_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_WRAPPER'], '###ITEM_WRAPPER###');
     $subparts['ITEM_ATTRIBUTES_WRAPPER'] = $this->cObj->getSubpart($subparts['ITEMS_WRAPPER'], '###ITEM_ATTRIBUTES_WRAPPER###');
     //bottom row
     $subparts['SUBTOTAL_INCLUDE_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SUBTOTAL_INCLUDE_VAT_WRAPPER###');
     $subparts['SUBTOTAL_EXCLUDE_VAT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SUBTOTAL_EXCLUDE_VAT_WRAPPER###');
     $subparts['DISCOUNT_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###DISCOUNT_WRAPPER###');
     $subparts['NEWSUBTOTAL_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###NEWSUBTOTAL_WRAPPER###');
     $subparts['TOTAL_VAT_ROW_INCLUDE_VAT'] = $this->cObj->getSubpart($subparts['template'], '###TOTAL_VAT_ROW_INCLUDE_VAT###');
     // single packing, shipping, payment costs line
     $subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'] = $this->cObj->getSubpart($subparts['template'], '###SINGLE_SHIPPING_PACKING_COSTS_WRAPPER###');
     // parsing
     $subpartArray = array();
     //ITEMS_HEADER_WRAPPER
     $markerArray = array();
     $markerArray['LABEL_HEADER_QTY'] = ucfirst($this->pi_getLL('qty'));
     $markerArray['LABEL_HEADER_PRODUCT_NAME'] = $this->pi_getLL('products_name');
     $markerArray['LABEL_HEADER_SKU'] = $this->pi_getLL('sku_number', 'SKU');
     $markerArray['LABEL_HEADER__QUANTITY'] = $this->pi_getLL('qty');
     $markerArray['LABEL_HEADER_TOTAL'] = $this->pi_getLL('total');
     $markerArray['LABEL_HEADER_PRICE'] = $this->pi_getLL('price');
     //hook to let other plugins further manipulate the replacers
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableHeaderNormalPostProc'])) {
         $params_internal = array('markerArray' => &$markerArray, 'table_type' => $table_type);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableHeaderNormalPostProc'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params_internal, $this);
         }
     }
     $subpartArray['###HEADER_NORMAL_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['HEADER_NORMAL_WRAPPER'], $markerArray, '###|###');
     $markerArray = array();
     $markerArray['LABEL_HEADER_VAT'] = $this->pi_getLL('vat');
     $markerArray['LABEL_HEADER_ITEM_NORMAL_PRICE'] = $this->pi_getLL('normal_price');
     $markerArray['LABEL_HEADER_ITEM_DISCOUNT'] = '';
     //hook to let other plugins further manipulate the replacers
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableHeaderIncludeExcludeVatPostProc'])) {
         $params_internal = array('markerArray' => &$markerArray, 'table_type' => $table_type);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableHeaderIncludeExcludeVatPostProc'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params_internal, $this);
         }
     }
     if ($displayDiscountColumn) {
         $markerArray['LABEL_HEADER_ITEM_DISCOUNT'] = '<th align="right" class="cell_products_normal_price">' . $this->pi_getLL('discount') . '</th>';
     }
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         $markerArray['LABEL_HEADER_ITEM_FINAL_PRICE'] = $this->pi_getLL('final_price_inc_vat');
         $subpartArray['###HEADER_INCLUDE_VAT_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['HEADER_INCLUDE_VAT_WRAPPER'], $markerArray, '###|###');
     } else {
         $markerArray['LABEL_HEADER_ITEM_FINAL_PRICE'] = $this->pi_getLL('final_price_ex_vat');
         $subpartArray['###HEADER_EXCLUDE_VAT_WRAPPER###'] = $this->cObj->substituteMarkerArray($subparts['HEADER_EXCLUDE_VAT_WRAPPER'], $markerArray, '###|###');
     }
     // template wrapper
     // removal start
     $subpartsTemplateWrapperRemove = array();
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         $subpartsTemplateWrapperRemove['###HEADER_EXCLUDE_VAT_WRAPPER###'] = '';
         $subpartsTemplateWrapperRemove['###SUBTOTAL_EXCLUDE_VAT_WRAPPER###'] = '';
     } else {
         $subpartsTemplateWrapperRemove['###HEADER_INCLUDE_VAT_WRAPPER###'] = '';
         $subpartsTemplateWrapperRemove['###SUBTOTAL_INCLUDE_VAT_WRAPPER###'] = '';
         $subpartsTemplateWrapperRemove['###TOTAL_VAT_ROW_INCLUDE_VAT###'] = '';
         if ($order['orders_tax_data']['shipping_tax'] || $order['orders_tax_data']['payment_tax']) {
             $subpartsTemplateWrapperRemove['###TOTAL_VAT_ROW_EXCLUDE_VAT_NO_SHIPPING_PAYMENT_TAX###'] = '';
         } else {
             $subpartsTemplateWrapperRemove['###TOTAL_VAT_ROW_EXCLUDE_VAT_HAVE_SHIPPING_PAYMENT_TAX###'] = '';
         }
     }
     if ($order['discount'] > -1 && $order['discount'] < 0.01) {
         $subpartsTemplateWrapperRemove['###DISCOUNT_WRAPPER###'] = '';
         $subpartsTemplateWrapperRemove['###NEWSUBTOTAL_WRAPPER###'] = '';
     }
     if (!empty($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'])) {
         $subpartsTemplateWrapperRemove['###SHIPPING_COSTS_WRAPPER###'] = '';
         $subpartsTemplateWrapperRemove['###PAYMENT_COSTS_WRAPPER###'] = '';
     }
     if (!$order['shipping_method_costs']) {
         // If shipping method costs are zero, then remove the whole subpart
         $subpartsTemplateWrapperRemove['###SHIPPING_COSTS_WRAPPER###'] = '';
     }
     if (!$order['payment_method_costs']) {
         // If payment method costs are zero, then remove the whole subpart
         $subpartsTemplateWrapperRemove['###PAYMENT_COSTS_WRAPPER###'] = '';
     }
     $subparts['template'] = $this->cObj->substituteMarkerArrayCached($subparts['template'], array(), $subpartsTemplateWrapperRemove);
     // items wrapper
     $subpartsItemsWrapperRemove = array();
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         $subpartsItemsWrapperRemove['###ITEM_EXCLUDE_VAT_WRAPPER###'] = '';
     } else {
         $subpartsItemsWrapperRemove['###ITEM_INCLUDE_VAT_WRAPPER###'] = '';
     }
     $subparts['ITEM_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEM_WRAPPER'], array(), $subpartsItemsWrapperRemove);
     // item attributes wrapper
     $subpartsItemAttributesWrapperRemove = array();
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         $subpartsItemAttributesWrapperRemove['###ITEM_ATTRIBUTE_EXCLUDE_VAT_WRAPPER###'] = '';
     } else {
         $subpartsItemAttributesWrapperRemove['###ITEM_ATTRIBUTE_INCLUDE_VAT_WRAPPER###'] = '';
     }
     $subparts['ITEM_ATTRIBUTES_WRAPPER'] = $this->cObj->substituteMarkerArrayCached($subparts['ITEM_ATTRIBUTES_WRAPPER'], array(), $subpartsItemAttributesWrapperRemove);
     // removal eol
     // tax subparts
     $subparts['TOTAL_VAT_ROW_EXCLUDE_VAT_NO_SHIPPING_PAYMENT_TAX'] = $this->cObj->getSubpart($subparts['template'], '###TOTAL_VAT_ROW_EXCLUDE_VAT_NO_SHIPPING_PAYMENT_TAX###');
     $subparts['TOTAL_VAT_ROW_EXCLUDE_VAT_HAVE_SHIPPING_PAYMENT_TAX'] = $this->cObj->getSubpart($subparts['template'], '###TOTAL_VAT_ROW_EXCLUDE_VAT_HAVE_SHIPPING_PAYMENT_TAX###');
     $subparts['TOTAL_VAT_ROW_INCLUDE_VAT'] = $this->cObj->getSubpart($subparts['template'], '###TOTAL_VAT_ROW_INCLUDE_VAT###');
     //print_r($subparts);
     //die();
     $total_tax = 0;
     $tr_type = 'even';
     $od_rows_count = 0;
     $product_counter = 1;
     $real_prefix = $prefix;
     if (is_array($order['products']) && count($order['products'])) {
         $contentItem = '';
         foreach ($order['products'] as $product) {
             $markerArray = array();
             $markerArray['ITEM_COUNTER'] = $product_counter;
             $od_rows_count++;
             if (!$tr_type or $tr_type == 'even') {
                 $tr_type = 'odd';
             } else {
                 $tr_type = 'even';
             }
             $markerArray['ITEM_ROW_TYPE'] = $tr_type;
             $markerArray['ITEM_PRODUCT_QTY'] = round($product['qty'], 2);
             $product_tmp = mslib_fe::getProduct($product['products_id']);
             $product_name = htmlspecialchars($product['products_name']);
             if ($product['products_article_number']) {
                 $product_name .= ' (' . htmlspecialchars($product['products_article_number']) . ')';
             }
             if ($this->ms['MODULES']['DISPLAY_SKU_IN_ORDER_DETAILS'] == '1' && !empty($product['sku_code'])) {
                 $product_name .= '<br/>' . htmlspecialchars($this->pi_getLL('admin_label_sku')) . ': ' . htmlspecialchars($product['sku_code']);
             }
             if ($this->ms['MODULES']['DISPLAY_PRODUCTS_MODEL_IN_ORDER_DETAILS'] == '1' && !empty($product['products_model'])) {
                 $product_name .= '<br/>Model: ' . htmlspecialchars($product['products_model']);
             }
             if ($product['products_description']) {
                 $product_name .= '<br/>' . nl2br(htmlspecialchars($product['products_description']));
             }
             if ($this->ms['MODULES']['DISPLAY_EAN_IN_ORDER_DETAILS'] == '1' && !empty($product['ean_code'])) {
                 $product_name .= '<br/>' . htmlspecialchars($this->pi_getLL('admin_label_ean')) . ': ' . htmlspecialchars($product['ean_code']);
             }
             if ($this->ms['MODULES']['DISPLAY_VENDOR_IN_ORDER_DETAILS'] == '1' && !empty($product['vendor_code'])) {
                 $product_name .= '<br/>' . htmlspecialchars($this->pi_getLL('admin_label_vendor_code')) . ': ' . htmlspecialchars($product['vendor_code']);
             }
             $markerArray['ITEM_PRODUCT_NAME'] = $product_name;
             // Seperate marker version
             $markerArray['ITEM_SEPERATE_PRODUCTS_NAME'] = htmlspecialchars($product['products_name']);
             $markerArray['ITEM_SEPERATE_PRODUCTS_DESCRIPTION'] = nl2br(htmlspecialchars($product['products_description']));
             $markerArray['ITEM_SEPERATE_PRODUCTS_MODEL'] = htmlspecialchars($product['products_model']);
             // Seperate marker version eol
             $markerArray['ITEM_VAT'] = str_replace('.00', '', number_format($product['products_tax'], 2)) . '%';
             $markerArray['ITEM_ORDER_UNIT'] = $product['order_unit_name'];
             // ITEM IMAGE
             $image_path = mslib_befe::getImagePath($product_tmp['products_image'], 'products', '50');
             if (isset($product_tmp['products_image']) && !empty($product_tmp['products_image'])) {
                 if (!strstr(mslib_befe::strtolower($product_tmp['products_image']), 'http://') and !strstr(mslib_befe::strtolower($product_tmp['products_image']), 'https://')) {
                     $product_tmp['products_image'] = $image_path;
                 }
                 $markerArray['ITEM_IMAGE'] = '<img src="' . $product_tmp['products_image'] . '" title="' . htmlspecialchars($product['products_name']) . '">';
             } else {
                 $markerArray['ITEM_IMAGE'] = '<div class="no_image_50"></div>';
             }
             if ($table_type == 'invoice' && $prefix == '-') {
                 if (strpos($product['final_price'], '-') !== false) {
                     $product['final_price'] = str_replace('-', '', $product['final_price']);
                 } else {
                     $product['final_price'] = $prefix . $product['final_price'];
                 }
             }
             if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                 $markerArray['ITEM_NORMAL_PRICE'] = mslib_fe::amount2Cents($product['final_price'] + $product['products_tax_data']['total_tax'], $customer_currency, $display_currency_symbol, 0);
                 $markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($product['qty'] * ($product['final_price'] + $product['products_tax_data']['total_tax']), $customer_currency, $display_currency_symbol, 0);
             } else {
                 $markerArray['ITEM_NORMAL_PRICE'] = mslib_fe::amount2Cents($product['final_price'], $customer_currency, $display_currency_symbol, 0);
                 $markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($product['qty'] * $product['final_price'], $customer_currency, $display_currency_symbol, 0);
             }
             $markerArray['ITEM_DISCOUNT_AMOUNT'] = '';
             if ($displayDiscountColumn) {
                 $markerArray['ITEM_DISCOUNT_AMOUNT'] = '<td align="right" class="cell_products_normal_price">' . mslib_fe::amount2Cents($product['discount_amount'], 0) . '</td>';
                 if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                     $markerArray['ITEM_DISCOUNT_AMOUNT'] = '<td align="right" class="cell_products_normal_price">' . mslib_fe::amount2Cents($product['discount_amount'] + $product['discount_amount'] * $product['products_tax'] / 100, 0) . '</td>';
                     $markerArray['ITEM_NORMAL_PRICE'] = mslib_fe::amount2Cents($product['final_price'] + $product['final_price'] * $product['products_tax'] / 100, $customer_currency, $display_currency_symbol, 0);
                     //$markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($prefix . (($product['final_price'] - $product['discount_amount']) + $product['products_tax_data']['total_tax']), $customer_currency, $display_currency_symbol, 0);
                     $markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($product['final_price'] + $product['products_tax_data']['total_tax'], $customer_currency, $display_currency_symbol, 0);
                 } else {
                     $markerArray['ITEM_NORMAL_PRICE'] = mslib_fe::amount2Cents($product['final_price'], $customer_currency, $display_currency_symbol, 0);
                     //$markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($prefix . ($product['qty'] * ($product['final_price'] - $product['discount_amount'])), $customer_currency, $display_currency_symbol, 0);
                     $markerArray['ITEM_FINAL_PRICE'] = mslib_fe::amount2Cents($product['qty'] * $product['final_price'], $customer_currency, $display_currency_symbol, 0);
                 }
             }
             //hook to let other plugins further manipulate the replacers
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableProductIteratorPostProc'])) {
                 $params_internal = array('markerArray' => &$markerArray, 'table_type' => $table_type, 'product' => $product_tmp, 'order_product' => $product);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['printInvoiceOrderDetailsTableProductIteratorPostProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params_internal, $this);
                 }
             }
             $append_attributes_label_to_product_name = false;
             if (empty($subparts['ITEM_ATTRIBUTES_WRAPPER'])) {
                 $append_attributes_label_to_product_name = true;
             } else {
                 $contentItem .= $this->cObj->substituteMarkerArray($subparts['ITEM_WRAPPER'], $markerArray, '###|###');
             }
             if (is_array($product['attributes']) && count($product['attributes'])) {
                 foreach ($product['attributes'] as $tmpkey => $options) {
                     if ($options['products_options_values']) {
                         if ($table_type == 'invoice' && $prefix == '-') {
                             if (strpos($options['options_values_price'], '-') !== false) {
                                 $options['options_values_price'] = str_replace('-', '', $options['options_values_price']);
                             } else {
                                 $options['options_values_price'] = $prefix . $options['options_values_price'];
                             }
                         }
                         $attributeMarkerArray = array();
                         $attributeMarkerArray['ITEM_ATTRIBUTE_ROW_TYPE'] = $tr_type;
                         $attributeMarkerArray['ITEM_ATTRIBUTE'] = '';
                         if ($options['products_options'] && $options['products_options_values']) {
                             if ($append_attributes_label_to_product_name) {
                                 $markerArray['ITEM_PRODUCT_NAME'] .= ' <br />' . $options['products_options'] . ': ' . $options['products_options_values'];
                             }
                             $attributeMarkerArray['ITEM_ATTRIBUTE'] = htmlspecialchars($options['products_options']) . ': ' . htmlspecialchars($options['products_options_values']);
                         }
                         $attributeMarkerArray['ITEM_ATTRIBUTE_VAT'] = '';
                         // calculating
                         $od_rows_count++;
                         $cell_products_normal_price = '';
                         $cell_products_vat = '';
                         $cell_products_final_price = '';
                         if ($options['options_values_price'] > 0) {
                             if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                                 $attributes_price = $options['price_prefix'] . $options['options_values_price'] + $options['attributes_tax_data']['tax'];
                                 $total_attributes_price = $attributes_price * $product['qty'];
                                 $cell_products_normal_price = mslib_fe::amount2Cents($attributes_price, $customer_currency, $display_currency_symbol, 0);
                                 $cell_products_final_price = mslib_fe::amount2Cents($total_attributes_price, $customer_currency, $display_currency_symbol, 0);
                             } else {
                                 $cell_products_normal_price = mslib_fe::amount2Cents($options['price_prefix'] . $options['options_values_price'], $customer_currency, $display_currency_symbol, 0);
                                 $cell_products_final_price = mslib_fe::amount2Cents(($options['price_prefix'] . $options['options_values_price']) * $product['qty'], $customer_currency, $display_currency_symbol, 0);
                             }
                         }
                         $attributeMarkerArray['ITEM_ATTRIBUTE_NORMAL_PRICE'] = $cell_products_normal_price;
                         $attributeMarkerArray['ITEM_ATTRIBUTE_DISCOUNT_AMOUNT'] = '';
                         if ($displayDiscountColumn) {
                             $attributeMarkerArray['ITEM_ATTRIBUTE_DISCOUNT_AMOUNT'] = '<td align="right" class="cell_products_normal_price">&nbsp;</td>';
                         }
                         $attributeMarkerArray['ITEM_ATTRIBUTE_FINAL_PRICE'] = $cell_products_final_price;
                     }
                     $contentItem .= $this->cObj->substituteMarkerArray($subparts['ITEM_ATTRIBUTES_WRAPPER'], $attributeMarkerArray, '###|###');
                 }
             }
             if (empty($subparts['ITEM_ATTRIBUTES_WRAPPER'])) {
                 $contentItem .= $this->cObj->substituteMarkerArray($subparts['ITEM_WRAPPER'], $markerArray, '###|###');
             }
             $subpartArray['###ITEM_ATTRIBUTES_WRAPPER###'] = '';
             // count the vat
             if ($order['final_price'] and $order['products_tax']) {
                 $item_tax = $order['qty'] * ($order['final_price'] * $order['products_tax'] / 100);
                 $total_tax = $total_tax + $item_tax;
             }
             $product_counter++;
         }
     } else {
         $subpartArray['###ITEM_ATTRIBUTES_WRAPPER###'] = '';
     }
     $subpartArray['###ITEM_WRAPPER###'] = $contentItem;
     if ($table_type == 'invoice' && $prefix == '-') {
         if (strpos($order['shipping_method_costs'], '-') !== false) {
             $prefix = '';
             $order['shipping_method_costs'] = str_replace('-', '', $order['shipping_method_costs']);
             $order['orders_tax_data']['shipping_tax'] = str_replace('-', '', $order['orders_tax_data']['shipping_tax']);
         } else {
             $prefix = '-';
         }
         if (strpos($order['payment_method_costs'], '-') !== false) {
             $prefix = '';
             $order['payment_method_costs'] = str_replace('-', '', $order['payment_method_costs']);
             $order['orders_tax_data']['payment_tax'] = str_replace('-', '', $order['orders_tax_data']['payment_tax']);
         } else {
             $prefix = '-';
         }
         if (strpos($order['orders_tax_data']['sub_total'], '-') !== false) {
             $prefix = '';
             $order['orders_tax_data']['sub_total'] = str_replace('-', '', $order['orders_tax_data']['sub_total']);
         } else {
             $prefix = '-';
         }
         if (strpos($order['subtotal_amount'], '-') !== false) {
             $prefix = '';
             $order['subtotal_amount'] = str_replace('-', '', $order['subtotal_amount']);
         } else {
             $prefix = '-';
         }
         if (strpos($order['discount'], '-') !== false) {
             $prefix = '';
             $order['discount'] = str_replace('-', '', $order['discount']);
         } else {
             $prefix = '-';
         }
         if (strpos($order['orders_tax_data']['grand_total'], '-') !== false) {
             $prefix = '';
             $order['orders_tax_data']['grand_total'] = str_replace('-', '', $order['orders_tax_data']['grand_total']);
         } else {
             $prefix = '-';
         }
     }
     if (!empty($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'])) {
         /*
         * special subparts
         <!-- ###SINGLE_SHIPPING_PACKING_COSTS_WRAPPER### begin -->
         				<tr class="###ITEM_SHIPPING_PAYMENT_COSTS_ROW_TYPE###">
         					<td align="right" class="cell_products_counter valign_top">###ITEM_SHIPPING_PAYMENT_COSTS_COUNTER###</td>
         					<td align="left" class="cell_products_name valign_top">###ITEM_SHIPPING_PAYMENT_COSTS_LABEL###</td>
         					<td align="right" class="cell_products_normal_price valign_top">###ITEM_SHIPPING_PAYMENT_COSTS_NORMAL_PRICE###</td>
         					<td align="right" class="cell_products_vat valign_top">###ITEM_SHIPPING_PAYMENT_COSTS_VAT###</td>
         					<td align="right" class="cell_products_final_price valign_top">###ITEM_SHIPPING_PAYMENT_COSTS_FINAL_PRICE###</td>
         				</tr>
         				<!-- ###SINGLE_SHIPPING_PACKING_COSTS_WRAPPER### end -->
         */
         $shipping_payment_costs_line = '';
         // payment costs
         if (!$tr_type or $tr_type == 'even') {
             $tr_type = 'odd';
         } else {
             $tr_type = 'even';
         }
         $payment_tax_rate = '-';
         if (!empty($order['orders_tax_data']['payment_total_tax_rate'])) {
             $payment_tax_rate = $order['orders_tax_data']['payment_total_tax_rate'] * 100 . '%';
         }
         $markerArray = array();
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_COUNTER'] = $product_counter;
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_LABEL'] = $this->pi_getLL('payment_costs') . ' (' . $order['payment_method_label'] . ')';
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_ROW_TYPE'] = $tr_type;
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_VAT'] = $payment_tax_rate;
         $payment_costs = '0';
         if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
             if ($order['payment_method_costs'] !== 0) {
                 $payment_costs = $prefix . ($order['payment_method_costs'] + $order['orders_tax_data']['payment_tax']);
             }
         } else {
             if ($order['payment_method_costs'] !== 0) {
                 $payment_costs = $prefix . $order['payment_method_costs'];
             }
         }
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_NORMAL_PRICE'] = mslib_fe::amount2Cents($payment_costs, $customer_currency, $display_currency_symbol, 0);
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_FINAL_PRICE'] = mslib_fe::amount2Cents($payment_costs, $customer_currency, $display_currency_symbol, 0);
         $shipping_payment_costs_line .= $this->cObj->substituteMarkerArray($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'], $markerArray, '###|###');
         $product_counter++;
         // shipping costs
         if (!$tr_type or $tr_type == 'even') {
             $tr_type = 'odd';
         } else {
             $tr_type = 'even';
         }
         $shipping_tax_rate = '0%';
         if (!empty($order['orders_tax_data']['shipping_total_tax_rate'])) {
             $shipping_tax_rate = $order['orders_tax_data']['shipping_total_tax_rate'] * 100 . '%';
         }
         $markerArray = array();
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_COUNTER'] = $product_counter;
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_LABEL'] = $this->pi_getLL('shipping_costs') . ' (' . $order['shipping_method_label'] . ')';
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_ROW_TYPE'] = $tr_type;
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_VAT'] = $shipping_tax_rate;
         $shipping_costs = '0';
         if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
             if ($order['shipping_method_costs'] !== 0) {
                 $shipping_costs = $prefix . ($order['shipping_method_costs'] + $order['orders_tax_data']['shipping_tax']);
             }
         } else {
             if ($order['shipping_method_costs'] !== 0) {
                 $shipping_costs = $prefix . $order['shipping_method_costs'];
             }
         }
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_NORMAL_PRICE'] = mslib_fe::amount2Cents($shipping_costs, $customer_currency, $display_currency_symbol, 0);
         $markerArray['ITEM_SHIPPING_PAYMENT_COSTS_FINAL_PRICE'] = mslib_fe::amount2Cents($shipping_costs, $customer_currency, $display_currency_symbol, 0);
         $shipping_payment_costs_line .= $this->cObj->substituteMarkerArray($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'], $markerArray, '###|###');
         $product_counter++;
         $subpartArray['###SINGLE_SHIPPING_PACKING_COSTS_WRAPPER###'] = $shipping_payment_costs_line;
     }
     // bottom row
     // taxes row renderer
     $vat_wrapper_keys = array();
     $vat_wrapper_keys[] = 'TOTAL_VAT_ROW_INCLUDE_VAT';
     $vat_wrapper_keys[] = 'TOTAL_VAT_ROW_EXCLUDE_VAT_NO_SHIPPING_PAYMENT_TAX';
     $vat_wrapper_keys[] = 'TOTAL_VAT_ROW_EXCLUDE_VAT_HAVE_SHIPPING_PAYMENT_TAX';
     foreach ($vat_wrapper_keys as $vat_wrapper_key) {
         if (!empty($subparts[$vat_wrapper_key])) {
             $vatItem = '';
             if (isset($order['orders_tax_data']['tax_separation']) && count($order['orders_tax_data']['tax_separation']) && !$order['discount']) {
                 foreach ($order['orders_tax_data']['tax_separation'] as $tax_sep_rate => $tax_sep_data) {
                     $markerArray = array();
                     if (isset($tax_sep_rate)) {
                         // If TAX seperation has only 1 entry always print it (0% TAX for example)
                         // Else only print the current TAX rate if it is higher than zero
                         if (count($order['orders_tax_data']['tax_separation']) == 1 || count($order['orders_tax_data']['tax_separation']) > 1 && $tax_sep_rate > 0) {
                             if (empty($tax_sep_data['shipping_tax'])) {
                                 $tax_sep_data['shipping_tax'] = 0;
                             }
                             if (empty($tax_sep_data['payment_tax'])) {
                                 $tax_sep_data['payment_tax'] = 0;
                             }
                             if ($table_type == 'invoice' && $real_prefix == '-') {
                                 if (strpos($tax_sep_data['products_total_tax'], '-') !== false) {
                                     $prefix = '';
                                     $tax_sep_data['products_total_tax'] = str_replace('-', '', $tax_sep_data['products_total_tax']);
                                     $tax_sep_data['shipping_tax'] = str_replace('-', '', $tax_sep_data['shipping_tax']);
                                     $tax_sep_data['payment_tax'] = str_replace('-', '', $tax_sep_data['payment_tax']);
                                 } else {
                                     $prefix = '-';
                                 }
                             }
                             $tax_sep_total = $prefix . ($tax_sep_data['products_total_tax'] + $tax_sep_data['shipping_tax'] + $tax_sep_data['payment_tax']);
                             if (count($order['orders_tax_data']['tax_separation']) == 1 || $tax_sep_total > 0) {
                                 // only print TAX rate if there is only 1 seperation OR if there are multiple seperations where each seperation amount is higher than 0
                                 if ($vat_wrapper_key == 'TOTAL_VAT_ROW_INCLUDE_VAT') {
                                     $markerArray['LABEL_INCLUDED_VAT_AMOUNT'] = $this->pi_getLL('included_vat_amount') . ' ' . $tax_sep_rate . '%';
                                 } else {
                                     // todo: add typoscript constant to enable/disable the view
                                     // Show the taken amount for the seperated VAT (i.e. BTW 21% from 10 Euro)
                                     //$markerArray['LABEL_VAT']=sprintf($this->pi_getLL('vat_nn_from_subtotal_nn'), $tax_sep_rate.'%', ($display_currency_symbol ? '' : 'EUR ').mslib_fe::amount2Cents($prefix.($tax_sep_data['products_sub_total_excluding_vat']+$tax_sep_data['shipping_costs']+$tax_sep_data['payment_costs']), $customer_currency, $display_currency_symbol, 0));
                                     // Show traditional label (i.e. BTW 21%)
                                     $markerArray['LABEL_VAT'] = $this->pi_getLL('vat') . ' ' . $tax_sep_rate . '%';
                                 }
                                 $markerArray['TOTAL_VAT'] = mslib_fe::amount2Cents($tax_sep_total, $customer_currency, $display_currency_symbol, 0);
                                 $vatItem .= $this->cObj->substituteMarkerArray($subparts[$vat_wrapper_key], $markerArray, '###|###');
                             }
                         }
                     }
                 }
             } else {
                 $markerArray = array();
                 if ($vat_wrapper_key == 'TOTAL_VAT_ROW_INCLUDE_VAT') {
                     $markerArray['LABEL_INCLUDED_VAT_AMOUNT'] = $this->pi_getLL('included_vat_amount');
                 } else {
                     $markerArray['LABEL_VAT'] = $this->pi_getLL('vat');
                 }
                 if ($table_type == 'invoice' && $real_prefix == '-') {
                     if (strpos($order['orders_tax_data']['total_orders_tax'], '-') !== false) {
                         $prefix = '';
                         $order['orders_tax_data']['total_orders_tax'] = str_replace('-', '', $order['orders_tax_data']['total_orders_tax']);
                     } else {
                         $prefix = '-';
                     }
                 }
                 $markerArray['TOTAL_VAT'] = mslib_fe::amount2Cents($prefix . $order['orders_tax_data']['total_orders_tax'], $customer_currency, $display_currency_symbol, 0);
                 $vatItem .= $this->cObj->substituteMarkerArray($subparts[$vat_wrapper_key], $markerArray, '###|###');
             }
             $subpartArray['###' . $vat_wrapper_key . '###'] = $vatItem;
             break;
         }
     }
     $hr_colspan = 3;
     $colspan = 5;
     if ($displayDiscountColumn) {
         $hr_colspan = 4;
         $colspan = 6;
     }
     $subpartArray['###INVOICE_HR_COLSPAN###'] = $hr_colspan;
     $subpartArray['###INVOICE_TOTAL_COLSPAN###'] = $colspan;
     $subpartArray['###LABEL_SUBTOTAL###'] = $this->pi_getLL('sub_total');
     //$subpartArray['###LABEL_VAT###']=$this->pi_getLL('vat');
     $subpartArray['###LABEL_SHIPPING_COSTS###'] = $this->pi_getLL('shipping_costs');
     $subpartArray['###LABEL_PAYMENT_COSTS###'] = $this->pi_getLL('payment_costs');
     $subpartArray['###LABEL_PAYMENT_COSTS###'] = $this->pi_getLL('payment_costs');
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         if (!empty($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'])) {
             $subpartArray['###SUBTOTAL###'] = mslib_fe::amount2Cents($prefix . ($order['orders_tax_data']['sub_total'] + $shipping_costs + $payment_costs), $customer_currency, $display_currency_symbol, 0);
             $subpartArray['###SUBTOTAL_EXTRA###'] = mslib_fe::amount2Cents($prefix . ($order['orders_tax_data']['sub_total'] + $shipping_costs + $payment_costs), $customer_currency, $display_currency_symbol, 0);
         } else {
             $subpartArray['###SUBTOTAL###'] = mslib_fe::amount2Cents($prefix . $order['orders_tax_data']['sub_total'], $customer_currency, $display_currency_symbol, 0);
             $subpartArray['###SUBTOTAL_EXTRA###'] = mslib_fe::amount2Cents($prefix . $order['orders_tax_data']['sub_total'], $customer_currency, $display_currency_symbol, 0);
         }
         //$subpartArray['###TOTAL_VAT###']=mslib_fe::amount2Cents($prefix.($order['orders_tax_data']['total_orders_tax']), 0,$display_currency_symbol,0);
         $subpartArray['###TOTAL_SHIPPING_COSTS###'] = mslib_fe::amount2Cents($prefix . ($order['shipping_method_costs'] + $order['orders_tax_data']['shipping_tax']), $customer_currency, $display_currency_symbol, 0);
         $subpartArray['###TOTAL_PAYMENT_COSTS###'] = mslib_fe::amount2Cents($prefix . ($order['payment_method_costs'] + $order['orders_tax_data']['payment_tax']), $customer_currency, $display_currency_symbol, 0);
     } else {
         if (!empty($subparts['SINGLE_SHIPPING_PACKING_COSTS_WRAPPER'])) {
             $subpartArray['###SUBTOTAL###'] = mslib_fe::amount2Cents($prefix . ($order['subtotal_amount'] + $shipping_costs + $payment_costs), $customer_currency, $display_currency_symbol, 0);
             $subpartArray['###SUBTOTAL_EXTRA###'] = mslib_fe::amount2Cents($prefix . ($order['subtotal_amount'] + $shipping_costs + $payment_costs), $customer_currency, $display_currency_symbol, 0);
         } else {
             $subpartArray['###SUBTOTAL###'] = mslib_fe::amount2Cents($prefix . $order['subtotal_amount'], $customer_currency, $display_currency_symbol, 0);
             $subpartArray['###SUBTOTAL_EXTRA###'] = mslib_fe::amount2Cents($prefix . $order['subtotal_amount'], $customer_currency, $display_currency_symbol, 0);
         }
         //$subpartArray['###TOTAL_VAT###']=mslib_fe::amount2Cents($prefix.($order['orders_tax_data']['total_orders_tax']), 0,$display_currency_symbol,0);
         $subpartArray['###TOTAL_SHIPPING_COSTS###'] = mslib_fe::amount2Cents($prefix . $order['shipping_method_costs'], $customer_currency, $display_currency_symbol, 0);
         $subpartArray['###TOTAL_PAYMENT_COSTS###'] = mslib_fe::amount2Cents($prefix . $order['payment_method_costs'], $customer_currency, $display_currency_symbol, 0);
     }
     if ($order['discount'] < 0 || $order['discount'] > 0) {
         $subpartArray['###LABEL_DISCOUNT###'] = $this->pi_getLL('discount');
         $subpartArray['###TOTAL_DISCOUNT###'] = mslib_fe::amount2Cents($prefix . $order['discount'], $customer_currency, $display_currency_symbol, 0);
         //
         $subpartArray['###PRODUCTS_NEWSUB_TOTAL_PRICE_LABEL###'] = $this->pi_getLL('subtotal');
         $subpartArray['###PRODUCTS_NEWTOTAL_PRICE###'] = mslib_fe::amount2Cents($order['subtotal_amount'] - $order['discount'], $customer_currency, $display_currency_symbol, 0);
     }
     //$subpartArray['###LABEL_INCLUDED_VAT_AMOUNT###']=$this->pi_getLL('included_vat_amount');
     $subpartArray['###LABEL_GRAND_TOTAL_EXCLUDING_VAT###'] = $this->pi_getLL('grand_total_excluding_vat') . ' ';
     $subpartArray['###GRAND_TOTAL_EXCLUDING_VAT###'] = mslib_fe::amount2Cents($prefix . $order['orders_tax_data']['grand_total_excluding_vat'], $customer_currency, $display_currency_symbol, 0);
     $subpartArray['###LABEL_GRAND_TOTAL###'] = $this->pi_getLL('total');
     $subpartArray['###GRAND_TOTAL###'] = mslib_fe::amount2Cents($prefix . $order['orders_tax_data']['grand_total'], $customer_currency, $display_currency_symbol, 0);
     $tmpcontent = $this->cObj->substituteMarkerArrayCached($subparts['template'], null, $subpartArray);
     return $tmpcontent;
 }
						  <th class="cellModel">' . $this->pi_getLL('products_model') . '</th>
						  <th class="cellName">' . $this->pi_getLL('products_name') . '</th>
						  </tr></thead>';
        }
        $total_tax = 0;
        foreach ($order['products'] as $product) {
            if (!$tr_type or $tr_type == 'even') {
                $tr_type = 'odd';
            } else {
                $tr_type = 'even';
            }
            $tmpcontent .= '<tr class="' . $tr_type . '">';
            $tmpcontent .= '<td class="cellQty">' . number_format($product['qty']) . '</td>';
            $tmpcontent .= '<td class="cellID">' . $product['products_id'] . '</td>';
            $tmpcontent .= '<td class="cellModel">' . $product['products_model'] . '</td>';
            $product_tmp = mslib_fe::getProduct($product['products_id']);
            if ($this->ms['MODULES']['DISPLAY_PRODUCT_IMAGE_IN_ADMIN_PACKING_SLIP'] and $product_tmp['products_image']) {
                $tmpcontent .= '<td class="cellName"><strong>';
                $tmpcontent .= '<img src="' . mslib_befe::getImagePath($product_tmp['products_image'], 'products', '50') . '"> ';
                $tmpcontent .= $product['products_name'];
            } else {
                $tmpcontent .= '<td class="cellName"><strong>' . $product['products_name'];
            }
            if ($product['products_article_number']) {
                $tmpcontent .= ' (' . $product['products_article_number'] . ')';
            }
            $tmpcontent .= '</strong>';
            if ($this->ms['MODULES']['DISPLAY_EAN_IN_ORDER_DETAILS'] == '1' && !empty($product['ean_code'])) {
                $tmpcontent .= '<br/>' . $this->pi_getLL('admin_label_ean') . ': ' . $product['ean_code'];
            }
            if ($this->ms['MODULES']['DISPLAY_SKU_IN_ORDER_DETAILS'] == '1' && !empty($product['sku_code'])) {
     $local_primary_product_categories = 0;
 }
 if ($_REQUEST['action'] == 'edit_product' && is_numeric($this->get['pid'])) {
     $str = "SELECT p.*, c.categories_id, pd.file_location, pd.file_label, p.custom_settings from tx_multishop_products p, tx_multishop_products_description pd, tx_multishop_products_to_categories p2c, tx_multishop_categories c, tx_multishop_categories_description cd where p2c.products_id='" . $this->get['pid'] . "' ";
     if (is_numeric($this->get['cid'])) {
         $str .= " and p2c.categories_id=" . $this->get['cid'] . " and is_deepest=1";
     }
     if ($this->ms['MODULES']['ENABLE_LAYERED_PRODUCTS_DESCRIPTION']) {
         $str .= " and p2c.page_uid=" . $this->showCatalogFromPage;
     }
     $str .= " and p.products_id=pd.products_id and p.products_id=p2c.products_id and p2c.categories_id=c.categories_id and p2c.categories_id=cd.categories_id";
     $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
     $product = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
     // redirect to proper edit product path if any
     if (!$product['products_id'] && is_numeric($this->get['cid'])) {
         $redirect_product = mslib_fe::getProduct($this->get['pid'], '', '', 1);
         if ($redirect_product['products_id'] && $redirect_product['categories_id']) {
             header("Location: " . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $this->get['pid'] . '&cid=' . $redirect_product['categories_id'] . '&action=edit_product', 1));
             exit;
         }
     }
     //
     $local_primary_product_categories = $product['categories_id'];
     if ($this->ms['MODULES']['ENABLE_LAYERED_PRODUCTS_DESCRIPTION']) {
         //$str="SELECT * from tx_multishop_products p, tx_multishop_products_description pd where p.products_id='".$this->get['pid']."' and pd.page_uid='".$this->shop_pid."' and (pd.layered_categories_id='".$local_primary_product_categories."' or pd.layered_categories_id='0') and p.products_id=pd.products_id";
         $str = "SELECT * from tx_multishop_products p, tx_multishop_products_description pd where p.products_id='" . $this->get['pid'] . "' and pd.page_uid='" . $this->shop_pid . "' and p.products_id=pd.products_id";
     } else {
         $str = "SELECT * from tx_multishop_products p, tx_multishop_products_description pd where p.products_id='" . $this->get['pid'] . "' and p.products_id=pd.products_id";
     }
     $qry = $GLOBALS['TYPO3_DB']->sql_query($str);
     while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) {
 $pageset = mslib_fe::getProductsPageSet($filter, $offset, 99999, $orderby, $having, $select, $where, 0, array(), array(), 'products_feeds', '', 0, 1, array(), $includeDisabled);
 $products = $pageset['products'];
 if ($pageset['total_rows'] > 0) {
     foreach ($pageset['products'] as $row) {
         $fetchExtraDataFromProducts = 1;
         //hook to let other plugins further manipulate the settings
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/download_product_feed.php']['productFeedIteratorPreProc'])) {
             $params = array('fields' => &$fields, 'row' => &$row, 'fetchExtraDataFromProducts' => &$fetchExtraDataFromProducts);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/download_product_feed.php']['productFeedIteratorPreProc'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         if (!$fetchExtraDataFromProducts) {
             $records[] = $row;
         } else {
             $product = mslib_fe::getProduct($row['products_id'], '', '', $includeDisabled);
             //hook to let other plugins further manipulate the settings
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/download_product_feed.php']['productFeedIteratorProductLoadedPostProc'])) {
                 $params = array('fields' => &$fields, 'row' => &$row, 'fetchExtraDataFromProducts' => &$fetchExtraDataFromProducts, 'product' => &$product);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/download_product_feed.php']['productFeedIteratorProductLoadedPostProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             if ($this->ms['MODULES']['ENABLE_DEFAULT_CRUMPATH']) {
                 $product_path = mslib_befe::getRecord($row['products_id'], 'tx_multishop_products_to_categories', 'products_id', array('is_deepest=1 and default_path=1'));
                 if (is_array($product_path) && count($product_path)) {
                     $product['categories_id'] = $product_path['node_id'];
                     $product['products_to_categories_id'] = $product_path['products_to_categories_id'];
                 }
             }
             if ($product['products_id']) {