Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Skuiz's Achievements


Rookie (2/14)

  • Week One Done Rare
  • First Post Rare
  • Conversation Starter Rare

Recent Badges



  1. Good Day, I want to add the carrier's name to the customers orders grid on backoffice. I have tried with override, modules and seems not to be working on this version of prestashop. Have anyone accomplished this on the newer versions. I can see on the developers documents how to do it with hooks but its not very clear on that. If anyone can help me or guide me on how to do it you would make my day, thanks for reading and have a wonderful day!
  2. Good morning, can you please tell me how to add it to the modules? Im adding the content to the modules folder on prestashop but its not showing on my modules tab to install it.
  3. Good day, I am trying to check how to the prestashop backoffice password encryption works. Checking some examples as the follow: <?php namespace PrestaShop\PrestaShop\Core\Crypto; include('config/config.inc.php'); $plaintextPassword = '123456'; $crypto = new Hashing(); $encryptedPassword = $crypto->hash($plaintextPassword, _COOKIE_KEY_); echo 'Clear: '.$plaintextPassword.'<br />Encrypted: '.$encryptedPassword; /* Result (example) Clear: 123456 Encrypted: $2y$10$6b460aRLklgWblz75NAMteYXLJwjfV6a/uN8GJKgJgPDBuNhHs.ym */ ?> Seems not to work anymore with version as i just get error when trying to test. What is the encryption method prestashop is using? is it still md5 or hash? I am developing an external API to modify some database info on out shop tables and i want to set a login like the one of the backoffice uses with encrypting the password for more security. Can someone tell me how it works with this new version please? Thanks in advance and have a good day
  4. Quick update: After doing some research, i was able to find some information to install a module using hooks. This is the example i found: <?php /** * After install clean prestashop cache */ use PrestaShop\PrestaShop\Core\Domain\Customer\Exception\CustomerException; use Symfony\Component\Form\Extension\Core\Type\TextType; if (!defined('_PS_VERSION_')) { exit; } class ps_customercedula extends Module { // const CLASS_NAME = 'ps_customercedula'; public function __construct() { $this->name = 'ps_customercedula'; $this->version = '1.0.0'; $this->author = 'wfpaisa'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->getTranslator()->trans( 'Campo Raro', [], 'Modules.ps_customercedula.Admin' ); $this->description = $this->getTranslator()->trans( 'Customer cedula', [], 'Modules.ps_customercedula.Admin' ); $this->ps_versions_compliancy = [ 'min' => '', 'max' => _PS_VERSION_, ]; } /** * This function is required in order to make module compatible with new translation system. * * @return bool */ public function isUsingNewTranslationSystem() { return true; } /** * Install module and register hooks to allow grid modification. * * @see https://devdocs.prestashop.com/1.7/modules/concepts/hooks/use-hooks-on-modern-pages/ * * @return bool */ public function install() { return parent::install() && $this->registerHook('actionCustomerGridDefinitionModifier') && $this->registerHook('actionCustomerGridQueryBuilderModifier') && $this->registerHook('additionalCustomerFormFields') && $this->registerHook('actionCustomerFormBuilderModifier') && $this->registerHook('actionAfterCreateCustomerFormHandler') && $this->registerHook('actionAfterUpdateCustomerFormHandler') && $this->alterCustomerTable() ; } public function uninstall() { return parent::uninstall() && $this->uninstallAlterCustomerTable(); } /** * Alter customer table, add module fields * * @return bool true if success or already done. */ protected function alterCustomerTable() { $sql = 'ALTER TABLE `' . pSQL(_DB_PREFIX_) . 'customer` ADD `cedula` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL'; // CLEAN_INSTALATION 1/2 (if you want to delete all data after an installation) // comment: Db::getInstance()->execute($sql); return true; // and uncomment: // return Db::getInstance()->execute($sql); } /** * Uninstalls sample tables required for demonstration. * * @return bool */ private function uninstallAlterCustomerTable() { // CLEAN_INSTALATION 2/2 (if you want to delete all data after an installation) // uncomment: // $sql = 'ALTER TABLE `' . pSQL(_DB_PREFIX_) . 'customer` DROP `cedula`'; // return Db::getInstance()->execute($sql); // // and comment: return true; } /** * Hook allows to modify Customers form and add additional form fields as well as modify or add new data to the forms. * FRONT_END * @param array $params */ public function hookAdditionalCustomerFormFields($params) { return [ (new FormField) ->setName('cedula') ->setType('text') ->setRequired(true) // is Required ->setLabel($this->l('Cédula')) ]; } /** * Hook allows to modify Customers form and add additional form fields as well as modify or add new data to the forms. * BACK_END * @param array $params */ public function hookActionCustomerFormBuilderModifier(array $params) { /** @var FormBuilderInterface $formBuilder */ $formBuilder = $params['form_builder']; $formBuilder->add('cedula', TextType::class, [ 'label' => $this->getTranslator()->trans('Cedula', [], 'Modules.ps_customercedula.Admin'), 'required' => false, ]); $customer = new Customer($params['id']); $params['data']['cedula'] = $customer->cedula; $formBuilder->setData($params['data']); } /** * Hook allows to modify Customers form and add additional form fields as well as modify or add new data to the forms. * * @param array $params * * @throws CustomerException */ public function hookActionAfterUpdateCustomerFormHandler(array $params) { $this->updateCustomerCedula($params); } /** * Hook allows to modify Customers form and add additional form fields as well as modify or add new data to the forms. * * @param array $params * * @throws CustomerException */ public function hookActionAfterCreateCustomerFormHandler(array $params) { $this->updateCustomerCedula($params); } /** * Update / Create * * @param array $params * * @throws \PrestaShop\PrestaShop\Core\Module\Exception\ModuleErrorException */ private function updateCustomerCedula(array $params) { $customerId = (int)$params['id']; /** @var array $customerFormData */ $customerFormData = $params['form_data']; $cedula = $customerFormData['cedula']; try { $customer = new Customer($customerId); $customer->cedula= $cedula; $customer->update(); } catch (ReviewerException $exception) { throw new \PrestaShop\PrestaShop\Core\Module\Exception\ModuleErrorException($exception); } } } So with this im able to add the CustomerID to the customer Edit Form, the only thing left its to add it to the customer grid table but im not able to do it. i just need to know how to add this here with a hook, its supposed to be a normal text data display.
  5. I added the field to the database table prstshp_customer. Now i want it to display on the customer grid and being able to edit on backoffice when you click on customer edit form.
  6. Good morning, I would like to Remove Social Title column from grid and also add a new one that is named CustomerID. Since its a field i have for the customer invoices needed for informative and fast access to them on the same customer grid table.
  7. Good day, I am currently using prestashop There is a field on the table from backoffice if we go to customer > customer that its social title. I was able to remove it from the edit user fields if i delete it from the customer config >titles. Is there a way to remove it from the customer table grid? I want to add a new column on the same table, so i was checking if its possible to edit the social title one and add mine isntead. Have those two options. already did some research and find a helpful document on dev docs from prestashop about using Hooks, but its not very clear to me since im new to using prestashop and it doesnt tell you very clear where to edit on the php files or where to use the code. If someone is able to guide me or help me to add that new field it would be great. Thanks for having the time to read this and i hope you have a great day.
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More