postgresql
7.1
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, '' as price
from ec_orders o
join ec_items i on (o.order_id=i.order_id)
join ec_products p on (i.product_id=p.product_id)
left join (select product_id, offer_code
from ec_user_session_offer_codes usoc
where usoc.user_session_id=:user_session_id) u on (p.product_id=u.product_id)
where 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
select coalesce(base_shipping_cost,0) as base_shipping_cost,
coalesce(default_shipping_per_item,0) as default_shipping_per_item,
coalesce(weight_shipping_cost,0) as weight_shipping_cost,
coalesce(add_exp_base_shipping_cost,0) as add_exp_base_shipping_cost,
coalesce(add_exp_amount_per_item,0) as add_exp_amount_per_item,
coalesce(add_exp_amount_by_weight,0) as add_exp_amount_by_weight
from ec_admin_settings"