sakiri Posted October 13, 2013 Share Posted October 13, 2013 (edited) Hi everybody, I would like to put up a Birthday Club in my store. For obvious reasons I therefore need to make the day and month of a customer's birthday non-changeable by the customer once he/she has stored his/her birthday. So I would like to change the identity.tpl: If the value stored in the database for birthday is 0000-00-00 then the <select>fields should be displayed as usual and be available for putting in new data. If however the value stored in the database is different from 0000-00-00, I only want to display the stored value for day and month (don't care about the year) for information, but unchangeable. Could somebody please explain to a PHP-greenhorn how to do this? Thank you! Edited October 14, 2013 by sakiri (see edit history) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted October 14, 2013 Share Posted October 14, 2013 You don't have to modify the controller file. Only need to modify the theme file indentity.tpl {if !$sl_year} {* default prestashop select box for birthday *} {else} {foreach from=$months key=k item=v}{if ($sl_month == $k)}{assign var=my_month value=$v}{/if}{/foreach} <p class="text"><label>{l s='Date of Birth'}</label>{$sl_day} - {$my_month}</p> {/if} Only someone who knows Prestashop, may change the birthday data with browser plugin/addons e.g firebugs. And if you think this is an issue, then you should modify the controller file too. Link to comment Share on other sites More sharing options...
sakiri Posted October 14, 2013 Author Share Posted October 14, 2013 (edited) Thank you very much for your help! When looking at this piece of coding, it all seems so terribly easy, but I would have never worked it out myself ... that's the fate of a newbie... I had to tinker slightly with the coding, and that's now the final & working snippet: <label>{l s='Date of Birth'} </label> {if $sl_year == "0000"} {* default prestashop select box for birthday *} {else} {foreach from=$months key=k item=v}{if ($sl_month == $k)}{assign var=my_month value=$v}{/if}{/foreach} <label style="text-align: left; font-weight: bold;"> {$sl_day}. {l s=$my_month} {$sl_year} </label> {/if} Thank you again! Edited October 14, 2013 by sakiri (see edit history) Link to comment Share on other sites More sharing options...
KevinNash Posted April 7, 2015 Share Posted April 7, 2015 (edited) Hello, that code introduce a huge bug : If the customer tick ( or untick ) the newsletter, that delete his birthday from database. And after that, the customer gets an error when he try to access his account personal informations. When I remove that code, the bug disappear, I am on PS 1.5.4.1. Any idea to fix that ? Edited April 7, 2015 by KevinNash (see edit history) 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