Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

problem with includes/modules/order_details.php


hipifreq

Recommended Posts

I'm trying to alter the handling of product quantity for a client. She sells quilt fabric, and wants to have quantities in increments of .25 (i.e. 1.00, 1.25, 1.50, 1.75) Easy enough for me to round to the nearest quarter in javascript, but ran into a little snag in includes/modules/order_details.php:

// Quantity box or information as an input box or text
   if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {
     echo '    <td align="center" valign="top">' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . '</td>' . "\n";
   } else {
     echo '    <td align="center" valign="top" class ="main">' . $products[$i]['quantity'] . '</td>' . "\n";
   }

This produces the following HTML output:

<input type="text" name="quantity[]" value="2" size="4"><input type="hidden" name="products_id[]" value="1">

 

Which is all well and good until you try to script through order quantities, validating each one along the way. in javascript "document.cart_quantity.cart_quantity[].value" is invalid, even though cart_quantity[] is the real name of the object.

 

The brackets at the end of this and other form elements should be removed from any future releases of osCommerce. Of course, if there's a REALLY good reason to keep them I'd love to know, as I'm getting rid of them on this install right now...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...