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

Can't update cms pages with is_active = 0 #109

Open
maaarghk opened this issue Oct 16, 2019 · 0 comments
Open

Can't update cms pages with is_active = 0 #109

maaarghk opened this issue Oct 16, 2019 · 0 comments

Comments

@maaarghk
Copy link

maaarghk commented Oct 16, 2019

If a cms page is defined as follows:

my-test-page:
  page:
    -
      source: app/configurator/common/pages/content/my-test-page.html
      title: My Test Page
      page_layout: 1column
      meta_keywords:
      meta_description:
      content_heading:
      is_active: 0
      sort_order: 0
      layout_update_xml:
      custom_theme:
      custom_root_template:
      custom_layout_update_xml:
      custom_theme_from:
      custom_theme_to:
      meta_title:

then re-running the configurator to update the content will fail with:

Could not save the page: URL key for specified store already exists.

The reason is here: https://github.com/ctidigital/magento2-configurator/blob/develop/Component/Pages.php#L101

This calls checkIdentifier: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Cms/Model/ResourceModel/Page.php#L276 - which hardcodes a value of 1 for isActive.

Therefore a query like the following is generated:

SELECT `cp`.`page_id` FROM `cms_page` AS `cp`
 INNER JOIN `cms_page_store` AS `cps` ON cp.row_id = cps.row_id WHERE ((cp.identifier = 'my-test-page') AND (cps.store_id IN (0, 0)) AND (cp.is_active = 1)) AND (cp.created_in <= 1) AND (cp.updated_in > 1) ORDER BY `cps`.`store_id` DESC
 LIMIT 1

with is_active = 1 the page is not found, and configurator therefore tries to create it instead of update it.

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

1 participant