Index: openacs-4/packages/ecommerce/www/address-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/Attic/address-2.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address-2.adp 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address-2.adp 5 Aug 2002 12:41:25 -0000 1.2 @@ -7,7 +7,7 @@ Enter Your Billing Address Has Been Store - + checkout {Select Billing Address}

Your Billing Address Has Been Stored

Index: openacs-4/packages/ecommerce/www/address-international-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/Attic/address-international-2.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address-international-2.adp 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address-international-2.adp 5 Aug 2002 12:41:25 -0000 1.2 @@ -7,7 +7,7 @@
Enter Your Billing Address Has Been Store - + checkout {Select Billing Address}

Your Billing Address Has Been Stored

Index: openacs-4/packages/ecommerce/www/address-international.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/address-international.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address-international.adp 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address-international.adp 5 Aug 2002 12:41:25 -0000 1.2 @@ -6,7 +6,7 @@

Enter Your Shipping Address

- + checkout {Select Billing Address}

Enter Your Billing Address

Index: openacs-4/packages/ecommerce/www/address-international.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/address-international.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address-international.tcl 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address-international.tcl 5 Aug 2002 12:41:25 -0000 1.2 @@ -50,6 +50,8 @@ set header_set [ns_conn headers] set action [ns_set get [ns_conn headers] Referer] +# This will set "action" to be "foo" out of "http://bar.com/baz/foo" +set action [string range $action [expr [string last "/" $action] +1] end] # Get the form vars that were passed on delete-address so that they # can be passed back to the calling url. gift-certificate-billing has Index: openacs-4/packages/ecommerce/www/address.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/address.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address.adp 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address.adp 5 Aug 2002 12:41:25 -0000 1.2 @@ -7,7 +7,7 @@
Enter Your Billing Address - + checkout {Select Billing Address}

Enter Your Billing Address

Index: openacs-4/packages/ecommerce/www/address.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/address.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/address.tcl 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/address.tcl 5 Aug 2002 12:41:25 -0000 1.2 @@ -68,6 +68,8 @@ set header_set [ns_conn headers] set action [ns_set get [ns_conn headers] Referer] +# This will set "action" to be "foo" out of "http://bar.com/baz/foo" +set action [string range $action [expr [string last "/" $action] + 1] end] # Get the form vars that were passed on delete-address so that they # can be passed back to the calling url. gift-certificate-billing has Index: openacs-4/packages/ecommerce/www/delete-address.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/delete-address.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/delete-address.tcl 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/delete-address.tcl 5 Aug 2002 12:41:25 -0000 1.2 @@ -33,6 +33,8 @@ set header_set [ns_conn headers] set action [ns_set get [ns_conn headers] Referer] +# This will set "action" to be "foo" out of "http://bar.com/baz/foo" +set action [string range $action [expr [string last "/" $action] + 1] end] # Get the form vars that were passed on delete-address so that they # can be passed back to the calling url. gift-certificate-billing has Index: openacs-4/packages/ecommerce/www/shopping-cart.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/shopping-cart.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/shopping-cart.adp 26 May 2002 05:09:57 -0000 1.1 +++ openacs-4/packages/ecommerce/www/shopping-cart.adp 5 Aug 2002 12:41:25 -0000 1.2 @@ -5,8 +5,94 @@

Your Shopping Cart

-

