Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl 5 Aug 2005 05:40:09 -0000 1.11 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.tcl 10 Aug 2005 21:17:47 -0000 1.12 @@ -852,7 +852,8 @@ } elseif { $method == "check" || $method == "cash" || $method == "invoice" || - $method == "scholarship" + $method == "scholarship" || + $method == "lockbox" } { if { [db_0or1row check_transaction { select 1 Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.xql 23 Jun 2005 12:28:22 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form-2.xql 10 Aug 2005 21:17:47 -0000 1.2 @@ -96,7 +96,7 @@ update ec_items - set price_charged=round(:price_charged,2), price_name=:price_name, shipping_charged=round(:shipping_charged,2), price_tax_charged=round(:tax_charged,2), shipping_tax_charged=round(:shipping_tax,2) + set price_charged=coalesce(price_charged, round(:price_charged,2)), price_name=coalesce(price_name, :price_name), shipping_charged=round(:shipping_charged,2), price_tax_charged=round(:tax_charged,2), shipping_tax_charged=round(:shipping_tax,2) where item_id=:item_id Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl 5 Aug 2005 13:06:02 -0000 1.19 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl 10 Aug 2005 21:17:47 -0000 1.20 @@ -150,7 +150,11 @@ and i.product_id = p.product_id group by p.product_name, p.one_line_description, p.product_id, i.price_name, i.price_charged, i.color_choice, i.size_choice, i.style_choice, c.offer_code" { if {$product_id != $last_product_id} { - set lowest_price [lindex [ec_lowest_price_and_price_name_for_an_item $product_id $user_id $offer_code] 0] + if { ! [empty_string_p $price_charged] } { + set lowest_price $price_charged + } else { + set lowest_price [lindex [ec_lowest_price_and_price_name_for_an_item $product_id $user_id $offer_code] 0] + } } set option_list [list] if { ![empty_string_p $color_choice] } { @@ -586,6 +590,9 @@ # admins by logic, but this can be set in the param lappend method_options [list "[_ dotlrn-ecommerce.Scholarship]" scholarship] } + lockbox { + lappend method_options [list "[_ dotlrn-ecommerce.Lock_Box]" lockbox] + } } incr method_count } @@ -676,11 +683,13 @@ } elseif { [lsearch $payment_methods internal_account] != -1 } { set method internal_account } elseif { [lsearch $payment_methods cash] != -1 } { - set method internal_account + set method cash } elseif { [lsearch $payment_methods invoice] != -1 } { - set method internal_account + set method invoice } elseif { [lsearch $payment_methods scholarship] != -1 } { - set method internal_account + set method scholarship + } elseif { [lsearch $payment_methods lockbox] != -1 } { + set method lockbox } } -on_submit { Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 19 Jul 2005 04:03:33 -0000 1.7 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 10 Aug 2005 21:17:47 -0000 1.8 @@ -172,6 +172,11 @@ set edit_url [export_vars -base ../admin/process-purchase-course { section_id participant_id {user_id $patron_id} }] } +# MoS Specific: Give a discounts if user has more than one item in cart +set multi_item_discount_p [parameter::get -parameter MultipleItemDiscountP -default 0] +set start_applying_discount_p 0 +set multi_item_discount [parameter::get -parameter MultipleItemDiscountAmount -default 5] + for {set i 1} {$i <= [template::multirow size in_cart]} {incr i} { set product_name [template::multirow get in_cart $i product_name] @@ -190,6 +195,9 @@ set patron_id [template::multirow get in_cart $i patron_id] set participant_id [template::multirow get in_cart $i participant_id] + set item_id [template::multirow get in_cart $i item_id] + set section_id [template::multirow get in_cart $i section_id] + set max_quantity_length [max $max_add_quantity_length [string length $quantity]] # Deletions are done by product_id, color_choice, size_choice, # style_choice, not by item_id because we want to delete the @@ -206,7 +214,26 @@ set lowest_price_and_price_name [ec_lowest_price_and_price_name_for_an_item $product_id $user_id $offer_code] set lowest_price [lindex $lowest_price_and_price_name 0] + # MoS Specific: Give a discounts if user has more than one item in cart + if { $multi_item_discount_p && ! [empty_string_p $section_id] } { + if { $start_applying_discount_p } { + set discounted_price_name "[ec_pretty_price $multi_item_discount] Off" + set lowest_price_and_price_name [list $lowest_price $discounted_price_name] + set lowest_price [expr $lowest_price - $multi_item_discount] + # Set the discounted price now so it'll be recognized by the + # ecommerce procs, if the product is a section + db_dml set_price_charged { + update ec_items + set price_name = :discounted_price_name, + price_charged = :lowest_price + where item_id = :item_id + } + } else { + set start_applying_discount_p 1 + } + } + # Calculate line subtotal for end users set line_subtotal [ec_pretty_price [expr $quantity * $lowest_price] $currency] template::multirow set in_cart $i line_subtotal $line_subtotal