Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with Drop Down Please


tonyv

Recommended Posts

Hi, I am a noobee to oscommerce, and pretty green to editing php, but learning. If someone has the answer to this, if you could please walk me through, what php file to edit, etc..... thank you.

 

the options I am setting up refer to more than one model. they are all the same picture so I am grouping them together to prevent confusion.... in the product atributes I am building drop downs for each page lay out... I start with a base price and then adjust the price for each model either with - or + Prefix to reflect the price of each model. in the drop down that the customer will see however, it will show the -$ or +$ Prefix and amount to adjust the price so that it will be correct in the shopping cart... is there any way to hide this - or + $ Prefix and amount from the drop down all together so the customer will not see it? it looks quite confusing. for an example of the drop down please go to This Page

 

you should see something like ;

GSR-160-400 1-5 Rolls (+$53.68)

in the drop down.........

 

I desperately need to get rid of (+$53.68)

 

Anyones help would be highly apreciated.

 

Thanks ahead of time.

Link to comment
Share on other sites

Hi Tony

 

Yep osCommerce does have a couple of quirks, your problem being one of them. Why show the extra price involved -allowing the customer to take out a calc and have to add up the difference. ?????

 

Anyway it's only a bit of fun

 

Find the following code in catalog/product_info.php

<?php
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
       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'])) .') ';
         }
       }

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>

 

The part your looking for is this

          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'])) .') ';
         }

 

This sets the price of the product options.

Now change the above code to this

    if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' .  $currencies->display_price($products_options['options_values_price']+$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }

 

This should make you product options make a bit more sense.

 

Regards

PhilipH

Link to comment
Share on other sites

Hi Tony

 

Yep osCommerce does have a couple of quirks, your problem being one of them. Why show the extra price involved -allowing the customer to take out a calc and have to add up the difference. ?????

 

Anyway it's only a bit of fun

 

Find the following code in catalog/product_info.php

<?php
? ? ?$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
? ? ?while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
? ? ? ?$products_options_array = array();
? ? ? ?$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
? ? ? ?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'])) .') ';
? ? ? ? ?}
? ? ? ?}

? ? ? ?if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
? ? ? ? ?$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
? ? ? ?} else {
? ? ? ? ?$selected_attribute = false;
? ? ? ?}
?>

 

The part your looking for is this

 ? ? ? ? ?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'])) .') ';
? ? ? ? ?}

 

This sets the price of the product options.

Now change the above code to this

 ? ?if ($products_options['options_values_price'] != '0') {
? ? ? ? ? ?$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . ?$currencies->display_price($products_options['options_values_price']+$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
? ? ? ? ?}

 

This should make you product options make a bit more sense.

 

Regards

PhilipH

 

 

 

 

 

Awsome.................... that took the + and - out and even changed the figures to make more sense.... Thank you very much.......

Any chance you have a simular code that will whipe out the price in the drop down all together and yet still calculate for the shopping cart?

Thanks again

Link to comment
Share on other sites

No problems in doing that - why? Do you not want to let your customers know the price of options ??

 

Strange request !!!

 

If you really want to remove the prices remove the line I just gave you .... mmmmmm very starange request .........

 

PhilipH

Link to comment
Share on other sites

No problems in doing that  - why? Do you not want to let your customers know the price of options ??

 

Strange request !!!

 

If you really want to remove the prices remove the line I just gave you .... mmmmmm very starange request .........

 

PhilipH

 

 

 

sorry I should have explained further. I have a table above the drop down with prices for each model# so I thought I could put just the model #'s in the drop down and the customer could pick that way,,, See this example

 

 

are you saying that if I delete all the code you sent me, that will solve the problem...??

 

it will then just list the code# and not the price as well?

Thanks for your prompt response thus far....

Link to comment
Share on other sites

Hi Tony,

 

OK that makes sense....

    if ($products_options['options_values_price'] != '0') {
          $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' .  $currencies->display_price($products_options['options_values_price']+$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
        }

 

By removing my piece of code incl the original that you over wrote, you will omit the price. Looking at the above code it is telling you that if products options price is not zero then append ( .= ) the text of products_options_array with the price.

By removing this line it will not add in the price.

 

PhilipH

Link to comment
Share on other sites

Hi Tony,

 

OK that makes sense....

 ? ?if ($products_options['options_values_price'] != '0') {
? ? ? ? ? $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . ?$currencies->display_price($products_options['options_values_price']+$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
? ? ? ? }

 

By removing my piece of code incl the original that you over wrote, you will omit the price. Looking at the above code it is telling you that if products options price is not zero then append (  .=  )  the text of products_options_array with the price.

By removing this line it will not add in the price.

 

PhilipH

 

 

arggggg!

Im too green to figure this out lol..... I tried a couple different variations and I am not sure what exactly to leave out.......... Can you please bear with me, and show me exactly how the code should look? I have it back the old way, and I am unsure what to get rid of exactly....

Thanks

Link to comment
Share on other sites

Greeen but willing :D

 

 

The original .........

<?php
    $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
    while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
      $products_options_array = array();
      $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
      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'])) .') ';
        }
      }

      if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
        $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
      } else {
        $selected_attribute = false;
      }
?>

 

The new ............

 

<?php
    $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
    while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
      $products_options_array = array();
      $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
      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 (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
        $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
      } else {
        $selected_attribute = false;
      }
?>

 

 

Regards

PhilipH

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...