} if ($product_info['products_technical'] == '') { $product_info['products_technical'] = $language_fallback['products_technical']; } } /*language fallback*/ $manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $product_info['manufacturers_id'] . "'"); $manufacturer = tep_db_fetch_array($manufacturer_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int) $_GET['products_id'] . "' and language_id = '" . (int) $languages_id . "'"); $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $_GET['products_id'] . "'"); $categories = tep_db_fetch_array($categories_query); $current_category = $categories['categories_id']; //DISCOUNT if (USE_PRICES_TO_QTY == 'false' && PRICE_BOOK == 'true') { //added here so this can be used add the whole page $discount_price = tep_get_discountprice($product_info['products_price'], $customer_id, $customer_group, $product_info['products_id'], $cPath, $product_info['manufacturers_id']); if (PRICE_BOOK_STAR_PRODUCT_INFO == 'true') { if (($discount_price['lowest']['discount'] > 0 || strstr($discount_price['lowest']['discount'], '%')) && (tep_get_products_special_price($product_info['products_id']) > $discount_price['lowest']['price'] || !tep_get_products_special_price($product_info['products_id']))) { $discount = $discount_price['lowest']['discount']; } else { $discount = false; } } else { $discount = false; } } //END DISCOUNT /*breadcrumbs*/ if (IS_PRINT_FRIENDLY != '1') { ?>
function get_products() { global $languages_id, $_SERVER, $customer_id; if (!is_array($this->contents)) { return false; } $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { if (USE_PRICES_TO_QTY == 'true') { $products_query = tep_db_query("select p.products_id, pp.products_plant_id, pp.plant_price, pp.plant_maat, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_discount, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p JOIN " . TABLE_PRODUCTS_PLANT . " pp USING (products_model), " . TABLE_PRODUCTS_DESCRIPTION . " pd where pp.products_plant_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'"); if (tep_db_num_rows($products_query) < 1) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'"); } } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'"); } if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; if (USE_PRICES_TO_QTY == 'true') { //Calculate products price if (SOAP_STATUS == 'true') { if ($this->contents[$products_id]['price']) { $products_price = $this->contents[$products_id]['price']; } else { $products_price = showPriceTable($prid, $customer_id, $products['plant_maat'], $this->contents[$products_id]['qty'], $table = false); $this->contents[$products_id]['price'] = $products_price; } } else { $products_price = calculatePrice($products['plant_price'], $this->contents[$products_id]['qty']); if (isset($products['products_discount']) && strlen($products['products_discount']) > 2) { if ($tranche = explode(',', $products['products_discount'])) { foreach ($tranche as $cle => $trn) { if ($qty_px = explode(':', $trn)) { if ($this->contents[$products_id]['qty'] >= $qty_px[0]) { $products_price = $qty_px[1]; } } } } } } } else { if (SOAP_STATUS == 'true' && SOAP_PRICE == 'true') { if ($this->contents[$products_id]['price']) { $products_price = $this->contents[$products_id]['price']; } else { $products_price = showCustomerPrice($prid, $customer_id, $this->contents[$products_id]['qty']); $this->contents[$products_id]['price'] = $products_price; } } else { //DISCOUNT $discount_price = tep_get_discountprice($products['products_price'], $customer_id, $customer_group, $products['products_id'], $cPath, $products['manufacturers_id']); if ($discount_price['lowest']['discount'] > 0 || $discount_price['lowest']['price'] > 0 && PRICE_BOOK == 'true') { if ($new_price = tep_get_products_special_price($products['products_id'])) { if ($new_price < $discount_price['lowest']['price']) { $products_price = $new_price; } else { $products_price = $discount_price['lowest']['price']; } } else { $products_price = $discount_price['lowest']['price']; } } else { if ($new_price = tep_get_products_special_price($products['products_id'])) { $products_price = $new_price; } else { $products_price = $products['products_price']; } } if (PRICE_BOOK == 'true') { foreach ($discount_price['others'] as $prices) { if ($prices['min_amount'] <= $this->contents[$products_id]['qty'] && $prices['price'] < $products_price) { $products_price = $prices['price']; } } } //END DISCOUNT } } if (USE_PRICES_TO_QTY == 'true') { //Lets get all sized $products_sizes_query = tep_db_query("SELECT plant_description, plant_mc FROM " . TABLE_PRODUCTS_PLANT . " WHERE products_plant_id = '" . $products['products_plant_id'] . "'"); $products_size = tep_db_fetch_array($products_sizes_query); $qty_array = getPricesToQty($products_size['plant_price']); if ($products['plant_maat'] != '') { $maat = Translate('Maat') . ': ' . $products['plant_maat']; if ($products_size['plant_mc'] == 'hoogte') { $eenheid = ' cm.'; } elseif ($products_size['plant_mc'] == 'stamomtrek') { $eenheid = ' stamomtrek'; } elseif ($products_size['plant_mc'] == 'diameter') { $eenheid = ' diameter'; } else { $eenheid = ''; } } else { $maat = ''; $eenheid = ''; } if ($products_size['plant_description'] != '') { $descr = $products_size['plant_description']; } else { $descr = ''; } $products_array[] = array('id' => $prid, 'size_id' => $products['products_plant_id'], 'original_name' => $products['products_name'], 'name' => $products['products_name'], 'description' => '<span style="font-weight: normal;">' . $descr . '</span>', 'maat' => '<span style="font-weight: normal;">' . $maat . $eenheid . '</span>', 'size' => $products['plant_maat'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''); } else { $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''); } } } return $products_array; }