How to get a simple product id from configurable in checkout order summary in magento 2How to show a advance inventory custom field value in checkout order summary in magento 2Magento 2.1.4: Order Summary Modal on Checkout BreakpointReplicate order summary block Magento 2Extend checkout order summary section in Magento 2how to add product link on the checkout page order summary magento 2?Checkout Order Summary Update Selected Payment MethodHow to move order summary sidebar from right to left in checkout page Magento 2.2.5Magento2: On Checkout page, order summary box product name updateFetch product category name in order summary at checkout pageHide Shipping Method Title from Order SummaryHow to update quantity into order summary at checkout page?
Why don't I have ground wiring on any of my outlets?
Is there any Biblical Basis for 400 years of silence between Old and New Testament?
Can I ask a publisher for a paper that I need for reviewing
Is it possible to kill all life on Earth?
Why does my electric oven present the option of 40A and 50A breakers?
How can I stop my presentation being derailed by audience questions?
Expenditure in Poland - Forex doesn't have Zloty
What does the behaviour of water on the skin of an aircraft in flight tell us?
Can an old DSLR be upgraded to match modern smartphone image quality
Different PCB color ( is it different material? )
California: "For quality assurance, this phone call is being recorded"
Accidentally cashed a check twice
What is a simple, physical situation where complex numbers emerge naturally?
Looking for an old image of designing a cpu with plan laid out / being edited on a literal floor
Are grass strips more dangerous than tarmac?
Starting VLC from command line always puts the window behind other windows
The deliberate use of misleading terminology
How can I offer a test ride while selling a bike?
Can you use a concentration spell while using Mantle of Majesty?
What is the difference between a game ban and a VAC ban in Steam?
Future enhancements for the finite element method
Explain Ant-Man's "not it" scene from Avengers: Endgame
How does increase in volume change the speed of reaction in production of NO2?
Asking bank to reduce APR instead of increasing credit limit
How to get a simple product id from configurable in checkout order summary in magento 2
How to show a advance inventory custom field value in checkout order summary in magento 2Magento 2.1.4: Order Summary Modal on Checkout BreakpointReplicate order summary block Magento 2Extend checkout order summary section in Magento 2how to add product link on the checkout page order summary magento 2?Checkout Order Summary Update Selected Payment MethodHow to move order summary sidebar from right to left in checkout page Magento 2.2.5Magento2: On Checkout page, order summary box product name updateFetch product category name in order summary at checkout pageHide Shipping Method Title from Order SummaryHow to update quantity into order summary at checkout page?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to get a simple product id from configurable in checkout order summary in magento 2
image is https://prnt.sc/nsnh7y
code:
<?php
namespace CmPreorderPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel
protected $checkoutSession;
protected $stockItem;
protected $_productRepository;
private $_objectManager;
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->checkoutSession = $checkoutSession;
$this->_productRepository = $productRepository;
$this->stockItem = $stockItem;
$this->_objectManager = $objectmanager;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$product = $this->_productRepository->getById($quoteItem->getProduct()->getId());
$productId = $product->getId();
$stock = $this->stockItem->get($productId);
/* $preorder_note = $stock->getData('preorder_note'); */
$result['quoteItemData'][$index]['preorder_note'] =$productId;
return $result;
order-summary magento-21
add a comment |
How to get a simple product id from configurable in checkout order summary in magento 2
image is https://prnt.sc/nsnh7y
code:
<?php
namespace CmPreorderPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel
protected $checkoutSession;
protected $stockItem;
protected $_productRepository;
private $_objectManager;
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->checkoutSession = $checkoutSession;
$this->_productRepository = $productRepository;
$this->stockItem = $stockItem;
$this->_objectManager = $objectmanager;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$product = $this->_productRepository->getById($quoteItem->getProduct()->getId());
$productId = $product->getId();
$stock = $this->stockItem->get($productId);
/* $preorder_note = $stock->getData('preorder_note'); */
$result['quoteItemData'][$index]['preorder_note'] =$productId;
return $result;
order-summary magento-21
add a comment |
How to get a simple product id from configurable in checkout order summary in magento 2
image is https://prnt.sc/nsnh7y
code:
<?php
namespace CmPreorderPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel
protected $checkoutSession;
protected $stockItem;
protected $_productRepository;
private $_objectManager;
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->checkoutSession = $checkoutSession;
$this->_productRepository = $productRepository;
$this->stockItem = $stockItem;
$this->_objectManager = $objectmanager;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$product = $this->_productRepository->getById($quoteItem->getProduct()->getId());
$productId = $product->getId();
$stock = $this->stockItem->get($productId);
/* $preorder_note = $stock->getData('preorder_note'); */
$result['quoteItemData'][$index]['preorder_note'] =$productId;
return $result;
order-summary magento-21
How to get a simple product id from configurable in checkout order summary in magento 2
image is https://prnt.sc/nsnh7y
code:
<?php
namespace CmPreorderPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel
protected $checkoutSession;
protected $stockItem;
protected $_productRepository;
private $_objectManager;
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->checkoutSession = $checkoutSession;
$this->_productRepository = $productRepository;
$this->stockItem = $stockItem;
$this->_objectManager = $objectmanager;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$product = $this->_productRepository->getById($quoteItem->getProduct()->getId());
$productId = $product->getId();
$stock = $this->stockItem->get($productId);
/* $preorder_note = $stock->getData('preorder_note'); */
$result['quoteItemData'][$index]['preorder_note'] =$productId;
return $result;
order-summary magento-21
order-summary magento-21
edited May 24 at 5:15
divya sekar
asked May 24 at 5:06
divya sekardivya sekar
465117
465117
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try following way:
<?php
namespace SRMagentoCommunityPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider
/**
* @var CheckoutSession
*/
protected $checkoutSession;
/**
* @var StockItemRepository
*/
protected $stockItem;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* DefaultConfigProvider constructor.
* @param CheckoutSession $checkoutSession
* @param ProductRepository $productRepository
* @param StockItemRepository $stockItem
*/
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
StockItemRepository $stockItem
)
$this->checkoutSession = $checkoutSession;
$this->productRepository = $productRepository;
$this->stockItem = $stockItem;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->checkoutSession->getQuote();
$quoteItemsArray = [];
/** @var MagentoQuoteModelQuoteItem $item */
foreach ($quote->getAllItems() as $item)
if ($item->getParentItemId())
$quoteItemsArray[$item->getParentItemId()] = $item->getProductId();
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
if (isset($quoteItemsArray[$item['item_id']]))
$item['child_product_id'] = $quoteItemsArray[$item['item_id']];
$result['totalsData']['items'][$index] = $item;
return $result;
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
add a comment |
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
);
);
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%2f275932%2fhow-to-get-a-simple-product-id-from-configurable-in-checkout-order-summary-in-ma%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
Try following way:
<?php
namespace SRMagentoCommunityPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider
/**
* @var CheckoutSession
*/
protected $checkoutSession;
/**
* @var StockItemRepository
*/
protected $stockItem;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* DefaultConfigProvider constructor.
* @param CheckoutSession $checkoutSession
* @param ProductRepository $productRepository
* @param StockItemRepository $stockItem
*/
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
StockItemRepository $stockItem
)
$this->checkoutSession = $checkoutSession;
$this->productRepository = $productRepository;
$this->stockItem = $stockItem;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->checkoutSession->getQuote();
$quoteItemsArray = [];
/** @var MagentoQuoteModelQuoteItem $item */
foreach ($quote->getAllItems() as $item)
if ($item->getParentItemId())
$quoteItemsArray[$item->getParentItemId()] = $item->getProductId();
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
if (isset($quoteItemsArray[$item['item_id']]))
$item['child_product_id'] = $quoteItemsArray[$item['item_id']];
$result['totalsData']['items'][$index] = $item;
return $result;
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
add a comment |
Try following way:
<?php
namespace SRMagentoCommunityPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider
/**
* @var CheckoutSession
*/
protected $checkoutSession;
/**
* @var StockItemRepository
*/
protected $stockItem;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* DefaultConfigProvider constructor.
* @param CheckoutSession $checkoutSession
* @param ProductRepository $productRepository
* @param StockItemRepository $stockItem
*/
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
StockItemRepository $stockItem
)
$this->checkoutSession = $checkoutSession;
$this->productRepository = $productRepository;
$this->stockItem = $stockItem;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->checkoutSession->getQuote();
$quoteItemsArray = [];
/** @var MagentoQuoteModelQuoteItem $item */
foreach ($quote->getAllItems() as $item)
if ($item->getParentItemId())
$quoteItemsArray[$item->getParentItemId()] = $item->getProductId();
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
if (isset($quoteItemsArray[$item['item_id']]))
$item['child_product_id'] = $quoteItemsArray[$item['item_id']];
$result['totalsData']['items'][$index] = $item;
return $result;
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
add a comment |
Try following way:
<?php
namespace SRMagentoCommunityPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider
/**
* @var CheckoutSession
*/
protected $checkoutSession;
/**
* @var StockItemRepository
*/
protected $stockItem;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* DefaultConfigProvider constructor.
* @param CheckoutSession $checkoutSession
* @param ProductRepository $productRepository
* @param StockItemRepository $stockItem
*/
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
StockItemRepository $stockItem
)
$this->checkoutSession = $checkoutSession;
$this->productRepository = $productRepository;
$this->stockItem = $stockItem;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->checkoutSession->getQuote();
$quoteItemsArray = [];
/** @var MagentoQuoteModelQuoteItem $item */
foreach ($quote->getAllItems() as $item)
if ($item->getParentItemId())
$quoteItemsArray[$item->getParentItemId()] = $item->getProductId();
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
if (isset($quoteItemsArray[$item['item_id']]))
$item['child_product_id'] = $quoteItemsArray[$item['item_id']];
$result['totalsData']['items'][$index] = $item;
return $result;
Try following way:
<?php
namespace SRMagentoCommunityPluginCheckoutModel;
use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;
class DefaultConfigProvider
/**
* @var CheckoutSession
*/
protected $checkoutSession;
/**
* @var StockItemRepository
*/
protected $stockItem;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* DefaultConfigProvider constructor.
* @param CheckoutSession $checkoutSession
* @param ProductRepository $productRepository
* @param StockItemRepository $stockItem
*/
public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
StockItemRepository $stockItem
)
$this->checkoutSession = $checkoutSession;
$this->productRepository = $productRepository;
$this->stockItem = $stockItem;
public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->checkoutSession->getQuote();
$quoteItemsArray = [];
/** @var MagentoQuoteModelQuoteItem $item */
foreach ($quote->getAllItems() as $item)
if ($item->getParentItemId())
$quoteItemsArray[$item->getParentItemId()] = $item->getProductId();
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
if (isset($quoteItemsArray[$item['item_id']]))
$item['child_product_id'] = $quoteItemsArray[$item['item_id']];
$result['totalsData']['items'][$index] = $item;
return $result;
answered May 24 at 13:32
Sohel RanaSohel Rana
24.1k34663
24.1k34663
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
add a comment |
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
its working @sohel
– divya sekar
May 24 at 13:35
its working @sohel
– divya sekar
May 24 at 13:35
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
can you give any trick to get a selected simple product id from configurable option in category product listing page
– divya sekar
May 24 at 13:38
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%2f275932%2fhow-to-get-a-simple-product-id-from-configurable-in-checkout-order-summary-in-ma%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