[ic] $Tag->total_cost Giving Spurious Result?

interchange at tvcables.co.uk interchange at tvcables.co.uk
Mon Apr 18 18:03:13 EDT 2005


Quoting interchange at tvcables.co.uk:

> Quoting Mike Heins <mike at perusion.com>:
>
> > Quoting interchange at tvcables.co.uk (interchange at tvcables.co.uk):
> > > Quoting Stefan Hornburg <racke at linuxia.de>:
> > >
> > > > On Mon, 18 Apr 2005 02:36:02 -0600
> > > > interchange at tvcables.co.uk wrote:
> > > >
> > > > > Hi folks,
> > > > >
> > > > > Running IC 5.2.0 and the total_cost tag in perl is giving me spurious
> > > > results,
> > > > > it seems to be *sometimes* (50/50) not adding the shipping value.
> > > > [total-cost]
> > > > > always returns the correct total cost its just when using it in perl.
> > Here
> > > > is
> > > > > the snippet of code, can anyone suggest why this does not always give
> > the
> > > > > correct total cost.
> > > > >
> > > > > [perl]
> > > > > my $price = $Tag->total_cost({noformat => 1,});
> > > > > $Scratch->{new-total} = sprintf("%.2f", $price);
> > > > > [/perl]
> > > >
> > > > Maybe total_cost tries to access a database table and isn't allowed to
> do
> > so.
> > > >
> > > > Bye
> > > > 	Racke
> > > >
> > >
> > > Hi Racke,
> > >
> > > Maybe but would it sometimes work if that was the case, I find that for
> > some
> > > shipping methods it gives the correct amount for others it doesn't. It
> may
> > not
> > > be specifically linked to a shipping method but be something to do with
> the
> > > value of the shipping.
> >
> > Stefan was giving you a hint that you likely need to pass a table
> > name in [perl tables="sometable othertable"].
> >
> > It would work *some* of the time because you may have previously opened
> > the table in some pages. If you have not opened the table previously,
> > and total-cost uses a table  -- it is almost for sure to use products --
> > then it will fail.
> >
>
> Hi Mike et al,
>
> Well I tried [perl tables .....] and that doesn't fix it either, what is
> really
> stange is that for 3 of my 6 UK shipping methods it reports the cost
> correctly
> but for the other 3 it is different by the shipping amount, ie the shipping
> is
> not added to total_cost. [total-cost] reports correctly for all shipping
> modes
> though....
>
> Any more ideas?
>

After some experimentation I have discovered that it is shipping modes that use
"formula" that do not get the correct total_cost even though [total-cost]
reports ok. Is this a bug or something I am doing worng?

If I change one of the problem shipping mode tables to "number" rather than
formula then it works ok.

Thanks,
Andy.




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the interchange-users mailing list