Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show "0" value attributes


lsd_se

Recommended Posts

I am using the contrib which allows you to display your attributes in a table and displays the actual price rather then "+$5" etc.

A problem I am having is that I enter the price regularly in the product page, and then add attributes, some of these attributes increase the price, while some of them don't, so the attribtue value would be 0. But if the attrbute is 0 it won't show up.

 

how can I get it to show up even if the value is 0?

 

I think it has to do with this coding, but I'm not advanced enough to figure out how to change it.

 

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

Under this ADD ( before the } ):

if ($products_options['price_prefix'] == '+') {
          $price_with_attribute = ($product_info['products_price'] + $products_options['options_values_price']);
} else {
   $price_with_attribute = ($product_info['products_price'] - $products_options['options_values_price']);
   }
     ?>
           <tr>
             <td class="main" align="center">
        <?php echo $products_options['products_options_values_name'];
              echo tep_draw_hidden_field('a[]', $products_options['products_options_values_id']);
     	        echo tep_draw_hidden_field('b[]',$products_options_name['products_options_id']); ?>	      </td>
      <td class="main" align="center">
	<?php /* uncomment if you want to show the model number
	      echo $product_info['products_model']; */
	 ?>
      </td>
             <td class="main" align="center"><?php echo $currencies->display_price($price_with_attribute, tep_get_tax_rate($product_info['products_tax_class_id'])); ?></td>
             <td class="main" align="center"><?php echo tep_draw_input_field('quantity[]',$value = '0',"size=2");?></td>
     </tr>
    <?php    
     $x++;

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.
Note: Your post will require moderator approval before it will be visible.

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