I have this script
<?php
$cmsPage = Array (
'title' => 'Test Page 1',
'root_template' => 'one_column',
'identifier' => 'testpage1',
'content' => "<p>Testowa sprawa czy dziaĆa update ? oooooooooooo</p>",
'is_active' => 1,
'stores' => array(1),
'sort_order' => 0
);
Mage::getModel('cms/page')->setData($cmsPage)->save();
If cms page with identifier "testpage1" exist , the script create another with the same identifier.
Is there a way to check if cmspage exist – and if that is true – do update ?
Best Answer
I came accross the exact same problem on Magento 1.9.2.2
I couldn't find why, but every time I wanted to update a specific cms page, it was creating a new one instead. I finally checked the controller code, and after seeing it was the same code I was using, I checked the data sent in the form. And the answer is the page_id.
Try setting the page_id of your current page in the data, and it should work.