سؤال

I have installed an extension which converts the standard order_invoice.tpl to pdf.

This extension creates one more button "Download pdf invoice".

Now there are two buttons. One is opencart default "PRINT INVOICE" and second is "DOWNLOAD PDF INVOICE". As of now they both are pointing to order_invoice.tpl.

Can I make this functionality as below:

  1. "PRINT INVOICE": points to new order_invoice1.tpl
  2. "DOWNLOAD PDF INVOICE" points to default order_invoice.tpl

I have tried creating another ORDER_INVOICE1.TPL in admin\view\template\sale

And I had also updated order.php (admin\controller\sale) at bottom end as below:

                    }
        }

        $this->template = 'sale/order_invoice.tpl';
        $this->template = 'sale/order_invoice1.tpl';


        $this->response->setOutput($this->render());
    }
}
?>

Could someone please assist me if I am missing something as its not working out. This will help customise templates based on the type of orders and customer residing in different locations.

Link to extension : http://www.opencart.com/index.php?route=extension/extension/info&extension_id=6331

هل كانت مفيدة؟

المحلول

As per the link given by you to the extension

there is a code in invoice-to-pdf-1.21.154.xml

if ($pdf){
    $this->response->setOutput(pdf($this->render(),$this->data['orders']));
}else{
    $this->response->setOutput($this->render());
}

replace it with

if ($pdf){
    $this->template = 'sale/order_invoice_for_pdf.tpl';
    $this->response->setOutput(pdf($this->render(),$this->data['orders']));
}else{
    $this->template = 'sale/order_invoice.tpl';
    $this->response->setOutput($this->render());
}

now you can have two separate tpl order_invoice_for_pdf.tpl and order_invoice.tpl for different purposes

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top