Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I display the available quantities of a product?


JoeWoodworker

Recommended Posts

Posted

Is there a way to display the available quantity of product to the viewer?

I know that if they enter more than I have available, it will show the *** and tell them there isnt enough. But if they select 130 of a given product and I have only 10 left, they will have to keep updating their cart with a different quantity until the *** goes away.

 

Any suggestions?

Evil will always triumph over good...

Because good is dumb.

- D.H.

Posted

Edit the /includes/modules/order_details.php file to test the qty and show the quantity on hand when less that what they want.

Posted

Edit /catalog/includes/modules/order_details.php

 

Change the lines:

$psize = sizeof($products);

for ($i=0; $i<$psize; $i++) {

 echo '  <tr>' . "n";

// Delete box only for shopping cart

 

To read:

$psize = sizeof($products);

for ($i=0; $i<$psize; $i++) {



// BOF: WebMakers.com Added: Low Stock Warning

// Low Stock warning

if (tep_get_products_stock($products[$i]['id']) < $products[$i]['quantity']) {

 $lowstock=true;

} else {

 $lowstock=false;

}

 $colspan=(4 + ( (PRODUCT_LIST_MODEL && strstr($PHP_SELF, FILENAME_SHOPPING_CART)) ) ? 1 : 0));



if ($lowstock) {

 echo ' <tr class="Caution">' . "n";

 echo '   <td colspan="' . $colspan . '" align="left" class="Caution">' . 'Low Stock: ' . tep_get_products_stock($products[$i]['id']) . '</td>' . "n";

 echo ' </tr>' . "n";

}

// EOF: WebMakers.com Added: Low Stock Warning



 echo '  <tr>' . "n";

// Delete box only for shopping cart

 

Add to the stylesheet.css file:

/* Caution Messages */

TR.Caution {

 background: #EBCB14;

}



TD.Caution {

 font-family: Verdana, Arial, sans-serif;

 font-size: 10px;

 background: #FFFF00;

 color: #000000;

 font-weight: bold;

 line-height: 1.5;

 padding-right: 5px;

 padding-left: 5px

}

Posted

Error correction ...

$colspan=(4 + ( (PRODUCT_LIST_MODEL && strstr($PHP_SELF, FILENAME_SHOPPING_CART)) ) ? 1 : 0));

 

Should read ...

$colspan=(4 + ( (PRODUCT_LIST_MODEL && strstr($PHP_SELF, FILENAME_SHOPPING_CART)) ) ? 1 : 0);

 

I got a little wild on the parens there ... :roll:

  • 11 months later...
Posted

Linda,

 

I'm just new at this whole shopping cart experience and I wanted to know a couple things. Firstly, I don't have the order_details.php file - where can I get that? And how do I make the shopping cart interact with that new .php file?

  • 2 years later...
Posted

<_<

 

The suggested coding above looks really good, but just like what was asked above, which *.php is to be modified. So far, the only folder which makes sense is the order_total folder, but searching through those finds no files which even has 'cart' in it..not to mention the rest. Any insight would be appreciated.

 

Thanks!

Claire

Posted

So, doing some further thought...figured out that the checkout_process.php was the most logical location for an edit like this..and lo and behold it's there. Since I'm not a programmer, I'll play around with Linda's suggestions and give a whirl at modification. Any success, I'll be sure to share.

  • 1 year later...
Posted

will this work if I have QTPro contribution, which allows me to have stock quantities managed by attribute, eg 4 red small, 3 green medium etc etc.

 

What I need is if the customer orders 10 red small nappies and we only have 4, when they get to check out and see that we do not have enough stock, that they see we do have 4 red small nappies, as opposed to we have 20 nappies.

Archived

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

×
×
  • Create New...