PHP File Manager
Editing File: Printer.php
<?php /* * Copyright (C) Wayne Purton-Smith - All Rights Reserved * Unauthorized copying of this file or removing this paragraph, via any medium is strictly prohibited * Proprietary and confidential * Written by Wayne Purton-Smith <waynepurtonsmith@hotmail.co.uk> February 2014 */ class Printer extends CI_Controller { public function shipping($order_id = NULL) { if(!(($order_id = (int) $order_id) > 0 && ($order_info = $this->orders->get($order_id)))) { exit('Order not found'); } $this->load->model('shipping/shipping'); if(isset($order_info->tracking_number)) { $command_file = 'assets/uploads/print-commands/' . md5($order_id) . '/' . $order_info->tracking_number . '.txt'; if(file_exists($command_file)) { if($this->input->post('get_print_data')) { $raw_command = file_get_contents($command_file); $print_type = ($order_info->courier_service == 'UPS') ? 'ZPL' : 'EPL'; if($print_type == 'EPL') { $command_contents = explode("\r", $raw_command); } elseif($print_type == 'ZPL') { $command_contents = explode("\n", $raw_command); } exit_with_json(array('type' => $print_type, 'command' => $command_contents, 'raw' => $raw_command)); } } } else { if($this->input->post('get_print_data')) { $raw_command = $this->shipping->generateAddressLabelOfOrder($order_id); $command_contents = explode("\n", $raw_command); exit_with_json(array('type' => 'ZPL', 'command' => $command_contents, 'raw' => $raw_command)); } } $this->load->view('templates/print/print-commander'); } public function dispatch_note($order_id = NULL) { if(!(($order_id = (int) $order_id) > 0 && ($order_info = $this->orders->get($order_id)))) { exit('Order not found'); } $data['order_info'] = $order_info; $order_items = $this->orders->getOrderItems($order_id); $products = array(); $gift_messages = array(); foreach($order_items as $item_info) { $products[] = input_value($item_info->name); if($item_info->gift_message !== NULL && !in_array($item_info->gift_message, $gift_messages)) { $gift_messages[] = $item_info->gift_message; } } $data['products'] = $products; $data['gift_messages'] = $gift_messages; $this->load->view('templates/print/dispatch-note', $data); } }
Cancel