Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with tep_draw_checkbox_field()


LiquidPony

Recommended Posts

Posted

Alright, so, here's my question-- I'm customizing my new products form (/catalog/admin/categories.php), and I've added a new field for wholesale/discount pricing. There is a text box that contains the numerical value for the wholesale price, and a check box that is used to determine whether or not to apply a standard percentage discount to the price to find the wholesale price. In other words, if you check the box, the wholesale price is automatically calculated and entered into the field, if you don't check the box, then you can enter your own custom wholesale price for the product.

 

<tr bgcolor="#ebebff">
         <td class="main">Use Default Contractor Discount?:</td>
         <td class="main"><?php echo tep_draw_separator('pixel_trans.gif','24', '15') . ' ' . tep_draw_checkbox_field('products_wsprice_choice', 1, false,  'onMouseUp="updateCPrice()"'); ?></td>
</tr>
<tr bgcolor="#ebebff">
          <td class="main"><?php echo TEXT_PRODUCTS_PRICE_WS; ?></td>
          <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_wsprice', $pInfo->products_wsprice); ?></td>
</tr>

 

So, what I've got here is a checkbox that should execute the updateCPrice() function with the onMouseUp() event handler. The code for tep_draw_checkbox_field() is as follows (from /catalog/includes/functions/html_output.php):

  function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
   return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
 }

 

So the tep_draw_checkbox_field(name,value,checked,parameters) function takes four parameters--name, value, checked, and parameters. My call to this function sends four parameters, but for some reason the fourth parameter (named 'parameters') is never correctly output as HTML from the php echo command. By that I mean that when I upload the categories.php file and test the form, the source code after PHP has processed it is as follows (view source from browser window):

          <tr bgcolor="#ebebff">
        	 <td class="main">Use Default Contractor Discount:</td>
        	 <td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <input type="checkbox" name="products_wsprice_choice" value="1"></td>
         </tr>
         <tr bgcolor="#ebebff">
           <td class="main">Contractor Price:</td>
           <td class="main"><img src="images/pixel_trans.gif" border="0" alt="" width="24" height="15"> <input type="text" name="products_wsprice"></td>
         </tr>

         <tr>

So, we can see that the last parameter I passed to tep_draw_checkbox_field (being onMouseUp="updateCPrice()") has dissapeared into the ether ;). Anyway, I'd like to avoid having to hardcode the HTML for this checkbox into the file, because it's all going to be dynamically loaded in the future. Am I doing something wrong here, or is there a problem with the checkbox function? Any help would be greatly appreciated. Thanks in advance!

Archived

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

×
×
  • Create New...