Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Questions


nbercasio

Recommended Posts

We are going to sell one quantity per item so does anyone know when a buyer purchase this item, the quantity sets to zero, so no other buyer can purchase this item?

 

Thank you for your help.....

 

 

Good morning

 

I'm sorry, most of my stores are downloadable products so I never noticed a issue with the stock. I read your message this morning and did a bit of research and found and fixed your problem.

 

In your checkout_process.php file find the following block of code:

Code:

 

$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

FROM " . TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_ATTRIBUTES . " pa,

" . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'

and p.products_id=pa.products_id

and pad.products_attributes_id=pa.products_attributes_id ";

 

 

and replace it with:

Code:

 

$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

FROM " . TABLE_PRODUCTS . " p

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

ON p.products_id=pa.products_id

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

ON pa.products_attributes_id=pad.products_attributes_id

WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

 

 

That's all, stock will now update properly

 

Kevin

Link to comment
Share on other sites

This code limits one item per customer? Because I need the cart to limit one item per customer without running out of stock. The store I'm creating will be selling certificates limited to one of each type of certificate per customer.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...