ingleknifeshop Posted December 24, 2013 Share Posted December 24, 2013 How do i add the birthday to be required during the check out? Link to comment Share on other sites More sharing options...
vekia Posted December 24, 2013 Share Posted December 24, 2013 classes/Customer change code: 'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate'), to 'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate', 'required' => true), Link to comment Share on other sites More sharing options...
ingleknifeshop Posted December 24, 2013 Author Share Posted December 24, 2013 Thanks for the help Link to comment Share on other sites More sharing options...
vekia Posted December 25, 2013 Share Posted December 25, 2013 does it work as you expected? Link to comment Share on other sites More sharing options...
ingleknifeshop Posted January 4, 2014 Author Share Posted January 4, 2014 Its coming up as an error after putting in the birthday There is 1 Error(s): birthday is required. Link to comment Share on other sites More sharing options...
vekia Posted January 4, 2014 Share Posted January 4, 2014 so you see this message even if you fill "birthday" field during register process? Link to comment Share on other sites More sharing options...
ingleknifeshop Posted January 4, 2014 Author Share Posted January 4, 2014 I was using guest checkout. I have guest checkout on and still say something. Link to comment Share on other sites More sharing options...
vekia Posted January 5, 2014 Share Posted January 5, 2014 and you see there "birthday" field to fill out ? your website is online? can i test it? Link to comment Share on other sites More sharing options...
ingleknifeshop Posted January 5, 2014 Author Share Posted January 5, 2014 yes, ingleknifeshop.com Link to comment Share on other sites More sharing options...
ingleknifeshop Posted January 6, 2014 Author Share Posted January 6, 2014 Would this module work with 1.5.6.1? Do not wont to buy it if it dont work with my prestashop version. Module Checkout Fieldshttp://addons.prestashop.com/en/administration-tools-prestashop-modules/3769-checkout-fields.html Link to comment Share on other sites More sharing options...
siaip Posted February 26, 2014 Share Posted February 26, 2014 (edited) There is a problem with ObjectModel.php -> validateController(...). When "Birthday" is set to 'required' => true, then validateController() checking field value "birthday" which does not exists, because in authentication form birthday is created from 3 fields (years, months, days). Here is quick fix for that (version 1.5.3.1): change code in ObjectModel.php -> validateController(..): // Checking for required fields if (isset($data['required']) && $data['required'] && ($value = Tools::getValue($field, $this->{$field})) == false && (string)$value != '0') if (!$this->id || $field != 'passwd') $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.'); to this one: // Checking for required fields if($field == 'birthday' && isset($data['required']) && $data['required']) { $birthday = ((int)Tools::getValue('years')>0 && (int)Tools::getValue('months')>0 && (int)Tools::getValue('days')>0 ? (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days') : ''); if(!Validate::isBirthDate($birthday)) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is incorrect.'); else if(empty($birthday)) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.'); } else if (isset($data['required']) && $data['required'] && ($value = Tools::getValue($field, $this->{$field})) == false && (string)$value != '0') { if (!$this->id || $field != 'passwd') $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.'); } Edited February 26, 2014 by siaip (see edit history) Link to comment Share on other sites More sharing options...
Dashe Posted January 2, 2015 Share Posted January 2, 2015 Someone have a solution for PS 1.6? Link to comment Share on other sites More sharing options...
Recommended Posts