X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   Following the "Create a module" Tutorial (for devs) (https://forum.x-cart.com/showthread.php?t=76756)

greevesh 01-10-2019 01:20 PM

Following the "Create a module" Tutorial (for devs)
 
I'm stuck on step 5 of this guide. My module won't show up when I attempt to "redeploy" the store. In fact, nothing actually happens. Has this happened to anybody else and does anyone know how to resolve this issue?

Thanks in advance

qualiteam 01-11-2019 04:22 AM

Re: Following the "Create a module" Tutorial (for devs)
 
Hello. I have created a number of modules based on that article, so it's safe to say the example is correct there.

We will need to see the actual code to say why it isn't working.
Thank you.

greevesh 01-11-2019 01:50 PM

Re: Following the "Create a module" Tutorial (for devs)
 
Not sure why I didn't hand out the code in the first place :roll:

PHP Code:

<?php

namespace XLite\Module\GreevesH\FirstModule;

abstract class 
Main extends \XLite\Module\AModule
{
    
/**
     * Harrison Greeves
     *
     * @return string
     */

    // static methods can be used before instantiating the object it resides in
    
public static function getAuthorName()
    {
        return 
'Harrison Greeves';
    }

    
/**
     * FirstModule
     *
     * @return string
     */
    
public static function getModuleName()
    {
        return 
'FirstModule';
    }

    
/**
     * Get module major version
     *
     * @return string
     */
    
public static function getMajorVersion()
    {
        return 
'5.3';
    }

    
/**
     * Module version
     *
     * @return string
     */
    
public static function getMinorVersion()
    {
        return 
0;
    }

    
/**
     * Module description
     *
     * @return string
     */
    
public static function getDescription()
    {
        return 
'This is my first ever module written with X-Cart.';
    }
}


qualiteam 01-13-2019 01:35 AM

Re: Following the "Create a module" Tutorial (for devs)
 
1 Attachment(s)
Thank you for the code.
I don't know why it isn't working for you, but when I added it to my X-Cart installation, it worked just fine. The module shows up in the list of addons :)
Screenshot attached.
Maybe you are inserting it into a wrong folder?
The path must exactly match the namespace, so you should be putting this into <X-Cart>/classes/XLite/Module/GreevesH/FirstModule/.


All times are GMT -8. The time now is 07:51 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.