[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Numerical sort on 'code' failing - ideas?
****** message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com> ******
At 03:36 PM 5/24/99 , mediamob wrote:
>****** message to minivend-users from mediamob <mediamob@dnaco.net>
******
>
>
>Greetings-
>
>I have just finished figuring out the most obscure problem I have seen
>with minivend to date, and the fix has left me with another mystery. Let
>me give a bit of background.
>
>My site sells videotapes. Due to the limitations under which I developed
>the first version of the site, I stored my product code as a text datatype
>3 digits long, with leading zeros to pad the catalog number. This allowed
>easy alphabetical sorting and predicable pattern matching for the image
>files.
>
>When I found that minivend calls to my catalog entry page ( strongly based
>on the the FAQ version of the browse1 page) above code #7 resulted in
>errors, I spend a week figuring out that perl treats numbers with leading
>zeros as octal values. 008 doesnt mean anything, and 010 is decimal 8!
Oh my.
>
>Alright, so I can change my catalog codes so they don't have leading
>zeros. I did that, and tried to do a numeric sort on the whole database to
>list titles, with this code:
>
>[loop search="se=*/sf=code"]
>[sort products:code:n]
>[page href=browse1 arg=[loop-code]:1]<I>MediaMob# [loop-code]</I>  
><B>[loop-field Mobtitle]</B>
>[/page] arg to browse1 = [calc][loop-code][/calc]:1
>   
>[order [loop-code]]Add to cart[/order]
><B>[L]Our Price[/L] [loop-price]</B><p>
>[/loop]
>
>What I get is an alpha sort ( 1, 10, 2) not a numeric. The same result
>comes from:
>[sort products:code:f]
>
>I do not understand why.
>
>I have gotten the result I want by removing the sort line completely
>(1,2,3,4...) but I don't want to proceed until I know why. I am tired of
>Gotchas.
It is probably because your products.db is sorted correctly?
>
>The other alternative is to force perl to treat my numbers as decimal.
>Anyone know how to do that?
Sorry I don't, but as comic relief, you try changing your product numbers
to (intentional) hex. ;-P
I've run into this problem, but just chose to live with it. *shrug*
>
>Thanks,
>Pat
>
>-
>To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
>email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
>Archive of past messages: http://www.minivend.com/minivend/minivend-list
>
Ryan Hertz tel 520-645-3812
Webmaster tel 800-645-BAIT
Advertising Director fax 520-645-2588
Gary Yamamoto Custom Baits, Inc. http://www.yamamoto.baits.com
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list