Skip to content

Instantly share code, notes, and snippets.

View convenient's full-sized avatar

Luke Rodgers convenient

View GitHub Profile
@convenient
convenient / readme.md
Last active August 22, 2016 10:44
Safe Update Cms Block Content - Setup Script

We've been having some issues with setup scripts causing an issue when updating CMS blocks, throws an exception and fails the deployment. The issue was related to using the Mage::getModel('cms/block')->load() function which actually does an is_active filter in the background. Meaning if you try and update a cms block that the client has actually marked as in_active, you're code assumes it is creating a new one instead of updating.

To get around this you HAVE to use collections.

The script below was an example for a particular project, in which each store had its own CMS block with the same identifier. The key ingredient is how the CMS block is updated within the second loop.

@convenient
convenient / gist:b8e99c221caf9e599ac8
Last active November 6, 2015 16:25
Git PR Task List
javascript:(function() {var clickEvt = new MouseEvent("click", {bubbles: true, clientX: 20}); var editButtons = document.getElementsByClassName('js-comment-edit-button'); editButtons[0].dispatchEvent(clickEvt); var commentForms = document.getElementsByClassName('comment-form-textarea'); commentForms[0].value+="\n\n* [ ] Task 1\n* [ ] Task 2\n* [ ] Task 3\n* [ ] Task 4\n* [ ] Tasl 5\n"; var updateButtons = document.getElementsByClassName('btn-primary'); updateButtons[0].click();})()