Get custom attribute from product in ToOrderItem convert methodGet cart contents from my custom moduleHow to get product attribute color text from quote item?get product id from quote id - Magento 1.9get cart items from custom column valueMagento 2 how to get product id from QuoteDetailsItemInterface objectGet orderId from quote_itemGet Quote Item from Product IdMagento2 How to get customer group from sales order item collectionMagento 2 get custom product attributeGet data from Quote_items table in Magento 2

Wordplay addition paradox

A verb to describe specific positioning of three layers

Why does "git status" show I'm on the master branch and "git branch" does not in a newly created repository?

What details should I consider before agreeing for part of my salary to be 'retained' by employer?

How to find location on Cambridge-Mildenhall railway that still has tracks/rails?

Why do so many pure math PhD students drop out or leave academia, compared to applied mathematics PhDs?

Optimising the Selection of MaxValue in Association

Did Voldemort kill his father before finding out about Horcruxes?

What were the problems on the Apollo 11 lunar module?

Why do space operations use "nominal" to mean "working correctly"?

What is the difference between a Hosaka, Ono-Sendai, and a "deck"?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

What is this green alien supposed to be on the American covers?

Can a Resident Assistant be told to ignore a lawful order?'

Is passive Investigation essentially truesight against illusions?

A Table Representing the altar

Jump back to the position I started a search

Alphanumeric Line and Curve Counting

Is it ethical for a company to ask its employees to move furniture on a weekend?

Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"

Why is Google approaching my VPS machine?

Generating a PIN from cryptographic bytes

Is this artwork (used in a video game) real?

Which GPUs to get for Mathematical Optimization (if any...)?



Get custom attribute from product in ToOrderItem convert method


Get cart contents from my custom moduleHow to get product attribute color text from quote item?get product id from quote id - Magento 1.9get cart items from custom column valueMagento 2 how to get product id from QuoteDetailsItemInterface objectGet orderId from quote_itemGet Quote Item from Product IdMagento2 How to get customer group from sales order item collectionMagento 2 get custom product attributeGet data from Quote_items table in Magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm implementing a plugin for MagentoQuoteModelQuoteItemToOrderItem



 public function aroundConvert(MagentoQuoteModelQuoteItemToOrderItem $subject,
Closure $proceed,
MagentoQuoteModelQuoteItemAbstractItem $item,
$additional = [])
$orderItem = $proceed($item, $additional);

$product = $this->productFactory->create();
$product->load($item->getProductId());

$unitPv = 0;
if ($product->getCustomAttribute('pv') != null)
$unitPv = $product->getCustomAttribute('pv')->getValue();


$pv = $unitPv;
$qty = $orderItem->getQty();

// ???
$orderItem->setData('pv', $pv);
$orderItem->setData('total_pv', $qty * $pv);
return $orderItem;



This method to supposed to copy over a custom attribute (PV) from my products over to the sales order item field (PV and total PV) which I added directly to the sales_order_item table.



My code above is able to retrieve the PV from the products but for some reason is unable to assign the values to the ordered item. Is my syntax to assign the PV and total_pv to order_sales_item correct?










share|improve this question
























  • did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

    – Venugopal Chikkegowda
    Jul 9 at 8:02











  • The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

    – user3109848
    Jul 9 at 8:05











  • $orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

    – Venugopal Chikkegowda
    Jul 9 at 8:09

















0















I'm implementing a plugin for MagentoQuoteModelQuoteItemToOrderItem



 public function aroundConvert(MagentoQuoteModelQuoteItemToOrderItem $subject,
Closure $proceed,
MagentoQuoteModelQuoteItemAbstractItem $item,
$additional = [])
$orderItem = $proceed($item, $additional);

$product = $this->productFactory->create();
$product->load($item->getProductId());

$unitPv = 0;
if ($product->getCustomAttribute('pv') != null)
$unitPv = $product->getCustomAttribute('pv')->getValue();


$pv = $unitPv;
$qty = $orderItem->getQty();

// ???
$orderItem->setData('pv', $pv);
$orderItem->setData('total_pv', $qty * $pv);
return $orderItem;



This method to supposed to copy over a custom attribute (PV) from my products over to the sales order item field (PV and total PV) which I added directly to the sales_order_item table.



