Skip to content

Category\Collection::joinUrlRewrite should use the store set on the collection #13704

Closed
@alepane21

Description

@alepane21

Preconditions

  1. Magento 2.1.8
  2. PHP 7
  3. MySQL 5.6

Steps to reproduce

$categoryCollection = $this->categoryCollectionFactory->create();
$categoryCollection->setStoreId(1);
$categoryCollection->addUrlRewriteToResult();
echo $categoryCollection->getUrl();

Expected result

  1. should return the url of category in store 1

Actual result

  1. Instead it returns the url of default store

The problem is that Magento\Catalog\Model\ResourceModel\Category\Collection::joinUrlRewrite always use the store id from the store manager. I think that it should instead use the storeId set on the actual collection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedimprovement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions