PDA

View Full Version : Token Calculation in Tiny Cart


Beverly
09-13-06, 05:51 PM
I have worked on a few miva carts and have never been asked to do this before. I have searched the archives to no avail.

I have a client that wishes to show the amount needed before they receive free shipping. Therefore, the calculation would be $150 - subtotal = x

How would I write this with tokens?

Thanks in advance.

Beverly

Bruce - PhosphorMedia
09-13-06, 06:02 PM
I don't believe that TinyCart will process tokens other than what is provided in the module.

Vic - WolfPaw Computers
09-13-06, 06:05 PM
Contact us offlist, we've done this type of scripting for other customers.

jason - jmh web services
09-13-06, 07:33 PM
I don't believe that TinyCart will proce
ss tokens other than what is provided in the module.

just fyi, viking added ability to use openui tokens

Bruce - PhosphorMedia
09-13-06, 10:46 PM
Thanks for the correction.

In that case, use something like:


%FUNC(glosub(viking-subtotal-token, '$', '')
%ASSIGN(g.OUIX_FuncReturn|g.CurrentTotal)%

You need to purchase:

$%EXPR(150 - g.CurrentTotal)

to qualify for free shipping.

pldoolittle
12-21-06, 09:25 PM
I just tried that and I cannot get any OUI script to be parsed inside tinycart. It just dumps the code to the screen as text. Any sugestions? I already tried
%OUI% and %OUI1%

Vic - WolfPaw Computers
12-22-06, 12:06 AM
Check for an update and be sure you have the latest version of Tiny Cart.

Also, are you inserting the Tiny Cart token into another template screen?

pldoolittle
12-22-06, 03:42 AM
Check for an update and be sure you have the latest version of Tiny Cart.

Also, are you inserting the Tiny Cart token into another template screen?

It's from last Thursday, so I hope it is up to date. I'll ask anyway, but Viking support seems to be on 3-4 response cycles these days... :mad:

Yes, I am inserting it into PPT and CPT with a token. I thought that might be a problem with recursive parsing, so I have pulled the code I wanted out and pasted it directly into RH column. For those interested, here's the code I am using for "only $XX until Free shipping":

%IF(%VAR(BASKET_SUBTOTAL)% LE '150')%
%ASSIGN(g.shipchrg|3.00)%
%ASSIGN(g.shipnext|'FREE')%
%ASSIGN(g.diff|150)%
%IFEND%
%IF(%VAR(BASKET_SUBTOTAL)% LE '25')%
%ASSIGN(g.shipchrg|9.00)%
%ASSIGN(g.shipnext|7.00)%
%ASSIGN(g.diff|50)%
%IFEND%


Your Shipping: $ %VAR(g.shipchrg)%
%IF(%VAR(g.shipchrg)% GT '0' )%
You are only $%EXPR(%VAR(g.diff)% - %VAR(BASKET_SUBTOTAL)%)% from $%VAR(g.shipnext)% shipping.
%ELSE%
%IFEND%

I snipped it a bit for length, so the shipping charges may seem a little funny but the logic is there. Basically, shipping stairsteps down from $9.00 -> $0.00 and at each step I have a message in the RH column that says only

Your shipping $9.00: Only $12.65 until $7.00 shipping.
Your shipping $7.00: Only $12.65 until $5.00 shipping.
Your shipping $5.00: Only $12.65 until $3.00 shipping.
Your shipping $3.00: Only $12.65 until FREE shipping.
Your shipping is FREE!

William Davis
05-08-07, 11:33 PM
It's from last Thursday, so I hope it is up to date. I'll ask anyway, but Viking support seems to be on 3-4 response cycles these days... :mad:

Yes, I am inserting it into PPT and CPT with a token. I thought that might be a problem with recursive parsing, so I have pulled the code I wanted out and pasted it directly into RH column. For those interested, here's the code I am using for "only $XX until Free shipping":

%IF(%VAR(BASKET_SUBTOTAL)% LE '150')%
%ASSIGN(g.shipchrg|3.00)%
%ASSIGN(g.shipnext|'FREE')%
%ASSIGN(g.diff|150)%
%IFEND%
%IF(%VAR(BASKET_SUBTOTAL)% LE '25')%
%ASSIGN(g.shipchrg|9.00)%
%ASSIGN(g.shipnext|7.00)%
%ASSIGN(g.diff|50)%
%IFEND%


Your Shipping: $ %VAR(g.shipchrg)%
%IF(%VAR(g.shipchrg)% GT '0' )%
You are only $%EXPR(%VAR(g.diff)% - %VAR(BASKET_SUBTOTAL)%)% from $%VAR(g.shipnext)% shipping.
%ELSE%
%IFEND%

I snipped it a bit for length, so the shipping charges may seem a little funny but the logic is there. Basically, shipping stairsteps down from $9.00 -> $0.00 and at each step I have a message in the RH column that says only

Your shipping $9.00: Only $12.65 until $7.00 shipping.
Your shipping $7.00: Only $12.65 until $5.00 shipping.
Your shipping $5.00: Only $12.65 until $3.00 shipping.
Your shipping $3.00: Only $12.65 until FREE shipping.
Your shipping is FREE!

First things first. I stopped your site http://www.odordestroyer.com (http://www.odordestroyer.com) -nice. However, I would like to make a small suggestion regarding your attributes http://www.odordestroyer.com/Merchant2/merchant.mvc?Screen=CTGY&Category_Code=Specials (http://www.odordestroyer.com/Merchant2/merchant.mvc?Screen=CTGY&Category_Code=Specials) , both default to the first option "rose". Customers might forget to select the one they actually desire and you end up shipping the wrong one. Take a look at this http://www.cubacollectibles.com/cuba-114-TSBC.html (http://www.cubacollectibles.com/cuba-114-TSBC.html) attribute, it forces the customer to make a selection.

This is accomplished by replacing the %fields% token in the select attr. template field with the token %fields|text|%. The "text" will be displayed as the default in the select list and will have no value so if the attribute is configured to be required the customer will be taken to the "missing attribute" page if they do not make a selection.

For example, to display <Select One> as the default in select type attributes, replace the %fields% token with:

Example: %fields|<Select One>|%

Now, were you able to ever accomplish what you were trying to do "Token Calculation in Tiny Cart (http://extranet.miva.com/forums/showthread.php?t=3909)"? If so, can you please send me a link to the store so I can see it first hand. I am interested in doing the same thing.