When updating a widget instance programmatically, layout updates are removedCopy a Widget Instance Programmatically, Preserving Layout UpdatesWidget Instance Block BugCreate categories through installerPer Store Widget Instance Block ReferencesUnable to trace when order status for an order is marked complete in MagentoGet Widget Instance TitleHow to create a custom block from billing.phtmlMagento config xml multiple layout updatesSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoSQLSTATE[42000] when updating attributes in magento 1 programmaticallyHow to add Widget layout updates field in my custom module admin form Magento 2
Remove sudoers using script
Translating 'Liber'
Secure offsite backup, even in the case of hacker root access
Is it recommended against to open-source the code of a webapp?
Are there any existing monsters I can use as a basis for a baby skeleton statblock?
Why only the fundamental frequency component is said to give useful power?
Did Darth Vader wear the same suit for 20+ years?
How to generate random points without duplication?
Implement Homestuck's Catenative Doomsday Dice Cascader
Can you really not move between grapples/shoves?
Select items in a list that contain criteria
What's the correct term for a waitress in the Middle Ages?
Incremental Ranges!
Java guess the number
How to skip replacing first occurrence of a character in each line?
Does Lightning Network has concept of continuous stream of value?
Etymology of 'calcit(r)are'?
How to make a setting relevant?
Axial Equatorial NMR graph difference
Pushout commutative diagram
siunitx error: Invalid numerical input
When conversion from Integer to Single may lose precision
My coworkers think I had a long honeymoon. Actually I was diagnosed with cancer. How do I talk about it?
When writing an error prompt, should we end the sentence with a exclamation mark or a dot?
When updating a widget instance programmatically, layout updates are removed
Copy a Widget Instance Programmatically, Preserving Layout UpdatesWidget Instance Block BugCreate categories through installerPer Store Widget Instance Block ReferencesUnable to trace when order status for an order is marked complete in MagentoGet Widget Instance TitleHow to create a custom block from billing.phtmlMagento config xml multiple layout updatesSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoSQLSTATE[42000] when updating attributes in magento 1 programmaticallyHow to add Widget layout updates field in my custom module admin form Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I tried to update a widget instance as follows (where /PATH/TO and WIDGET_INSTANCE_ID should be replaced by the actual values:
require_once '/PATH/TO/app/Mage.php';
Mage::app();
$widgetInstance = Mage::getModel('widget/widget_instance');
$widgetInstance->load(WIDGET_INSTANCE_ID);
$widgetInstance->setData('title', 'foo');
$widgetInstance->save();
After executing this code, all layout updates of the widget have been removed.
What could be the cause of this?
magento-1.9 bug widget-instance
add a comment |
I tried to update a widget instance as follows (where /PATH/TO and WIDGET_INSTANCE_ID should be replaced by the actual values:
require_once '/PATH/TO/app/Mage.php';
Mage::app();
$widgetInstance = Mage::getModel('widget/widget_instance');
$widgetInstance->load(WIDGET_INSTANCE_ID);
$widgetInstance->setData('title', 'foo');
$widgetInstance->save();
After executing this code, all layout updates of the widget have been removed.
What could be the cause of this?
magento-1.9 bug widget-instance
add a comment |
I tried to update a widget instance as follows (where /PATH/TO and WIDGET_INSTANCE_ID should be replaced by the actual values:
require_once '/PATH/TO/app/Mage.php';
Mage::app();
$widgetInstance = Mage::getModel('widget/widget_instance');
$widgetInstance->load(WIDGET_INSTANCE_ID);
$widgetInstance->setData('title', 'foo');
$widgetInstance->save();
After executing this code, all layout updates of the widget have been removed.
What could be the cause of this?
magento-1.9 bug widget-instance
I tried to update a widget instance as follows (where /PATH/TO and WIDGET_INSTANCE_ID should be replaced by the actual values:
require_once '/PATH/TO/app/Mage.php';
Mage::app();
$widgetInstance = Mage::getModel('widget/widget_instance');
$widgetInstance->load(WIDGET_INSTANCE_ID);
$widgetInstance->setData('title', 'foo');
$widgetInstance->save();
After executing this code, all layout updates of the widget have been removed.
What could be the cause of this?
magento-1.9 bug widget-instance
magento-1.9 bug widget-instance
edited Jul 13 '16 at 11:28
Aad Mathijssen
asked Jul 13 '16 at 11:21
Aad MathijssenAad Mathijssen
1,38511122
1,38511122
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The cause of this issue is that the format of the page_groups field needs a different format for saving than is used available after loading.
The format needed for saving can be generated from the format after loading by placing the following code somewhere between the load and save calls:
if ($widgetInstance->getData('page_groups'))
$formattedPageGroups = [];
foreach ($widgetInstance->getData('page_groups') as $pageGroup)
$pageGroupName = $pageGroup['page_group'];
$formattedPageGroups[] = [
'page_group' => $pageGroupName,
$pageGroupName => [
'page_id' => $pageGroup['page_id'],
'layout_handle' => $pageGroup['layout_handle'],
'for' => $pageGroup['page_for'],
'block' => $pageGroup['block_reference'],
'entities' => $pageGroup['entities'],
'template' => $pageGroup['template']
]
];
$widgetInstance->setData('page_groups', $formattedPageGroups);
Note that this is in essence the same issue as described in the post on copying a widget instance.
add a comment |
I think the name of the property is 'page_template' and not 'template' at line:
'template' => $pageGroup['template']
should be
'template' => $pageGroup['page_template']
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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%2f125547%2fwhen-updating-a-widget-instance-programmatically-layout-updates-are-removed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The cause of this issue is that the format of the page_groups field needs a different format for saving than is used available after loading.
The format needed for saving can be generated from the format after loading by placing the following code somewhere between the load and save calls:
if ($widgetInstance->getData('page_groups'))
$formattedPageGroups = [];
foreach ($widgetInstance->getData('page_groups') as $pageGroup)
$pageGroupName = $pageGroup['page_group'];
$formattedPageGroups[] = [
'page_group' => $pageGroupName,
$pageGroupName => [
'page_id' => $pageGroup['page_id'],
'layout_handle' => $pageGroup['layout_handle'],
'for' => $pageGroup['page_for'],
'block' => $pageGroup['block_reference'],
'entities' => $pageGroup['entities'],
'template' => $pageGroup['template']
]
];
$widgetInstance->setData('page_groups', $formattedPageGroups);
Note that this is in essence the same issue as described in the post on copying a widget instance.
add a comment |
The cause of this issue is that the format of the page_groups field needs a different format for saving than is used available after loading.
The format needed for saving can be generated from the format after loading by placing the following code somewhere between the load and save calls:
if ($widgetInstance->getData('page_groups'))
$formattedPageGroups = [];
foreach ($widgetInstance->getData('page_groups') as $pageGroup)
$pageGroupName = $pageGroup['page_group'];
$formattedPageGroups[] = [
'page_group' => $pageGroupName,
$pageGroupName => [
'page_id' => $pageGroup['page_id'],
'layout_handle' => $pageGroup['layout_handle'],
'for' => $pageGroup['page_for'],
'block' => $pageGroup['block_reference'],
'entities' => $pageGroup['entities'],
'template' => $pageGroup['template']
]
];
$widgetInstance->setData('page_groups', $formattedPageGroups);
Note that this is in essence the same issue as described in the post on copying a widget instance.
add a comment |
The cause of this issue is that the format of the page_groups field needs a different format for saving than is used available after loading.
The format needed for saving can be generated from the format after loading by placing the following code somewhere between the load and save calls:
if ($widgetInstance->getData('page_groups'))
$formattedPageGroups = [];
foreach ($widgetInstance->getData('page_groups') as $pageGroup)
$pageGroupName = $pageGroup['page_group'];
$formattedPageGroups[] = [
'page_group' => $pageGroupName,
$pageGroupName => [
'page_id' => $pageGroup['page_id'],
'layout_handle' => $pageGroup['layout_handle'],
'for' => $pageGroup['page_for'],
'block' => $pageGroup['block_reference'],
'entities' => $pageGroup['entities'],
'template' => $pageGroup['template']
]
];
$widgetInstance->setData('page_groups', $formattedPageGroups);
Note that this is in essence the same issue as described in the post on copying a widget instance.
The cause of this issue is that the format of the page_groups field needs a different format for saving than is used available after loading.
The format needed for saving can be generated from the format after loading by placing the following code somewhere between the load and save calls:
if ($widgetInstance->getData('page_groups'))
$formattedPageGroups = [];
foreach ($widgetInstance->getData('page_groups') as $pageGroup)
$pageGroupName = $pageGroup['page_group'];
$formattedPageGroups[] = [
'page_group' => $pageGroupName,
$pageGroupName => [
'page_id' => $pageGroup['page_id'],
'layout_handle' => $pageGroup['layout_handle'],
'for' => $pageGroup['page_for'],
'block' => $pageGroup['block_reference'],
'entities' => $pageGroup['entities'],
'template' => $pageGroup['template']
]
];
$widgetInstance->setData('page_groups', $formattedPageGroups);
Note that this is in essence the same issue as described in the post on copying a widget instance.
edited Apr 13 '17 at 12:55
Community♦
1
1
answered Jul 13 '16 at 11:41
Aad MathijssenAad Mathijssen
1,38511122
1,38511122
add a comment |
add a comment |
I think the name of the property is 'page_template' and not 'template' at line:
'template' => $pageGroup['template']
should be
'template' => $pageGroup['page_template']
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I think the name of the property is 'page_template' and not 'template' at line:
'template' => $pageGroup['template']
should be
'template' => $pageGroup['page_template']
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I think the name of the property is 'page_template' and not 'template' at line:
'template' => $pageGroup['template']
should be
'template' => $pageGroup['page_template']
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I think the name of the property is 'page_template' and not 'template' at line:
'template' => $pageGroup['template']
should be
'template' => $pageGroup['page_template']
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited May 28 at 16:42
Daniel
895219
895219
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered May 28 at 14:17
DexBGDexBG
1
1
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
DexBG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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%2f125547%2fwhen-updating-a-widget-instance-programmatically-layout-updates-are-removed%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