Index: openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl 15 Nov 2008 22:00:40 -0000 1.32 +++ openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl 24 Nov 2008 11:49:36 -0000 1.33 @@ -989,21 +989,11 @@ set lowest_price [lindex $lowest_price_and_price_name 0] set lowest_price_description [lindex $lowest_price_and_price_name 1] if {![string equal "" $lowest_price_description]} { - set price_line " -
$lowest_price_description: | " + set price_line "$lowest_price_description: " } else { - set price_line " -
Our Price: | " + set price_line "Our price: " } - append price_line " -- [ec_pretty_price $lowest_price $currency] - | -
Compare to: | -|
Savings: | -[format %.2f [expr (($regular_price - $lowest_price) / $regular_price) * 100]]% | -
[ns_info name]/[ns_info patchlevel] on [ns_conn location]
+ }] + ad_script_abort + } + } - db_dml insert_user_session $__sql + } else { + + set user_session_id [db_nextval ec_user_session_sequence] + + ## use ACS 4 faster sessions + ## set user_session_id [ad_conn session_id] + + set ip_address [ns_conn peeraddr] + set http_user_agent [ecGetUserAgentHeader] + + # we should be able to get rid of this in ACS 4, but + # we need to examine longevity of ad_sessions + + db_dml insert_user_session $__sql + + set cookie_name "user_session_id" + set cookie_value $user_session_id + + set usca_p "t" + set final_page "[ns_conn url]?[export_url_vars usca_p]" + if ![empty_string_p $_ec_more_url_vars_exported] { + append final_page "&" $_ec_more_url_vars_exported + } - set cookie_name "user_session_id" - set cookie_value $user_session_id - - set usca_p "t" - set final_page "[ns_conn url]?[export_url_vars usca_p]" - if ![empty_string_p $_ec_more_url_vars_exported] { - append final_page "&" $_ec_more_url_vars_exported + # It would probably be good to add max_age as a + # parameter in the future + + ad_set_cookie -replace "t" -path "/" user_session_id $cookie_value + ad_returnredirect $final_page + ad_script_abort } - - # It would probably be good to add max_age as a - # parameter in the future - ad_set_cookie -replace "t" -path "/" user_session_id $cookie_value - ad_returnredirect $final_page - ad_script_abort } else { # usca_p has been set, but user id is still 0! So, @@ -1454,20 +1463,36 @@ in your browser. " ad_script_abort + } elseif {[string compare $_ec_cookie_requirement "cookies_are_not_required"] == 0} { # For this page continue - ns_log Notice "ec_create_new_session_if_necessary: ec_create_session cookies are off but that's okay, they aren't required." set current_url [ns_conn url] + set right_of_q [ad_conn query] + ns_log Notice "ec_create_new_session_if_necessary: ns_conn url = $current_url" if { [parameter::get -parameter CacheProductAsFile -default 0] && [string match "*[ec_url]product*" $current_url ] } { - regexp {product_id=([1-9][0-9]*)} $current_url scratch product_id + if { ![regexp {product_id=([1-9][0-9]*)} $right_of_q scratch product_id ] } { + regexp {product%f5id=([1-9][0-9]*)} $right_of_q scratch product_id + } if { [info exists product_id] } { db_0or1row get_sku_from_product_id "select sku from ec_products where product_id = :product_id" - if { [info exists sku] && [file exists "[file join [acs_root_dir] www [string trim [ec_url] /] ${sku}.html]"] } { + if { [info exists sku] } { # this is a valid product url, redirect to the existing static version - ad_returnredirect "[ec_url]${sku}.html" + # replacing ad_returnredirect "\[ec_url\]${sku}.html" with following so it works with return code 301 + set url "[ec_insecure_location][ec_url]${sku}.html" + ns_set update [ns_conn outputheaders] Location $url + ns_return 301 "text/html" [subst { + + +[ns_info name]/[ns_info patchlevel] on [ns_conn location]
+ }] ad_script_abort } }