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

API to determine product price for various options

Started by graemian, December 20, 2007, 02:53:47 pm

Previous topic - Next topic

graemian

Hello,

Is there an API call to determine the price of a product for various option values? I need to display a modified product listing with prices for all the different option values for a given option.

Thanks,
Graeme

ryan

Hi,

For a product with an array of options, can't you just add the option value to the product price ?

graemian

Yup, I suppose I could. Bit of a dumb question :-)

But how would I handle the tax? I'll dig around to find an API for that - I think I saw a call that prints an incl tax amount from an excl.

Thanks,
G

graemian

Is there an API (other than the admin API) to get the product attributes?

The only thing I can see is to use the "setSelectedProduct" call and to loop through all the products, but that's a bit messy.

Thanks,
G

ryan

Hi,

The way to get the attributes of a product is to get the product and then loop through them. The Client API (the one used by the struts actions) has a method called fetchSelectedProduct() (look at ShowProductDetailsAction) which in turn calls the Server API getProduct() . The getProduct() call returns a fully populated product which includes attributes. The fetchSelectedProduct()  call does the same thing but then stores the product in the session and sets other things in the session such as the selected manufacturer and the current category  so thet the UI can display this data.