Question

problem is self made module not working- I make my self made module in Joomla 3.0. I made a mod_products folder here we created a file called mod_products.php.

mod_products.php - code

defined('_JEXEC') or die;
require_once __DIR__ . '/helper.php';         
$value = modProductsHelper::getproducts( $params );
require JModuleHelper::getLayoutPath('mod_products', $params->get('layout', 'default'));

and after it I made second file helper.php code -

class modProductsHelper{

    public static function getProducts( $params ){
          return 'Products';
    }

} 

and third one is default.php

<?php      

defined('_JEXEC') or die;

if($value!='') { ?>

<ul style="margin-left: 0px;" class="clients-list slides-list slide-wrapper">
       <li class="slide">
            <div class="product-image"><img src="images/product3.png" width="181" height="177"></div>
       </li>       
</ul>
<?php } ?>

Then we install through administrator panel and gave a position to the mod_products module and display in index.php file like so:

<div class="grid_12 product_home">
    <jdoc:include type="modules" name="position-3" />
</div>

But it's not being displayed on the site. Does anyone have any idea why?

Edit:mod_products.xml

<?xml version="1.0" encoding="utf-8"?> 
<extension type="module" version="3.0" client="site" method="upgrade"> 
    <name>mod_products</name> 
    <author>Joomla! Project</author> 
    <creationDate>July 2004</creationDate> 
    <copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright> 
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license> 
    <authorEmail>admin@joomla.org</authorEmail> 
    <authorUrl>www.joomla.org</authorUrl> 
    <version>3.0.0</version> 
    <description>MOD_PRODUCTS_XML_DESCRIPTION</description>
    <files> 
        <filename module="mod_products">mod_products.php</filename> 
        <folder>tmpl</folder> 
        <filename>helper.php</filename> 
        <filename>mod_products.xml</filename> 
    </files> 
    <config> 
    </config> 
</extension>
Was it helpful?

Solution

Right, I've created a small example for you. I think it might have been due to you calling the wrong module layout, not entirely sure.

Here is a link to download the module. Uninstall the current module you're using via the Joomla backend and install this:

http://www.mediafire.com/download/ucp3prv219430zl/mod_products.zip

Also, don't forget to assign the module to a menu item. That might have been the problem before

Enjoy

OTHER TIPS

For me it seems your problem is module name.In some places you have used mod_product and in other places mod_products Please make sure you use only one.I will suggest you to change

require JModuleHelper::getLayoutPath('mod_products', $params->get('layout', 'default'));

to

require JModuleHelper::getLayoutPath('mod_product', $params->get('layout', 'default'));

Also check that you have published the module and also test it for all pages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top