MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Weights change by size, and multiple sizes



Well, I spoke a little bit too soon, I suppose...  :) 

One thing I had to change was the that the tallying of the weights
should also include:

$weight += $item_weight * $item->{quantity};

It wasn't dealing with multiple quantities as it was given below.

Like that game where you hit the head with the mallet when it pokes up,
another head has just popped up and I'm too feeble to knock it down.

We now have the total shipping weights being calculated correctly in the
basket.  However, when it comes to checking out, no shipping weights are
listed or used as a lookup.

This would obviously be the case because our total weight is determined
by a lookup and sum of each item with this User Tag in the shopping
cart. However, on Checkout, the [shipping] tag then knows nothing about
it (so no lookups are performed in the shipping.asc database) which
means the total cost knows nothing about it either (nor any taxes added
to the shipping).

Is there some way to communicate a User Tag's returned value (the total
shipping weight of all items) to the [shipping] tag?

I'm assuming that shipping weights for the items are not stored in a
referenceable format, but are instead re-looked-up when [shipping] is
called, so it seems unlikely.  Meaning, there's no way I can I alter
this User Tag below to define a variable with each item's weight to be
used by [shipping] down the road... ??

I have a feeling I'm missing something fundamental in my slowly growing
understand of how this is all tied together.

Any help someone could give would be pure bliss (but I promise not to
make a mess).

Thanks!
Mark

Mark Rushing wrote:
> 
> ******    message to minivend-users from Mark Rushing <rushing@orbislumen.net>     ******
> 
> Tested or not, Mike, this worked BEAUTIFULLY!!  Obscure enough to make
> me dig a bit to understand, but in doing so, it's opened up a lot for me
> where MiniVend's concerned...
> 
> Thank you so much...  :)
> 
> Mark
> 
> mikeh@minivend.com wrote:
> >
> > ******    message to minivend-users from mikeh@minivend.com     ******
> >
> > Quoting Mark Rushing (rushing@orbislumen.net):
> > > ******    message to minivend-users from Mark Rushing <rushing@orbislumen.net>     ******
> > >
> > > I'm very sorry to take up the bandwidth here -- I've gotten most of my
> > > initial questions answered by the search engine on the minivend site --
> > > thank you to whomever set that up.
> > >
> > > I have been unable to shed any light on my problem.  I know there are
> > > some cludge-y ways to accomplish this, but I was hoping for a more
> > > elegant (simple) solution than what I've been able to come up with --
> > > hopefully using the database structures and tags instead of code patches
> > > here and there.
> > >
> > > Scenerio:
> > >
> > > Items have multiple sizes.
> > > Each size is a different price. (hence, pricing.asc fields: code vs.
> > > size = price)
> > > Each size is a different weight.
> > >
> > > For computing shipping weights, which do you think?
> > >
> > > 1. A separate shipprice.asc database (code vs size = weight) -- if so,
> > > how could I make the basket look up the weight with multiple sizes
> > > possible?
> > >
> > > 2. Including extra fields in the pricing.asc database to designate
> > > weights for sizes -- if so, how would I make it know a particularly
> > > selected size was to be a corresponding weight, and similarly, how would
> > > I make the basket know about this weight?
> > >
> > > It seems to always come down to the basket...  :)
> > >
> >
> > As it must. You didn't give any data examples, but I can guess...
> >
> > UserTag compute_weight Order cart
> > UserTag compute_weight Routine <<EOR
> > sub {
> >         my ($name) = @_;
> >
> >         my $cart;
> >         if($name) {
> >                 $cart = $Vend::Session->{carts}{$name};
> >         }
> >         else {
> >                 $cart = $Vend::Items;
> >         }
> >         return 0 unless $cart;
> >
> >         my $weight;
> >         foreach my $item (@$cart) {
> >                 my $item_weight = 0;
> >                 if ($item->{size}) {
> >                         $item_weight = Vend::Interpolate::tag_data(
> >                                                                                                 'pricing',
> >                                                                                                 "$item->{size}_weight",
> >                                                                                                 $item->{code},
> >                                                                                                 );
> >                 }
> >                 $item_weight = Vend::Interpolate::tag_data(
> >                                                                                                 'products',
> >                                                                                                 'weight',
> >                                                                                                 $item->{code},
> >                                                                                                 )
> >                                                 if ! $item_weight;
> >                 $weight += $item_weight;
> >         }
> >         return $weight;
> > }
> > EOR
> >
> > Untested, but it should work (minivend.cfg).
> >
> > --
> > Mike Heins                          http://www.minivend.com/  ___
> >                                     Internet Robotics        |_ _|____
> >                                     131 Willow Lane, Floor 2  | ||  _ \
> > It's a little-known fact            Oxford, OH  45056         | || |_) |
> > that the Y1K problem caused         <mikeh@minivend.com>     |___|  _ <
> > the Dark Ages. -- unknown           513.523.7621 FAX 7501        |_| \_\
> > -
> > To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> > email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> -
> To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: