[ic] Pricing based on cart group?

Mike Heins mike at perusion.com
Wed Jun 23 12:43:54 EDT 2004


Quoting Eric Small (interchange at ericsmall.com):
> Eric Small wrote:
> >I'm trying to implement different pricing for a product depending upon 
> >whether the item is in an item group or not.  I know I would need to 
> >check the value of mv_mi for the item, but after that I'm unclear on how 
> >to handle it.
> >
> 
> I'm trying to use CommonAdjust do this and it seems very close to 
> working, but I get an error.
> 
> --begin after.cfg snippet--
> Profile dealer <<EOR
> {
> 	CommonAdjust => <<EOF,
> 
> 		pricing:w5,w10:,
> 		;:wholesale,
> 		;:wholesale:mv_sku,
> 		;&"if ($Vend::Interpolate::item->{mv_mi}){return 
> 		':sale_price';} else{return ':price';}",
> 		;:price,
> 		;$,
> 		==:options,
> 		-20%
> EOF
> 	NonTaxableField => 'nontaxable',
> 	PriceField => 'common_adjust',
> }
> EOR
> --end after.cfg snippet--
> There is no line return in the ;&"if ($Vend::Inter... line
> 
> The error I get in the error.log file is this
> apistore /cgi-bin/apistore/process Safe: syntax error at (eval 385) line 
> 1, near "()"
> >
> > if (){return ':sale_price';} else{return ':price';}
> >
> 
> If I change the line to this
>     &"if (1){return ':sale_price';} else{return ':price';}",
> then it works like a champ.

Why are you are using mv_mi? That is used in the Interchange grouped
items. It would be better to use some other attribute.

In any case, just make a UserTag in catalog.cfg and use $item.

UserTag check-sale Routine <<EOR
sub {
	return $item->{mv_mi} ? ':sale_price' : ':price';
}
EOR

Then use [check-sale] in your CommonAdjust.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Friends don't let friends use Outlook. -- Bob Blaylock


More information about the interchange-users mailing list