Index: openacs-4/packages/ecommerce/www/category-browse-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-oracle.xql,v diff -u -r1.1 -r1.1.8.1 --- openacs-4/packages/ecommerce/www/category-browse-oracle.xql 19 Sep 2002 23:38:18 -0000 1.1 +++ openacs-4/packages/ecommerce/www/category-browse-oracle.xql 11 Jun 2005 05:09:27 -0000 1.1.8.1 @@ -23,15 +23,34 @@ + + + select count(*) as product_count + from $product_map($sub) m, ec_products_searchable p, ec_user_session_offer_codes o + where (p.product_id=o.product_id(+) and (user_session_id=:user_session_id or user_session_id is null)) + and p.product_id = m.product_id + and m.${sub}category_id = :${sub}category_id + $exclude_subproducts + + + - select p.product_id, p.product_name, p.one_line_description, o.offer_code + select r.* + from ( + select rownum as r_rownum, q.* + from ( + 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, ec_user_session_offer_codes o where (p.product_id=o.product_id(+) and (user_session_id=:user_session_id or user_session_id is null)) and p.product_id = m.product_id and m.${sub}category_id = :${sub}category_id $exclude_subproducts order by p.product_name + ) q + ) r + where r_rownum > :start_row + and r_rownum <= :start_row + :how_many Index: openacs-4/packages/ecommerce/www/category-browse-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-postgresql.xql,v diff -u -r1.1 -r1.1.8.1 --- openacs-4/packages/ecommerce/www/category-browse-postgresql.xql 19 Sep 2002 23:38:18 -0000 1.1 +++ openacs-4/packages/ecommerce/www/category-browse-postgresql.xql 11 Jun 2005 05:09:27 -0000 1.1.8.1 @@ -23,14 +23,24 @@ + + + select count(*) as product_count + 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 + + + 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 + order by p.product_name limit :how_many offset :start_row Index: openacs-4/packages/ecommerce/www/category-browse-subcategory-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subcategory-oracle.xql,v diff -u -r1.1.8.1 -r1.1.8.2 --- openacs-4/packages/ecommerce/www/category-browse-subcategory-oracle.xql 28 Dec 2004 09:55:41 -0000 1.1.8.1 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory-oracle.xql 11 Jun 2005 05:09:27 -0000 1.1.8.2 @@ -23,15 +23,34 @@ + + + select count(*) as product_count + from $product_map($sub) m, ec_products_searchable p, ec_user_session_offer_codes o + where (p.product_id=o.product_id(+) and (user_session_id=:user_session_id or user_session_id is null)) + and p.product_id = m.product_id + and m.${sub}category_id = :${sub}category_id + $exclude_subproducts + + + + select r.* + from ( + select rownum as r_rownum, q.* + from ( 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, ec_user_session_offer_codes o where (p.product_id=o.product_id(+) and (user_session_id=:user_session_id or user_session_id is null)) and p.product_id = m.product_id and m.${sub}category_id = :${sub}category_id $exclude_subproducts order by p.product_name + ) q + ) r + where r_rownum > :start_row + and r_rownum <= :start_row + :how_many Index: openacs-4/packages/ecommerce/www/category-browse-subcategory-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/category-browse-subcategory-postgresql.xql,v diff -u -r1.1.8.1 -r1.1.8.2 --- openacs-4/packages/ecommerce/www/category-browse-subcategory-postgresql.xql 28 Dec 2004 09:52:02 -0000 1.1.8.1 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory-postgresql.xql 11 Jun 2005 05:09:27 -0000 1.1.8.2 @@ -22,6 +22,17 @@ + + + select count(*) as product_count + 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 + + + select p.product_id, p.dirname, p.product_name, p.one_line_description, o.offer_code @@ -30,7 +41,7 @@ where p.product_id = m.product_id and m.${sub}category_id = :${sub}category_id $exclude_subproducts - order by p.product_name + order by p.product_name limit :how_many offset :start_row 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.6.2.2 -r1.6.2.3 --- openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 28 Dec 2004 09:48:08 -0000 1.6.2.2 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 11 Jun 2005 05:09:27 -0000 1.6.2.3 @@ -6,7 +6,7 @@ @param subcategory_id The ID of the subcategory @param subsubcategory_id The possible ID of any subsubcategory @param how_many How many products to display on the page - @param start Where to begin from + @param start_row Where to begin from @param usca_p User session begun or not @author @@ -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_row:naturalnum "0"} usca_p:optional } @@ -57,7 +57,7 @@ # want their offer price # 4. Log this category_id into the user session -ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start] cookies_are_not_required +ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start_row] cookies_are_not_required # type4 if { [string compare $user_session_id "0"] != 0 } { @@ -139,18 +139,22 @@ set products {} set have_how_many_more_p f -set count 0 +set count $start_row +db_1row get_regular_product_count " + select count(*) as product_count + 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" 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" { + order by p.product_name limit :how_many offset :start_row" { - if { $count >= $start && [expr $count - $start] < $how_many } { - append products " @@ -162,31 +166,30 @@ [ec_add_to_cart_link $product_id "Add to Shopping Cart"]" - } - 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 - } + + incr count } +if { $product_count > [expr $start_row + (2 * $how_many)] } { + # we know there are at least how_many more items to display next time + set have_how_many_more_p t +} else { + set have_how_many_more_p f +} append products "
[expr $count + 1] [ec_price_line $product_id $user_id $offer_code]
" -if { $start >= $how_many } { - set prev_link "Previous $how_many" +if { $start_row >= $how_many } { + set prev_link "Previous $how_many" } else { set prev_link "" } if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" + set next_link "Next $how_many" } else { - set number_of_remaining_products [expr $count - $start - $how_many] + set number_of_remaining_products [expr $product_count - $start_row - $how_many] if { $number_of_remaining_products > 0 } { - set next_link "Next $number_of_remaining_products" + set next_link "Next $number_of_remaining_products" } else { set next_link "" } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ecommerce/www/category-browse-subsubcategory-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ecommerce/www/category-browse-subsubcategory-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? 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.6 -r1.6.2.1 --- openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl 8 Mar 2004 19:46:11 -0000 1.6 +++ openacs-4/packages/ecommerce/www/category-browse-subsubcategory.tcl 11 Jun 2005 05:09:27 -0000 1.6.2.1 @@ -6,7 +6,7 @@ @param subcategory_id The ID of the subcategory @param subsubcategory_id The ID of the subsubcategory @param how_many How many products to show on a page - @param start Which product to start at + @param start_row Which product to start at @param usca_p User session begun or not @author @@ -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_row:naturalnum "0"} usca_p:optional } @@ -58,7 +58,7 @@ # want their offer price # 4. Log this category_id into the user session -ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start] cookies_are_not_required +ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start_row] cookies_are_not_required # type4 if { [string compare $user_session_id "0"] != 0 } { @@ -138,16 +138,21 @@ set have_how_many_more_p f set count 0 +db_1row get_regular_product_count " + select count(*) as product_count + 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" + 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" { + order by p.product_name limit :how_many offset :start_row" { - if { $count >= $start && [expr $count - $start] < $how_many } { - append products " [expr $count + 1] @@ -158,31 +163,30 @@ $one_line_description [ec_price_line $product_id $user_id $offer_code] " - } + 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 - } } +if { $product_count > [expr $start_row + (2 * $how_many)] } { + # we know there are at least how_many more items to display next time + set have_how_many_more_p t +} else { + set have_how_many_more_p f +} append products "" -if { $start >= $how_many } { - set prev_link "Previous $how_many" +if { $start_row >= $how_many } { + set prev_link "Previous $how_many" } else { set prev_link "" } if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" + set next_link "Next $how_many" } else { - set number_of_remaining_products [expr $count - $start - $how_many] + set number_of_remaining_products [expr $product_count - $start_row - $how_many] if { $number_of_remaining_products > 0 } { - set next_link "Next $number_of_remaining_products" + set next_link "Next $number_of_remaining_products" } else { set next_link "" } 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.9 -r1.9.2.1 --- openacs-4/packages/ecommerce/www/category-browse.tcl 11 Mar 2004 04:11:52 -0000 1.9 +++ openacs-4/packages/ecommerce/www/category-browse.tcl 11 Jun 2005 05:09:27 -0000 1.9.2.1 @@ -6,7 +6,7 @@ @param subcategory_id The ID of the subcategory @param subsubcategory_id The possible ID of any subsubcategory @param how_many How many products to display on the page - @param start Where to begin from + @param start_row Where to begin from @param usca_p User session begun or not @author @@ -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_row:naturalnum "0"} usca_p:optional } @@ -88,7 +88,7 @@ # want their offer price # 4. Log this category_id into the user session -ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start] cookies_are_not_required +ec_create_new_session_if_necessary [export_url_vars category_id subcategory_id subsubcategory_id how_many start_row] cookies_are_not_required if { [string compare $user_session_id "0"] != 0 } { db_dml grab_new_session_id " @@ -176,18 +176,22 @@ set products {} set have_how_many_more_p f -set count 0 +set count $start_row +db_1row get_regular_product_count " + select count(*) as product_count + 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" 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" { + order by p.product_name limit :how_many offset :start_row" { - if { $count >= $start && [expr $count - $start] < $how_many } { - append products " @@ -198,34 +202,30 @@ " - } - 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 - } + incr count } +if { $product_count > [expr $start_row + (2 * $how_many)] } { + # We know there are at least how_many more items to display + # next time + set have_how_many_more_p t +} else { + set have_how_many_more_p f +} append products "
[expr $count + 1]$one_line_description [ec_price_line $product_id $user_id $offer_code]
" -if { $start >= $how_many } { - set prev_link "Previous $how_many" +if { $start_row >= $how_many } { + set prev_link "Previous $how_many" } else { set prev_link "" } if { $have_how_many_more_p == "t" } { - set next_link "Next $how_many" + set next_link "Next $how_many" } else { - set number_of_remaining_products [expr $count - $start - $how_many] + set number_of_remaining_products [expr $product_count - $start_row - $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 next_link "<\"a href=[ad_conn url]?[export_url_vars category_id subcategory_id subsubcategory_id how_many]&start_row=[expr $start_row + $how_many]\">Next $number_of_remaining_products" } else { set next_link "" }