Anthony IVOL
Members-
Posts
28 -
Joined
-
Last visited
Profile Information
-
Activity
Freelancer
Recent Profile Visitors
291 profile views
Anthony IVOL's Achievements
-
Adding a custom field during the Checkout process
Anthony IVOL replied to Liyali's topic in Core developers
@r4yn0r I did that trick to send the client_message it in the order confirmation email, i don't use the value in templates. You can access the variable in templates with {$cart.client_message}, or ($order.client_message}, obviously if $cart and $order are set and not empty, as well as the client_message value. You can try {debug} in your template to output the accessible smarty variables and look into $cart and $order. -
Allow <br> tags in Modules Admin tinymce fields.
Anthony IVOL replied to Anthony IVOL's topic in Core developers
I feel a bit alone here... But I found the solution, the Configuration::updateValue function takes a third argument $html that should be true : public static function updateValue($key, $values, $html = false, $idShopGroup = null, $idShop = null) so this : Configuration::updateValue('TRUC', Tools::getValue('TRUC')); becomes : Configuration::updateValue('TRUC', Tools::getValue('TRUC'), true); tadaaaa ! -
Allow <br> tags in Modules Admin tinymce fields.
Anthony IVOL replied to Anthony IVOL's topic in Core developers
Well, I checked what was actually sent by the form and the Tinymce looks to work well as this code dumps <br> tags : dump(Tools::getValue('TRUC')); die(); Configuration::updateValue('TRUC', Tools::getValue('TRUC')); It means that the problem comes while : Configuration::updateValue('TRUC', Tools::getValue('TRUC')); -
Allow <br> tags in Modules Admin tinymce fields.
Anthony IVOL replied to Anthony IVOL's topic in Core developers
Actually It doesn't allow more than one paragraph also. <p>truc</p><p>another truc</p> becomes : <p>truc another truc</p> -
Hi, How to allow <br> tags in Modules Admin Fields ? I have that in my tinymce config : valid_children: "+*[*]", valid_elements: "*[*]", I tried then in Tools.php line 3703 in purifyHTML function: $def->addElement('br', 'Block', 'Flow', 'Common', array()); then $def->addElement('br', 'Inline', 'Flow', 'Common', array()); then $def->addElement('br'); then I have disabled the htmlPurifier library in Settings > General But nothing seems to work. Working with prestashop 1.7.1.2, and I declare my field like this in my module : array( 'type' => 'textarea', 'autoload_rte' => true, 'lang' => true, 'label' => $this->trans('Truc truc truc', array(), 'Modules.Page_About.Admin'), 'name' => 'TRUC', ), What am I doing wrong ? Thanks
-
As you explore it a bit more, any chance to find something similar with database ?
-
Well that's I was looking for : https://github.com/PrestaShop/PrestaShop/compare/1.7.1.1...1.7.1.2
-
Thanks for your reply. I work on a PS with some overrides, that means that when I get errors after upgrade I need to check file by file from where the error comes. ( errors from Presenters doesn't give me enough clues actually ). And in the case I need to import orders or clients tables I also need to check each columns of each tables I have imported. And how the dev community can work together without a precise changelog ? Why not using github ? at least it could give the files differences. That's convenient...
-
Hi, Where can I find a precise Changelog (files and DB) between PS version ? Thanks
-
Hi, I would like to change the module default link in the admin menu to the installed modules link. I found that : http://doc.prestashop.com/display/PS16/Administration+Menus+Configuration "This administration page enables you to move, edit, disable and even create pages" That's great, but actually how to access this page ? Or maybe it has disappear in PS1.7 ? Thanks for your help.
-
Hi, I have an issue with customer login. No problem to create an account but after logout customers can't login again. If I force the hash method to md5 like this in /src/Core/Crypto in "hash" method : public function hash($plaintextPassword, $staticSalt = _COOKIE_KEY_) { if (!count($this->hashMethods)) { $this->initHashMethods(); } //$closure = reset($this->hashMethods); // changed with the following : $closure = $this->hashMethods['md5']; return $closure['hash']($plaintextPassword, $staticSalt, $closure['option']); } That works and customer can create an account, login, logout, and login again. So the problem maybe comes from bcrypt the other used hashing method : $this->hashMethods = array( 'bcrypt' => array( 'option' => array(), 'hash' => function ($passwd, $staticSalt, $option) { return password_hash($passwd, PASSWORD_BCRYPT); }, 'verify' => function ($passwd, $hash, $staticSalt) { return password_verify($passwd, $hash); }, ), 'md5' => array( 'option' => array(), 'hash' => function ($passwd, $staticSalt, $option) { return md5($staticSalt.$passwd); }, 'verify' => function ($passwd, $hash, $staticSalt) { return md5($staticSalt.$passwd) === $hash; }, ), ); The hash method of bcrypt works as customers can create an account, and hash is saved in database. But the the 'password_verify' method doesn't and return false all the time. The weird thing is that I am working on another PS 1.7.1 and on this other one that works.... So the problem maybe comes from server setup. I moved both on my local computer with mamp, and same problem. So..., anyone have an idea on what is going wrong ? Thanks
-
Adding a custom field during the Checkout process
Anthony IVOL replied to Liyali's topic in Core developers
And you also need to add in AdminCartsController in ajaxProcessUpdateDeliveryOption function : if (Validate::isMessage(($client_message = pSQL(Tools::getValue('client_message'))))) { $this->context->cart->client_message = $client_message; } What's the purpose of trying to do something modular if for only one field you need to modify 5 files... Or is there a way to implement these overrides from the module directly ?? -
Adding a custom field during the Checkout process
Anthony IVOL replied to Liyali's topic in Core developers
In complement of Paul C answer, for PS 1.7.1 : - In a module class, add colums to database in the ps_orders and ps_cart tables : private function installSQL() { $sql = array(); $sql[] = "ALTER TABLE `"._DB_PREFIX_."cart` ADD client_message TEXT"; $sql[] = "ALTER TABLE `"._DB_PREFIX_."orders` ADD client_message TEXT"; $this->executeSQL($sql); return true; } private function uninstallSQL(){ $sql = array(); $sql[] = "ALTER TABLE `"._DB_PREFIX_."cart` DROP client_message"; $sql[] = "ALTER TABLE `"._DB_PREFIX_."orders` DROP client_message"; $this->executeSQL($sql); } private function executeSQL($requests){ foreach ($requests as $q) { if (!DB::getInstance()->execute($q)) { return false; } } } Declare your field in Cart.php and Order.php classes : // at the top public $client_message; // in $definition 'fields' => array( ..., 'client_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'), ), In classes/checkout/CheckoutDeliveryStep.php at the end of the handleRequest function, get the correct params for our module hook function : $checkoutCart = $this->getCheckoutSession()->getCart(); if( isset($requestParams['client_message'])){ $checkoutCart->client_message = $requestParams['client_message']; } Hook::exec('actionCarrierProcess', array( 'cart' => $checkoutCart)); In the module hook : public function hookActionCarrierProcess(Array $params) { $cart = $params['cart']; if (!($cart instanceof Cart)) return; if( isset($params['cart']->client_message) ){ $cart->client_message = $params['cart']->client_message; } $cart->save(); } And in classes/PaymentModule.php in the validateOrder function : $order->client_message = $this->context->cart->client_message; -
Hi, I am trying to configure this module on a PS 1.7.1.1, I created the REST API, got the credentials. When I try to activate the module in the PS backend, it only works when sandbox is not enable. That mean I guess that the module works fine, but I can't test it... ...I also checked 10 times with copy/paste that there where no typo... Any idea ?