Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkboxes to add ProductInfo text


TaFfin

Recommended Posts

And I thought it would be easy to find...

 

I'd like to put several checkboxes on the admin/productspage wich should relect a value of text on the ProductInfo page.

 

I've seen (and tried) several contributions, but they al just miss my point.

 

The alternative attribute handling contribution comes close...

 

But in all cases you see the product option with its value, but i'm not interested in the value. I'd just want to see the option (text).

 

For instance:

I'm selling a car which has powersteering. In the admin console I'd like to check the (predefined) option powersteering so a customers sees the word 'powersteering' on the ProductInfo page. No prices, no values, no pulldownmenu, just the text powersteering.

And if a car doesn't have powersteering, I just uncheck the checkbox so the word powersteering does not show on the ProductInfo page.

 

Has anybody got an idea?

 

-------

Thanx

TaFfin

SIGnificant.....right?

Link to comment
Share on other sites

I wrote this code to make it so that if I only have one option for an attribute, it will display as text instead of a dropdown menu. However (and I don't think this will affect you), if you wanted to have a price added on for this option, it doesn't work, it just gets thrown away.

 

Replace the block of code that is similiar to this in product_info.php. I'm sorry that I don't know the exact code that needs replaced. I did this awhile back and have no idea exactly what it was originally. I do know that it starts with "// display atrributes" though, so you can search for that.

 

if ($products_attributes == '1') {

     

        $products_options_name = 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='" . $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

        echo '<table border="0" cellpading="0" cellspacing"0">';

        while ($products_options_name_values = tep_db_fetch_array($products_options_name)) { 

       $options_count = 0;

          $selected = 0;

          $products_options_array = array();

          echo '<tr><td class="main">' . $products_options_name_values['products_options_name'] . ':</td><td class="main">' . "n"; 

          $products_options = 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 = '" . $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

          while ($products_options_values = tep_db_fetch_array($products_options)) {

      $options_count++;	

            $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name']);

            if ($products_options_values['options_values_price'] != '0') {

              $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') ';

            }

          }

  	 if ($options_count > 1) {

           echo tep_draw_pull_down_menu('id[' . $products_options_name_values['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name_values['products_options_id']]);

          } else {

     echo $products_options_array[0]['text'];

  	 }

  	 

  	 

  	 echo '</td></tr>';

        }

        echo '</table>';

      }

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...