Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cart with read only on product qty


Guest

Recommended Posts

In my cart, some of my product quantities are calculated before being placed in the cart. I don't want my users to be able to arbitrairily change the quantity values on those items reqiring the calculation.

In shopping_cart.php I have:

    $unit_measure = tep_db_query("select unit_measure
                                   from " . TABLE_PRODUCTS . "
                                   where products_id = '" . $products[$i]['id'] . "'");
   $unit_measure_values = tep_db_fetch_array($unit_measure);

if(isset($unit_measure_values['unit_measure'])) {
     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" 
                                            valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]', 
                                            $products[$i]['quantity'], 'readonly size="4"') . 
       tep_draw_hidden_field('products_id[]', $products[$i]['id']));
} else {
  $info_box_contents[$cur_row][] = array('align' => 'center', 
                                            'params' => 'class="productListing-data"                            
                                            valign="top"',
                                            'text' => tep_draw_input_field('cart_quantity[]',
                                             $products[$i]['quantity'], 'size="4"') .      
       tep_draw_hidden_field('products_id[]', $products[$i]['id']));
}

Right now all products added are read only, even if they don't have unit_measure set. Any suggestions on how to change this so that those products with unit_measure set will be read only, else normal.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...