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

[Sylius 2] Division by zero on admin cart promotion index #17608

Open
jbcr opened this issue Jan 7, 2025 · 0 comments · May be fixed by #17609
Open

[Sylius 2] Division by zero on admin cart promotion index #17608

jbcr opened this issue Jan 7, 2025 · 0 comments · May be fixed by #17609
Labels
Admin AdminBundle related issues and PRs. Bug Confirmed bugs or bugfixes.

Comments

@jbcr
Copy link
Contributor

jbcr commented Jan 7, 2025

Sylius version affected: 2.0.2

Description
When you navigate to the cart promotion index, an error division by zero can occur if a promotion has the field Usage limit set to zero.

Steps to reproduce

  1. Go to the administration panel.
  2. In the Marketing section click on "Cart promotion".
  3. Edit a promotion or create a new one.
  4. Set the Usage limit to 0 and save.
  5. Return to the "Cart promotion" list.

This procedure works on Sylius demonstration instance.

Possible Solution

Replace {% if data.usageLimit is empty %} with {% if not data.usageLimit %} in src/Sylius/Bundle/AdminBundle/templates/promotion/grid/field/usage.html.twig line 1.

@GSadee GSadee added Bug Confirmed bugs or bugfixes. Admin AdminBundle related issues and PRs. labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants