cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying /vendor/...

Modifying /vendor/...

I'm trying to customize my M2.2 installation. I want to change one of the files under /vendor/...

 

Currently, I navigate to the file (/var/www/html/vendor/magento/module-sales/Model/Order/Pdf/Invoice.php) and change the code, but I don't know how to make the changes take effect. i.e. how to make the changes appear on the frontend?

 

Can someone direct me to the correct process for making these kinds of modifications? I don't know if I should be working in the /app/ directory or /vendor/ or where. What commands are need to publish changes?

 

Thank you.

5 REPLIES 5

Re: Modifying /vendor/...

what kind of changes you want to do?
you have 2 ways to change code of that file.

  1. you can override class file and change code you want
  2. you can create plugin as per your change

 

please elaborate your question properly so you can get exact answer.

 

if it helps please click "Kudos" and "accept solution".

Re: Modifying /vendor/...

Hi @rob223,

You can override vendor model file using di.xml.

for more info, you can follow below link:

https://magento.stackexchange.com/a/160047

I hope it will help you!

Re: Modifying /vendor/...

The link says to modify "etc/di.xml". Where is this file?

 

Where should I put my Model file?

Re: Modifying /vendor/...

In this file: "/vendor/magento/module-sales/Model/Order/Pdf/Invoice.php", there is a line:

$page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));

If I understand correctly, in the generated PDF, this creates a block with a gray background on my invoice. This causes me to waste a lot of ink during printing. I want to modify the background to white.

 

Thanks for your help.

 

Also, can you explain the relationship between app/code and /vendor/?

Re: Modifying /vendor/...

$page->setFillColor(new \Zend_Pdf_Color_Rgb(255,255,255));