Index: openacs-4/packages/ecommerce/www/category-browse-subcategory.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subcategory.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/ecommerce/www/category-browse-subcategory.adp 13 Jan 2005 13:57:58 -0000 1.6 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory.adp 28 Apr 2008 08:16:31 -0000 1.7 @@ -1,35 +1,62 @@ - - @subcategory_name;noquote@ - @context_bar;noquote@ - @ec_system_owner;noquote@ - - t - -
- - - - - - - - - - -
-

Browse:

-
    - @subcategories@ -
-
-

We recommend:

- @recommendations@ -
-
-

@category_name@ > @subcategory_name@ products:

- @products;noquote@ - - @prev_link@ @separator@ @next_link@ -
- -

Add yourself to the @the_category_name@ mailing list!

+ + @subcategory_name;noquote@ + @context_bar;noquote@ + @ec_system_owner;noquote@ + + t + +
+ + + + + + + + + + +
+

Browse:

+
    + @subcategories@ +
+
+

We recommend:

+ @recommendations@ +
+
+ + +

@category_name@ > @subcategory_name@ products:

+ + + + + + + + + + + + + + +
@products.product_name@
@products.one_line_description;noquote@@products.price_line;noquote@
+ + +Previous @how_many@ + +| + + + +Next @how_many_next@ + +
+ + +
+ +

Add yourself to the @the_category_name@ mailing list!

Index: openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 1 Mar 2005 00:01:30 -0000 1.8 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 28 Apr 2008 08:16:31 -0000 1.9 @@ -136,67 +136,45 @@ " } -set products {} - -set have_how_many_more_p f set count 0 -db_foreach get_regular_product_list " - select p.product_id, p.dirname, p.product_name, p.one_line_description, o.offer_code - from $product_map($sub) m, ec_products_searchable p left outer join ec_user_session_offer_codes o on (p.product_id = o.product_id and user_session_id = :user_session_id) - where p.product_id = m.product_id - and m.${sub}category_id = :${sub}category_id - $exclude_subproducts - order by p.product_name" { +# TODO: memoize +# NOTE: careful if you do cache this since the code block calculates per-user specials, and also change implementation of count +db_multirow -extend { + thumbnail_url + thumbnail_height + thumbnail_width + price_line + } products get_regular_product_list "sql in db specific xql files" { + + array set thumbnail_info [ecommerce::resource::image_info -type Thumbnail -product_id $product_id -dirname $dirname] + set thumbnail_url $thumbnail_info(url) + set thumbnail_width $thumbnail_info(width) + set thumbnail_height $thumbnail_info(height) - if { $count >= $start && [expr $count - $start] < $how_many } { + set price_line [ec_price_line $product_id $user_id $offer_code] - append products " - - - - - - - - - " - } incr count - if { $count > [expr $start + (2 * $how_many)] } { - # we know there are at least how_many more items to display next time - set have_how_many_more_p t - break - } else { - set have_how_many_more_p f - } } -append products "
[expr $count + 1]$product_name
$one_line_description
- [ec_add_to_cart_link $product_id "Add to Shopping Cart"]
[ec_price_line $product_id $user_id $offer_code]
" - +# what if start is < how many? shouldn't happen I guess... if { $start >= $how_many } { - set prev_link "Previous $how_many" -} else { - set prev_link "" + set prev_url [export_vars -base [ad_conn url] -override {{start {[expr $start - $how_many]}}} {category_id subsubcategory_id how_many}] } -if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" -} else { - set number_of_remaining_products [expr $count - $start - $how_many] - if { $number_of_remaining_products > 0 } { - set next_link "Next $number_of_remaining_products" +set how_many_more [expr $count - $start - $how_many + 1] + +if { $how_many_more > 0 } { + set next_url [export_vars -base [ad_conn url] -override {{start {[expr $start + $how_many]}}} {category_id subsubcategory_id how_many}] + + if { $how_many_more >= $how_many } { + set how_many_next $how_many } else { - set next_link "" + set how_many_next $how_many_more } } -if { [empty_string_p $next_link] || [empty_string_p $prev_link] } { - set separator "" -} else { - set separator "|" -} +set end [expr $start + $how_many - 1] #============================== # subcategories Index: openacs-4/packages/ecommerce/www/category-browse-subsubcategory.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subsubcategory.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/category-browse-subsubcategory.adp 8 Mar 2004 19:46:11 -0000 1.4 +++ openacs-4/packages/ecommerce/www/category-browse-subsubcategory.adp 28 Apr 2008 08:16:31 -0000 1.5 @@ -17,10 +17,35 @@ +

@category_name@ > @subcategory_name@ > @subsubcategory_name@ products:

- @products@ - @prev_link@ @separator@ @next_link@ + + + + + + + + + + + + + +
@products.product_name@
@products.one_line_description;noquote@@products.price_line;noquote@
+ + +Previous @how_many@ + +| + + + +Next @how_many_next@ + +
+

Add yourself to the @the_category_name@ mailing list!

Index: openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl 1 Mar 2005 00:01:30 -0000 1.7 +++ openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl 28 Apr 2008 08:16:31 -0000 1.8 @@ -133,66 +133,45 @@ " } -set products "" - -set have_how_many_more_p f set count 0 -db_foreach get_regular_product_list " - select p.product_id, p.product_name, p.one_line_description, o.offer_code - from $product_map($sub) m, ec_products_searchable p left outer join ec_user_session_offer_codes o on (p.product_id = o.product_id and user_session_id = :user_session_id) - where p.product_id = m.product_id - and m.${sub}category_id = :${sub}category_id - $exclude_subproducts - order by p.product_name" { +# TODO: memoize +# NOTE: careful if you do cache this since the code block calculates per-user specials, and also change implementation of count +db_multirow -extend { + thumbnail_url + thumbnail_height + thumbnail_width + price_line + } products get_regular_product_list "sql in db specific xql files" { + + array set thumbnail_info [ecommerce::resource::image_info -type Thumbnail -product_id $product_id -dirname $dirname] + set thumbnail_url $thumbnail_info(url) + set thumbnail_width $thumbnail_info(width) + set thumbnail_height $thumbnail_info(height) - if { $count >= $start && [expr $count - $start] < $how_many } { + set price_line [ec_price_line $product_id $user_id $offer_code] - append products " - - - - - - - - - " - } incr count - if { $count > [expr $start + (2 * $how_many)] } { - # we know there are at least how_many more items to display next time - set have_how_many_more_p t - break - } else { - set have_how_many_more_p f - } } -append products "
[expr $count + 1]$product_name
$one_line_description[ec_price_line $product_id $user_id $offer_code]
" - +# what if start is < how many? shouldn't happen I guess... if { $start >= $how_many } { - set prev_link "Previous $how_many" -} else { - set prev_link "" + set prev_url [export_vars -base [ad_conn url] -override {{start {[expr $start - $how_many]}}} {category_id subsubcategory_id how_many}] } -if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" -} else { - set number_of_remaining_products [expr $count - $start - $how_many] - if { $number_of_remaining_products > 0 } { - set next_link "Next $number_of_remaining_products" +set how_many_more [expr $count - $start - $how_many + 1] + +if { $how_many_more > 0 } { + set next_url [export_vars -base [ad_conn url] -override {{start {[expr $start + $how_many]}}} {category_id subsubcategory_id how_many}] + + if { $how_many_more >= $how_many } { + set how_many_next $how_many } else { - set next_link "" + set how_many_next $how_many_more } } -if { [empty_string_p $next_link] || [empty_string_p $prev_link] } { - set separator "" -} else { - set separator "|" -} +set end [expr $start + $how_many - 1] #============================== # subcategories Index: openacs-4/packages/ecommerce/www/category-browse.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ecommerce/www/category-browse.adp 11 Mar 2004 04:11:52 -0000 1.7 +++ openacs-4/packages/ecommerce/www/category-browse.adp 28 Apr 2008 08:16:31 -0000 1.8 @@ -5,15 +5,19 @@ t - + - + @@ -29,12 +33,34 @@

@category_name@ items:

- @products;noquote@ - @prev_link;noquote@ @separator;noquote@ @next_link;noquote@ -
+

@category_name@ > subcategories

- - @subcategories;noquote@ - + + + + > @subcategories.name@
+
+
+
+ + + + + + + + + + + + +
@products.product_name@
@products.one_line_description;noquote@@products.price_line;noquote@
- + +Previous @how_many@ + +| + + + +Next @how_many_next@ + + + + There are currently no items listed in this category.  Please check back often for updates. Index: openacs-4/packages/ecommerce/www/category-browse.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/ecommerce/www/category-browse.tcl 27 Apr 2008 01:38:23 -0000 1.11 +++ openacs-4/packages/ecommerce/www/category-browse.tcl 28 Apr 2008 08:16:31 -0000 1.12 @@ -19,7 +19,7 @@ subcategory_id:optional,naturalnum subsubcategory_id:optional,naturalnum {how_many:naturalnum {[ad_parameter -package_id [ec_id] ProductsToDisplayPerPage ecommerce]}} - {start:naturalnum "0"} + {start:naturalnum "1"} usca_p:optional } @@ -162,8 +162,7 @@ #============================== # products -# All products in the "category" and not in "subcategories" - +# All products in the "category" and not in "subcategories" (used in xql subst) set exclude_subproducts "" if ![at_bottom_level_p] { set exclude_subproducts " @@ -173,84 +172,62 @@ and c.${sub}category_id = :${sub}category_id)" } -set products {} - -set have_how_many_more_p f set count 0 -db_foreach get_regular_product_list "sql in db specific xql filessw" { +# TODO: memoize +# NOTE: careful if you do cache this since the code block calculates per-user specials, and also change implementation of count +db_multirow -extend { + thumbnail_url + thumbnail_height + thumbnail_width + price_line + } products get_regular_product_list "sql in db specific xql files" { + + array set thumbnail_info [ecommerce::resource::image_info -type Thumbnail -product_id $product_id -dirname $dirname] + set thumbnail_url $thumbnail_info(url) + set thumbnail_width $thumbnail_info(width) + set thumbnail_height $thumbnail_info(height) - if { $count >= $start && [expr $count - $start] < $how_many } { + set price_line [ec_price_line $product_id $user_id $offer_code] - array set thumbnail_info [ecommerce::resource::image_info -type Thumbnail -product_id $product_id -dirname $dirname] - set image_html "" - # assumes exists... - set image_html "" - - append products " - - - - - - - - " - } incr count - if { $count > [expr $start + (2 * $how_many)] } { - - # We know there are at least how_many more items to display - # next time - - set have_how_many_more_p t - break - } else { - set have_how_many_more_p f - } } -append products "
$image_html$product_name
$one_line_description[ec_price_line $product_id $user_id $offer_code]
" - +# what if start is < how many? shouldn't happen I guess... if { $start >= $how_many } { - set prev_link "Previous $how_many" -} else { - set prev_link "" + set prev_url [export_vars -base [ad_conn url] -override {{start {[expr $start - $how_many]}}} {category_id subsubcategory_id how_many}] } -if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" -} else { - set number_of_remaining_products [expr $count - $start - $how_many] - if { $number_of_remaining_products > 0 } { - set next_link "<\"a href=[ad_conn url]?[export_url_vars category_id subcategory_id subsubcategory_id how_many]&start=[expr $start + $how_many]\">Next $number_of_remaining_products" +set how_many_more [expr $count - $start - $how_many + 1] + +if { $how_many_more > 0 } { + set next_url [export_vars -base [ad_conn url] -override {{start {[expr $start + $how_many]}}} {category_id subsubcategory_id how_many}] + + if { $how_many_more >= $how_many } { + set how_many_next $how_many } else { - set next_link "" + set how_many_next $how_many_more } } -if { [empty_string_p $next_link] || [empty_string_p $prev_link] } { - set separator "" -} else { - set separator "|" -} +set end [expr $start + $how_many - 1] #============================== # subcategories -set subcategories "" +set subcategories_p 0 if ![at_bottom_level_p] { - db_foreach get_subcategories " - select * from ec_sub${sub}categories c - where ${sub}category_id = :${sub}category_id - and exists (select 'x' from ec_products_displayable p, $product_map(sub$sub) s - where p.product_id = s.product_id - and s.sub${sub}category_id = c.sub${sub}category_id) - order by sort_key, sub${sub}category_name" { - append subcategories " - > [eval "ident \$sub${sub}category_name"]
" - } + db_multirow -extend { url name } subcategories get_subcategories "see xql" { + set url [export_vars -base "category-browse-sub${sub}category" {category_id subcategory_id subsubcategory_id}] + set name [eval "ident \$sub${sub}category_name"] + } + + if { ${subcategories:rowcount} > 0 } { + set subcategories_p 1 + # ident? what is this?? + } + } set the_category_id [eval "ident \$${sub}category_id"] Index: openacs-4/packages/ecommerce/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/index.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ecommerce/www/index.adp 24 Feb 2005 13:33:14 -0000 1.8 +++ openacs-4/packages/ecommerce/www/index.adp 28 Apr 2008 08:16:31 -0000 1.9 @@ -16,7 +16,7 @@

We recommend:

- @recommendations_if_there_are_any@ + @recommendations_if_there_are_any;noquote@