How to get parent product data from parent id for configurable productsHow to get available sizes from configurable product using SOAP?Update table data for configurable productUpdate simple products with parent configurable product priceHow to get a configurable parent product from catalog in Magento2?How to get parent product id in magento 2?Magento 2 - Configurable product - Get parent product ID from child product IDGet Price For Configurable Product Magento 2Get product Category from Parent Product using SQL queryMagento 2 get Parent products id in admin create productsConfigurable Product - Get child product id
Are one time pads still secure when using randomly generated words as the pad?
Leaving job close to major deadlines
In the US, can a former president run again?
Why things float in space, though there is always gravity of our star is present
What is the most suitable position for a bishop here?
How do you transpose samples in cents?
Math symbols in math operators
Is there any way to revive my Sim?
Help with coding a matrix
Is there any possible way to get these hearts as Adult Link?
Why there is a red color in right side?
How much steel armor can you wear and still be able to swim?
Are intrusions within a foreign embassy considered an act of war?
If the mass of the Earth is decreasing by sending debris in space, does its angular momentum also decrease?
How to make all magic-casting innate, but still rare?
I found a password with hashcat but it doesn't work
Definition of 'vrit'
Why is it easier to balance a non-moving bike standing up than sitting down?
My student in one course asks for paid tutoring in another course. Appropriate?
How to write a nice frame challenge?
What is that ceiling compartment of a Boeing 737?
「捨ててしまう」why is there two て’s used here?
reverse a call to mmap()
Are there examples of rowers who also fought?
How to get parent product data from parent id for configurable products
How to get available sizes from configurable product using SOAP?Update table data for configurable productUpdate simple products with parent configurable product priceHow to get a configurable parent product from catalog in Magento2?How to get parent product id in magento 2?Magento 2 - Configurable product - Get parent product ID from child product IDGet Price For Configurable Product Magento 2Get product Category from Parent Product using SQL queryMagento 2 get Parent products id in admin create productsConfigurable Product - Get child product id
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to get parent product data for configurable products.
I have parent id
How do I get it?
magento2 configurable-product
add a comment |
I want to get parent product data for configurable products.
I have parent id
How do I get it?
magento2 configurable-product
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54
add a comment |
I want to get parent product data for configurable products.
I have parent id
How do I get it?
magento2 configurable-product
I want to get parent product data for configurable products.
I have parent id
How do I get it?
magento2 configurable-product
magento2 configurable-product
edited Jun 11 at 6:13
Smita Kagwade
asked Jun 10 at 21:04
Smita KagwadeSmita Kagwade
37513
37513
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54
add a comment |
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54
add a comment |
1 Answer
1
active
oldest
votes
I Got the solution
use MagentoCatalogModelProductRepository;
use MagentoConfigurableProductModelProductTypeConfigurable;
Then in construct function use
public function __construct(ProductRepository $_productloader,Configurable $configurable)
$this->configurable=$configurable;
$this->_productloader=$_productloader;
get parent product id by product id
$productId='get your product id'
$parentId=$this->configurable->getParentIdsByChild($productId);
$parentId gives an array
then get parent product data by
$parentProductData=$this->_productloader->getById($parentId[0]);
This worked for me.
I had comment the same thing above
– mohith
Jun 11 at 10:13
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%2f277877%2fhow-to-get-parent-product-data-from-parent-id-for-configurable-products%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
I Got the solution
use MagentoCatalogModelProductRepository;
use MagentoConfigurableProductModelProductTypeConfigurable;
Then in construct function use
public function __construct(ProductRepository $_productloader,Configurable $configurable)
$this->configurable=$configurable;
$this->_productloader=$_productloader;
get parent product id by product id
$productId='get your product id'
$parentId=$this->configurable->getParentIdsByChild($productId);
$parentId gives an array
then get parent product data by
$parentProductData=$this->_productloader->getById($parentId[0]);
This worked for me.
I had comment the same thing above
– mohith
Jun 11 at 10:13
add a comment |
I Got the solution
use MagentoCatalogModelProductRepository;
use MagentoConfigurableProductModelProductTypeConfigurable;
Then in construct function use
public function __construct(ProductRepository $_productloader,Configurable $configurable)
$this->configurable=$configurable;
$this->_productloader=$_productloader;
get parent product id by product id
$productId='get your product id'
$parentId=$this->configurable->getParentIdsByChild($productId);
$parentId gives an array
then get parent product data by
$parentProductData=$this->_productloader->getById($parentId[0]);
This worked for me.
I had comment the same thing above
– mohith
Jun 11 at 10:13
add a comment |
I Got the solution
use MagentoCatalogModelProductRepository;
use MagentoConfigurableProductModelProductTypeConfigurable;
Then in construct function use
public function __construct(ProductRepository $_productloader,Configurable $configurable)
$this->configurable=$configurable;
$this->_productloader=$_productloader;
get parent product id by product id
$productId='get your product id'
$parentId=$this->configurable->getParentIdsByChild($productId);
$parentId gives an array
then get parent product data by
$parentProductData=$this->_productloader->getById($parentId[0]);
This worked for me.
I Got the solution
use MagentoCatalogModelProductRepository;
use MagentoConfigurableProductModelProductTypeConfigurable;
Then in construct function use
public function __construct(ProductRepository $_productloader,Configurable $configurable)
$this->configurable=$configurable;
$this->_productloader=$_productloader;
get parent product id by product id
$productId='get your product id'
$parentId=$this->configurable->getParentIdsByChild($productId);
$parentId gives an array
then get parent product data by
$parentProductData=$this->_productloader->getById($parentId[0]);
This worked for me.
answered Jun 11 at 6:37
Smita KagwadeSmita Kagwade
37513
37513
I had comment the same thing above
– mohith
Jun 11 at 10:13
add a comment |
I had comment the same thing above
– mohith
Jun 11 at 10:13
I had comment the same thing above
– mohith
Jun 11 at 10:13
I had comment the same thing above
– mohith
Jun 11 at 10:13
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%2f277877%2fhow-to-get-parent-product-data-from-parent-id-for-configurable-products%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
As a parent configurable product you can get the children simple products. Likewise as a child simple product you can get the parent. Do you want to do either of these?
– Dominic Xigen
Jun 11 at 0:44
then load the product data based on id use ProductRepositoryInterface and call getById function
– mohith
Jun 11 at 4:54