[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


Dan,
Thanks for the response. Do you know how the checkout
process 
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
Behalf 
> 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
cart
> 
> 
> >>> 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
it 
> 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
yourself:
> 
> 1) get the price string for the option you're looking for
the 
> price of.  
>
(fi=options/sf=sku/se=[item-code]/sf=o_group/se=installed/rf
=p
> rice/ml=1)
> (or $odb->field("$item_code-installed", "price") if you
use 
> 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
is 
> something that would be helpful to everybody.)
> 
> 3) look up the key corresponding to the current value of
the 
> 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
can 
> trigger a db lookup.  But the is currently the only place 
> where you can reliably look for the option's price.  I
don't 
> 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 
>
http://www.icdevgroup.org/mailman/listinfo/interchange-users
> 




More information about the interchange-users mailing list