[ic] How to give each cart item its own flat rate shipping cost? AutoModifier, mv_sku/code problems

Mike Heins mike at perusion.com
Sun Oct 23 10:23:56 EDT 2005

Quoting John1 (list_subscriber at yahoo.co.uk):
> I am trying to give each item its own flat rate shipping cost by
> putting the shipping cost in a field in the products table.
> However, I am having problems getting it to work for both items with
> matrix options and items without matrix options.
> Specifically, the problem centres around the fact that for standard
> items without any matrix options, $item->{code} is the correct key to
> the row in the "products" table from where I wish to look up the
> delivery cost. $item->{mv_sku} does not exist.
> However, for matrix options it is $item->{mv_sku} that contains the sku
> of the parent product code and hence the key to the row in the products
> table from where I wish to look up the delivery cost.
> Here is what I have:
> catalog.cfg:
> AutoModifier shipping_cost
> shipping.asc:
> STD Standard shipping_cost 1 9999 f @@TOTAL@@
> (i.e. by setting the criteria to the shipping cost field, I can use
> @@TOTAL@@ to give me the total shipping cost - at least I could if it
> weren't for the problems I am having...)
> variable.txt:
> MV_SHIP_MODIFIERS shipping_cost
> In the "products" table, the field "shipping_cost" contains the shipping
> cost for that item.
> However, this only works for standard products (i.e. products without
> matrix options).
> I believe if I change AutoModifier to:
> AutoModifier products:shipping_cost:mv_sku
> it would then work for matrix option products but not standard products.
> How do I set it up so that the delivery cost is always looked up from
> the field shipping_cost in the products table, regardless of whether
> the cart item is a product with matrix options or a standard product.
> I have read the the archives, searched the web, and tried to read the
> code in order.pm and ship.pm to work this one out, but to no avail  
> Any help would be greatly appreciated.

Hmm. I believe you are correct. Actually, I would want

	AutoModifier  shipping_cost

to work, as we should use item_common to populate it. But alas, it
does not.

That is now fixed in CVS. It only works for the no-table case of
the attribute (i.e. shipping_cost or other_mod=shipping_cost).

It also might not be completely what would always be wanted, since
it has the precedence:


It is important in this case to make sure you have the table set
in the item mv_ib pointer, as otherwise products->mv_sku will shadow

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

Some people have twenty years of experience, some people have
one year of experience twenty times over. -- Anonymous

More information about the interchange-users mailing list