Can't load new modules on the eshop site

Hello,

I am new to eshop and I am still struggling with the basics.
I tried to create a couple of modules, but none of them would load on the eshop site under extension/modules. It only loads the previously created, default modules.

Any ideas how to fix it?

Thanks!

improving your oxid development skills seems to be the only way to fix that

I followed the exact instructions from the tutorials but it doesn’t work… I don’t know what else to try. I cannot activate them from the extensions/modules at all, they are not found there.

are you sure you uploaded your files into the right shop and directory?
check file system permissions

1 Like

There is no extensions/modules directory in OXID. Modules are in <shoproot>/modules.

I saved the module in application/modules/ak/newModule. I added the metadata file here. According to the tutorals, it should be visible on the site if it is saved in the modules directory. But when I loaded the shop, it wasn’t. I think I got the path right… Right?

No, the correct path is /modules/ak/newModule.

1 Like

That’s what I meant, sorry. modules/ak/newModule is the path. I checked now.

maybe you forgot to upload vendormetadata.php?

1 Like

I did that too…

Information:
System healthcheck shows setup/server setup of this OXID eShop might be broken. Probably this OXID eShop behaves strange in some cases. Please fix this as soon as possible. Support for fixing find in system healthcheck.
Due to security reasons put your config.inc.php file to read-only mode!

Could this be the issue? I have had several other problems too.

okay, the first and maybe the biggest problem here is that you do not provide any background information like:
Shop Version,
PHP Version,
where the shop is running (Hoster or your own PC at home),
Operatin System,
XAMPP or IIS webserver.
How did you install the Shop? (zip, composer, from github, installer script from hoster, etc)

Also, you need to be more exact when describing what you did and how you did it.
E.g. instead of “i created a module but it did not work” you could post metadata.php code and tell us its file system path.

And what are the other problems, you mentioned?

1 Like

I am sorry, this is the first time I write on a forum. Also, I am new to oxid so I thought that I was doing some beginner general mistakes, that have an easy explanation and that anyone (except me) knows of. Thank’s for the feedback, I will keep that in mind for future posts too. Please let me know if you need any additional info. So:

oxid version: 4.10.7
OS: ubuntu
php version: PHP 7.2.4

the metadata file:
$sMetadataVersion = ‘1.1’;

/**

  • Module information
    */
    $aModule = array(
    ‘id’ => ‘mysaving’,
    ‘title’ => ‘My Saving’,
    ‘description’ => ‘Description’,
    // ‘thumbnail’ => ‘out/pictures/pmlogo.png’,
    ‘version’ => ‘0.9’,
    ‘author’ => ‘Ane’,
    // ‘url’ => ‘https://paymorrow.de/’,
    ‘email’ => ‘[email protected]’,
    ‘extend’ => array(
    ‘oxarticle’ => ‘ak/mysaving/application/controllers/ak_mysaving_oxarticle’
    ),

    ‘blocks’ => array(
    array(
    ‘template’ => ‘page/details/inc/productmain.tpl’,
    ‘block’ => ‘details_productmain_tprice’ //vo koj blok da se vmetne modulot
    ‘file’ => ‘application/views/blocks/details_productmain_tprice_tpl’
    )
    )
    );

the vendormetadata:

<?php * along with OXID eSales Theme Switcher. If not, see . * * @link http://www.oxid-esales.com * @copyright (C) OXID eSales AG 2003-2015 $sVendorMetadataVersion = '1.0'; module location: modules/ak/mysaving (I was following these instructions on creating the module: https://marco-steinhaeuser.de/how-to-write-a-module-for-oxid-eshop-display-you-will-save-x-percent-on-the-product-details-page.html) I installed eshop from this link: https://oxidforge.org/en/downloads#tab-id-2 and unpacked in the /var/www/html folder. Thank you for your patience!

assuming, you uploaded all the files into correct directories: there (in oxid admin in modules view) should be no modules visible at all and you should get the following error in php error log:

