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

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

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?