public function get_checkout_shopping_basket_for_current_session_table()
 {
     $shopping_baskets_table = $this->get_element();
     $database = $shopping_baskets_table->get_database();
     $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
     $customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']);
     $currency = $customer_region->get_currency();
     $shopping_baskets_table = $this->get_element();
     $checkout_shopping_basket_table = new HTMLTags_Table();
     $checkout_shopping_basket_table->set_attribute_str('id', 'shopping-basket-table');
     $caption = new HTMLTags_Caption('Your Shopping Basket');
     $checkout_shopping_basket_table->append_tag_to_content($caption);
     // THEAD
     $thead = new HTMLTags_THead();
     $thead_tr = new HTMLTags_TR();
     $name_th = new HTMLTags_TH('Name');
     $price_th = new HTMLTags_TH('Unit Price');
     $quantity_th = new HTMLTags_TH('Amount');
     $sub_total_th = new HTMLTags_TH('Sub-Total');
     $thead_tr->append_tag_to_content($name_th);
     $thead_tr->append_tag_to_content($price_th);
     $thead_tr->append_tag_to_content($quantity_th);
     $thead_tr->append_tag_to_content($sub_total_th);
     $thead->append_tag_to_content($thead_tr);
     $checkout_shopping_basket_table->append_tag_to_content($thead);
     // TFOOT
     $tfoot = new HTMLTags_TFoot();
     $blank_td = new HTMLTags_TD('');
     // TFOOT - sub-total-tr
     $tfoot_sub_total_tr = new HTMLTags_TR();
     $sub_total_price = new Shop_SumOfMoney($shopping_baskets_table->get_sub_total_for_current_session($customer_region), $currency);
     $sub_total_th = new HTMLTags_TH('Sub-Total');
     $sub_total_td = new HTMLTags_TD($sub_total_price->get_as_string());
     $tfoot_sub_total_tr->append_tag_to_content($blank_td);
     $tfoot_sub_total_tr->append_tag_to_content($blank_td);
     $tfoot_sub_total_tr->append_tag_to_content($sub_total_th);
     $tfoot_sub_total_tr->append_tag_to_content($sub_total_td);
     $tfoot->append_tag_to_content($tfoot_sub_total_tr);
     // TFOOT - shipping-tr
     $shipping_price = new Shop_SumOfMoney($shopping_baskets_table->get_shipping_total_for_current_session($customer_region->get_id()), $currency);
     $tfoot_shipping_tr = new HTMLTags_TR();
     $shipping_th = new HTMLTags_TH('Shipping');
     $shipping_td = new HTMLTags_TD($shipping_price->get_as_string());
     $tfoot_shipping_tr->append_tag_to_content($blank_td);
     $tfoot_shipping_tr->append_tag_to_content($blank_td);
     $tfoot_shipping_tr->append_tag_to_content($shipping_th);
     $tfoot_shipping_tr->append_tag_to_content($shipping_td);
     $tfoot->append_tag_to_content($tfoot_shipping_tr);
     // TFOOT - total-tr
     $total_price = new Shop_SumOfMoney($shopping_baskets_table->get_total_for_current_session($customer_region->get_id()), $currency);
     $tfoot_total_tr = new HTMLTags_TR();
     $total_th = new HTMLTags_TH('Total');
     $total_td = new HTMLTags_TD($total_price->get_as_string());
     $tfoot_total_tr->append_tag_to_content($blank_td);
     $tfoot_total_tr->append_tag_to_content($blank_td);
     $tfoot_total_tr->append_tag_to_content($total_th);
     $tfoot_total_tr->append_tag_to_content($total_td);
     $tfoot->append_tag_to_content($tfoot_total_tr);
     $checkout_shopping_basket_table->append_tag_to_content($tfoot);
     // TBODY
     $tbody = new HTMLTags_TBody();
     try {
         $shopping_baskets = $shopping_baskets_table->get_shopping_baskets_for_current_session();
     } catch (Exception $e) {
     }
     if (count($shopping_baskets) > 0) {
         foreach ($shopping_baskets as $shopping_basket) {
             $shopping_basket_renderer = $shopping_basket->get_renderer();
             $shopping_basket_tr = $shopping_basket_renderer->get_checkout_shopping_basket_tr();
             $tbody->append_tag_to_content($shopping_basket_tr);
         }
     }
     $checkout_shopping_basket_table->append_tag_to_content($tbody);
     return $checkout_shopping_basket_table;
 }
 public function get_checkout_order_for_current_session_table()
 {
     $orders_table = $this->get_element();
     $database = $orders_table->get_database();
     $customer_regions_table = $database->get_table('hpi_shop_customer_regions');
     $orders_table = $this->get_element();
     $checkout_order_table = new HTMLTags_Table();
     $caption = new HTMLTags_Caption('Your Shopping Basket');
     $checkout_order_table->append_tag_to_content($caption);
     // THEAD
     $thead = new HTMLTags_THead();
     $thead_tr = new HTMLTags_TR();
     $name_th = new HTMLTags_TH('Name');
     $price_th = new HTMLTags_TH('Unit Price');
     $quantity_th = new HTMLTags_TH('Amount');
     $sub_total_th = new HTMLTags_TH('Sub-Total');
     $thead_tr->append_tag_to_content($name_th);
     $thead_tr->append_tag_to_content($price_th);
     $thead_tr->append_tag_to_content($quantity_th);
     $thead_tr->append_tag_to_content($sub_total_th);
     $thead->append_tag_to_content($thead_tr);
     $checkout_order_table->append_tag_to_content($thead);
     // TFOOT
     $tfoot = new HTMLTags_TFoot();
     $blank_td = new HTMLTags_TD('');
     // TFOOT - sub-total-tr
     $tfoot_sub_total_tr = new HTMLTags_TR();
     $sub_total_th = new HTMLTags_TH('Sub-Total');
     $sub_total_td = new HTMLTags_TD($orders_table->get_sub_total_for_current_session());
     $tfoot_sub_total_tr->append_tag_to_content($blank_td);
     $tfoot_sub_total_tr->append_tag_to_content($blank_td);
     $tfoot_sub_total_tr->append_tag_to_content($sub_total_th);
     $tfoot_sub_total_tr->append_tag_to_content($sub_total_td);
     $tfoot->append_tag_to_content($tfoot_sub_total_tr);
     // TFOOT - shipping-tr
     $tfoot_shipping_tr = new HTMLTags_TR();
     $shipping_th = new HTMLTags_TH('Shipping');
     $shipping_td = new HTMLTags_TD($orders_table->get_shipping_total_for_current_session());
     $tfoot_shipping_tr->append_tag_to_content($blank_td);
     $tfoot_shipping_tr->append_tag_to_content($blank_td);
     $tfoot_shipping_tr->append_tag_to_content($shipping_th);
     $tfoot_shipping_tr->append_tag_to_content($shipping_td);
     $tfoot->append_tag_to_content($tfoot_shipping_tr);
     // TFOOT - total-tr
     $tfoot_total_tr = new HTMLTags_TR();
     $total_th = new HTMLTags_TH('Total');
     $total_td = new HTMLTags_TD($orders_table->get_total_for_current_session($shipping_location));
     $tfoot_total_tr->append_tag_to_content($blank_td);
     $tfoot_total_tr->append_tag_to_content($blank_td);
     $tfoot_total_tr->append_tag_to_content($total_th);
     $tfoot_total_tr->append_tag_to_content($total_td);
     $tfoot->append_tag_to_content($tfoot_total_tr);
     $checkout_order_table->append_tag_to_content($tfoot);
     // TBODY
     $tbody = new HTMLTags_TBody();
     try {
         $orders = $orders_table->get_orders_for_current_session();
     } catch (Exception $e) {
     }
     if (count($orders) > 0) {
         foreach ($orders as $order) {
             $order_renderer = $order->get_renderer();
             $order_tr = $order_renderer->get_checkout_order_tr();
             $tbody->append_tag_to_content($order_tr);
         }
     }
     $checkout_order_table->append_tag_to_content($tbody);
     return $checkout_order_table;
 }