Index: openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 10 Dec 2002 20:06:32 -0000 1.12
+++ openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 8 Mar 2004 19:46:11 -0000 1.13
@@ -80,6 +80,9 @@
if { [string compare $formatted_price "-0.00"] == 0 } {
set formatted_price "0.00"
}
+
+ set formatted_price [util_commify_number $formatted_price]
+
}
if { $currency == "USD" } {
@@ -324,18 +327,18 @@
if { [file exists "$full_dirname/product.jpg"] } {
set linked_thumbnail "
-
+
"
} elseif { [file exists "$full_dirname/product.gif"] } {
set linked_thumbnail "
-
+
"
}
} else {
set linked_thumbnail "
-
+
"
}
}
@@ -1043,3 +1046,59 @@
ec_product_purchase_comb.product_1, ec_product_purchase_comb.product_2,
ec_product_purchase_comb.product_3, ec_product_purchase_comb.product_4))}
}
+
+
+ad_proc ec_gets_char_delimited_line {
+ fileId
+ varName
+ {delimiter "\t"}
+} {
+ Reads and parses a line of data from a character delimited file
+ similar to ns_getscsv. Defaults to delimit tabs
+} {
+ upvar $varName split_line
+ if {[eof $fileId]} {
+ set return_val -1
+ set split_line [list]
+ } else {
+ gets $fileId line
+ set split_line [split $line $delimiter]
+ set return_val [llength $split_line]
+ }
+ return $return_val
+}
+
+ad_proc ec_product_url_if_exists {
+ product_id
+} {
+
+ Returns product url of product id, or null if none exists
+
+} {
+ set product_url [db_string get_product_url "
+ select url
+ from ec_products
+ where product_id=:product_id" -default ""]
+ return $product_url
+}
+
+ad_proc ec_product_link_if_exists {
+ product_id
+ {link_label "more details"}
+} {
+
+ Returns product link (to ec_products url with link_label wrapped by anchor tag) of product id, or null if no url exists.
+ link_label defaults to "more details"
+
+} {
+ set product_url [db_string get_product_url "
+ select url
+ from ec_products
+ where product_id=:product_id" -default ""]
+ if { ![empty_string_p $product_url] } {
+ set product_link "$link_label"
+ } else {
+ set product_link ""
+ }
+ return $product_link
+}