select order_id from ec_orders where user_session_id=:user_session_id and order_state='in_basket'
select count(*) from ec_items where order_id=:order_id
select user_id from ec_orders where order_id=:order_id
select shipping_address from ec_orders where order_id=:order_id
update ec_orders
set shipping_method=:shipping_method,
tax_exempt_p=:tax_exempt_p
where order_id=:order_id
select user_class_id from ec_user_class_user_map where user_id=:user_id $additional_user_class_restriction
select default_shipping_per_item, weight_shipping_cost from ec_admin_settings
select add_exp_amount_per_item, add_exp_amount_by_weight from ec_admin_settings
select usps_abbrev from ec_addresses where address_id=:address_id
select tax_rate, shipping_p from ec_sales_tax_by_state where usps_abbrev=:usps_abbrev
select i.item_id, i.product_id, u.offer_code
from ec_items i
LEFT JOIN
(select * from ec_user_session_offer_codes usoc where usoc.user_session_id=:user_session_id) u
on (i.product_id=u.product_id)
where i.order_id=:order_id
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) where item_id=:item_id
select coalesce(base_shipping_cost,0) from ec_admin_settings
select coalesce(add_exp_base_shipping_cost,0) from ec_admin_settings
update ec_orders set shipping_charged=round(:order_shipping_cost,2), shipping_tax_charged=round(:tax_on_order_shipping_cost,2) where order_id=:order_id