My code above is able to retrieve the PV from the products but for some reason is unable to assign the values to the ordered item. Is my syntax to assign the PV and total_pv to order_sales_item correct?










share|improve this question
























  • did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

    – Venugopal Chikkegowda
    Jul 9 at 8:02











  • The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

    – user3109848
    Jul 9 at 8:05











  • $orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

    – Venugopal Chikkegowda
    Jul 9 at 8:09













0












0








0








I'm implementing a plugin for MagentoQuoteModelQuoteItemToOrderItem



 public function aroundConvert(MagentoQuoteModelQuoteItemToOrderItem $subject,
Closure $proceed,
MagentoQuoteModelQuoteItemAbstractItem $item,
$additional = [])
$orderItem = $proceed($item, $additional);

$product = $this->productFactory->create();
$product->load($item->getProductId());

$unitPv = 0;
if ($product->getCustomAttribute('pv') != null)
$unitPv = $product->getCustomAttribute('pv')->getValue();


$pv = $unitPv;
$qty = $orderItem->getQty();

// ???
$orderItem->setData('pv', $pv);
$orderItem->setData('total_pv', $qty * $pv);
return $orderItem;



This method to supposed to copy over a custom attribute (PV) from my products over to the sales order item field (PV and total PV) which I added directly to the sales_order_item table.



My code above is able to retrieve the PV from the products but for some reason is unable to assign the values to the ordered item. Is my syntax to assign the PV and total_pv to order_sales_item correct?










share|improve this question
















I'm implementing a plugin for MagentoQuoteModelQuoteItemToOrderItem



 public function aroundConvert(MagentoQuoteModelQuoteItemToOrderItem $subject,
Closure $proceed,
MagentoQuoteModelQuoteItemAbstractItem $item,
$additional = [])
$orderItem = $proceed($item, $additional);

$product = $this->productFactory->create();
$product->load($item->getProductId());

$unitPv = 0;
if ($product->getCustomAttribute('pv') != null)
$unitPv = $product->getCustomAttribute('pv')->getValue();


$pv = $unitPv;
$qty = $orderItem->getQty();

// ???
$orderItem->setData('pv', $pv);
$orderItem->setData('total_pv', $qty * $pv);
return $orderItem;



This method to supposed to copy over a custom attribute (PV) from my products over to the sales order item field (PV and total PV) which I added directly to the sales_order_item table.



My code above is able to retrieve the PV from the products but for some reason is unable to assign the values to the ordered item. Is my syntax to assign the PV and total_pv to order_sales_item correct?







quoteitem sales-order-item






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 9 at 7:36









Raj Mohan R

1,6113 silver badges13 bronze badges




1,6113 silver badges13 bronze badges










asked Jul 9 at 7:17









user3109848user3109848

1




1












  • did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

    – Venugopal Chikkegowda
    Jul 9 at 8:02











  • The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

    – user3109848
    Jul 9 at 8:05











  • $orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

    – Venugopal Chikkegowda
    Jul 9 at 8:09

















  • did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

    – Venugopal Chikkegowda
    Jul 9 at 8:02











  • The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

    – user3109848
    Jul 9 at 8:05











  • $orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

    – Venugopal Chikkegowda
    Jul 9 at 8:09
















did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

– Venugopal Chikkegowda
Jul 9 at 8:02





did you created 'pv, total_pv' columns on sales_order_item table? . Please verify the sales_order_item table.

– Venugopal Chikkegowda
Jul 9 at 8:02













The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

– user3109848
Jul 9 at 8:05





The fields 'pv' and 'total_pv' are created and exists in the sales_order_item table.

– user3109848
Jul 9 at 8:05













$orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

– Venugopal Chikkegowda
Jul 9 at 8:09





$orderItem->getData('pv); $orderItem->getData('total_pv'); below the setData, try to print this values in logger and check whether the values are getting set or not in orderItem Object.

– Venugopal Chikkegowda
Jul 9 at 8:09










0






active

oldest

votes














Your Answer








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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281312%2fget-custom-attribute-from-product-in-toorderitem-convert-method%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281312%2fget-custom-attribute-from-product-in-toorderitem-convert-method%23new-answer', 'question_page');

);

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







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form