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

#9113 fix url_path attribute value is not populated #12012

Closed
wants to merge 4 commits into from

Conversation

thiagolima-bm
Copy link
Member

Fix url_path attribute value is not populated for any product #9113

@vrann vrann added the mm17es label Nov 4, 2017
@vrann vrann self-assigned this Nov 4, 2017
@vrann vrann added this to the November 2017 milestone Nov 4, 2017
class ProductUrlPathAutogeneratorObserver implements ObserverInterface
{
/** @var ProductUrlPathGenerator */
protected $productUrlPathGenerator;
Copy link
Contributor

Choose a reason for hiding this comment

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

According to Magento technical guidelines
http://devdocs.magento.com/guides/v2.1/coding-standards/technical-guidelines/technical-guidelines.html
2.7. All non-public properties and methods SHOULD be private.

Could you change protected visibility to private?

@thiagolima-bm
Copy link
Member Author

thiagolima-bm commented Nov 5, 2017

@ihor-sviziev I have removed the observer that I created. I would say that is better to use the same observer ProductUrlKeyAutogeneratorObserver and just add a new line instead
$product->setUrlPath($this->productUrlPathGenerator->getUrlPath($product));

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

@thiagolima-bm not sure that setting url_path should be added to existing class because of class name, but in general looks good.
now integration tests failed. Could you adjust them jf needed?

@thiagolima-bm
Copy link
Member Author

@ihor-sviziev I will take a look why the tests are failing

@@ -32,5 +32,6 @@ public function execute(\Magento\Framework\Event\Observer $observer)
/** @var Product $product */
$product = $observer->getEvent()->getProduct();
$product->setUrlKey($this->productUrlPathGenerator->getUrlKey($product));
$product->setUrlPath($this->productUrlPathGenerator->getUrlPath($product));
Copy link

@TeknoFiend TeknoFiend Nov 14, 2017

Choose a reason for hiding this comment

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

The issue mentioned using [product-suffix-from-setting] to build the path. Should this not be getUrlPathWithSuffix?

Sorry for the drive-by comment, I'm in need of a populated path, that includes the suffix.

@thiagolima-bm
Copy link
Member Author

@ihor-sviziev any clue where this test could be failing?

{
/** @var Product $product */
$product = $observer->getEvent()->getProduct();
$product->setUrlKey($this->productUrlPathGenerator->getUrlPath($product));
Copy link
Contributor

@ihor-sviziev ihor-sviziev Nov 22, 2017

Choose a reason for hiding this comment

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

  1. Looks like you was thinking to us $product->setUrlPath() method instead
  2. Would be great to add some unit or integration test there. Could you add it?

If you need any help - feel free to ask

Copy link
Member Author

Choose a reason for hiding this comment

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

For sure! I need more coffee :P

@ihor-sviziev
Copy link
Contributor

Hi @thiagolima-bm, are you interested in finishing your PR or maybe you need some help?

@okorshenko
Copy link
Contributor

Hi @thiagolima-bm
We are closing this PR due to inactivity. Feel free to reopen it once ready

@okorshenko okorshenko closed this Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants