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.2 -r1.3 --- openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 31 Jan 2002 22:43:54 -0000 1.2 +++ openacs-4/packages/ecommerce/www/category-browse-subcategory.tcl 26 May 2002 04:36:50 -0000 1.3 @@ -1,4 +1,3 @@ -# /www/ecommerce/category-browse-subcategory.tcl ad_page_contract { This one file is used to browse not only categories, but also subcategories and subsubcategories. @@ -12,8 +11,9 @@ @author @creation-date - @cvs-id category-browse-subcategory.tcl,v 3.2.2.7 2000/08/18 21:46:31 stevenp Exp @author ported by Jerry Asher (jerry@theashergroup.com) + @author revised by Bart Teeuwisse + @revision-date May 2002 } { category_id:notnull,naturalnum subcategory_id:optional,naturalnum @@ -84,46 +84,42 @@ # Recommended products in this category -set recommendations "" +set recommendations "" -set header_to_print "We Recommend

" -set header_printed 0 - if { [ad_parameter -package_id [ec_id] UserClassApproveP ecommerce] } { set user_class_approved_p_clause "and user_class_approved_p = 't'" } else { set user_class_approved_p_clause "" } -db_foreach get_recommended_products "select - p.product_name, p.product_id, p.dirname, r.recommendation_text -from ec_products_displayable p, ec_product_recommendations r -where p.product_id = r.product_id -and r.${sub}category_id=:${sub}category_id -and r.active_p='t' -and (r.user_class_id is null or r.user_class_id in - (select user_class_id - from ec_user_class_user_map m - where user_id=:user_id - $user_class_approved_p_clause)) -order by p.product_name" { +db_foreach get_recommended_products " + select p.product_id, p.product_name, p.dirname, r.recommendation_text, o.offer_code + from ec_product_recommendations r, ec_products_displayable 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 = r.product_id + and r.${sub}category_id=:${sub}category_id + and r.active_p='t' + and (r.user_class_id is null or r.user_class_id in (select user_class_id + from ec_user_class_user_map m + where user_id=:user_id + $user_class_approved_p_clause)) + order by p.product_name" { - if { !$header_printed } { - append recommendations $header_to_print - incr header_printed - } - append recommendations "

- - - - -
[ec_linked_thumbnail_if_it_exists $dirname "f" "t"]$product_name -

-$recommendation_text -

-" + append recommendations " + + [ec_linked_thumbnail_if_it_exists $dirname "f" "t"] + $product_name +

$recommendation_text

+ + [ec_price_line $product_id $user_id $offer_code] + " } +if {[string equal $recommendations ""]} { + set recommendations "" +} else { + append recommendations "
" +} + #============================== # products @@ -140,22 +136,31 @@ " } -set products "" +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 -from ec_products_searchable p, $product_map($sub) m -where p.product_id = m.product_id -and m.${sub}category_id = :${sub}category_id -$exclude_subproducts -order by p.product_name -" { +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" { if { $count >= $start && [expr $count - $start] < $how_many } { - append products "
[expr $count + 1]$product_name
$one_line_description
\n" + append products " + + [expr $count + 1] + $product_name + + + + $one_line_description + [ec_price_line $product_id $user_id $offer_code] + " } incr count if { $count > [expr $start + (2 * $how_many)] } { @@ -167,7 +172,7 @@ } } -append products "" +append products "" if { $start >= $how_many } { set prev_link "Previous $how_many" @@ -213,21 +218,7 @@ } } -set the_category_id [eval "ident \$${sub}category_id"] +set the_category_id $category_id set the_category_name [eval "ident \$${sub}category_name"] db_release_unused_handles -ec_return_template - - - - - - - - - - - - - - +ad_return_template