VictoryKing Posted January 9, 2023 Share Posted January 9, 2023 I have the current year YYYY as part of many of my product descriptions. Every year, I have to update all the descriptions manually. How can I use a variable for the current year? I've looked thru many posts online, but couldn't find how to do this in Prestashop 1.7. Not sure if I have to make changes to PHP and TPL files in order to reference the Year. Thank you. Link to comment Share on other sites More sharing options...
Prestachamps Posted January 9, 2023 Share Posted January 9, 2023 Hi, You can try to add a variable to the product descriptions (like {YearVariable} ) and inside the Product controller override you can replace it with the current year using str_replace. You have to make changes in PHP this way. Or if you want you can make the replace part inside the tpl where the product description variable is displayed. I hope that I could help. Have a nice day, Leo. 1 Link to comment Share on other sites More sharing options...
JBW Posted January 10, 2023 Share Posted January 10, 2023 Another option as you only have to do it yearly: Do a SQL update on all descriptions at once (little risk that there are other number looking like the year that might get updated too) 1 Link to comment Share on other sites More sharing options...
VictoryKing Posted January 11, 2023 Author Share Posted January 11, 2023 Thank you so much for your replies Leo and JBW! I appreciate the suggestions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now