[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Numerical sort on 'code' failing - ideas?
****** 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!
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.
The other alternative is to force perl to treat my numbers as decimal.
Anyone know how to do that?
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