Junny Posted November 1, 2007 Posted November 1, 2007 (edited) I'm looking for a contribution that works about "options_values_price". But I can't find that. When I have a special price products and that has a different price with options. On default oscommerce does not discount "options_values_price". for example ..(pull down menu - "size/Color" is attribute) size/color : 80/green 100/green 150/green (+50yen) when special price (if 30%off) size/color : 80/green 100/green 150/green (+50yen +15yen) I think product_option code is below (../product_info.php) if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; How do I get the discount rate? or does sombody have a good idea? Thanks for checking this topic. junny Edited November 1, 2007 by Junny Quote
Junny Posted November 11, 2007 Author Posted November 11, 2007 I'm just fixed the problem. I hope this customize help somebody. To get the discount rate is ($new_price/$product_info['products_price']) very simple and change in product_info.php while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); echo '</td></tr>'; } echo '</table>'; } to while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price']*($new_price/$product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } else { if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } } echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); echo '</td></tr>'; } echo '</table>'; } thats all Quote
FedericoG Posted August 27, 2010 Posted August 27, 2010 Hi, I would like to know if there is a way to make this edit even in the shopping_cart class. If we edit only product_info.php page we will see the price only in this page, but in the shopping cart the price added will be the one without discount rate. Could someone help me please??? Thanks and best regards!!! Quote
FedericoG Posted August 30, 2010 Posted August 30, 2010 Hi, I tried to solve this issue by myself. I have replaced the function "attributes_price" in classes/shopping_cart.php with this: function attributes_price($products_id) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); 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 = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $attributes_price = $attribute_price['options_values_price']; if ($attribute_price['price_prefix'] == '+') { $products_query = tep_db_query("select p.products_id, p.products_price, s.specials_new_products_price, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS ." s where s.status = 1 and p.products_id = '" . (int)$products_id . "' and s.products_id = p.products_id"); $products = tep_db_fetch_array($products_query); $special_price = $products['specials_new_products_price']; $products_price = $products['products_price']; if ($special_price > 0) { $num = (($special_price*100)/$products_price); $attributes_price = (($attribute_price['options_values_price'])*($num/100)); } else { $attributes_price = $attribute_price['options_values_price']; } } else { $attributes_price = 0-$attribute_price['options_values_price']; } } } return $attributes_price; } But this works for certain products and not for others (and I really don't know why). Could someone help me please? Thank you! 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.