@cart_contents@

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Shopping Cart ItemsOptionsQuantityPrice/ItemAction
+ @in_cart.product_name@ + + + Color: @in_cart.color_choice@ + + +
Size: @in_cart.size_choice@ +
+ +
Style: @in_cart.style_choice@ +
+
+ + + @price_line@ + + delete +
Total:@product_counter@@pretty_total_price@
+ Residents of @tax_entries.state@, please add @tax_entries.pretty_tax@ tax. +
+
+
+ +
+
+
+
+
+
+ +
Your Shopping Cart is empty.
+
+
Index: openacs-4/packages/ecommerce/www/shopping-cart.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/shopping-cart.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/shopping-cart.tcl 26 May 2002 04:36:50 -0000 1.3 +++ openacs-4/packages/ecommerce/www/shopping-cart.tcl 5 Aug 2002 12:41:25 -0000 1.4 @@ -19,14 +19,14 @@ # Create the link now before the product_id gets overwritten when # looping through the products in the cart. +set previous_product_id_p 0 +set previous_product_id 0 + if {[info exists product_id]} { - set bottom_links "
  • Continue Shopping
  • " -} else { - set bottom_links "
  • Continue Shopping
  • " -} + set previous_product_id_p 1 + set previous_product_id $product_id +} -set cart_contents "" - # We don't need them to be logged in, but if they are they might get a # lower price @@ -49,7 +49,8 @@ set product_counter 0 set total_price 0 -db_foreach get_products_in_cart " + +db_multirow in_cart get_products_in_cart " select p.product_name, p.one_line_description, p.product_id, count(*) as quantity, u.offer_code, i.color_choice, i.size_choice, i.style_choice from ec_orders o, ec_items i, ec_products p, (select product_id, offer_code from ec_user_session_offer_codes usoc where usoc.user_session_id=:user_session_id) u @@ -59,54 +60,14 @@ and o.user_session_id=:user_session_id and o.order_state='in_basket' group by p.product_name, p.one_line_description, p.product_id, u.offer_code, i.color_choice, i.size_choice, i.style_choice" { - # No products listed yet, print header. - - if { $product_counter == 0 } { - append cart_contents " -
    -
    - - - - - - - - " - } - - # Prepare color, size and style option list - - set option_list [list] - if { ![empty_string_p $color_choice] } { - lappend option_list "Color: $color_choice" - } - if { ![empty_string_p $size_choice] } { - lappend option_list "Size: $size_choice" - } - if { ![empty_string_p $style_choice] } { - lappend option_list "Style: $style_choice" - } - set options [join $option_list "
    "] - - # Print the product with name, selected options and quantity - - append cart_contents " - - - - " - # Deletions are done by product_id, color_choice, size_choice, # style_choice, not by item_id because we want to delete the # entire quantity of that product. Also print the price for a # product of the selected options and the aforementioned delete # option. - append cart_contents " - - - " + set price_line [ec_price_line $product_id $user_id $offer_code] + set delete_export_vars [export_url_vars product_id color_choice size_choice style_choice] # Too bad I have to do another call to get the price. That is # because ec_price_line returns canned html instead of the price. @@ -121,50 +82,18 @@ } # Add adjust quantities line if there are products in the cart. +set pretty_total_price [ec_pretty_price $total_price [ad_parameter -package_id [ec_id] Currency]] -if { $product_counter != 0 } { - append cart_contents " - - - - - - " +# List the states that get charged tax. Although not 100% accurate +# as shipping might be taxed too this is better than nothing. - # List the states that get charged tax. Although not 100% accurate - # as shipping might be taxed too this better than nothing. - - db_foreach tax_states " - select tax_rate, initcap(state_name) as state +db_multirow -extend { pretty_tax } tax_entries tax_states " + select tax_rate, initcap(state_name) as state from ec_sales_tax_by_state tax, us_states state where state.abbrev = tax.usps_abbrev" { - append cart_contents " - - - " - } + set pretty_tax "[format %0.2f [expr $tax_rate * 100]]%" } -# Close product listing and add proceed to checkout button. - -if { $product_counter != 0 } { - append cart_contents " -
    Shopping Cart ItemsOptionsQuantityPrice/ItemAction
    $product_name$options[ec_price_line $product_id $user_id $offer_code]delete
    Total:$product_counter[ec_pretty_price $total_price [ad_parameter -package_id [ec_id] Currency]]
    Residents of $state, please add [format %0.2f [expr $tax_rate * 100]]% tax.
    -
    -
    -
    -
    -
    -
    -
    " -} else { - - # There are no products in the cart. - - append cart_contents " -
    Your Shopping Cart is empty.
    " -} - # bottom links: # 1) continue shopping (always and already created) # 2) log in (if they're not logged in) @@ -174,32 +103,20 @@ if { $user_id == 0 } { # Case 2) the user is not logged in. + set return_url=[ns_urlencode "[ec_url]"] - append bottom_links " -
  • Log In
  • " } else { - if { ![empty_string_p [db_string check_for_saved_carts " + # Case 3) Retrieve saved carts + set saved_carts_p [db_string check_for_saved_carts " select 1 from dual where exists ( select 1 from ec_orders where user_id=:user_id and order_state='in_basket' - and saved_p='t')" -default ""]] } { - - # Case 3) Retrieve saved carts - - append bottom_links "
  • Retrieve a Saved Cart
  • " - } + and saved_p='t')" -default ""] } -if { $product_counter != 0 } { - - # Case 4) Save non empty cart - - append bottom_links "
  • Save Your Cart for Later
  • " -} - db_release_unused_handles ad_return_template