Jump to content

Issue with the "mymodule" example from the developer guide


morganmcreynolds

Recommended Posts

Hi,

 

PrestaShop newbie here, so please be gentle :)

 

I am beginning (literally) to learn about PrestaShop development.  I have copied the mymodule.php example from the PrestaShop Developers Guide and it is not working for me.  I am testing it in both a local 1.6.0.5 PS instance and a 1.6.0.14 PS instance (hosted remotely).  The error message is: Parse error: syntax error, unexpected T_CLASS.

 

I am certain that it is a relatively trivial issue, but I am unable to figure it it out.  Any help would be much appreciated.  The code (which I am copying verbatim from the Developer Guide) is listed below:

 

<?php
if (!defined('_PS_VERSION_'))
  exit;
 
class MyModule extends Module
{
  public function __construct()
  {
    $this->name = 'mymodule';
    $this->tab = 'front_office_features';
    $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');
  }
}
Link to comment
Share on other sites

Hi,

 

Following my own initial post..

 

If you double click the sample code from the doc.prestashop site and paste it in (as I did originally), it appears that cause some sort of character issues.  I didn't get to the bottom of it exactly, but cut/paste of certain sections and manually typing the beginning and end seemed to move it past one issue.

 

With that silliness out of the way, it appears to work fine.

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