Replace "else if" smarty conditions by "elseif" as officially recommanded
Klemart3D opened this issue · comments
Prerequisites
- I understand and accept the project's code of conduct.
- I have already searched in existing issues and found no previous report of this bug.
Describe the bug and add attachments
As recommended by Smarty official documentation an "else-if" condition must be write {elseif}
(without space between else
and if
).
But currently, an else if
syntax (with a space between else
and if
) is currently used:
- 3 times in 2 files into last version of Classic theme:
https://github.com/search?q=repo%3APrestaShop%2Fclassic-theme+%22%7Belse+if%22&type=code - 4 times in 3 files into last version of Hummingbird theme:
https://github.com/search?q=repo%3APrestaShop%2Fhummingbird%20%22%7Belse%20if%22&type=code
In comparison, elseif
syntax (without space between else
and if
) is currently used:
- 28 times in 22 files into last version of Classic theme:
https://github.com/search?q=repo%3APrestaShop%2Fclassic-theme+%7Belseif&type=code - 35 times in 19 files into last version of Hummingbird theme:
https://github.com/search?q=repo%3APrestaShop%2Fhummingbird+%22%7Belseif%22&type=code
Not checked into every Smarty template files (modules, other themes…)
Expected behavior
A uniform smarty else-if syntax following official recommendation everywhere (in each smarty template ".tpl" files of the whole project).
Steps to reproduce
- Search for "{else if" in Classic theme codebase
PrestaShop version(s) where the bug happened
1.7.x, 8.x
PHP version(s) where the bug happened
8.1
If your bug is related to a module, specify its name and its version
No response
Your company or customer's name goes here (if applicable).
No response
Hi @Klemart3D
Thank you for your report. Currently you seems to show a feature to add in Prestashop instead of a real issue, If you're agree with that, I can change this issue into a discussion to discuss with the tech-council and product-council
Waiting for your feedback
Hi @AureRita,
It's not a feature, it's a refactoring issue to have a more clean code, it's an issue for developers like me because some IDE like phpStorm showing it as an error (because of wrong smarty syntax used):
It can take less than one minute to fix that for team working on native PrestaShop themes, but if you prefer, I can open issue into hummingbird repository?
Let's transfer into hummingbird repo ! If you are willing to contribute, we would be happy to review your work 🤗
Hi @MatShir , thank you.
I made 2 pull requests :
- For Classic theme: PrestaShop/classic-theme#142
- For Hummingbird theme: #605
Fixed