abhibh Posted April 9, 2005 Posted April 9, 2005 Hi, I m trying to install the "TEPcontrib" which can be found here http://www.oscommerce.com/community/contri...arch,TEPcontrib I have understood everything but im unable to know what does the following mean in the "TEPcontrib". It says: (PLZ see at end too what i want to know..) Check in the following files & make the changes as defined by bof and eof. **** step 1 : In \catalog\shopping_cart.php in catalog catalog directory if ($attributes_exist == '1') { reset($cart->contents[$products[$i]['id']]['attributes']); //----------------bof $x_ctr = 0; //----------------eof while (list($option, $value) = each($cart->contents[$products[$i]['id']]['attributes'])) { $attributes = tep_db_query("select pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_values_id = '" . $value . "'"); $attributes_values = tep_db_fetch_array($attributes); if ($attributes_values['options_values_price'] != '0') { //--------------------------------------------------bof if ($attributes_values['price_prefix'] != 'x') { $attributes_values['options_values_price'] = $products[$i]['quantity'] * $attributes_values['options_values_price']; echo "\n" . '<br><small><i>' . $attributes_values['price_prefix'] . $currencies->display_price($attributes_values['options_values_price'],tep_get_tax_rate($products[$i]['tax_class_id'])) . '</i></small>'; } else { $temp = $attributes_values['options_values_price']; $x_ctr = $x_ctr + 1; if ($x_ctr <= 1) { $attributes_values['options_values_price'] = $products[$i]['price'] * ($attributes_values['options_values_price']); $total_price = $attributes_values['options_values_price']; echo "\n" . '<br><small><i>' . '(cost ' . $attributes_values['price_prefix'] . ' ' . $temp . ') = ' . '</i></small>' . $currencies->display_price($attributes_values['options_values_price'],tep_get_tax_rate($products[$i]['tax_class_id'])); } else { $attributes_values['options_values_price'] = $total_price * ($attributes_values['options_values_price']); $total_price = $attributes_values['options_values_price']; echo "\n" . '<br><small><i>' . '(cost ' . $attributes_values['price_prefix'] . ' ' . $temp . ') = ' . '</i></small>' . $currencies->display_price($attributes_values['options_values_price'],tep_get_tax_rate($products[$i]['tax_class_id'])); } } //-------------------------------eof } else { // Keep price aligned with corresponding option $attributes_values['options_values_price'] = $products[$i]['price']; echo "\n" . '<br><small><i> </i></small>'; } } } //------display customer choosen option eof----- echo '</td>' . "\n"; echo ' </tr>' . "\n"; } ******step 2 : changes in /catalog/classes/shopping_cart.php function calculate() { $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "'"); if ($product = tep_db_fetch_array($product_query)) { // ICW ORDER TOTAL CREDIT CLASS Start Amendment $no_count=1; $gv_query=tep_db_query("select products_model from ".TABLE_PRODUCTS." where products_id='".$products_id."'"); $gv_result=tep_db_fetch_array($gv_query); if (ereg('^GIFT', $gv_result['products_model'])) { $no_count=0; } // ICW ORDER TOTAL CREDIT CLASS End Amendment $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; //---------------------------------------------------------------------------------bof $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'"); if (tep_db_num_rows ($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } // $this->total += $products_price * $qty; $total_price = $products_price; //$this->total += tep_add_tax($products_price, $products_tax) * $qty; //---------------------------------------------------------------------------------eof $this->weight += ($qty * $products_weight); $this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty*$no_count;// CREDIT CLASS; $this->weight_virtual += ($qty * $products_weight)*$no_count;// CREDIT CLASS; } // attributes price if ($this->contents[$products_id]['attributes']) { reset($this->contents[$products_id]['attributes']); //----------------------------bof $x_ctr = 0; //----------------------------eof while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); //----------------------------------------------------------------bof if ($attribute_price['price_prefix'] == '+') { $this->total += $qty * $attribute_price['options_values_price']; } if ($attribute_price['price_prefix'] == '-') { $this->total -= $qty * $attribute_price['options_values_price']; } if ($attribute_price['price_prefix'] == 'x') { $x_ctr = $x_ctr + 1; if ($x_ctr <= 1) { $total_price = $products_price * ($attribute_price['options_values_price']); } else { $total_price = $total_price * ($attribute_price['options_values_price']); } } } // $total_price -= $products_price; } //} $this->total += $qty * tep_add_tax($total_price, $products_tax); //$this->total += $qty * $total_price; //-------------------------------------------------------------------eof } } function attributes_price($products_id) { if ($this->contents[$products_id]['attributes']) { reset($this->contents[$products_id]['attributes']); //----------bof $x_ctr = 0; eof $end_ctr = 0; $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1'"); //----------eof while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); //----------------------------------------------------------------------------bof $temp_price_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'"); $temp_price = tep_db_fetch_array($temp_price_query); $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1'"); if (tep_db_num_rows ($specials_query)) { $specials = tep_db_fetch_array($specials_query); $temp_price['products_price'] = $specials['specials_new_products_price']; //$attributes_price = $specials['specials_new_products_price']; } if ($attribute_price['price_prefix'] == '+') { $attributes_price += $attribute_price['options_values_price']; } if ($attribute_price['price_prefix'] == '-') { $attributes_price -= $attribute_price['options_values_price']; } if ($attribute_price['price_prefix'] == 'x') { $x_ctr = $x_ctr + 1; if ($x_ctr <= 1) { $attributes_price = $temp_price['products_price'] * ($attribute_price['options_values_price']); $total_price = $attributes_price; } else { $attributes_price = $total_price * ($attribute_price['options_values_price']); $total_price = $attributes_price; } } } if ($x_ctr >= 1) { $attributes_price -= $temp_price['products_price']; } } //----------------------------------------------------------------------------eof return $attributes_price; } **** and also change the product array around end of the file : $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], //---------------------------------------------bof //'final_price' => ($products_price + $this->attributes_price($products_id)), 'final_price' => ($this->attributes_price($products_id)), //---------------------------------------------eof 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $this->contents[$products_id]['attributes']); } ***** step 3 : change /catalog/checkout_confirmation.php if (sizeof($order->products[$i]['attributes']) > 0) { for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) { echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; if ($order->products[$i]['attributes'][$j]['price'] != '0') { //----------------------------------------------------------------------bof if ($order->products[$i]['attributes'][$j]['prefix'] != 'x') { echo ' (' . ($order->products[$i]['attributes'][$j]['prefix']) . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty']) . ')'; echo '</i></small></nobr>'; } else { echo ' (' . ($order->products[$i]['attributes'][$j]['prefix']) . ' ' . $order->products[$i]['attributes'][$j]['price'] . ' ' . 'times' . ')'; echo '</i></small></nobr>';} } //----------------------------------------------------------------------bof } } echo '</td>' . "\n" . ' <td class="main" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n"; echo ' <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n"; echo ' </tr>' . "\n"; } Now wat does that eof and bof means and wat i need to change in files. Plz help me any example will be good. Thank You. Quote
pisces69 Posted April 12, 2005 Posted April 12, 2005 bof = beginning of change eof = end of change Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.