marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
[SOLVED] IF statements in sortorder.txt

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « [SOLVED] IF statements in sortorder.txt »
Welcome, Guest. Please Login or Register.
12/14/17 at 10:15:11
Home Help Search Login Register
   marty.net message board
   About cpshop
   Customization Help
   [SOLVED] IF statements in sortorder.txt
(Moderator: Marty)
Pages: 1 Reply Notify of replies Send the topic Print 
   Author  Topic: [SOLVED] IF statements in sortorder.txt  (Read 872 times)
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
[SOLVED] IF statements in sortorder.txt
« on: 11/30/10 at 14:54:03 »
Reply with quote Modify message

I cannot seem to get the <IF> statements to work properly in my cpshop.cgi.sortorder.txt file.  The order of products, the title div classes and how they display all seem to work fine.  However, the <IF> statements are not working right.  When there are no gift items added into a section, I want the headers for those products such as "Buttons" and "Magnets" to NOT display.  Instead, in a <ELSE> clause I want it to display nothing.  

This feature used to work, but I don't know if changes at CP or changes to CPSHOP, or if changes to my CSS have caused this to stop working.  

I have changed around items, removed item product numbers in the <IF> statements and none of this seems to change anything, so I am confused.

EXAMPLE of my sortorder.txt file:


Code:
<BR>
<if 120,121,122,123,207,203,204,205,65,118,119,141,142,143,30,194,195,105,120,124,137,138,139,209,210,90,211,212,51,213,50,26,368>
<div align="center"><span class="kmtitle"><a name="gifts" id="gifts"></a>Buttons, Magnets, Stickers &amp; Gifts</span>
120
121
122
123
207
203
204
205
65
118
119
141
142
143
30
194
195
105
120
124
137
138
139
209
210
90
211
212
51
213
50
26
368
</div>
</ELSE>
<BR>
END


In this example, on a page that displays a design of many products, this one page only has shirts.  But it's still displaying the "Buttons, Magnets, Stickers, and Gifts" title and nothing below it.

What should I do to make this <IF, ELSE> statement work properly?

Thanks!

« Last Edit: 02/10/11 at 19:10:44 by KaptainMyke.com » Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #1 on: 11/30/10 at 16:23:01 »
Reply with quote Modify message

Is your if statement with the product numbers all on one line? It's not as shown above unless the board formatted it with a line break. I seem to recall there being something to that if I remember correctly.

Also, I seem to recall that Else isn't supported in sort order, and /Else doesn't make sense anyway. Try removing the last 3 lines from your file along with making sure the if statement is all on one line.
Logged
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Question about <IF> statements in sortorder.tx
« Reply #2 on: 11/30/10 at 18:22:40 »
Reply with quote Modify message

Yes, IF statement is one line.  I have tried the /ELSE, just ELSE, and no ELSE, doesn't seem to matter either way.
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #3 on: 11/30/10 at 19:32:43 »
Reply with quote Modify message

I don't know then, mine looks very similar to yours (except the line break after the IF which you said isn't there in your copy> and it works like you're wanting your too. But the Else isn't going to make a diff, as I recall it's implied in sort order, so you don't need it. Also I'm not sure what the END is for on the last line. Do you have a link we can look at?
Logged
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Question about <IF> statements in sortorder.tx
« Reply #4 on: 11/30/10 at 19:46:11 »
Reply with quote Modify message

http://www.kaptainmyke.com/cgi-bin/store/cpshop.cgi/kaptainmyke.3597991+break-dance-not-hearts.html

Towards the bottom, after baby apparel but before drinkware... on other pages where I have all products, it all displays, so it's not an issue.  It's more of an annoyance than anything, really.  I just want it to not show my titles if there's no products of that nature to be shown.

Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #5 on: 11/30/10 at 20:10:44 »
Reply with quote Modify message

Yup, that's weird. It should work. Mine does. You said it used to work, when abouts did it stop working? And...I'm not sure if this is one of the things on the page you have to clear the cache for in order to update it. I lose track of which items need to have the cache cleared in order to update them.

Maybe for kicks delete that sort order file, refresh your page and see if it updates, then replace that file? If the page doesn't update then you know you need to clear the cache (when you can) to update changes to the sort order file. Hope that makes sense.
Logged
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Question about <IF> statements in sortorder.tx
« Reply #6 on: 11/30/10 at 20:47:47 »
Reply with quote Modify message

when I deleted the file this morning, all products displayed as they do in the cafepress storefront, so this is definitely not a cache refresh problem.  Good idea, though!  Thank you for trying to help!  
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #7 on: 11/30/10 at 21:10:23 »
Reply with quote Modify message

Sorry I couldn't get it working. I'm at a loss. Maybe Marty will chime in with something when he gets a free minute.
Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #8 on: 11/30/10 at 21:18:58 »
Reply with quote Modify message

Sent you a PM.
Logged
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Question about <IF> statements in sortorder.tx
« Reply #9 on: 02/10/11 at 15:02:10 »
Reply with quote Modify message

does anyone else have example codes they would like to share with me on what your sortorder.txt files look like?

More specifically, do you have classes or font code when dealing with text
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Question about <IF> statements in sortorder.tx
« Reply #10 on: 02/10/11 at 17:04:44 »
Reply with quote Modify message

Still perplexing. Are you positive you don't accidently have a product number in there that belongs to an item that is actually on the page? I'd go through them one by one, and put the first "if" string in numerical order so it's easier to keep track of them.

You also have 120 in there twice, hey, anything is worth a try at this point.
Logged
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Question about <IF> statements in sortorder.tx
« Reply #11 on: 02/10/11 at 19:10:08 »
Reply with quote Modify message

SOLVED

The conditional IF statement must not include a paragraph line break for the next line of code I had...

After the IF statement you must include the next line.  The product numbers themselves can be on individual line breaks.

code:


Code:
<if 38,152,7,217,45,107,108,23,244,155,5,159,221,218,115,111,250,126,4,249,112,2,245,246,106,251,260,15,296><div align="center"><span class="kmtitle"><a name="men"></a>Men's Apparel</span>
38
152
7
217
45
107
108
23
244
155
5
159
221
218
115
111
250
126
4
249
112
2
245
246
106
251
260
15
296
</div>
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: [SOLVED] IF statements in sortorder.txt
« Reply #12 on: 02/10/11 at 19:41:39 »
Reply with quote Modify message

I had asked you above in my first reply if it was all on one line and you said yes. I guess we misunderstood each other. Glad you got working!
Logged
Pages: 1 Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.