[ic] how to access the price for options in cart

Tim Good tim.g at edsd.com
Wed Apr 13 12:43:05 EDT 2005

Thanks for the response. Do you know how the checkout
adds to item-subtotal if a particular option is selected?
For instance, if you select yes "installed" which adds $.20 
to the extended price. Where is this code located. Maybe I 
could inject code snippet to tally installed items there?

Tim Good

> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On
> Of Daniel Davenport
> Sent: Wednesday, April 13, 2005 9:20 AM
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] how to access the price for options in
> >>> tim.g at edsd.com 04/13/05 12:45 AM >>>
> > I need to loop through all items in a cart and return
> > wither or not "installed" (simple option) is selected.
> > If it is, total the extra charge for installed items. I
> > would like to display this total in an extra field
> > called "install_chrg." Question: how do I access
> > the options (price) for items in the cart? What is
> > the best way to loop through cart / items and
> > total the charge for installed options?
> >
> > Tim Good
> The cart doesn't keep track of the prices of options.  All
> does is track the item and the options selected, and 
> somewhere along the line attaches a total and a shipping 
> method. It would be possible to figure out the amount
> 1) get the price string for the option you're looking for
> price of.  
> rice/ml=1)
> (or $odb->field("$item_code-installed", "price") if you
> my favorite naming scheme for option codes)
> 2) convert the string to a hash. 
> (Vend::Util::get_option_hash() works great for this, if 
> you're in a global UserTag--and why wouldn't you be?  This
> something that would be helpful to everybody.)
> 3) look up the key corresponding to the current value of
> option.  the resulting value is the price for the option.

> (Or a percentage of the price of the item, which is easy 
> enough to turn into a  usable number.)
> Note that this can be horribly inefficient if you have 
> hundreds of items in the cart.  :)  Each item in the cart
> trigger a db lookup.  But the is currently the only place 
> where you can reliably look for the option's price.  I
> see that fact changing, unless someone wants to edit the 
> item/option lookup stuff to cache the info it grabs.
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org 

More information about the interchange-users mailing list