PHP Parse error: syntax error, unexpected ''file'' (T_CONSTANT_ENCAPSED_STRING), 
expecting ')' in /.../modules/ak/mysaving/metadata.php on line 24, 
referer: https://.../admin/index.php?force_admin_sid=...&stoken=...&cl=module

this message points you to this line of code:


as my IDE already noticed, there is missing comma at the end of line 23

After adding missing comma, your module appears together with all the other modules and can be activated

thats why it is important to have a proper IDE for writing code :wink:

1 Like

It works!

Thank you, thank you, thank you!!!

Hello!
I have been following the instructions from this tutorial on how to create and implement a new module on an oxid website: https://marco-steinhaeuser.de/how-to-write-a-module-for-oxid-eshop-display-you-will-save-x-percent-on-the-product-details-page.html .
The module is active, but it is not displaying in the webstore. I have spent hours trying to figure it out, to find out if I have missed a step or done something wrong, so I would appreciate your help. I have copied everything I have done so far. I am still new to oxid, I make beginner mistakes, I don’t quite understand what I’m doing.
Thank you very much!!

I am using:oxid version: 4.10.7 OS: ubuntu php version: PHP 7.2.4

ak_mysaving_oxarticle:

class ak_mysaving_oxarticle extends ak_mysaving_oxarticle_parent //extends the oxarticle class
{
	public function getMySaving()
	{
		//define the variable you want to fill
		$sProductSaving='';
		//assign a default value for $dProductOldPrice in case there is no Tprice
		$dProductOldPrice=0;
		//grab the data you need via getters from the database and put them into a self defined variable
		$oTPrice=$this->getTPrice();
		if($oTPrice)
		{
			$dProductOldPrice=$oTPrice->getPrice();
		}
		//if this price > 0
		if($dProductOldPrice>0)
		{
			//get the present price of the product
			$dProductPrice = $this->getPrice()->getPrice();

			//calculate the difference between the old and the new price as a percentage
			$dProductSaving = 100 - ( $dProductPrice * 100 / $ $dProductOldPrice);

			if($dProductSaving > 0)
			{
				//format the output
				$sProductSaving = number_format($dProductSaving, 0, ".",",");			}
		}
		return $sProductSaving;
	}
}

akmysaving_lang.php:

$sLangName = “English”;
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
‘charset’ => ‘ISO-8859-15’,
‘AK_MYSAVING_PERCENTSAVED’ => ‘You will save %s &#37’

);

details_productmain_tprice.tpl
[{$smarty.block.parent}] {* Block vo koj e vklucen details_productmain_tprice blokot *}

[{assign var=“saving” value=$oDetailsProduct -> getMySaving}]
{* Kreira new variable saving=getMySaving *}

[{if $saving > ‘’"}]


[{oxmultilang ident=“AK_MYSAVING_PERCENTSAVED” args=$saving }]

[{/if}]

out/lang/en/akmysaving_lang.php:
include_once(dirname(FILE).’/…/…/…/application/translations/en/akmysaving_lang.php’);

metadata file:

$aModule = array(
    'id'          => 'mysaving',
    'title'       =>  'My Saving',
    'description' =>  'Description',
  //  'thumbnail'   => 'out/pictures/pmlogo.png',
    'version'     => '0.9',
    'author'      => 'Me',
    'extend'      => array(
        'oxarticle' => 'ak/mysaving/application/controllers/ak_mysaving_oxarticle'
    ),

    'blocks' => array(
        array(
            'template' => 'page/details/inc/productmain.tpl', //The template we want to alter
            //se naoga vo /application/views/azure/tpl/page/details/inc/
            'block' => 'details_productmain_tprice', //predefined block close to where you want to place your output, in the
            'file' => 'modules/ak/views/blocks/details_productmain_tprice.tpl'          
             //defined  new file details_productmain_tprice.tpl in /application/views/blocks/ which extends the details_productmain_tprice block in the template
            //noviot blok koj go extend-a details_productmain_tprice blokot vo templejtot!
        )
    )
);

why did you suddenly change the path to your modules block file?
in you first example code and also in the tutorial its relative to module root directory:

also, you have an unexpected double quote in your template: