Index: openacs-4/packages/ecommerce/www/admin/products/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/index.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/ecommerce/www/admin/products/index.adp 18 Feb 2009 10:20:34 -0000 1.4
+++ openacs-4/packages/ecommerce/www/admin/products/index.adp 18 Feb 2009 11:16:39 -0000 1.5
@@ -32,7 +32,7 @@
Index: openacs-4/packages/ecommerce/www/admin/products/search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/search.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/products/search.adp 16 Aug 2008 00:29:16 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/products/search.adp 18 Feb 2009 11:16:39 -0000 1.2
@@ -13,3 +13,18 @@
@product_search_select_html;noquote@
+
+
+
+
+
+
+
Index: openacs-4/packages/ecommerce/www/admin/products/search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/search.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/ecommerce/www/admin/products/search.tcl 16 Aug 2008 00:29:16 -0000 1.7
+++ openacs-4/packages/ecommerce/www/admin/products/search.tcl 18 Feb 2009 11:16:39 -0000 1.8
@@ -15,22 +15,44 @@
ad_require_permission [ad_conn package_id] admin
if { [info exists sku] } {
- set additional_query_part "sku=:sku"
+ set sku_search $sku
+ set additional_query_part "sku=:sku_search"
set description "Products with SKU #$sku:"
} else {
set product_name_search $product_name
set additional_query_part "upper(product_name) like '%' || upper(:product_name_search) || '%'"
- set description "Products whose name includes \"$product_name\":"
+ set description "Products whose name includes \"$product_name_search\":"
}
+
+
set title "Product Search"
set context [list [list index Products] $title]
set product_counter 0
set product_search_select_html ""
-db_foreach product_search_select "select product_id, product_name from ec_products where $additional_query_part" {
+db_foreach product_search_select "select product_id, sku, product_name from ec_products where $additional_query_part order by product_name" {
incr product_counter
- append product_search_select_html "$product_name\n"
+ if { $sku eq ""} {
+ set sku $product_id
+ }
+ append product_search_select_html "$product_name ($sku)\n"
} if_no_rows {
- # do nothing
+ # do nothing for product_name
+ if { [info exists sku_search] } {
+ # set additional_query_part "sku=:sku"
+ set sku_search $sku
+ set additional_query_part "upper(sku) like '%' || upper(:sku_search) || '%'"
+ set description "No product with sku $sku_search found. Products whose sku includes \"${sku_search}\":"
+ # set sku [string tolower $sku]
+ set product_counter 0
+ set product_search_select_html ""
+ db_foreach product_search_select "select product_id, sku, product_name from ec_products where $additional_query_part order by product_name" {
+ incr product_counter
+ if { $sku eq ""} {
+ set sku $product_id
+ }
+ append product_search_select_html "${product_name} ($sku)\n"
+ }
+ }
}
Index: openacs-4/packages/ecommerce/www/admin/products/search.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/search.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ecommerce/www/admin/products/search.xql 10 Jul 2001 20:33:53 -0000 1.1
+++ openacs-4/packages/ecommerce/www/admin/products/search.xql 18 Feb 2009 11:16:39 -0000 1.2
@@ -3,7 +3,7 @@
- select product_id, product_name from ec_products where $additional_query_part
+ select product_id, sku, product_name from ec_products where $additional_query_part order by product_name