public function get_order_data($ord_id) { $order = array(); if ($order['order'] = $this->get_order($ord_id)) { $order_summ = $this->get_order_sum($ord_id); $order['order'] = array_merge($order['order'], $order_summ); $order['order']['orders_status_name'] = $this->get_order_state_name($order['order']['orders_state']); $order['customer'] = $this->get_order_customer($order['order']['id_m_u_customers']); $order['addresses'] = $this->get_order_addresses($ord_id); $this->load->model('sales/minvoices'); $order['invoice'] = $this->minvoices->get_order_invoice($order['order'][self::ID_ORD]); if ($order['invoice']) { $order['invoice']['invoices_status_name'] = Minvoices::get_invoice_state_name($order['invoice']['invoices_status']); } $this->load->model('sales/mshippings'); $order['shipping'] = $this->mshippings->get_order_shipping($order['order'][self::ID_ORD]); if ($order['shipping']) { $order['shipping']['shippings_status_name'] = Mshippings::get_shipping_state_name($order['shipping']['shippings_status']); } if ($order['order'][self::ID_UPM] != NULL) { $order['order']['payment_method'] = $order['order']['payment_method_alias'] . ' - ' . $order['order']['pm_name']; } if ($order['order'][self::ID_USM] != NULL) { $order['order']['shipping_method'] = $order['order']['shipping_method_alias'] . ' - ' . $order['order']['sm_name']; } return $order; } return FALSE; }
function helper_shipping_view($data) { $form_id = 'shippings_view_shipping'; $CI =& get_instance(); $CI->load->library('form'); $CI->form->_init('Просмотр отправки', $form_id, set_url('*/*/edit_shipping/shp_id/' . $data['shipping']['id_m_orders_shippings'])); $CI->form->add_button(array('name' => 'Список доставок', 'href' => set_url('*/*'))); $CI->form->add_button(array('name' => 'Заказ ' . $data['order']['orders_number'], 'href' => set_url('*/orders/view/ord_id/' . $data['order']['id_m_orders']))); $CI->form->add_button(array('name' => 'Инвойс ' . $data['invoice']['invoices_number'], 'href' => set_url('*/invoices/view/inv_id/' . $data['invoice']['id_m_orders_invoices']))); if ($data['shipping']['shippings_status'] != 'CN' && $data['invoice']['invoices_status'] != 'C') { $CI->form->add_button(array('name' => 'Отменить отправку', 'href' => set_url('*/*/cancel_shipping/shp_id/' . $data['shipping']['id_m_orders_shippings']), 'options' => array('class' => 'action_question'))); } if ($data['shipping']['shippings_status'] == 'C') { $CI->form->add_button(array('name' => 'Отправить повторно письмо получателю', 'href' => set_url('*/shippings/send_shipping_mail/shp_id/' . $data['shipping']['id_m_orders_shippings']))); } if ($data['shipping']['shippings_status'] != 'CN' && $data['shipping']['shippings_status'] != 'C') { $CI->form->add_button(array('name' => 'Сохранить изменения', 'href' => '#', 'options' => array('id' => 'submit_back'))); } $CI->form->add_tab('s_d', 'Данные отправки'); $CI->form->add_tab('a_d', 'Данные получателя'); $shipping['shipping'] = $data['shipping']; $input_disabled = array(); $select_disabled = array(); if ($shipping['shipping']['shippings_status'] == 'CN' || $shipping['shipping']['shippings_status'] == 'C') { $input_disabled = array('readonly' => NULL); $select_disabled = array('readonly' => NULL, 'disabled' => NULL); } $CI->form->add_group('s_d', $shipping); $lid = $CI->form->group('s_d')->add_object('fieldset', 'order_address_b_fieldset', 'Информация об отправке'); if ($shipping['shipping']['shippings_status'] != 'CN') { $shp_states = Mshippings::get_shipping_state_collection(); unset($shp_states['CN']); $CI->form->group('s_d')->add_object_to($lid, 'select', 'shipping[shippings_status]', 'Состояние отправки :', array('options' => $shp_states, 'option' => array('id' => 'shipping_state') + $select_disabled)); } else { $shp_states = Mshippings::get_shipping_state_collection(); $CI->form->group('s_d')->add_object_to($lid, 'select', 'shipping[shippings_status]', 'Состояние отправки :', array('option' => $select_disabled, 'options' => $shp_states)); } $CI->form->group('s_d')->add_object_to($lid, 'text', 'shipping[shippings_number]', 'Номер отправки :', array('option' => array('readonly' => NULL))); if ($shipping['shipping']['shippings_status'] == 'N') { $CI->form->group('s_d')->add_object_to($lid, 'html', '<div id="shipping_send_mail" class="hidden">'); $CI->form->group('s_d')->add_object_to($lid, 'checkbox', 'shipping[send_mail]', 'Отправить письмо получателю :', array('value' => 1, 'option' => array('checked' => 'checked'))); $CI->form->group('s_d')->add_object_to($lid, 'textarea', 'shipping[note]', 'Сообщение получателю :', array('option' => array('rows' => 3))); $CI->form->group('s_d')->add_object_to($lid, 'html', '</div>'); $CI->form->add_js_code(' $(\'#shipping_state\').change(function() { if($(this).val() == \'C\') {$(\'#shipping_send_mail\').removeClass(\'hidden\');} else {$(\'#shipping_send_mail\').addClass(\'hidden\');} });'); } else { $CI->form->group('s_d')->add_object_to($lid, 'textarea', 'shipping[note]', 'Сообщение получателю :', array('option' => array('rows' => 3) + $input_disabled)); } $CI->form->group('s_d')->add_object_to($lid, 'textarea', 'shipping[admin_note]', 'Примечание к отправке :', array('option' => array('rows' => 3) + $input_disabled)); $CI->form->group('s_d')->add_object_to($lid, 'text', 'shipping[create_date]', 'Дата создания :', array('option' => array('readonly' => NULL))); $CI->form->group('s_d')->add_object_to($lid, 'text', 'shipping[update_date]', 'Дата обновления :', array('option' => array('readonly' => NULL))); $order['order'] = $data['order']; $CI->form->add_group('o_d', $order); $lid = $CI->form->group('o_d')->add_object('fieldset', 'order_address_b_fieldset', 'Информация о заказе'); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[orders_number]', 'Номер заказа :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[total_qty]', 'Сумарное количество единиц :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[subtotal]', 'Предварительная сумма :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[discount]', 'Скидка в валюте заказа :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[total]', 'Сумма :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[base_currency_name]', 'Базовая валюта :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[currency_name]', 'Валюта заказа :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[currency_rate]', 'Курс по отношению к базовой валюте :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[payment_method]', 'Метод оплаты :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[shipping_method]', 'Метод доставки :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'text', 'order[l_name]', 'Язык заказа :', array('option' => array('readonly' => NULL))); $CI->form->group('o_d')->add_object_to($lid, 'textarea', 'order[note]', 'Примечание к заказу :', array('option' => array('rows' => 3, 'readonly' => NULL))); $lid = $CI->form->group('o_d')->add_object('fieldset', 'order_products_data', 'Продукты заказа', array('style' => 'background-color:#CCCCCC;')); $CI->form->group('o_d')->add_object_to($lid, 'html', '<div align="center" style="margin:0 0 10px 0;"><a href="' . set_url('*/orders/ajax_show_products_with_photo/ord_id/' . $data['order']['id_m_orders']) . '" style="font-size:18px;" id="show_products_with_photo">Посмотреть продукты заказа с фото</a></div>'); $CI->form->group('o_d')->add_html_to($lid, $data['products']); $CI->form->group('o_d')->add_view('sales/shippings/view_shipping_js', array()); $ad['addresses'] = $data['addresses']; $CI->form->add_group('a_d', $ad); $CI->form->group('a_d')->add_object('text', 'addresses[S][name]', 'Фамидия, Имя :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][country]', 'Страна :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][city]', 'Область, Город :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][zip]', 'Индекс :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][address]', 'Адрес :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][telephone]', 'Телефон :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][fax]', 'Факс :', array('option' => array('readonly' => NULL))); $CI->form->group('a_d')->add_object('text', 'addresses[S][address_email]', 'E-Mail :', array('option' => array('readonly' => NULL))); $CI->form->add_block_to_tab('s_d', 's_d'); $CI->form->add_block_to_tab('s_d', 'o_d'); $CI->form->add_block_to_tab('a_d', 'a_d'); $CI->form->render_form(); }