Jump to content

Apium

Members
  • Posts

    111
  • Joined

  • Last visited

Posts posted by Apium

  1. Oh, excuses! Ik had hier eerder nog eventjes over nagedacht en zou je eens onder "Geavanceerder Instellingen -> Configuratie Informatie" kunnen kijken naar de gewijzigde files?

     

    Als het goed is zou daar iets met "Adapter" bij moeten staan.

  2. Dit heb je niet in Firefox, maar wel in Chrome? Misschien dat je in Firefox nog met een gecachte versie werkt?

     

    Eventjes flushen en opnieuw proberen. Die templates worden namelijk op de server gemaakt, en het zou dus niet *moeten* uitmaken welke browser je gebruikt om de pagina te bekijken (althans, niet voor de inhoud. Voor de styling is dat een ander verhaal).

  3. Ahh, yes! Sorry about that, but if you insist and while I'm on it.. :)

     

    In /controllers/admin/AdminSearchController.php, you'll find the initCustomerList() function.

     

    It should look like this:

        protected function initCustomerList()
        {
            $genders_icon = array('default' => 'unknown.gif');
            $genders = array(0 => $this->l('?'));
            foreach (Gender::getGenders() as $gender) {
                /** @var Gender $gender */
                $genders_icon[$gender->id] = '../genders/'.(int)$gender->id.'.jpg';
                $genders[$gender->id] = $gender->name;
            }
            $this->fields_list['customers'] = (array(
                'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
                'id_gender' => array('title' => $this->l('Social title'), 'align' => 'center', 'icon' => $genders_icon, 'list' => $genders, 'width' => 25),
                'firstname' => array('title' => $this->l('First Name'), 'align' => 'left', 'width' => 150),
                'lastname' => array('title' => $this->l('Name'), 'align' => 'left', 'width' => 'auto'),
                'email' => array('title' => $this->l('Email address'), 'align' => 'left', 'width' => 250),
                'birthday' => array('title' => $this->l('Birth date'), 'align' => 'center', 'type' => 'date', 'width' => 75),
                'date_add' => array('title' => $this->l('Registration date'), 'align' => 'center', 'type' => 'date', 'width' => 75),
                'orders' => array('title' => $this->l('Orders'), 'align' => 'center', 'width' => 50),
                'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'width' => 25),
            ));
        }
    

    Simply add 'company', like so:

        protected function initCustomerList()
        {
            $genders_icon = array('default' => 'unknown.gif');
            $genders = array(0 => $this->l('?'));
            foreach (Gender::getGenders() as $gender) {
                /** @var Gender $gender */
                $genders_icon[$gender->id] = '../genders/'.(int)$gender->id.'.jpg';
                $genders[$gender->id] = $gender->name;
            }
            $this->fields_list['customers'] = (array(
                'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
                'id_gender' => array('title' => $this->l('Social title'), 'align' => 'center', 'icon' => $genders_icon, 'list' => $genders, 'width' => 25),
                'firstname' => array('title' => $this->l('First Name'), 'align' => 'left', 'width' => 150),
                'lastname' => array('title' => $this->l('Name'), 'align' => 'left', 'width' => 'auto'),
                'email' => array('title' => $this->l('Email address'), 'align' => 'left', 'width' => 250),
                'company' => array('title' => $this->l('Company'), 'align' => 'left', 'width' => 150),
                'birthday' => array('title' => $this->l('Birth date'), 'align' => 'center', 'type' => 'date', 'width' => 75),
                'date_add' => array('title' => $this->l('Registration date'), 'align' => 'center', 'type' => 'date', 'width' => 75),
                'orders' => array('title' => $this->l('Orders'), 'align' => 'center', 'width' => 50),
                'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'width' => 25),
            ));
        }
    

    That should do it!

    • Like 1
  4. Ahh, thanks for the clarification!

     

    This is exceptionally easy to built-in. Go to /classes/Customer.php. Then find the method searchByName (search in the file).

     

    It should look like this:

        public static function searchByName($query, $limit = null)
        {
            $sql_base = 'SELECT *
    				FROM `'._DB_PREFIX_.'customer`';
            $sql = '('.$sql_base.' WHERE `email` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `id_customer` = '.(int)$query.' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `lastname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `firstname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
    
            if ($limit) {
                $sql .= ' LIMIT 0, '.(int)$limit;
            }
    
            return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
        }
    

    Add another SQL UNION statement, to search in the company field, like so:

        public static function searchByName($query, $limit = null)
        {
            $sql_base = 'SELECT *
    				FROM `'._DB_PREFIX_.'customer`';
            $sql = '('.$sql_base.' WHERE `email` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `id_customer` = '.(int)$query.' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `lastname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `firstname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
            $sql .= ' UNION ('.$sql_base.' WHERE `company` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')';
    
            if ($limit) {
                $sql .= ' LIMIT 0, '.(int)$limit;
            }
    
            return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
        }
    

    This will not give you the easthetically pleasing column 'company' in your search results, but it will return customers where the company matches the associated company name. Be sure to give it a try! :)

     

     

    I hope this helps.

    • Like 1
  5. Kun je eens kijken of /var/www/vhosts/69/262628/webspace/siteapps/Prestashop-426810/htdocs/Adapter/Adapter_ServiceLocator.php bestaat? Daar wordt de class 'Adapter_ServiceLocator' gedefinieerd, en het kan zijn dat die ofwel niet bestaat, ofwel niet wordt ingeladen.

  6. I do agree that unused code should be removed stat, and definitely not be present in a production version of the software. But do we know if this code is unused? :)

     

    Personally, I think the transition onto Symfony is simply causing a lot of overhead, as Traumflug already described. Besides this, most of the files in /css, /themes, and /install are either styling (not so much executable code) or only there for the initial installation.

  7. But what, precisely, is your point? Storage space is cheap these days, and most of this footprint is not actually caused by the code, but rather by styling (e.g. that massive admin /css folder) and third-party apps.

     

    In terms of footprint and folder size, most of it resides in /vendor. This is third-party code (including the new symfony framework!) used by PrestaShop, and not so much part of the native application. Maintenance of this code is largely done by these other projects themselves.

     

    It's just a very rich platform, with many default themes (including for the backoffice) and options! The footprint on the filesystem is indicative of such.

×
×
  • Create New...

Important Information

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