Jump to content
Sign in to follow this  
Junny

"options_values_price" special price

Recommended Posts

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 by Junny

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!!!

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×