Configurable product creating programatically not working in magneto 2 The Next CEO of Stack OverflowProceeding to an exception page after save new categoryMagento2: How to update the product price programaticallyMagento 2.1 Create a filter in the product grid by new attributeI want to add parent product to cart using child product id, it's configurable options in magento 2.1Magento2: Products group by filterable attributesMagento 2: Add a product to the cart programmaticallyError at order shippingMagento 2 ErrorMagento 2 Create new “Catalog Input Type for Store Owner” AttributeGetting Errors after MySQL database import
Why is information "lost" when it got into a black hole?
Aggressive Under-Indexing and no data for missing index
Strange use of "whether ... than ..." in official text
Scary film where a woman has vaginal teeth
How do I fit a non linear curve?
Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?
Is there a difference between "Fahrstuhl" and "Aufzug"?
Is there a reasonable and studied concept of reduction between regular languages?
What was Carter Burke's job for "the company" in Aliens?
Help/tips for a first time writer?
Is there an equivalent of cd - for cp or mv
Lucky Feat: How can "more than one creature spend a luck point to influence the outcome of a roll"?
Are the names of these months realistic?
A question about free fall, velocity, and the height of an object.
Help! I cannot understand this game’s notations!
How to get the last not-null value in an ordered column of a huge table?
Computationally populating tables with probability data
Is it professional to write unrelated content in an almost-empty email?
What does "shotgun unity" refer to here in this sentence?
Players Circumventing the limitations of Wish
Could a dragon use its wings to swim?
What difference does it make using sed with/without whitespaces?
Physiological effects of huge anime eyes
Inexact numbers as keys in Association?
Configurable product creating programatically not working in magneto 2
The Next CEO of Stack OverflowProceeding to an exception page after save new categoryMagento2: How to update the product price programaticallyMagento 2.1 Create a filter in the product grid by new attributeI want to add parent product to cart using child product id, it's configurable options in magento 2.1Magento2: Products group by filterable attributesMagento 2: Add a product to the cart programmaticallyError at order shippingMagento 2 ErrorMagento 2 Create new “Catalog Input Type for Store Owner” AttributeGetting Errors after MySQL database import
I create a configurable product programmatically and after creating it shows enable field of price and stock.But when i hit save button in admin, the price and quantity become non editable.Which table its saving this change.
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // instance of object manager
$product_configurable = $objectManager->create('MagentoCatalogModelProduct');
$product_configurable->setData('name', rand(30, 230));
$product_configurable->setData('sku', rand(5, 340));
$product_configurable->setAttributeSetId($set);
$product_configurable->setTypeId('configurable');
$product_configurable->setStatus(1);
$product_configurable->setVisibility(4);
$product_configurable->setPrice($wholedata['product']['price']);
$product_configurable->setWeight($wholedata['product']['weight']);
$product_configurable->setShortDescription($wholedata['product']['shortdes']);
$product_configurable->setDescription($wholedata['product']['descrip']);
$product_configurable->setWebsiteIds(array(1));
$product_configurable->setCategoryIds(array($cat_id));
$qty = $wholedata['product']['stock'];
$product_configurable->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'min_sale_qty' => 1,
'max_sale_qty' => 1002,
'is_in_stock' => 0,
'qty' => 0
)
);
$product_configurable->save();
$productId = 501; // Configurable Product Id
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId); // Load Configurable Product
$attributeModel = $objectManager->create('MagentoConfigurableProductModelProductTypeConfigurableAttribute');
$position = 0;
$attributes = array(90); // Super Attribute Ids Used To Create Configurable Product
$associatedProductIds = array(456); //Product Ids Of Associated Products
foreach ($attributes as $attributeId)
$data = array('attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $position);
$position++;
$attributeModel->setData($data)->save();
$product->setTypeId("configurable"); // Setting Product Type As Configurable
$product->setAffectConfigurableProductAttributes(4);
$objectManager->create('MagentoConfigurableProductModelProductTypeConfigurable')->setUsedProductAttributeIds($attributes, $product);
$product->setNewVariationsAttributeSetId(4); // Setting Attribute Set Id
$product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
$product->setCanSaveConfigurableAttributes(true);
$product->save();
magento2
add a comment |
I create a configurable product programmatically and after creating it shows enable field of price and stock.But when i hit save button in admin, the price and quantity become non editable.Which table its saving this change.
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // instance of object manager
$product_configurable = $objectManager->create('MagentoCatalogModelProduct');
$product_configurable->setData('name', rand(30, 230));
$product_configurable->setData('sku', rand(5, 340));
$product_configurable->setAttributeSetId($set);
$product_configurable->setTypeId('configurable');
$product_configurable->setStatus(1);
$product_configurable->setVisibility(4);
$product_configurable->setPrice($wholedata['product']['price']);
$product_configurable->setWeight($wholedata['product']['weight']);
$product_configurable->setShortDescription($wholedata['product']['shortdes']);
$product_configurable->setDescription($wholedata['product']['descrip']);
$product_configurable->setWebsiteIds(array(1));
$product_configurable->setCategoryIds(array($cat_id));
$qty = $wholedata['product']['stock'];
$product_configurable->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'min_sale_qty' => 1,
'max_sale_qty' => 1002,
'is_in_stock' => 0,
'qty' => 0
)
);
$product_configurable->save();
$productId = 501; // Configurable Product Id
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId); // Load Configurable Product
$attributeModel = $objectManager->create('MagentoConfigurableProductModelProductTypeConfigurableAttribute');
$position = 0;
$attributes = array(90); // Super Attribute Ids Used To Create Configurable Product
$associatedProductIds = array(456); //Product Ids Of Associated Products
foreach ($attributes as $attributeId)
$data = array('attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $position);
$position++;
$attributeModel->setData($data)->save();
$product->setTypeId("configurable"); // Setting Product Type As Configurable
$product->setAffectConfigurableProductAttributes(4);
$objectManager->create('MagentoConfigurableProductModelProductTypeConfigurable')->setUsedProductAttributeIds($attributes, $product);
$product->setNewVariationsAttributeSetId(4); // Setting Attribute Set Id
$product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
$product->setCanSaveConfigurableAttributes(true);
$product->save();
magento2
share your code in question
– Rakesh Donga
2 days ago
add code..........
– Ronak Rathod
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago
add a comment |
I create a configurable product programmatically and after creating it shows enable field of price and stock.But when i hit save button in admin, the price and quantity become non editable.Which table its saving this change.
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // instance of object manager
$product_configurable = $objectManager->create('MagentoCatalogModelProduct');
$product_configurable->setData('name', rand(30, 230));
$product_configurable->setData('sku', rand(5, 340));
$product_configurable->setAttributeSetId($set);
$product_configurable->setTypeId('configurable');
$product_configurable->setStatus(1);
$product_configurable->setVisibility(4);
$product_configurable->setPrice($wholedata['product']['price']);
$product_configurable->setWeight($wholedata['product']['weight']);
$product_configurable->setShortDescription($wholedata['product']['shortdes']);
$product_configurable->setDescription($wholedata['product']['descrip']);
$product_configurable->setWebsiteIds(array(1));
$product_configurable->setCategoryIds(array($cat_id));
$qty = $wholedata['product']['stock'];
$product_configurable->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'min_sale_qty' => 1,
'max_sale_qty' => 1002,
'is_in_stock' => 0,
'qty' => 0
)
);
$product_configurable->save();
$productId = 501; // Configurable Product Id
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId); // Load Configurable Product
$attributeModel = $objectManager->create('MagentoConfigurableProductModelProductTypeConfigurableAttribute');
$position = 0;
$attributes = array(90); // Super Attribute Ids Used To Create Configurable Product
$associatedProductIds = array(456); //Product Ids Of Associated Products
foreach ($attributes as $attributeId)
$data = array('attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $position);
$position++;
$attributeModel->setData($data)->save();
$product->setTypeId("configurable"); // Setting Product Type As Configurable
$product->setAffectConfigurableProductAttributes(4);
$objectManager->create('MagentoConfigurableProductModelProductTypeConfigurable')->setUsedProductAttributeIds($attributes, $product);
$product->setNewVariationsAttributeSetId(4); // Setting Attribute Set Id
$product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
$product->setCanSaveConfigurableAttributes(true);
$product->save();
magento2
I create a configurable product programmatically and after creating it shows enable field of price and stock.But when i hit save button in admin, the price and quantity become non editable.Which table its saving this change.
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // instance of object manager
$product_configurable = $objectManager->create('MagentoCatalogModelProduct');
$product_configurable->setData('name', rand(30, 230));
$product_configurable->setData('sku', rand(5, 340));
$product_configurable->setAttributeSetId($set);
$product_configurable->setTypeId('configurable');
$product_configurable->setStatus(1);
$product_configurable->setVisibility(4);
$product_configurable->setPrice($wholedata['product']['price']);
$product_configurable->setWeight($wholedata['product']['weight']);
$product_configurable->setShortDescription($wholedata['product']['shortdes']);
$product_configurable->setDescription($wholedata['product']['descrip']);
$product_configurable->setWebsiteIds(array(1));
$product_configurable->setCategoryIds(array($cat_id));
$qty = $wholedata['product']['stock'];
$product_configurable->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'min_sale_qty' => 1,
'max_sale_qty' => 1002,
'is_in_stock' => 0,
'qty' => 0
)
);
$product_configurable->save();
$productId = 501; // Configurable Product Id
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId); // Load Configurable Product
$attributeModel = $objectManager->create('MagentoConfigurableProductModelProductTypeConfigurableAttribute');
$position = 0;
$attributes = array(90); // Super Attribute Ids Used To Create Configurable Product
$associatedProductIds = array(456); //Product Ids Of Associated Products
foreach ($attributes as $attributeId)
$data = array('attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $position);
$position++;
$attributeModel->setData($data)->save();
$product->setTypeId("configurable"); // Setting Product Type As Configurable
$product->setAffectConfigurableProductAttributes(4);
$objectManager->create('MagentoConfigurableProductModelProductTypeConfigurable')->setUsedProductAttributeIds($attributes, $product);
$product->setNewVariationsAttributeSetId(4); // Setting Attribute Set Id
$product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
$product->setCanSaveConfigurableAttributes(true);
$product->save();
magento2
magento2
edited 2 days ago
Anees
asked 2 days ago
AneesAnees
14711
14711
share your code in question
– Rakesh Donga
2 days ago
add code..........
– Ronak Rathod
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago
add a comment |
share your code in question
– Rakesh Donga
2 days ago
add code..........
– Ronak Rathod
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago
share your code in question
– Rakesh Donga
2 days ago
share your code in question
– Rakesh Donga
2 days ago
add code..........
– Ronak Rathod
2 days ago
add code..........
– Ronak Rathod
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago
add a comment |
0
active
oldest
votes
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%2f267947%2fconfigurable-product-creating-programatically-not-working-in-magneto-2%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
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%2f267947%2fconfigurable-product-creating-programatically-not-working-in-magneto-2%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
share your code in question
– Rakesh Donga
2 days ago
add code..........
– Ronak Rathod
2 days ago
Rakesh, Ronak I had share code.
– Anees
2 days ago
Please follow this link mageplaza.com/devdocs/…
– Savan Patel
2 days ago