forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
magento#9113 fix url_path attribute value is not populated
1 parent
9d75bca
commit 56b9b19
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/code/Magento/CatalogUrlRewrite/Observer/ProductUrlPathAutogeneratorObserver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\CatalogUrlRewrite\Observer; | ||
|
||
use Magento\Catalog\Model\Product; | ||
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; | ||
use Magento\Framework\Event\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
class ProductUrlPathAutogeneratorObserver implements ObserverInterface | ||
{ | ||
/** @var ProductUrlPathGenerator */ | ||
protected $productUrlPathGenerator; | ||
|
||
/** | ||
* @param ProductUrlPathGenerator $productUrlPathGenerator | ||
*/ | ||
public function __construct(ProductUrlPathGenerator $productUrlPathGenerator) | ||
{ | ||
$this->productUrlPathGenerator = $productUrlPathGenerator; | ||
} | ||
|
||
/** | ||
* @param \Magento\Framework\Event\Observer $observer | ||
* @return void | ||
*/ | ||
public function execute(\Magento\Framework\Event\Observer $observer) | ||
{ | ||
/** @var Product $product */ | ||
$product = $observer->getEvent()->getProduct(); | ||
$product->setUrlPath($this->productUrlPathGenerator->getUrlPath($product)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters