Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Limit checkout based on quantity available?


spectral

Recommended Posts

Posted

I added an extra field to product_attributes called "quantity"

 

Currently, I use this contribution:http://addons.oscommerce.com/info/4155

to limit the number of items purchased to what's in the products_quantity field from the products table. It works perfectly, but now I want to limit quantities based on whats in the "quantity" table.

 

I can't seem to figure this out. I've added the database call in shopping_cart.php as so:

          $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.quantity
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                      and pa.options_id = '" . (int)$option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . (int)$value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . (int)$languages_id . "'
                                      and poval.language_id = '" . (int)$languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

         $products[$i][$option]['quantity'] = $attributes_values['quantity'];

Archived

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

×
×
  • Create New...