select order_id from ec_orders where user_session_id=:user_session_id and order_state='in_basket' select gift_certificate_id from ec_gift_certificates where claim_check=:claim_check select user_id as gift_certificate_user_id, amount from ec_gift_certificates where gift_certificate_id=:gift_certificate_id select user_id from ec_creditcards where creditcard_id=:creditcard_id select address_id from ec_addresses where user_id=:user_id and address_type = 'shipping' update ec_orders set creditcard_id=:creditcard_id where order_id=:order_id insert into ec_creditcards (creditcard_id, user_id, creditcard_number, creditcard_last_four, creditcard_type, creditcard_expire, billing_address) values (:creditcard_id, :user_id, :creditcard_number, :cc_no , :creditcard_type, :expiry, :billing_address_id) update ec_creditcards set billing_address = :billing_address_id where creditcard_id = :creditcard_id update ec_orders set creditcard_id=:creditcard_id where order_id=:order_id update ec_orders set creditcard_id=null where order_id=:order_id update ec_addresses set attn=:attn, line1=:line1, line2=:line2, city=:city, usps_abbrev=:usps_abbrev, zip_code=:zip_code, phone=:phone, phone_time=:phone_time where address_id=:address_id update ec_items 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 update ec_orders set shipping_address=:address_id 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 order_id from ec_orders where user_session_id=:user_session_id and order_state='in_basket' select attn, line1, line2, city, usps_abbrev, zip_code, phone, country_code, full_state_name, phone_time from ec_addresses where address_id=:address_id and user_id=:user_id update ec_addresses set attn = :attn, line1 = :line1, line2 = :line2, usps_abbrev = :usps_abbrev, city = :city, full_state_name = :full_state_name, zip_code = :zip_code, country_code = :country_code, phone = :phone, phone_time = :phone_time where address_id = :address_id 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 update ec_orders set shipping_address=:address_id where order_id=:order_id insert into ec_addresses (address_id, user_id, address_type, attn, line1, line2, city, usps_abbrev, full_state_name, zip_code, country_code, phone, phone_time) values (:address_id, :user_id, :address_type, :attn,:line1,:line2,:city,:usps_abbrev,:full_state_name,:zip_code,:country_code,:phone,:phone_time) update ec_orders set shipping_address=:address_id where order_id=:order_id 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 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