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
MO: Viewed products module now fully working #3
Conversation
Well, module at current state doesn't work at all, this PR makes it working, you can display viewed products anywhere you want as this is a widget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @kpodemski. I guess the fix is easier than you think. 😉
@@ -168,8 +168,8 @@ public function getCacheId($name = null) | |||
|
|||
public function renderWidget($hookName = null, array $configuration = []) | |||
{ | |||
if ('displayProductButtons' === $hookName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I was writing another review, then I found the actual issue)
On PrestaShop 1.7.1.0, we declared an alias for the hook 'displayProductButtons'.
The only you have to replace in this module is this line with the following one:
if (in_array($hookName, array('displayProductButtons', 'displayProductAdditionalInfo')))
@Quetzacoalt91 yeah but if you want to display module in leftColumn you can't because of this -_- |
@Quetzacoalt91 with dev_mode set to true it will return a notice as you want to have productId when it's not needed :) this is why there's |
$products = $this->getViewedProducts($this->context->controller->getProduct()->id); | ||
} else { | ||
$products = $this->getViewedProducts(false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this check, I was also using the configuration variable.
$id_product = isset($configuration['product']['id_product']) ? $configuration['product']['id_product'] : false;
$products = $this->getViewedProducts($id_product);
I do not understand why relying on the current function param is a bad idea for you. IMO it is even worse to look outside (even if the property you look after exists from PS 1.5). |
Yeah well we can argue about that, the thing is that we worked this out and module needs to be changed because right now it doesn't work :D |
In Prestashop 1.7.1 displayProductButtons hook was renamed to displayProductAdditionalInfo. This change caused viewed products not working at all. It also allow to hook module non product pages. Based on @kpodemksi PR PrestaShop#3 which is not merged yet
Hello, this code will fix this module, with that fix module work great on 1.7.2.4:
|
Hello, I am sorry I worked on this issue but I didn't have seen your PR |
Hi @kpodemski, As we merged the PR #4, which also fix that issue, I'm closing this one. FYI the version v1.1.0 of the module will be deployed tomorrow. Regards |
works on PS 1.7.8.7 (after upgrade from 1.7.6.5) |
Well, module at current state doesn't work at all, this PR makes it working, you can display viewed products anywhere you want as this is a widget