Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

one blinkin' word missing

Options
  • 22-12-2006 3:33pm
    #1
    Closed Accounts Posts: 460 ✭✭


    Hiya beautiful people,

    I have one simple issue that's knocking my site off kilter and I hope someone can help.

    I've integrated with WorldPay, who have asked me to post the following lines of code into the site:

    <form action="https://select.worldpay.com/wcc/purchase&quot; method=POST>
    <input type=hidden name="instId" value="As quoted in your Integration Pack">
    <input type=hidden name="cartId" value=" Your own reference for this purchase ">
    <input type=hidden name="amount" value="25.35">
    <input type=hidden name="currency" value="Eur">
    <input type=hidden name="desc" value="Socks, Black cotton">
    <input type=hidden name="testMode" value="0">
    <input type=submit value="Buy This">
    </form>

    The difficulty is with <input type=hidden name="amount" value=" ">.
    I want the value to be the total amount that the customer has to pay (described on my site as Order Total). I've tried "amount" value="ordertotal" and all variations that I can think of, but it's not being accepted.
    I'm sure I'm just missing out on one character or something.
    Any ideas?


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    Lurk wrote:
    I've integrated with WorldPay, who have asked me to post the following lines of code into the site:

    <form action="https://select.worldpay.com/wcc/purchase&quot; method=POST>
    <input type=hidden name="instId" value="As quoted in your Integration Pack">
    <input type=hidden name="cartId" value=" Your own reference for this purchase ">
    <input type=hidden name="amount" value="25.35">
    <input type=hidden name="currency" value="Eur">
    <input type=hidden name="desc" value="Socks, Black cotton">
    <input type=hidden name="testMode" value="0">
    <input type=submit value="Buy This">
    </form>

    The difficulty is with <input type=hidden name="amount" value=" ">.
    I want the value to be the total amount that the customer has to pay (described on my site as Order Total). I've tried "amount" value="ordertotal" and all variations that I can think of, but it's not being accepted.
    I'm sure I'm just missing out on one character or something.
    Any ideas?

    Well how is that variable stored throughout your site?

    If it was php I would expect something like

    <input type=hidden name="amount" value="<? echo $ordertotal; ?>">.


  • Registered Users Posts: 4,075 ✭✭✭muckwarrior


    Lurk wrote:
    (described on my site as Order Total).?
    Nobody can help you unless you tell us exactly what Order Total is supposed to be. Is it a form input, server side variable? What technology are you using?


  • Closed Accounts Posts: 460 ✭✭Lurk


    Oh God, thanks for the tips guys; I forgot to mention I'm not a programmer, so don't laugh if I say something funny (not out loud, anyway).

    It's a LiteCommerce 2.2 site (php).
    I've tried <input type=hidden name="amount" value="<? echo $ordertotal; ?>">, with no joy, but that seems to be the kind of thing I'm looking for (the value being whatever figure shows up next to 'Order total' on the checkout page.

    Here's some code from a sample checkout page in which I've ordered two items:
    </td></tr></table></span></td>
    <td class="ProductPriceSmall" align="right">€7.50</td>
    <td class="ProductPriceSmall" align="right">€7.50</td>
    </tr><tr valign=top>
    <td><input type=text size=3 name="amount[1]" value="1"></td>
    <td>170558</td>
    <td id="close1" style="cursor: hand;" onClick="visibleBox('1')"><b><a href="cart.php?target=product&product_id=16259">Black Socks</a></b></td>
    <td id="open1" style="display: none; cursor: hand;" onClick="visibleBox('1')"><b><span ><a href="cart.php?target=product&product_id=16259">Red Socks</a></span></b></td>
    <td class="ProductPriceSmall" align="right">€5.50</td>
    <td class="ProductPriceSmall" align="right">€5.50</td>
    </tr></table>
    <hr>
    <table align="right" border=0>
    <tr><td><b>Subtotal:</b></td><td align="right">€13.00</td></tr>
    <tr><td><b>Shipping:</b></td>
    <td align="right">
    <span >n/a</span> </td>
    </tr>
    <tr><td><b>Order total:</b></td><td align="right"><font class="ProductPriceSmall">€13.00</font></td></tr>
    </table>

    It's the number in bold that I want to submit to WorldPay. It seems to be such a simple thing, but I've no idea.


  • Closed Accounts Posts: 16,793 ✭✭✭✭Hagar


    Lurk wrote:
    <tr><td><b>Order total:</b></td><td align="right"><font class="ProductPriceSmall">€13.00</font></td></tr>

    PHP is foreign to me but if you are trying to submit "€13.00" as a number won't it fail as "€" is a non-numeric character?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Hagar wrote:
    [/I]
    PHP is foreign to me but if you are trying to submit "€13.00" as a number won't it fail as "€" is a non-numeric character?
    Indeed it would, but I the form control in question isn't contained in that snippet that he posted. Lurk, can you attach the entire source of the example page?

    Thanks


  • Advertisement
  • Closed Accounts Posts: 460 ✭✭Lurk


    I can indeed, Seamus (um..I don't actually sell socks, hope you don't mind...)







    I removed the attachments in case there's any wee whippersnappers out there


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    That seems to be just HTML. Can you post up the PHP script?


  • Closed Accounts Posts: 460 ✭✭Lurk


    Would that be this?


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Nope that's not it either. That's more HTML :(
    I worked with one of these template things last year and yours might be similar. The payment logic was contained in cart.php which is mentioned on line 3 of the last file you attached. The trouble was (for me at least) that cart.php was thousands of lines long. If yours is huge, we only need to see the part that relates to the WorldPay payment. Hopefully it's commented so you can extract it without too much hassle.


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    I took a look at the project I referred to in my last post just there. It had WorldPay logic in it also. The variable used was called "grandtotal". See if a variable define with that name is anywhere in your script.


  • Advertisement
  • Closed Accounts Posts: 460 ✭✭Lurk


    Darn, thanks a million for checking anyway. Yeah, it's a template thing. I'll have a good poke through it to see if anything jumps out at me. Actually, would this be any use (in bold at the end):
    <table align="right" border=0>
    <widget module="WholesaleTrading" template="modules/WholesaleTrading/totals.tpl">
    <tr><td><b>Subtotal:</b></td><td align="right">{price_format(cart,#subtotal#):h}</td></tr>
    <tr><td><b>Shipping:</b></td>
    <td align="right">
    <span IF="!cart.shippingAvailable">n/a</span>
    <span IF="cart.shippingAvailable">{price_format(cart,#shipping_cost#):h}</span>
    </td>
    </tr>
    <tr FOREACH="cart.getDisplayTaxes(),tax_name,tax">
    <td><b>{cart.getTaxLabel(tax_name)}:</b></td>
    <td align="right">
    {price_format(tax):h}
    </td>
    </tr>
    <widget module="GiftCertificates" template="modules/GiftCertificates/totals.tpl">
    <tr><td><b>Order total:</b></td><td align="right"><font class="ProductPriceSmall">{price_format(cart,#total#):h}</font></td></tr>
    </table>


    (I've seen grandtotal somewhere....will have a look...)


  • Registered Users Posts: 689 ✭✭✭JoeB-


    he he he... definitely NOT selling socks!


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    I know nothing about .tpl files unfortunately. A quick Google tells me they might be something to do with PHP template. I'm probably not being much help here as a result :(

    Do you get values when you display the other entries in #'s such as shipping_cost and subtotal? If so then total might be what you are looking for. Otherwise I still reckon the answer is in cart.php. Also is there a file called "modules/WholesaleTrading/totals.tpl" available to look at? That might also shed some light for you.


  • Closed Accounts Posts: 460 ✭✭Lurk


    he he he... definitely NOT selling socks!
    ;) well, there's a few 'socks' there alright
    malice_ wrote:
    I know nothing about .tpl files unfortunately. A quick Google tells me they might be something to do with PHP template. I'm probably not being much help here as a result :(
    Nah, you've been a real help...even just to know it's not such a simple issue after all, so I won't be embarrassed ringing up WorldPay about it (again - and they weren't very specific about what to do the first time I phoned).
    Do you get values when you display the other entries in #'s such as shipping_cost and subtotal? If so then total might be what you are looking for. Otherwise I still reckon the answer is in cart.php. Also is there a file called "modules/WholesaleTrading/totals.tpl" available to look at? That might also shed some light for you.

    I do get the proper values when there are shipping figures/subtotals on the checkout page. Everything seems to be grand except for the amount total. There is a wholesaletrading module, and I'll have a look at it (I'm almost certain its turned off for my site).

    The gas thing is, I've been doing hours-worth of Googling for 'LiteCommerce' + 'WorldPay' + 'integration problem' and nothing relevant is coming up. Have e-mailed LiteCommerce for ideas, so will expect an answer from them...eh...after Christmas sometime!


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    ok the issue is that you have the code needed to add in the order total - {price_format(cart,#total#):h}

    the main problem is, you need to be able to access that on a per user basis

    so basically on your form page you will need to add the following

    <input type=hidden name="amount" value="{price_format(cart,#total#):h}">.

    This is only based on the presumption that you are adding the worldpay form to a .tpl or some other php based page in your shopping area.


  • Closed Accounts Posts: 460 ✭✭Lurk


    Thanks Ph3nOm, I've just tried that but no joy unfortunately (also substituted terms like (cart,#order_total#), (shoppingcart,#total#): etc...but no luck). It definitely must be something like "{price_format(cart,#total#):h}">...a simple phrase to indicate that whatever total appears is to be used. I'll just have to keep plugging away until I hit on the terms recognised by the software.
    Oh for the days when computers can talk to us to tell us what's wrong with them :o


Advertisement