
victorweb
New Members-
Posts
16 -
Joined
-
Last visited
Everything posted by victorweb
-
Gracias @alex222er !!, soy nuevo con esto de presta y de los pocos overrides que he hecho nunca han sido de la parte nueva con Symfony o sería directamente en estos ficheros que indicas?? ... tienes algún tutorial o algo para que vaya metiendo mano al asunto? es para no marearte mucho con esto .. Por ejemplo, he intentado mostrar los datos en el panel de cliente (añadi 2 campos zipcode y phonemobile se llaman igual en la tabña ps_customer) : 1 - public_html/src/Core/Domain/Customer/QueryResult/PersonalInformation.php he añadido a la clase : class PersonalInformation { /** * @var string */ private $zipcode; /** * @var string */ private $phonemobile; public function __construct( $firstName, $lastName, $zipcode, $phonemobile, $email, $isGuest, $socialTitle, $birthday, $registrationDate, $lastUpdateDate, $lastVisitDate, $rankBySales, $shopName, $languageName, Subscriptions $subscriptions, $isActive ) { $this->firstName = $firstName; $this->lastName = $lastName; $this->zipcode = $zipcode; $this->phonemobile = $phonemobile; $this->email = $email; $this->isGuest = $isGuest; $this->socialTitle = $socialTitle; $this->birthday = $birthday; $this->registrationDate = $registrationDate; $this->lastUpdateDate = $lastUpdateDate; $this->lastVisitDate = $lastVisitDate; $this->rankBySales = $rankBySales; $this->shopName = $shopName; $this->languageName = $languageName; $this->subscriptions = $subscriptions; $this->isActive = $isActive; } /** * @return string */ public function getzipcode() { return $this->zipcode; } /** * @return string */ public function getphonemobile() { return $this->phonemobile; } } 2- public_html/src/Adapter/Customer/QueryHandler/GetCustomerForViewingHandler.php final class GetCustomerForViewingHandler implements GetCustomerForViewingHandlerInterface { private function getPersonalInformation(Customer $customer) { $customerStats = $customer->getStats(); $gender = new Gender($customer->id_gender, $this->contextLangId); $socialTitle = $gender->name ?: $this->translator->trans('Unknown', [], 'Admin.Orderscustomers.Feature'); if ($customer->birthday && '0000-00-00' !== $customer->birthday) { $birthday = sprintf( $this->translator->trans('%1$d years old (birth date: %2$s)', [], 'Admin.Orderscustomers.Feature'), $customerStats['age'], Tools::displayDate($customer->birthday) ); } else { $birthday = $this->translator->trans('Unknown', [], 'Admin.Orderscustomers.Feature'); } $registrationDate = Tools::displayDate($customer->date_add, null, true); $lastUpdateDate = Tools::displayDate($customer->date_upd, null, true); $lastVisitDate = $customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], null, true) : $this->translator->trans('Never', [], 'Admin.Global'); $customerShop = new Shop($customer->id_shop); $customerLanguage = new Language($customer->id_lang); $customerSubscriptions = new Subscriptions( (bool) $customer->newsletter, (bool) $customer->optin ); return new PersonalInformation( $customer->firstname, $customer->lastname, $customer->zipcode, $customer->phonemobile, $customer->email, $customer->isGuest(), $socialTitle, $birthday, $registrationDate, $lastUpdateDate, $lastVisitDate, $this->getCustomerRankBySales($customer->id), $customerShop->name, $customerLanguage->name, $customerSubscriptions, (bool) $customer->active ); } } 3 - public_html/src/PrestaShopBundle/Resources/views/Admin/Sell/Customer/Blocks/View/personal_information.html.twig <div class="card customer-personal-informations-card"> <h3 class="card-header"> <i class="material-icons">person</i> {{ customerInformation.personalInformation.firstName }} {{ customerInformation.personalInformation.lastName }} {{ customerInformation.personalInformation.zipcode }} {{ customerInformation.personalInformation.phonemobile }} ...... y no he conseguido que se muestre en el panel de control ...
-
- Hola : He conseguido añadir dos campos al formulario de registro de clientes en el front . Para ello he hecho override en el fichero: 1 - override/classes/form/CustomerFormatter.php 2 - override/classes/customer.php He añadido los campos a la tabla ps_customer y en el front todo funciona correctamente creando/editando. Pero no consigo reflejar estos dos nuevos campos en el back al editar/crear un cliente. He leído que se trataba de hacer override/controllers/admin/adminCustomerController.php pero en la versión 1.7.7.1 ese controlador ya no esta, esta adminCustomerThreadsController.php y lo he modificado pero no refleja los cambios. Alguien sabe por donde seguir el asunto ?
-
how can i add a custom field in registration
victorweb replied to karim31's topic in Addons, modules and themes developers
I have managed to manage the extra fields in the front and save in the database but I can't get it out in the back, I have seen in tutorials override on AdminCustomerController.php but in version 1.7.7.1 I can't find that controller, i find admincustomerthreadscontroller ... someone can help ? -
ContactController.php and save in database new fields added in 1.7
victorweb replied to MaxTab's topic in Core developers
i trying same but in v 1.7.7.1 i add fields in the front form view and insert in database , but i cant do it in back , i cant show fields in edit customer... i find and override AdminCustomerThreadsController.ph but not work -
how can i add a custom field in registration
victorweb replied to karim31's topic in Addons, modules and themes developers
Hi i need add two simple fields to the registration customer form (zipcode and phone_mobile) and save it in ps_customer table , i know i can override CustomerFormatter.php function getFormat() , or add hookAdditionalCustomerFormFields and hookvalidateCustomerFormFields but i dont know rules for prestashop overrides and where find this hooks or add .. i m trying to find a tutorial for this ..anyone know where can i find it ?? in version prestahop 1.7.7.1 i think i need these walkthrough : 1- Add fields to form registration 2- validate these fields 3 - Add these fields to table ps_customer -
Hola a todos !! Soy Víctor y estoy comenzando a dar mis primeros pasos en esto del prestashop !!!
-
SELECT C.firstname, C.lastname, C.email , SUM(OD.total_price_tax_incl) as pvp FROM ps_customer C INNER JOIN ps_orders O on C.id_customer = O.id_customer INNER JOIN ps_order_detail OD on O.id_order = OD.id_order INNER JOIN ps_category_product CP ON CP.id_product = OD.product_id WHERE CP.id_category = X GROUP BY C.email ORDER BY pvp desc En una determinada marca: SELECT C.email , CAST(SUM(OD.total_price_tax_incl) as decimal(8,2)) as pvp FROM ps_customer C INNER JOIN ps_orders O on C.id_customer = O.id_customer INNER JOIN ps_order_detail OD on O.id_order = OD.id_order INNER JOIN ps_product P ON P.id_product = OD.product_id WHERE P.id_manufacturer = X GROUP BY C.email ORDER BY pvp desc
-
prestashop version 1.6.1.20 I find this in class/cookie.php line 315 if (!$this->_standalone && !Language::getLanguage((int)$this->id_lang)) { $this->id_lang = Configuration::get('PS_LANG_DEFAULT'); // set detect_language to force going through Tools::setCookieLanguage to figure out browser lang $this->detect_language = true; } i trie in back office : localization>idioms i have (english,spanish) active and others languages inactive in localization>localization i set configuration>language_default to english. My idea is that when entering from a browser with language in Spanish lang = 'es' enter the Spanish language in the front but when entering any other language for example when entering from lang = 'fr' enter the front with English language. And clean cache. i tried this is correct? because when I enter from a browser in Spanish enters the front in English.
-
I would like to create a script to obtain the most visited products in the store. I'm newest to prestashop and can't find for example the ps_products table, I also imagine that I should get all the products with all their combinations. Has anyone worked on something similar