How to insert specific invoice items in sales_invoice_item Table? The Next CEO of Stack OverflowHow to add custom attribute in Collection?Subtotal is doubled in the second attempt to invoiceHow can I display non-invoiced items in the invoice?PDF Invoice - content forcing new pageHow to queue “New Order” email before “New Invoice” email?Add custom field in onepage check out,order,invoice,salesHow to get shipping address by invoice number?Magento 1.9.2 coupon( discount) not appearing while creating invoiceMagento Edit Order Invoice PDF - Options on Single LineInvoice Items Collection
Purpose of level-shifter with same in and out voltages
Help! I cannot understand this game’s notations!
Is it OK to decorate a log book cover?
Why did early computer designers eschew integers?
Point distance program written without a framework
Strange use of "whether ... than ..." in official text
Computationally populating tables with probability data
Can you teleport closer to a creature you are Frightened of?
What is the process for cleansing a very negative action
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
Is fine stranded wire ok for main supply line?
"Eavesdropping" vs "Listen in on"
How do I fit a non linear curve?
Is it professional to write unrelated content in an almost-empty email?
Why am I getting "Static method cannot be referenced from a non static context: String String.valueOf(Object)"?
Is French Guiana a (hard) EU border?
Can Sneak Attack be used when hitting with an improvised weapon?
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
How to use ReplaceAll on an expression that contains a rule
Getting Stale Gas Out of a Gas Tank w/out Dropping the Tank
Is it convenient to ask the journal's editor for two additional days to complete a review?
Help/tips for a first time writer?
Is there a difference between "Fahrstuhl" and "Aufzug"?
In the "Harry Potter and the Order of the Phoenix" video game, what potion is used to sabotage Umbridge's speakers?
How to insert specific invoice items in sales_invoice_item Table?
The Next CEO of Stack OverflowHow to add custom attribute in Collection?Subtotal is doubled in the second attempt to invoiceHow can I display non-invoiced items in the invoice?PDF Invoice - content forcing new pageHow to queue “New Order” email before “New Invoice” email?Add custom field in onepage check out,order,invoice,salesHow to get shipping address by invoice number?Magento 1.9.2 coupon( discount) not appearing while creating invoiceMagento Edit Order Invoice PDF - Options on Single LineInvoice Items Collection
Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.
I filter the invoice items in the New Invoice page shown in the screenshot 
In this order, there are 4 Items but I already filter each vendor can see own items.
In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.
My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.
How can I make restriction? please guide me. Thanks
magento2 invoice create restriction
add a comment |
Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.
I filter the invoice items in the New Invoice page shown in the screenshot 
In this order, there are 4 Items but I already filter each vendor can see own items.
In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.
My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.
How can I make restriction? please guide me. Thanks
magento2 invoice create restriction
are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
first i want to insert just filtered items insales_invoice_itemthen i will discuss after .
– HaFiz Umer
Mar 19 at 8:06
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20
add a comment |
Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.
I filter the invoice items in the New Invoice page shown in the screenshot 
In this order, there are 4 Items but I already filter each vendor can see own items.
In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.
My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.
How can I make restriction? please guide me. Thanks
magento2 invoice create restriction
Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.
I filter the invoice items in the New Invoice page shown in the screenshot 
In this order, there are 4 Items but I already filter each vendor can see own items.
In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.
My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.
How can I make restriction? please guide me. Thanks
magento2 invoice create restriction
magento2 invoice create restriction
edited Mar 19 at 7:57
magefms
2,1352426
2,1352426
asked Mar 19 at 7:46
HaFiz UmerHaFiz Umer
4019
4019
are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
first i want to insert just filtered items insales_invoice_itemthen i will discuss after .
– HaFiz Umer
Mar 19 at 8:06
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20
add a comment |
are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
first i want to insert just filtered items insales_invoice_itemthen i will discuss after .
– HaFiz Umer
Mar 19 at 8:06
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20
are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
first i want to insert just filtered items in
sales_invoice_item then i will discuss after .– HaFiz Umer
Mar 19 at 8:06
first i want to insert just filtered items in
sales_invoice_item then i will discuss after .– HaFiz Umer
Mar 19 at 8:06
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20
add a comment |
1 Answer
1
active
oldest
votes
You have to override the controller which is generating the invoice for the order.
Following file is doing this
MagentoSalesControllerAdminhtmlOrderInvoiceSave.php
You have to modify the invoiceItems array according to the vendor items
$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];
Following line is processing the invoice
$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
How to override controller
https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/
add a comment |
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266469%2fhow-to-insert-specific-invoice-items-in-sales-invoice-item-table%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have to override the controller which is generating the invoice for the order.
Following file is doing this
MagentoSalesControllerAdminhtmlOrderInvoiceSave.php
You have to modify the invoiceItems array according to the vendor items
$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];
Following line is processing the invoice
$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
How to override controller
https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/
add a comment |
You have to override the controller which is generating the invoice for the order.
Following file is doing this
MagentoSalesControllerAdminhtmlOrderInvoiceSave.php
You have to modify the invoiceItems array according to the vendor items
$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];
Following line is processing the invoice
$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
How to override controller
https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/
add a comment |
You have to override the controller which is generating the invoice for the order.
Following file is doing this
MagentoSalesControllerAdminhtmlOrderInvoiceSave.php
You have to modify the invoiceItems array according to the vendor items
$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];
Following line is processing the invoice
$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
How to override controller
https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/
You have to override the controller which is generating the invoice for the order.
Following file is doing this
MagentoSalesControllerAdminhtmlOrderInvoiceSave.php
You have to modify the invoiceItems array according to the vendor items
$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];
Following line is processing the invoice
$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
How to override controller
https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/
answered Mar 19 at 8:05
Rakesh JakharRakesh Jakhar
1765
1765
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266469%2fhow-to-insert-specific-invoice-items-in-sales-invoice-item-table%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

are you looking for to create multiple invoices for the same order for each vendor with their items?
– Rakesh Jakhar
Mar 19 at 7:53
first i want to insert just filtered items in
sales_invoice_itemthen i will discuss after .– HaFiz Umer
Mar 19 at 8:06
In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.
– HelgeB
Mar 19 at 8:07
Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you
– HaFiz Umer
Mar 19 at 8:20