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

Abort if category is not a child of the root category #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanieliMi
Copy link

Description

Importing a simple product into two websites with different category roots will cause an error, this is because it will try to generate a url rewrite for the root category of the other store since it's not recognized as one (it's trying to access url path but root categories do not have one). This PR fixes this issue.

Steps to reproduce

  1. Create two websites with different category roots
  2. Import a simple product and assign it to both websites and a category of each root

Expected result

The product is imported into each category with according url rewrites.

Actual result

The import fails due to missing url path of the one root category.

protected function isChildOfRootCategory($category)
{
// split the path into its segments
$categoryPathParts = explode('/', $category[MemberNames::PATH]);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a category is not yet present but created on the fly by pacemaker $category[MemberNames::PATH]) is empty and the method will return false.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We somehow have to catch this case and find a different solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieliMi Sorry, but I think I can't really follow you here. When Pacemaker will create a category on-the-fly, this will happen before this observer will be invoked. Can you please describe in more details how this case can come about?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will improve the Steps to reproduce

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this similar to techdivision/import#209 ?

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

Successfully merging this pull request may close these issues.

3 participants