PDA

View Full Version : CheckoutThis and OpenUI Tokens


Brandon MUS
04-05-06, 06:08 PM
http://www.mivacentral.com/page/m/PROD/MMP/MMP-CHKOUT

We want to interrupt an order if the value is over $150. There's a field to fill out that allows OpenUI tokens, but I'm unsure how to set it up. I think the statement I want to use is something similar to
%IF(%VAR(BASKET_SUBTOTAL) GE 150)%

I couldn't find much for documentation on the module, and up until now we've been only interrupting based on the shipping method. Can someone point me in the right direction?

Brandon

PCINET - Andreas
04-05-06, 06:18 PM
Try this:
%IF(%basket_subtotal% GE 150)%
...
%IFEND%

Brandon MUS
04-05-06, 06:35 PM
Thanks for the reply. I tried that code and it didn't work. The way that checkout this works is a little different than one might expect, so I attached a screenshot of what I mean (http://extranet.miva.com/forums/attachment.php?attachmentid=9&stc=1&d=1144254684).

You are only given a spot to put one token. There isn't a direct place to put an if/else type statement. It only asks for a single token to return. Do I need to design a function that returns maybe? Like I said, there isn't much documentation for this, so I'm guessing really. Maybe I should just contact the company that designed the module?

Thanks

Brandon

Bruce - PhosphorMedia
04-05-06, 06:37 PM
Contacting the developer first is always the best plan.

PCINET - Andreas
04-05-06, 06:42 PM
Bruce is right :)

BTW try to put %OUI% in the first place. Last try before contacting the developer.

Vic - WolfPaw Computers
04-05-06, 06:45 PM
Thanks for the reply. I tried that code and it didn't work. The way that checkout this works is a little different than one might expect, so I attached a screenshot of what I mean (http://extranet.miva.com/forums/attachment.php?attachmentid=9&stc=1&d=1144254684).

You are only given a spot to put one token. There isn't a direct place to put an if/else type statement. It only asks for a single token to return. Do I need to design a function that returns maybe? Like I said, there isn't much documentation for this, so I'm guessing really. Maybe I should just contact the company that designed the module?

Thanks

Brandon

Question here is, what token? Their own? Or an OpenToken?

If the module is not OpenToken compatible, this wont work. You would also have to pass %OUI% if it does support OpenTokens, however I would be very surprised to see a payment module supporting OpenTokens.

I would suspect it would only support the modules own tokens, and you would need to refer to their documentation to know what the appropriate syntax would be.

Brandon MUS
04-05-06, 06:59 PM
Thanks Vic. The module does claim to support OpenUI (both on Miva Central and on the screen you edit the messages (see the screenshot I attached above)). And unfortunatley I can't seem to find any of their own documentation. I've emailed the module's owner, hopefully I'll get a response shortly.

EDIT:
and %OUI%
%IF(%basket_subtotal% GE 100)% didn't work :(

Vic - WolfPaw Computers
04-05-06, 07:03 PM
There is a big difference in running under OpenUI or MMUI and supporting OpenTokens.

Not all modules written to run under the OUI, support the use of OpenTokens.

Brandon MUS
04-05-06, 07:42 PM
Ok, I found documentation!
http://themagicm.com/modhelp/chkoutthis/

it says:
Triggering messages with OpenUI tokens
You can probably think of other conditions under which you'd like to display a special message. What if a customer orders more than $5000 worth of merchandise? What if a customer has a billing address in Nigeria? If your store has a recent version of OpenUI installed, you can use OpenUI tokens to cause messages to be displayed under just about any kind of specfialized conditions. Checkout This will process the tokens, and the message will be displayed if the tokens return any text. If the tokens return no text at all, the message will not be displayed.

For example, if you want to display a message only when a customer ships their order to a certain country, you could use these tokens:

%IF(BasketList.d.ship_cntry EQ 'CA')% 1 %IFEND%

These tokens will cause a message to be displayed if the order is to be shipped to Canada (country code CA).

Note that the text returned by the tokens is not displayed on the screen; it is only used to decide whether or not to display the message. This is a bit different from the way OpenUI tokens are usually used.

Note: when using OpenUI tokens to control a message, you should NOT include the %OUI% token.

I cut and pasted the code it has in there and I still couldn't get it to display the message. Any ideas?

Vic - WolfPaw Computers
04-05-06, 07:49 PM
Try %IF(Orders.d.total GE 150)%Order Over $150%IFEND%

Although I doubt this will parse as the Basket has not yet been coverted to an Order at the OPAY stage.

%IF(%VAR(%BASKET_SUBTOTAL%) GE 150)%Order Over $150%IFEND% might work.

Brandon MUS
04-05-06, 07:54 PM
I tried both of those, Vic, and got no results either way.

According to the manual, it also says I can put %OUI% in the before-message and using OUI Tokens in the message. When I try that, all of my HTML is hidden.

Vic - WolfPaw Computers
04-05-06, 07:56 PM
I would definately contact Kent.

Something isnt right. Either the syntax isnt being parsed correctly or the instructions are missing a piece.

Brandon MUS
04-05-06, 08:04 PM
Thanks, I've got an email in to him. I'll post my findings here if we can get to the bottom of it. Thanks for the help.

Brandon

Kent Multer
04-05-06, 10:50 PM
Hi folks -- Brandon contacted me, and we should have this sorted out soon.

Vic, I wanted to ask about this:

%IF(%VAR(%BASKET_SUBTOTAL%) GE 150)%Order Over $150%IFEND% might work.

Are you sure that the percent signs are required around the BASKET_SUBTOTAL keyword? I haven't used these special codes before, but I checked the manual, and it didn't say anything about enclosing them in percents.

Thanks -- Kent

Vic - WolfPaw Computers
04-06-06, 12:09 AM
I've seen it both ways.

I just checked a site we have something similar added and this is the working method of the expression:

%IF(%VAR(BASKET_SUBTOTAL) GE 150)%Order Over $150%IFEND%

Without the %'s around basket_subtotal.

However, %IF(BASKET_SUBTOTAL GE 150)% should also work.