Make 2 views for Invoice and Shipping Invoice

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
8 years 2 months ago #248704

-- HikaShop version -- : 2.6.3

Hi Hikashop,

I have a wish to make two views instead of 1 for the Invoice and Shipping Invoice.

Customers have sometimes wishes for the lay-out of the invoice or shipping invoice but it's very difficult if you have anything adapt to the invoice/shipping invoice this immediately affects the other view.

Sometimes it's not possible to make the changes or it's makes it unnecessarily complicated.

So I have a wish to make two views instead of 1.

So one for the shipping invoice and
One for the invoice.

Hope you can see the benefits of this ;-)

Kind regards,
Lumiga


Kind regards,
Lumiga

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #248714

Hi,

You can create new "views" using the view override system.
Just put new files in the template override folder and you'll have your views.
Then, in the invoice view, you can use

if($this->invoice_type != 'full') {
  $this->setLayout('shipping_invoice');
  echo $this->loadTemplate();
  return;
}

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
8 years 2 months ago #248799

Hi Jerome,

Thanks for your answer, but it's not clear to me what to do.
I have to open the invoice view and give it an other name like shipping_invoice and then I get a new view?
I have to split all the code from the invoice into the 2 different views?
I have to put you code into the invoice? But where do I put this code and what does this code mean?

Summarize, splitting up the code is a bit to complicated for the most customers.
A little bit customization is fine, but this looks very complicated.

I see a lot of issues regarding people who struggle with the question editing the shipping invoice of invoice but not knowing this is in the same view. Please consider to make 2 views for it. Why making it so complicated for your customers.

Kind regards,
Lumiga


Kind regards,
Lumiga

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 2 months ago #248805

Hi,

We make it one view specifically to make it easier for people to customize the invoices and shipping invoices.

And if you want to have two views, it's not difficult. You can just do as Jerome explained.
So you put his code at the top of the file "invoice" of the view "order" for your backend template via the menu Display>Views.
Then, you create a file administrator/templates/YOUR_TEMPLATE/html/com_hikashop/order/shipping_invoice.php where you put the code you want for the shipping invoice (basically a copy of what you have in the order/invoice view file).
Then, the order/invoice view will be for the invoice only and the order/shipping_invoice will be for the shipping invoice only.

Please Log in or Create an account to join the conversation.

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
8 years 2 months ago #248860

Oké thanks, funny that you made it easier for people. :)
For me as a non programmer t's just more complicated.

For example when I want to get rid of the border and the text (shipping address) from the address on the shipping_invoice. It's also gone on the invoice, but there are two addresses so in that case it's not a good idea.

If I make a copy, then there is a lot of extra code you don't need for only the invoice or shipping_invoice and for my that's complicated.

But I make a copy of the views and try to split the code.

Thanks for your extra information.

Kind Regards,
Lumiga


Kind regards,
Lumiga

Please Log in or Create an account to join the conversation.

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
8 years 2 months ago #248867

Hi Nicolas/Jerome,

I have successfully made the second view for the shipping_invoice and it works fine.
Thanks for the code Jerome. :)

But is it correct that when I use the trash button "Remove customization" on the new shipping_invoice view that the whole file is deleted?
Because after I used the trash button "Remove customization" I had to put back the shipping_invoice.php file on the map: administrator/templates/YOUR_TEMPLATE/html/com_hikashop/order/

Maybe a bug or something?


Kind regards,
Lumiga

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #248870

Hi,

The trash button is there to delete the view override ; the view file stored in the template folder.
In your case, there is no corresponding view in the HikaShop view folder ; but because your file is in the template, it is still see as an override.
So there is no bug ; the button did what it has to do.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Lumiga

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum