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

In productlist: if price is not shown don't show add to cart either #662

Conversation

tswfi
Copy link
Contributor

@tswfi tswfi commented Nov 27, 2024

Questions Answers
Description? If customer group has "show prices: no" the product listing still shows the add to cart button. This adds the price check to the check if "add to cart" should be shown in the product listing
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #661
Sponsor company
How to test? Change "guest" and "visitor" to "show prices: no". Check shop product listings that prices are not shown anymore and no "add to cart" button is shown. Login with a customer that belongs to a group that sees prices and check that the add to cart button is shown.

Copy link
Contributor

@Hlavtox Hlavtox left a comment

Choose a reason for hiding this comment

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

@tswfi
Copy link
Contributor Author

tswfi commented Nov 27, 2024

should have checked with the default theme too..
I wonder why it works on the product page correctly in hummingbird..

Closing this as the PR is not going to go to the theme but into the core.

@tswfi tswfi closed this Nov 27, 2024
@tswfi tswfi deleted the productlist_hide_addto_cart_if_price_not_shown branch November 27, 2024 12:21
@Hlavtox
Copy link
Contributor

Hlavtox commented Nov 27, 2024

@tswfi No idea, but if we do it in core, it will work in all themes and will be centralized. 👍

Just do something like this:

// Do not enable add to cart button if prices are hidden
if (!$this->shouldShowPrice($this->settings, $this->product)) {
  return false;
}

@tswfi
Copy link
Contributor Author

tswfi commented Nov 27, 2024

yup, core is the correct place.. the problem is that when searching for existing issues I get like 14 pages of results: https://github.com/PrestaShop/PrestaShop/issues?q=is%3Aissue%20state%3Aopen%20add%20to%20cart ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

On product listing "add to cart" is shown even if prices are not.
3 participants