Index: openacs-4/packages/ecommerce/www/checkout-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/checkout-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/checkout-2.tcl 31 Jan 2002 22:43:54 -0000 1.4 +++ openacs-4/packages/ecommerce/www/checkout-2.tcl 16 Feb 2002 23:32:06 -0000 1.5 @@ -7,6 +7,7 @@ @creation-date @cvs-id checkout-2.tcl,v 3.7.2.13 2000/08/18 21:46:32 stevenp Exp @author ported by Jerry Asher (jerry@theashergroup.com) + @author Bart Teeuwisse } { address_id:optional,naturalnum usca_p:optional @@ -16,9 +17,7 @@ # we need them to be logged in set user_id [ad_verify_and_get_user_id] - if {$user_id == 0} { - set return_url "[ad_conn url]" ad_returnredirect "/register?[export_url_vars return_url]" return @@ -30,51 +29,36 @@ # attempted before # 3. if it has been attempted before, give them message that we can't do shopping carts # without cookies - set user_session_id [ec_get_user_session_id] ec_create_new_session_if_necessary [export_url_vars address_id] -# type5 # make sure they have an in_basket order, otherwise they've probably # gotten here by pushing Back, so return them to index.tcl - -set success_p [db_0or1row get_order_id_and_order_owner " - select order_id, - user_id as order_owner - from ec_orders - where user_session_id=:user_session_id - and order_state='in_basket' - "] - - +set success_p [db_0or1row get_order_id_and_order_owner " select order_id, user_id as order_owner from ec_orders where user_session_id=:user_session_id and order_state='in_basket' "] if { ! $success_p } { # No rows came back, so they probably got here by pushing "Back", so just redirect them # to index.tcl - ad_returnredirect index.tcl + ad_returnredirect [ec_url]index.tcl return } if { $order_owner != $user_id } { - # make sure the order belongs to this user_id (why? because before this point there was no # personal information associated with the order (so it was fine to go by user_session_id), # but now there is, and we don't want someone messing with their user_session_id cookie and # getting someone else's order) - # if they get here, - # either they managed to skip past checkout.tcl, or they messed + # if they get here, either they managed to skip past checkout.tcl, or they messed # w/their user_session_id cookie; - ad_returnredirect checkout.tcl + ad_returnredirect [ec_securelink [ec_url]checkout.tcl] return } - # make sure there's something in their shopping cart, otherwise # redirect them to their shopping cart which will tell them # that it's empty. - if { [db_string get_ec_item_count "select count(*) from ec_items where order_id=:order_id"] == 0 } { - ad_returnredirect shopping-cart + ad_returnredirect [ec_url]shopping-cart return } @@ -91,43 +75,29 @@ # to checkout.tcl if { [info exists address_id] && ![empty_string_p $address_id] } { - set n_this_address_id_for_this_user [db_string get_an_address_id "select count(*) from ec_addresses where address_id=:address_id and user_id=:user_id"] if {$n_this_address_id_for_this_user == 0} { - - ad_returnredirect checkout + ad_returnredirect [ec_securelink [ec_url]checkout] return } # it checks out ok db_dml update_ec_order_address "update ec_orders set shipping_address=:address_id where order_id=:order_id" } else { set address_id [db_string get_address_id "select shipping_address from ec_orders where order_id=:order_id" -default ""] if { [empty_string_p $address_id] } { - ad_returnredirect checkout + ad_returnredirect [ec_securelink [ec_url]checkout] return } } # everything is ok now; the user has a non-empty in_basket order and an # address associated with it, so now get the other necessary information - -# array set drivers [ec_preferred_drivers] - -# if { [ad_ssl_available_p] } { -# set ssl_port [ns_config -int "ns/server/[ns_info server]/module/$drivers(sdriver)" Port 443] -# if { $ssl_port == 443 } { -# set ssl_port "" -# } else { -# set ssl_port ":$ssl_port" -# } -# set form_action "https://[ns_config ns/server/[ns_info server]/module/$drivers(sdriver) Hostname]${ssl_port}[ec_url]process-order-quantity-shipping" -# } else { -# set form_action "http://[ns_config ns/server/[ns_info server]/module/$drivers(driver) Hostname][ec_url]process-order-quantity-shipping" -# } - -set form_action [ec_securelink [ec_url]process-order-quantity-shipping] +if { [ad_parameter -package_id [ec_id] ExpressShippingP ecommerce] } { + set form_action [ec_securelink [ec_url]select-shipping] +} else { + set form_action [ec_securelink [ec_url]process-order-quantity-shipping] +} set rows_of_items "" - set shipping_avail_p 1 db_foreach get_shipping_data " @@ -173,33 +143,8 @@ " } -set shipping_options "" -set checkout_step verify - -if { [ad_parameter -package_id [ec_id] ExpressShippingP ecommerce] } { - if { $shipping_avail_p } { - set checkout_step shipping - append shipping_options "

-

  • Shipping method: -

    - Standard Shipping
    - Express
    - Pickup -

    - " - } else { - set shipping_method "no shipping" - append shipping_options "

    -

  • No Shipping Available: -

    - [export_form_vars shipping_method] - One or more items in your order are not shippable. -

    - " - } -} +set checkout_step {Verify Order} set tax_exempt_options "" - if { [ad_parameter -package_id [ec_id] OfferTaxExemptStatusP ecommerce 0] } { append tax_exempt_options "

  • Is your organization tax exempt? (If so, we will ask you to @@ -208,5 +153,6 @@ Yes
    No" } + db_release_unused_handles ec_return_template