Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: A page URL key "home" (id 2) for specified store already exists.. #2

Open
amenk opened this issue Jan 13, 2013 · 8 comments
Open

Comments

@amenk
Copy link
Contributor

amenk commented Jan 13, 2013

I am getting this error:

Error: A page URL key "home" (id 2) for specified store already exists..

It is pretty much the standard Magento demo data.

mysql> select page_id, identifier from cms_page;
+---------+----------------------------------------+
| page_id | identifier                             |
+---------+----------------------------------------+
|       3 | about-magento-demo-store               |
|       4 | customer-service                       |
|       6 | enable-cookies                         |
|       2 | home                                   |
|       5 | home                                   |
|       1 | no-route                               |
|       7 | privacy-policy-cookie-restriction-mode |
+---------+----------------------------------------+
7 rows in set (0.00 sec)

mysql> select * from cms_page_store;
+---------+----------+
| page_id | store_id |
+---------+----------+
|       1 |        0 |
|       3 |        0 |
|       4 |        0 |
|       5 |        0 |
|       6 |        0 |
|       7 |        0 |
|       2 |        1 |
|       2 |        2 |
|       2 |        3 |
+---------+----------+
9 rows in set (0.00 sec)
@amenk
Copy link
Contributor Author

amenk commented Jan 13, 2013

Actually the original error message is "A page URL key for specified store already exists." - I just added more info to find out what's going on. But in fact, these seems to come from Magento core code...

@avstudnitz
Copy link
Contributor

This can happen if you try to merge data from two systems with different IDs for a page with the same identifier (i.e. "home"). I experienced this too once. Could this be your problem too?
At the moment, you should start from the same database for all shops. Any ideas on how to make this more robust? We have discussed getting rid of the need to use entity_ids for import, but can't see how to get around that (especially for content types like blocks and email templates which can be referenced by id)

@amenk
Copy link
Contributor Author

amenk commented Jan 16, 2013

I got this when checking on only one system. I am not sure if I did export or import first. But it was a almost clean Magento install. Have to check this with a completely clean Magento install again.

@amenk
Copy link
Contributor Author

amenk commented Jan 17, 2013

I can reproduce the issue in the current master, on a completely clean magento 1.7.0.2 with sample data, installed by n98-magerun.

First command after installation: php contentsync.php export

@amenk
Copy link
Contributor Author

amenk commented Jan 17, 2013

The problem is that I have a page "home" for store 0 which is disabled and another one for the stores which is enabled. This is valid (I just can not enable the other "home" page in the backend)

@avstudnitz
Copy link
Contributor

Ah, thanks for the info, that clarifies things.

@amenk
Copy link
Contributor Author

amenk commented Jan 17, 2013

There is a workaround: Save both of those coexisting CMS home pages once - then it exports data.
I am not 100% sure if my Magento installation is valid and if this is really a content sync bug.

@amenk
Copy link
Contributor Author

amenk commented Jan 17, 2013

Somehow it is a magento bug :-)

Mage_Cms_Model_Resource_Page::getIsUniquePageToStores

   public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object)
    {
        if (Mage::app()->isSingleStoreMode() || !$object->hasStores()) {
            $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
        } else {
            $stores = (array)$object->getData('stores');
        }

When contentsync saves the CMS page (in order to update the hash), $_data['stores'] is not set. When saving the CMS page from the admin interface, I think this comes from the admin form. So I think in my "special" (or not so special?) database constellation, I would guess that it is not possible to save this CMS page at all.

The question is if contentsync should work around that by filling the stores array from $_data['store_id']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants