• Welcome to KonaKart Community Forum. Please login or sign up.
 

Quantity at the Category Page

Started by chloeloves, November 10, 2009, 11:58:29 am

Previous topic - Next topic

chloeloves

Hello,

I am new to the Konakart community, and I have a simple question.

I'd like to display a message to my users on the ProductsBody page that will alert them of the stock level of a certain item.

I plan to maintain stock levels at the sku level (i.e blue shirt = 1, red shirt = 12).  I see there is a way to get at the stock item levels using the CartItem object, but I would like to display them before an item is added to the cart.

For example, if the user is on a category page and the aggregated stock level of a certain product is below a threshold, I would like to alert the user.  Something like "Act now! Only 2 left!".

What is the best way of accomplishing this?   I was browsing thru the Javadocs and I see the ProductQuantitiesIF class, but I am not sure of what is the most practical / efficient way of using this feature.

Any help would be greatly appreciated!

Thanks.

Roy

julie

Have you tried the getProductQuantity() API call ?

chloeloves

On which api? i dont see it?do you mean the prodmgr api?

Is there an example I can reference

Remember, i do not want product level quanties...but sku level

julie

KKEngIf:

getProductQuantity

ProductQuantityIf getProductQuantity(java.lang.String encodedProductId)
                                     throws com.konakart.app.KKException

The stock level of the product and the date available are returned within a ProductQuantity object. An exception is thrown if the product doesn't exist or if the encoded product id has an invalid format. The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5. If the product has no attributes then the encodedProductId should be just the productId in String format. If there are no option / value pairs then we use the stock level from the product object. If there is at least one option / value pair, we attempt to find the quantity in the product quantity table. If we can't find it in the product_quantity table we look for at least one record in the product_quantity table for this product id. If we find something then we assume that the quantity is zero. If we find no records, we use the quantity from the product object.
Parameters:
encodedProductId - The encoded product id which can reference a particular configuration of a product. i.e. A green shirt rather than a blue shirt.
Returns:
A ProductQuantity object containing the stock level of the product and the date available.
Throws:
com.konakart.app.KKException

chloeloves

Great!

Thanks for the help julie!

I actually figured it out...

I guess the confusion was that I was looking at the wrong API...