示例#1
0

                                                </div>

                                                <?php 
        }
    }
    /*price table*/
    if (USE_PRICES_TO_QTY == 'true' && CanShop() == 'true') {
        if (SOAP_STATUS == 'true' && tep_session_is_registered('customer_id')) {
            ?>

                                                        <div class="box pricetable">

                                                        <?php 
            echo showPriceTable($product_info['products_id'], $customer_id, '', 1);
            ?>

                                                        </div>

                                                <?php 
        } else {
            $products_sizes_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_PLANT . " WHERE products_model = '" . tep_db_input($product_info['products_model']) . "' ORDER BY plant_sort ASC");
            $qty_array = getPricesToQty($products_size['plant_price']);
            $products_titles_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_PLANT . " WHERE products_model = '" . tep_db_input($product_info['products_model']) . "' ORDER BY plant_price ASC");
            $products_titles = tep_db_fetch_array($products_titles_query);
            $titles_array = getPricesToQty($products_titles['plant_price']);
            ?>

                                                        <div class="box">
 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;
 }