rfourt Posted February 4, 2015 Share Posted February 4, 2015 Hello.. ive been working along time with our new shop and today i checked how the loyalty points where working and i pressed the button to transform the points to???well i never got that far to see what actually hapends.. becouse as soon as i clicked the Transform my points to a coupon i got this message. [PrestaShopException] Property CartRule->name is emptyat line 887 in file classes/ObjectModel.php 881.882. $message = $this->validateField($field, $value, $id_lang);883. if ($message !== true)884. {885. if ($die)886. throw new PrestaShopException($message);887. return $error_return ? $message : false;888. }889. }890. }891. ObjectModelCore->validateFieldsLang - [line 301 - classes/ObjectModel.php]295. {296. // Retrocompatibility297. if (method_exists($this, 'getTranslationsFieldsChild'))298. return $this->getTranslationsFieldsChild();299.300. $this->validateFieldsLang();301. $is_lang_multishop = $this->isLangMultishop();302.303. $fields = array();304. if ($this->id_lang === null)305. foreach (Language::getLanguages(false) as $language) ObjectModelCore->getFieldsLang - [line 489 - classes/ObjectModel.php]483. return false;484.485. // Database insertion for multilingual fields related to the object486. if (!empty($this->def['multilang']))487. {488. $fields = $this->getFieldsLang();489. if ($fields && is_array($fields))490. {491. $shops = Shop::getCompleteListOfShopsID();492. $asso = Shop::getAssoTable($this->def['table'].'_lang');493. foreach ($fields as $field) ObjectModelCore->add - [line 125 - classes/CartRule.php] - [2 Arguments] Argument [0]1Argument [1] CartRuleCore->add - [line 119 - modules/loyalty/controllers/front/default.php]113.114.115. $contains_categories = is_array($categories) && count($categories);116. if ($contains_categories)117. $cart_rule->product_restriction = 1;118. $cart_rule->add();119.120. //Restrict cartRules with categories121. if ($contains_categories)122. {123. LoyaltyDefaultModuleFrontController->processTransformPoints - [line 55 - modules/loyalty/controllers/front/default.php]49. * @see FrontController::postProcess()50. */51. public function postProcess()52. {53. if (Tools::getValue('process') == 'transformpoints')54. $this->processTransformPoints();55. }56.57. /**58. * Transform loyalty point to a voucher59. */ LoyaltyDefaultModuleFrontController->postProcess - [line 171 - classes/controller/Controller.php]165. // setMedia MUST be called before postProcess166. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))167. $this->setMedia();168.169. // postProcess handles ajaxProcess170. $this->postProcess();171.172. if (!empty($this->redirect_after))173. $this->redirect();174.175. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) ControllerCore->run - [line 373 - classes/Dispatcher.php]367. // Execute hook dispatcher368. if (isset($params_hook_action_dispatcher))369. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);370.371. // Running controller372. $controller->run();373. }374. catch (PrestaShopException $e)375. {376. $e->displayMessage();377. } DispatcherCore->dispatch - [line 28 - index.php]22. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)23. * International Registered Trademark & Property of PrestaShop SA24. */25.26. require(dirname(__FILE__).'/config/config.inc.php');27. Dispatcher::getInstance()->dispatch(); Anyone have an idea what could be wrong?Thank you. Link to comment Share on other sites More sharing options...
NemoPS Posted February 6, 2015 Share Posted February 6, 2015 I bet the module is broken. Open up that default.php file in the module's folder, controllers, front. Locate this $cart_rule = new CartRule(); And add the following afterwards $cart_rule->name[Configuration::get('PS_LANG_DEFAULT')] = 'test name'; Link to comment Share on other sites More sharing options...
rfourt Posted February 6, 2015 Author Share Posted February 6, 2015 Thank you for answer. Tested the method you gave me and it gave me this : [PrestaShopException]Property CartRule->name is emptyat line 887 in file classes/ObjectModel.php 881.882. $message = $this->validateField($field, $value, $id_lang);883. if ($message !== true)884. {885. if ($die)886. throw new PrestaShopException($message);887. return $error_return ? $message : false;888. }889. }890. }891. ObjectModelCore->validateFieldsLang - [line 301 - classes/ObjectModel.php]295. {296. // Retrocompatibility297. if (method_exists($this, 'getTranslationsFieldsChild'))298. return $this->getTranslationsFieldsChild();299.300. $this->validateFieldsLang();301. $is_lang_multishop = $this->isLangMultishop();302.303. $fields = array();304. if ($this->id_lang === null)305. foreach (Language::getLanguages(false) as $language) ObjectModelCore->getFieldsLang - [line 489 - classes/ObjectModel.php]483. return false;484.485. // Database insertion for multilingual fields related to the object486. if (!empty($this->def['multilang']))487. {488. $fields = $this->getFieldsLang();489. if ($fields && is_array($fields))490. {491. $shops = Shop::getCompleteListOfShopsID();492. $asso = Shop::getAssoTable($this->def['table'].'_lang');493. foreach ($fields as $field) ObjectModelCore->add - [line 125 - classes/CartRule.php] - [2 Arguments]119. /**120. * @see ObjectModel::add()121. */122. public function add($autodate = true, $null_values = false)123. {124. if (!parent::add($autodate, $null_values))125. return false;126.127. Configuration::updateGlobalValue('PS_CART_RULE_FEATURE_ACTIVE', '1');128. return true;129. } CartRuleCore->add - [line 120 - modules/loyalty/controllers/front/default.php]114.115.116. $contains_categories = is_array($categories) && count($categories);117. if ($contains_categories)118. $cart_rule->product_restriction = 1;119. $cart_rule->add();120.121. //Restrict cartRules with categories122. if ($contains_categories)123. {124. LoyaltyDefaultModuleFrontController->processTransformPoints - [line 55 - modules/loyalty/controllers/front/default.php]49. * @see FrontController::postProcess()50. */51. public function postProcess()52. {53. if (Tools::getValue('process') == 'transformpoints')54. $this->processTransformPoints();55. }56.57. /**58. * Transform loyalty point to a voucher59. */ LoyaltyDefaultModuleFrontController->postProcess - [line 171 - classes/controller/Controller.php]165. // setMedia MUST be called before postProcess166. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))167. $this->setMedia();168.169. // postProcess handles ajaxProcess170. $this->postProcess();171.172. if (!empty($this->redirect_after))173. $this->redirect();174.175. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) ControllerCore->run - [line 373 - classes/Dispatcher.php]367. // Execute hook dispatcher368. if (isset($params_hook_action_dispatcher))369. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);370.371. // Running controller372. $controller->run();373. }374. catch (PrestaShopException $e)375. {376. $e->displayMessage();377. } DispatcherCore->dispatch - [line 28 - index.php]22. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)23. * International Registered Trademark & Property of PrestaShop SA24. */25.26. require(dirname(__FILE__).'/config/config.inc.php');27. Dispatcher::getInstance()->dispatch(); Link to comment Share on other sites More sharing options...
NemoPS Posted February 7, 2015 Share Posted February 7, 2015 Try adding the same right before $cart_rule->add() then $cart_rule->name[Configuration::get('PS_LANG_DEFAULT')] = 'test name'; or $cart_rule->name[1] = 'test name'; Just use the default lang id instead of 1 Link to comment Share on other sites More sharing options...
rfourt Posted February 7, 2015 Author Share Posted February 7, 2015 Try adding the same right before $cart_rule->add() then $cart_rule->name[Configuration::get('PS_LANG_DEFAULT')] = 'test name'; That did the trick. thank you so much. I guess i can keep the "test name" or should i change that to something else? Link to comment Share on other sites More sharing options...
NemoPS Posted February 7, 2015 Share Posted February 7, 2015 As you prefer, you can even use Tools::passwdGen to get a random string Link to comment Share on other sites More sharing options...
rfourt Posted February 7, 2015 Author Share Posted February 7, 2015 Btw,, how about updates from PS.. im using 1.6.09 now.. Will have to add this to new updates also and why?Why am i having to do this hack? perhaps hard to know for you but is it some other module that is blocking? again thank you so much for helping. Link to comment Share on other sites More sharing options...
NemoPS Posted February 7, 2015 Share Posted February 7, 2015 Only if the module gets updated 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