if ($task == 'printOrder') { ?> <script type="text/javascript"> window.print(); </script> <?php } ?> <div class="j2store-order"> <div class="j2store-invoice-template"> <?php if (isset($this->order) && $this->error == false) { ?> <?php echo J2Store::invoice()->getFormatedInvoice($this->order, array()); ?> <?php } else { ?> <div class="alert alert-block alert-warning"> <?php echo $this->errormsg; ?> </div> <?php } ?> </div> </div>
public function createOrderPdf() { $app = JFactory::getApplication(); $order_id = $this->input->getString('order_id'); $view = $this->getThisView(); if ($model = $this->getThisModel()) { // Push the model into the view (as default) $view->setModel($model, true); } $order = F0FTable::getInstance('Order', 'J2StoreTable')->getClone(); $order->load(array('order_id' => $order_id)); if ($this->validate($order)) { $error = false; $view->assign('order', $order); } else { $msg = JText::_('J2STORE_ORDER_MISMATCH_OR_NOT_FOUND'); $msg_type = 'warning'; $error = true; $view->assign('errormsg', $msg); } if (!$error) { $msg_type = 'success'; $name = 'j2store_invoice_' . $order->order_id; $msg = JText::_('J2STORE_INVOICE_PDF_GENERATED_SUCCESSFULLY'); if (!J2Store::invoice()->createPdf($order)) { $msg_type = 'warning'; $msg = JText::_('J2STORE_INVOICE_PDF_GENERATED_ERROR'); } } $this->setRedirect(JRoute::_('index.php?option=com_j2store&view=myprofile'), $msg, $msg_type); }