Page 1 of 1

how to use IF tags properly in custom templates

PostPosted: Thu Feb 20, 2003 6:46 pm
by Andrew G
I am trying to use the IF tags for a custom 'more info' page that shows when
a product is out of stock by checking the QuanityOnHand value for 0. Using
the code below it always uses the html in the [-- ELSE --] tag even if i set
the QuantityOnHand to 0 for my test product. I 'think' im doing it correctly
based on the Shopsite help docs... but they don't give examples. Here's my
code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G

Re: how to use IF tags properly in custom templates

PostPosted: Thu Feb 20, 2003 6:51 pm
by loren_d_c
Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual contents of
the field, then it should be surrounded by quotes like that. Of course a VAR or
some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:

I am trying to use the IF tags for a custom 'more info' page that shows when
a product is out of stock by checking the QuanityOnHand value for 0. Using
the code below it always uses the html in the [-- ELSE --] tag even if i set
the QuantityOnHand to 0 for my test product. I 'think' im doing it correctly
based on the Shopsite help docs... but they don't give examples. Here's my
code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G

Re: how to use IF tags properly in custom templates

PostPosted: Fri Feb 21, 2003 5:19 pm
by Andrew G
UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is the
IF tag doesn't know how to compare a number. I can only compare a string. I
am guessing this because the help files say that QuantityOnHand displays the
number it contains. Therefore I can check if there is a number using [-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used javascript
instead:
<script language="JavaScript">
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
</script>

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...
Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual contents
of
the field, then it should be surrounded by quotes like that. Of course a
VAR or
some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:

I am trying to use the IF tags for a custom 'more info' page that shows
when
a product is out of stock by checking the QuanityOnHand value for 0.
Using
the code below it always uses the html in the [-- ELSE --] tag even if i
set
the QuantityOnHand to 0 for my test product. I 'think' im doing it
correctly
based on the Shopsite help docs... but they don't give examples. Here's
my
code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G

Re: how to use IF tags properly in custom templates

PostPosted: Fri Feb 21, 2003 5:37 pm
by loren_d_c
Andrew,

What version of ShopSite are you using?

-Loren


Andrew G wrote:

UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is the
IF tag doesn't know how to compare a number. I can only compare a string. I
am guessing this because the help files say that QuantityOnHand displays the
number it contains. Therefore I can check if there is a number using [-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.

"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...
Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual contents
of
the field, then it should be surrounded by quotes like that. Of course a
VAR or
some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:

I am trying to use the IF tags for a custom 'more info' page that shows
when
a product is out of stock by checking the QuanityOnHand value for 0.
Using
the code below it always uses the html in the [-- ELSE --] tag even if i
set
the QuantityOnHand to 0 for my test product. I 'think' im doing it
correctly
based on the Shopsite help docs... but they don't give examples. Here's
my
code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G

Re: how to use IF tags properly in custom templates

PostPosted: Fri Feb 21, 2003 7:30 pm
by Brian Williams
Interesting, but I don't think this would compare the current inventory on
hand real-time, only at the time of publishing or republishing the site. Am
I wrong?

Brian

"Andrew G" <andy@electroline4u.com> wrote in message
news:b36c6k$pk8$1@support.shopsite.com...
UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is the
IF tag doesn't know how to compare a number. I can only compare a string.
I
am guessing this because the help files say that QuantityOnHand displays
the
number it contains. Therefore I can check if there is a number using [--
IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used
javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...
Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual
contents
of
the field, then it should be surrounded by quotes like that. Of course a
VAR or
some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:

I am trying to use the IF tags for a custom 'more info' page that
shows
when
a product is out of stock by checking the QuanityOnHand value for 0.
Using
the code below it always uses the html in the [-- ELSE --] tag even if
i
set
the QuantityOnHand to 0 for my test product. I 'think' im doing it
correctly
based on the Shopsite help docs... but they don't give examples.
Here's
my
code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G



Re: how to use IF tags properly in custom templates

PostPosted: Fri Feb 21, 2003 8:58 pm
by Guest
Yes this would only show the status at publish time. If the store isn't
too busy and you publish once a day it could be fairly accurate.

Jim


Brian Williams wrote:
Interesting, but I don't think this would compare the current inventory on
hand real-time, only at the time of publishing or republishing the site. Am
I wrong?

Brian

"Andrew G" <andy@electroline4u.com> wrote in message
news:b36c6k$pk8$1@support.shopsite.com...

UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is the
IF tag doesn't know how to compare a number. I can only compare a string.

I

am guessing this because the help files say that QuantityOnHand displays

the

number it contains. Therefore I can check if there is a number using [--

IF

PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used

javascript

instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...

Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual

contents

of

the field, then it should be surrounded by quotes like that. Of course a

VAR or

some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:


I am trying to use the IF tags for a custom 'more info' page that

shows

when

a product is out of stock by checking the QuanityOnHand value for 0.

Using

the code below it always uses the html in the [-- ELSE --] tag even if

i

set

the QuantityOnHand to 0 for my test product. I 'think' im doing it

correctly

based on the Shopsite help docs... but they don't give examples.

Here's

my

code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G




Re: how to use IF tags properly in custom templates

PostPosted: Tue Feb 25, 2003 7:48 pm
by Amateur Geologist
I just came up to check out the newsgroup for the exact same problem.

I also tried the

[-- IF PRODUCT.QuantityOnHand "0" --]

and it didn't work either.

reversing the logic
[-- IF PRODUCT.QuantityOnHand --]
[-- ELSE --]

doesn't work either

I also have javascript to work around the problem though I don't want to.

-dana

Andrew G wrote:
UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is the
IF tag doesn't know how to compare a number. I can only compare a string. I
am guessing this because the help files say that QuantityOnHand displays the
number it contains. Therefore I can check if there is a number using [-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...

Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual contents

of

the field, then it should be surrounded by quotes like that. Of course a

VAR or

some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:


I am trying to use the IF tags for a custom 'more info' page that shows

when

a product is out of stock by checking the QuanityOnHand value for 0.

Using

the code below it always uses the html in the [-- ELSE --] tag even if i

set

the QuantityOnHand to 0 for my test product. I 'think' im doing it

correctly

based on the Shopsite help docs... but they don't give examples. Here's

my

code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G



Re: how to use IF tags properly in custom templates

PostPosted: Tue Feb 25, 2003 7:57 pm
by Amateur Geologist
Forgot to mention:

ShopSite® SC Pro 6.1.1


Amateur Geologist wrote:
I just came up to check out the newsgroup for the exact same problem.

I also tried the

[-- IF PRODUCT.QuantityOnHand "0" --]

and it didn't work either.

reversing the logic
[-- IF PRODUCT.QuantityOnHand --]
[-- ELSE --]

doesn't work either

I also have javascript to work around the problem though I don't want to.

-dana

Andrew G wrote:

UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is
the
IF tag doesn't know how to compare a number. I can only compare a
string. I
am guessing this because the help files say that QuantityOnHand
displays the
number it contains. Therefore I can check if there is a number using
[-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used
javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...

Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual
contents


of

the field, then it should be surrounded by quotes like that. Of course a


VAR or

some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:


I am trying to use the IF tags for a custom 'more info' page that shows


when

a product is out of stock by checking the QuanityOnHand value for 0.


Using

the code below it always uses the html in the [-- ELSE --] tag even
if i


set

the QuantityOnHand to 0 for my test product. I 'think' im doing it


correctly

based on the Shopsite help docs... but they don't give examples. Here's


my

code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G





Re: how to use IF tags properly in custom templates

PostPosted: Tue Feb 25, 2003 8:16 pm
by Amateur Geologist
[-- IF "0" --]

is true which it should be since it's a string.

[-- IF "0" "0" --]

and

[-- IF "1" "1" --]

are both false.

-dana

Amateur Geologist wrote:
I just came up to check out the newsgroup for the exact same problem.

I also tried the

[-- IF PRODUCT.QuantityOnHand "0" --]

and it didn't work either.

reversing the logic
[-- IF PRODUCT.QuantityOnHand --]
[-- ELSE --]

doesn't work either

I also have javascript to work around the problem though I don't want to.

-dana

Andrew G wrote:

UPDATE

I tried your suggestion Loren but I had no luck. I think the reason is
the
IF tag doesn't know how to compare a number. I can only compare a
string. I
am guessing this because the help files say that QuantityOnHand
displays the
number it contains. Therefore I can check if there is a number using
[-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used
javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...

Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual
contents


of

the field, then it should be surrounded by quotes like that. Of course a


VAR or

some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:


I am trying to use the IF tags for a custom 'more info' page that shows


when

a product is out of stock by checking the QuanityOnHand value for 0.


Using

the code below it always uses the html in the [-- ELSE --] tag even
if i


set

the QuantityOnHand to 0 for my test product. I 'think' im doing it


correctly

based on the Shopsite help docs... but they don't give examples. Here's


my

code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G





Re: how to use IF tags properly in custom templates

PostPosted: Tue Feb 25, 2003 9:52 pm
by Amateur Geologist
and.....

QOH is "[-- PRODUCT.QuantityOnHand --]"

always has a trailing space:

QOH is "0 "
QOH is "1 "
QOH is "2 "
....
QOH is "n "

but since
[--IF var var ==]
is always false it doesn't make any difference.

-dana

Amateur Geologist wrote:
[-- IF "0" --]

is true which it should be since it's a string.

[-- IF "0" "0" --]

and

[-- IF "1" "1" --]

are both false.

-dana

Amateur Geologist wrote:

I just came up to check out the newsgroup for the exact same problem.

I also tried the

[-- IF PRODUCT.QuantityOnHand "0" --]

and it didn't work either.

reversing the logic
[-- IF PRODUCT.QuantityOnHand --]
[-- ELSE --]

doesn't work either

I also have javascript to work around the problem though I don't want to.

-dana

Andrew G wrote:

UPDATE

I tried your suggestion Loren but I had no luck. I think the reason
is the
IF tag doesn't know how to compare a number. I can only compare a
string. I
am guessing this because the help files say that QuantityOnHand
displays the
number it contains. Therefore I can check if there is a number using
[-- IF
PRODUCT.QuantityOnHand --] but I can't compare the value.

I did find a solution for anyone who's interested though. I used
javascript
instead:
script language="JavaScript"
var outstock = "<HTML>";
var instock = "<HTML>";
var Quantity = [-- PRODUCT.QuantityOnHand --];
if(Quantity == 0) {
document.write(outstock);
} else {
document.write(instock);
}
/script

where outstock is a variable that contains the HTML string I want for
and
out of stock product and instock is the HTML for an instock product.


"Loren" <loren_d_c@yahoo.com> wrote in message
news:3E557804.A0C61998@yahoo.com...

Try:

[-- IF PRODUCT.QuantityOnHand "0" --]



I think that if the value you are trying to compare is the actual
contents



of

the field, then it should be surrounded by quotes like that. Of
course a



VAR or

some other template tag would not need to be in quotes.

-Loren




Andrew G wrote:


I am trying to use the IF tags for a custom 'more info' page that
shows



when

a product is out of stock by checking the QuanityOnHand value for 0.



Using

the code below it always uses the html in the [-- ELSE --] tag even
if i



set

the QuantityOnHand to 0 for my test product. I 'think' im doing it



correctly

based on the Shopsite help docs... but they don't give examples.
Here's



my

code:

[-- IF PRODUCT.QuantityOnHand 0 --]

html stuff

[-- ELSE --]

different HTML stuff

[-- END_IF --]

Am I using it right?

Thanks in advance for any insight!

Andrew G