Jump to content

Build-in module does not appear for installation


Xitroff

Recommended Posts

I can't see Contact form module available for installation at /index.php/module/manage until comment the part below inside src/Core/Addon/Module/ModuleRepository.php (line 239)

if ($module->database->get('installed') == 1
        && $module->database->get('active') == 1
        && !$filter->hasStatus(AddonListFilterStatus::DISABLED)
        && $filter->hasStatus(AddonListFilterStatus::ENABLED)) 
    {
        unset($modules[$key]);
        continue;
    }

The same happens with all my custom modules on fresh installations (tried to download both from GitHub and official site).

This example is from https://developers.prestashop.com/module/05-CreatingAPrestaShop17Module/02-CreatingAFirstModule.html

<?php

if (!defined('_PS_VERSION_')) {
    exit;
}

class Helloworld extends Module {
    public function __construct()
    {
        $this->name = 'helloworld';
        $this->tab = 'administration';
        $this->version = '1.0.0';
        $this->author = 'Firstname Lastname';
        $this->need_instance = 0;
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
        $this->bootstrap = true;

        parent::__construct();

        $this->displayName = $this->l('My module');
        $this->description = $this->l('Description of my module.');

        $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');

        if (!Configuration::get('MYMODULE_NAME'))
            $this->warning = $this->l('No name provided');

        //$this->install();
    }

    public function install()
    {
        if (Shop::isFeatureActive())
            Shop::setContext(Shop::CONTEXT_ALL);

        if (!parent::install() ||
            !$this->registerHook('displayLeftColumn') ||
            !$this->registerHook('header') ||
            !Configuration::updateValue('MYMODULE_NAME', 'my friend')
        )
            return false;

        return true;
    }

    public function uninstall()
    {
        if (!parent::uninstall() ||
            !Configuration::deleteByName('MYMODULE_NAME')
        )
            return false;

        return true;
    }
}

helloworld.php located inside /modules/helloworld

So I can't install anything without commenting core file lines.

I also tried to zip the module contents and upload it through panel but I always get

Quote

UndefinedMethodException HTTP 500 Internal Server Error Attempted to call an undefined method named "validateValue" of class "Symfony\Component\Validator\Validator\RecursiveValidator".

 

Edited by Xitroff (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...