Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Lost in PHP !


Guest

Recommended Posts

Posted

Hello.. hope you can help cause I`m seriously lost.. and it seems so simple !?

 

My problem. I`ve installed a contrib with which I can show my attributes in a radio box instead of the usual select list. I think this is more userfriendly cause people can see all the options at once. But know I`ve got this problem with tax. In the Netherlands we like to show prices including tax, but when I use the radio boxes the price of my attribs are showing without tax.

 

This is the script which shows the attribs in a select box:

 

$selected_attribute = false;

          $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 . "' order by products_options_values_name");

          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;

          }

?>

                <tr>

                  <td bgcolor="#eeeeee" class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

                  <td bgcolor="#DBFDE2" class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];  ?></td>

                </tr>

                <?php

 

And this is the script showing attribs in radio buttons:

 

$tmp_html = '<table>';

            $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 = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by products_options_values_name");

            $checked = true;

            while ($products_options_array = tep_db_fetch_array($products_options_query)) {

              $tmp_html .= '<tr><td class="main">';

              $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);

              $checked = false;

              $tmp_html .= $products_options_array['products_options_values_name'] ;

              $tmp_html .=$products_options_name['products_options_comment'] ;

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

                $tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], $product_info_values['products_tax_class_id']) .') ';

              }

              $tmp_html .= '</tr></td>';

            }

            $tmp_html .= '</table>';

?>

                <tr bgcolor="#DBFDE2">

                  <td valign="top" bgcolor="#eeeeee" class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

                  <td class="main"><?php echo $tmp_html;  ?></td>

                </tr>

                <?php

            break;

          case PRODUCTS_OPTIONS_TYPE_CHECKBOX:

 

Can you please tell me why the prices shown with the radio buttons is without tax (while select box with)? I really hope so.. thx in advance !

 

Greetings, Meano

Posted

there is no

tep_get_tax_rate

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Posted

Hi 241.. thx for your response..

 

I put in the tax rate and still no tax in attributes price.. do you know what else it can be ?

 

$tmp_html = '<table>';

            $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 = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by products_options_values_name");

            $checked = true;

            while ($products_options_array = tep_db_fetch_array($products_options_query)) {

              $tmp_html .= '<tr><td class="main">';

              $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);

              $checked = false;

              $tmp_html .= $products_options_array['products_options_values_name'] ;

              $tmp_html .=$products_options_name['products_options_comment'] ;

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

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

                                                       

 

              }

              $tmp_html .= '</tr></td>';

            }

            $tmp_html .= '</table>';

 

greetings, menno

Posted

I am not sure as to why you chose to use

') ';

instead of

') ';

though it should not make any difference

 

You do not state if you are getting any errors with the code

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Posted

Hey there - I use to have this Exact Opposite problem! I was putting tax on all my prices and I didnt want to.. What it ended up being for me was I zone the tax rate then I put my store location in that particular zone. When I removed this it fixed the problem... I am guessing that you do not have your store set to be within your tax zone. Check the settings to verify this.

Posted
I am not sure as to why you chose to use
') ';

instead of

') ';

though it should not make any difference

 

You do not state if you are getting any errors with the code

this would still be wrong inthat it is an incomplete code as the   does not have its ; to complete the code so you would be one ; short

 

should it not be more

'); '

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Posted

thx you ALL.. I`ll try it out right now !!

 

let you know !

Posted

Thx Yesudo ! .. It worked like a charme.. :)

Posted
Thx Yesudo ! .. It worked like a charme.. :)

no probs.

Your online success is Paramount.

Archived

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

×
×
  • Create New...