Extension point for set website ids product in case admin not set websiteHow to get the URL for the B2C website/storeview from a B2B website/storeview/product-pageMagento 2: Default REST API unable to update product data to multiple storesHow can I rewrite URL which can help for SEO with multiwebsite?Magento 2.1 Create a filter in the product grid by new attributeMagento2 : how to set per website is_required custom attribute for account creation formmysql deadlock when saving product with website ids through console commandMagento 2 Plugin for Contact Form Post ControllerMagento 2: I Want to add multiple product using checkboxI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Get Quote Item's Selected Custom Options
How do I exit BASH while loop using modulus operator?
What is the most common color to indicate the input-field is disabled?
How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction
Avoiding the "not like other girls" trope?
Am I breaking OOP practice with this architecture?
Can I hook these wires up to find the connection to a dead outlet?
Could the museum Saturn V's be refitted for one more flight?
Theorists sure want true answers to this!
How to remove border from elements in the last row?
What is required to make GPS signals available indoors?
How badly should I try to prevent a user from XSSing themselves?
files created then deleted at every second in tmp directory
OP Amp not amplifying audio signal
Ambiguity in the definition of entropy
What are the G forces leaving Earth orbit?
What exactly is ineptocracy?
How can saying a song's name be a copyright violation?
Finitely generated matrix groups whose eigenvalues are all algebraic
Send out email when Apex Queueable fails and test it
What historical events would have to change in order to make 19th century "steampunk" technology possible?
How to stretch the corners of this image so that it looks like a perfect rectangle?
Forgetting the musical notes while performing in concert
How to install cross-compiler on Ubuntu 18.04?
Why was Sir Cadogan fired?
Extension point for set website ids product in case admin not set website
How to get the URL for the B2C website/storeview from a B2B website/storeview/product-pageMagento 2: Default REST API unable to update product data to multiple storesHow can I rewrite URL which can help for SEO with multiwebsite?Magento 2.1 Create a filter in the product grid by new attributeMagento2 : how to set per website is_required custom attribute for account creation formmysql deadlock when saving product with website ids through console commandMagento 2 Plugin for Contact Form Post ControllerMagento 2: I Want to add multiple product using checkboxI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Get Quote Item's Selected Custom Options
This is my scenario I have hidden website_ids
field in product form (default magento show it)
So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this
My goal is if not website ids available when post data so init default website ids for product
Added modifier for modify Form:
public function modifyMeta(array $meta)
$this->_meta = unset($meta['websites']);
return $this->_meta;
magento2 product plugin multi-website
add a comment |
This is my scenario I have hidden website_ids
field in product form (default magento show it)
So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this
My goal is if not website ids available when post data so init default website ids for product
Added modifier for modify Form:
public function modifyMeta(array $meta)
$this->_meta = unset($meta['websites']);
return $this->_meta;
magento2 product plugin multi-website
add a comment |
This is my scenario I have hidden website_ids
field in product form (default magento show it)
So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this
My goal is if not website ids available when post data so init default website ids for product
Added modifier for modify Form:
public function modifyMeta(array $meta)
$this->_meta = unset($meta['websites']);
return $this->_meta;
magento2 product plugin multi-website
This is my scenario I have hidden website_ids
field in product form (default magento show it)
So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this
My goal is if not website ids available when post data so init default website ids for product
Added modifier for modify Form:
public function modifyMeta(array $meta)
$this->_meta = unset($meta['websites']);
return $this->_meta;
magento2 product plugin multi-website
magento2 product plugin multi-website
edited 18 hours ago
Ashish Viradiya
1,0811830
1,0811830
asked Mar 30 at 5:27
mrtuvnmrtuvn
1,88411829
1,88411829
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I post my answer here in case someone in future may need
Create di.xml file for prepare plugin class
<type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
<plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
</type>
original class here
Add new file Class WebsitePlugin
public function afterInitialize(
MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
MagentoCatalogModelProduct $product
)
if (Add your logic check here && isset($product))
if (!$product->getWebsiteIds())
$defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$websitesIds = [$defaultWebsiteId];
$product->setWebsiteIds($websitesIds);
return $product;
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%2f268028%2fextension-point-for-set-website-ids-product-in-case-admin-not-set-website%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 post my answer here in case someone in future may need
Create di.xml file for prepare plugin class
<type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
<plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
</type>
original class here
Add new file Class WebsitePlugin
public function afterInitialize(
MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
MagentoCatalogModelProduct $product
)
if (Add your logic check here && isset($product))
if (!$product->getWebsiteIds())
$defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$websitesIds = [$defaultWebsiteId];
$product->setWebsiteIds($websitesIds);
return $product;
add a comment |
I post my answer here in case someone in future may need
Create di.xml file for prepare plugin class
<type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
<plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
</type>
original class here
Add new file Class WebsitePlugin
public function afterInitialize(
MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
MagentoCatalogModelProduct $product
)
if (Add your logic check here && isset($product))
if (!$product->getWebsiteIds())
$defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$websitesIds = [$defaultWebsiteId];
$product->setWebsiteIds($websitesIds);
return $product;
add a comment |
I post my answer here in case someone in future may need
Create di.xml file for prepare plugin class
<type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
<plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
</type>
original class here
Add new file Class WebsitePlugin
public function afterInitialize(
MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
MagentoCatalogModelProduct $product
)
if (Add your logic check here && isset($product))
if (!$product->getWebsiteIds())
$defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$websitesIds = [$defaultWebsiteId];
$product->setWebsiteIds($websitesIds);
return $product;
I post my answer here in case someone in future may need
Create di.xml file for prepare plugin class
<type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
<plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
</type>
original class here
Add new file Class WebsitePlugin
public function afterInitialize(
MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
MagentoCatalogModelProduct $product
)
if (Add your logic check here && isset($product))
if (!$product->getWebsiteIds())
$defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
$websitesIds = [$defaultWebsiteId];
$product->setWebsiteIds($websitesIds);
return $product;
edited 18 hours ago
answered 18 hours ago
mrtuvnmrtuvn
1,88411829
1,88411829
add a comment |
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%2f268028%2fextension-point-for-set-website-ids-product-in-case-admin-not-set-website%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