Conversation
The block rendered by displayAdminCustomers never looked the customer up: the hook assigned only the module's display name and the template printed a hardcoded 0 badge, so the card was empty whatever the customer had saved. Fetch the wishlists with WishList::getAllWishlistsByIdCustomer(), which already returns the product count per list and scopes itself to the current shop or shop group, and render them with an explicit empty state.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
displayAdminCustomersnever looked the customer up.hookDisplayAdminCustomers()assigned only$this->displayName, and the template printed a hardcoded0badge with the module name as its body, so the block was empty for every customer no matter what they had saved - which is what PrestaShop/PrestaShop#28572 meant by "not implemented". It now fetches the wishlists and lists them with their product counts, and says so explicitly when there are none.0badge and the word "Wishlist". After: it lists each wishlist with the number of products in it, the default one first, and shows "This customer has no wishlist." for a customer who has none.Measured, on the real hook
Hook::exec('displayAdminCustomers', ['id_customer' => …])against a seeded wishlist of 2 products:Reused rather than written
WishList::getAllWishlistsByIdCustomer()already existed and already returnsnbProductsper list plusthe
defaultflag, and already restricts itself toShop::getContextShopID()or the context shop group.So the hook is four lines and the multistore scoping comes for free rather than being re-implemented -
worth saying in the PR, since a reviewer will otherwise wonder why no shop handling is visible.
Gates
php -lclean; module's ownphp-cs-fixer(PrestaShop coding standard) reports no violations.tests/holdsjs,php(phpstan) andUI), so the measuredRED -> GREEN above stands in for a unit test, as with ps_emailalerts.
Context worth carrying to the PR
PrestaShop SA said on the issue (ibahloul-ps, 2025-02-06) that they would not fix it and invited a community
PR; the issue is labelled
Ready. Three later reports were closed as duplicates of it: PrestaShop/PrestaShop#28572, PrestaShop/PrestaShop#34853, PrestaShop/PrestaShop#35844.