Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"options_values_price" special price


Junny

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
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 2 years later...

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

Link to comment
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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...