[interchange-docs] xmldocs - racke modified glossary/price
docs at icdevgroup.org
docs at icdevgroup.org
Mon Dec 10 06:09:38 EST 2007
User: racke
Date: 2007-12-10 11:09:38 GMT
Modified: glossary price
Log:
added custom pricing section, this is what I use a lot and this
doesn't leave people totally confused by CommonAdjust configuration :-)
Revision Changes Path
1.5 +40 -0 xmldocs/glossary/price
rev 1.5, prev_rev 1.4
Index: price
===================================================================
RCS file: /var/cvs/xmldocs/glossary/price,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- price 3 Sep 2006 21:26:10 -0000 1.4
+++ price 10 Dec 2007 11:09:38 -0000 1.5
@@ -23,6 +23,46 @@
</para>
</section>
+<section id="CustomPricing">
+ <title>Custom Pricing</title>
+<para>
+Although the &conf-CommonAdjust; directive provides a lot of options to
+describe pricing schemes, it might not match yours or you are just feeling
+more comfortable in writing code instead of delving through the following
+section. In this case you can simply write your own usertag calculating the
+price with the following settings for &conf-CommonAdjust; and &conf-PriceField;:
+<programlisting>
+PriceField 0
+CommonAdjust [calc-price]
+</programlisting>
+</para>
+<para>
+The following example can be used to base your own usertag on. Product code and
+quantity for the price calculation can be found in
+<literal>$Vend::Interpolate::item</literal>.
+
+<programlisting><![CDATA[
+UserTag calc_price Routine <<EOR
+sub {
+ my ($code, $quantity, $set);
+
+ $code = $Vend::Interpolate::item->{code};
+ $quantity = $Vend::Interpolate::item->{quantity};
+
+ $Tag->perl({tables => 'vendors_pricing'});
+
+ $set = $Db{vendors_pricing}->query(q{select price from vendors_pricing where sku = '%s' order by price asc limit 1}, $code);
+
+ if (@$set) {
+ return $set->[0]->[0];
+ } else {
+ return 0;
+ }
+}
+EOR
+]]></programlisting>
+</para>
+</section>
<section id="CommonAdjustPricing">
<title>"CommonAdjust" Pricing</title>
More information about the docs
mailing list