[ic] Using [item-list] on a callpage back??

Jonathan Clark jonc at webmaint.com
Sun Mar 20 18:59:54 EST 2005


> > > I have almost completed my implementation of Worldpay but I am
> > > stuck trying to
> > > use the [item-list] tag on the callback page.
> > >
> > > I send the item-code(s) to the worldpay server using:-
> > >
> > > [item-list]
> > > <input type=hidden name="MC_item-code[item-increment]"
> > > value="[item-code]">
> > > [/item-list]
> > >
> > > So if there are two items with codes os1234 and os5678 they get
> > > sent as variable
> > > MC_item-code1=os1234 and MC_item-code2=os5678.
> > >
> > > I can then display these two items on the callback page using:-
> > >
> > > Item1 = [cgi MC_item-code1]
> > > Item2 = [cgi MC_item-code2]
> > >
> > > What I want to do is use the [item-list] tag on the callback page
> > > though eg:-
> > >
> > > [item-list]
> > > [cgi MC_item-code[item-increment]]
> > > [/item-list]
> > >
> > > In theory this should display the two item codes, it works
> > > perfectly when the
> > > page is called from my server with the cgi variables in the
> > > browser line, but
> > > when called from Worldpay it returns no item codes. I therefore
> > > presume that
> > > [item-list] requires some other variable which I have not sent to
> > > Worldpay,
> > > maybe something to do with the cart, can anyone help me out
> here please??
> >
> > [item-list] is for looping the cart.
>
> Hi Jonathan,
>
> Yes I realised that is was for looping for the cart, I was trying
> to transfer
> the whole cart in a variable and then hoping to loop it, maybe it's not
> possible though?
>
>
> > in your callback page, you just need an incrementing number
> which goes up to
> > the number of lines in the cart, right?
>
> Yes, that would also work, I guess I would need a perl routine to
> determine the
> number of lines as it would not necessarily be the same as
> nitems, do you have
> such a routine? I am not good with Perl.
>

True, [nitems] won't give you the number of order lines. How about this:

[calc]
return scalar @{$Carts->{main}};
[/calc]

> > As has been said before, the WorldPay callback requests a page
> from IC in a
> > completely different session and so there are no items in _its_ cart.
>
> The session can be easily maintained by sending a variable with
> [data session
> id], I can use the callback page to write the transaction and
> userdb tables but
> I am struggling with the orderline table as I cannot use
> [item-list] on the
> callback page.

Just by sending the sessionid you are not maintaining the session. WorldPay
has a new session unless you configure Interchange to be insecure (which it
is not by default and I don't think you are doing). Knowing the sessionid is
not the same as sharing the session; if it was the same session then
[item-list] would work.

>
> > Why don't you pass the number of lines in the cart to WorldPay
> and then use
> > this with the [loop] tag on your callback page?
>
> That might work if I can determine the number of order lines and
> then how to use
> the loop tag.

Jonathan.


--
Jonathan Clark
Managing Director,
Webmaint.com   - Building Clever Websites        http://www.webmaint.com
Webmaint.net   - Business Web Hosting            http://www.webmaint.net
Cartridge SAVE - Printer Consumables Online
http://www.cartridgesave.co.uk
WireTel        - Internet Connectivity Solutions http://www.wiretel.net



More information about the interchange-users mailing list