Jump to content

Module not working


Recommended Posts

Hi everyone. 

 

I'm still trying to setup my first prestashop 1.7 module. I'm following the guide here, seems to be easy but I can't get the module to work.

 

When I try uploading it in the admin panel, prestashop says:

Ooops... Upload failed,
What happened?
This file does not seem to be a valid module zip

The module is pretty basic, it just has the module class with some empty hooks:

<?php
if (!defined('_PS_VERSION_')) {
    exit;
}


class MyFirstModule extends Module {
    public function __construct() {
    $this->name = 'myfirstmodule';
        $this->tab = 'checkout';
        $this->version = '1.0.0';
        $this->author = 'First Module';
        $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 First Module');
        $this->description = $this->l('This is my very first module.');


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


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


        if (
            !parent::install() ||
            !$this->registerHook('actionPaymentConfirmation') ||
            !$this->registerHook('actionProductSave') ||
            !$this->registerHook('displayAdminProductsExtra') ||
            !$this->registerHook('displayOrderDetail') ||
            !$this->registerHook('displayFooterProduct') ||
            !Configuration::updateValue('MYMODULE_NAME', 'My First Module')
        ) {
            return false;
        } else {
            return true;
        }
    }


    public function uninstall() {
        if (
            !parent::uninstall()
        ) {
            return false;
        } else {
            return true;
        }
    }




    // called after a payment is confirmed
    public function hookActionPaymentConfirmation($id_order) {


    }


    // called after product is saved
    public function hookActionProductSave($id_product, $product) {
        // throw new PrestaShopException("message"); //prevents product from saving
    }


    // used to add a tab in admin product page
    public function hookDisplayAdminProductsExtra($id_module) {


    }


    // used to add a tab in admin product page
    public function hookDisplayOrderDetail($order) {


    }


    // used to add a tab in admin product page
    public function hookDisplayFooterProduct($product, $category) {


    }
}

What am I missing? The full module zip is attached to this message

myfirstmodule.zip

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
  • 2 months later...
On 11/6/2017 at 12:39 PM, steve+paystack said:

Hi @Xpert-Idea,

What do you mean by 

I am trying to create this file to make it easy for users to upload without using FTP but I keep getting the same error message. Attached is the folder

v1.0.0-paystack.zip

Hey! Just integrated paystack to a project. What you should do is extract the paystack folder, make it a zip, ensure the zip folder and the extracted folder have the same names. So your file structure should be like this: 

paystack.zip > paystack(folder)  >  (files in paystack)

Link to comment
Share on other sites

  • 2 years later...
1 uur geleden, Alexander Firsov zei:

Would you please check what is wrong with this module archive?

It gives me the same error: "Oops... Upload failed."

And: "This file does not seem to be a valid module zip"

UnityPay 3.JPG

prestashop-module-master.zip 14.36 kB · 1 download

Please open a new topic for this. You are now responding on a topic from 3 years ago

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
  • 4 months later...

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...