Module not working in joomla 3.0 - joomla

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>

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

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.

Related

How to add SEO plugin in Codeigniter

i am using codeigniter. I want to add seo plugin.I found some code,but i don't know how to apply it.My code is,
controllers/seo.php
Class Seo extends CI_Controller {
function sitemap()
{
$data = "";//select urls from DB to Array
header("Content-Type: text/xml;charset=iso-8859-1");
$this->load->view("sitemap",$data);
}
}
views/sitemap.php
<?= '<?xml version="1.0" encoding="UTF-8" ?>' ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc><?= base_url();?></loc>
<priority>1.0</priority>
</url>
<!-- My code is looking quite different, but the principle is similar -->
<?php foreach($data as $url) { ?>
<url>
<loc><?= base_url().$url ?></loc>
<priority>0.5</priority>
</url>
<?php } ?>
</urlset>
config/routes.php
$route['seo/sitemap\.xml'] = "seo/sitemap";
How it works on search engine?Any one please help me.
The code pasted by you contains code for 3 files as it shows.
i) controller class of codeigniter application/controllers/seo.php
ii) A view that is loaded by sitemap function of the seo controller. application/views/sitemap.php that outputs an XML Sitemap file.
iii) and a route to be added to the application/config/routes.php
NOTE: The main and only function in this code is incomplete so is useless as it is. You need to add few lines to retrieve data from database & assign it to $data variable.
Once completed it can be used as path to sitemap of your website that will managed via database.
I hope I was able to it make it clear.

Joomla 3.x onContentAfterSave not triggering

my over all goal is to grab the articles content after they have saved it and send it though my API. It's stated that onContentAfterSave is fired after they save to the database, my database is getting updated, but nothing coming though api.
Im using Joomla! 3.2.3 Stable
Owtest is my api call, it currently has hard coded data in it.
I feel im either extending the wrong class or missing an import. code below.
<?php
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgContentHelloworld extends JPlugin
{
public function onContentAfterSave( $context, &$article, $isNew )
{
owTest();
}
}
?>
Xml Code:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content" method="upgrade">
<name>plg_content_helloworld</name>
<author>Keith</author>
<creationDate>March 18th, 2014</creationDate>
<copyright></copyright>
<license>GNU General Public License</license>
<authorEmail></authorEmail>
<version>1.0</version>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
</files>
</extension>
file names are helloworld.php and helloworld.xml respectfully.
what solved my problem was passing article by value and not reference

Magento customer can't log in

I just migrated my website. But I got a problem.
My customers can't log in to their account. When click log in on log-in page.
http://www.mywebsite.com/customer/account/login/
It should be log in on their account but it redirects the same page.
Please Help me how to fix that?
After upgrading to Magento 1.8.1 you need to edit your existing template files.
The files listed below need te be change in order to be compatible with Magento 1.8.1. If they exist in your custom theme, compare them to the original base/default/template files.
your_package/your_theme/template/customer/form/newsletter.phtml
your_package/your_theme/template/customer/form/login.phtml
your_package/your_theme/template/customer/form/edit.phtml
your_package/your_theme/template/customer/address/edit.phtml
your_package/your_theme/template/whishlist/view.phtml
your_package/your_theme/template/whishlist/sharing.phtml
your_package/your_theme/template/review/form.phtml
your_package/your_theme/template/persistent/customer/form/login.phtml
your_package/your_theme/template/persistent/checkout/onepage/login.phtml
your_package/your_theme/template/checkout/onepage/login.phtml
your_package/your_theme/template/checkout/multishipping/overview.phtml
your_package/your_theme/template/checkout/cart.phtml
your_package/your_theme/template/catalog/product/view.phtml
your_package/your_theme/template/sendfriend/send.phtml
your_package/your_theme/template/sales/reorder/sidebar.phtml
Edit these files and add <?php echo $this->getBlockHtml('formkey'); ?> after the <form ...> open tag
Step 1: Web_Customer.xml - Enabling custom module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<active>true</active>
<codePool>local</codePool>
</Web_Customer>
</modules>
</config>
Step 2: config.xml – Configuration for our module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<version>0.0.1</version>
</Web_Customer>
</modules>
<frontend>
<routers>
<customer><!– Name of core module to be overridden–>
<args>
<modules>
<Web_Customer before=”Mage_Customer”>Web_Customer</Web_Customer><!– Tell Magento to call our custom module before the Mage/Checkout module –>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
Step 3: Add the following code to line 139 just after the opening of loginPostAction() in AccountController.php
<?php
require_once(“Mage/Customer/controllers/AccountController.php”);
class Web_Customer_AccountController extends Mage_CUstomer_AccountController{
public function loginPostAction()
{
// generate form_key if missing or invalid
if (!($formKey = $this->getRequest()->getParam(‘form_key’, null)) || $formKey != Mage::getSingleton(‘core/session’)->getFormKey()) {
$this->getRequest()->setParams(array(‘form_key’ =>Mage::getSingleton(‘core/session’)->getFormKey()));
}
//Note*
// rest code is same as from Mage/Customer/controllers/AccountController.php
}
}
?>
After completing, don’t forget to clear Magento cache.
Go to template/customer/form/login.phtml and template/persistent/customer/form/login.phtml and under
<ul class="form-list">
Add the following code in the login form
<input type="hidden" name="form_key" value="<? echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
OR, if you are using the login form in several places with different template files
Copy app/code/core/Mage/Customer/controllers/AccountController.php to app/code/local/Mage/Customer/controllers/AccountController.php
Open the AccountController.php that you have copied to local and add the following code to line 139 just after the opening of loginPostAction()
// generate form_key if missing or invalid
if (!($formKey = $this->getRequest()->getParam('form_key', null)) || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
$this->getRequest()->setParams(array('form_key' =>Mage::getSingleton('core/session')->getFormKey()));
}
http://www.blueclawsearch.co.uk/blog/2013/12/12/fix-customer-cannot-login-to-magento-1-8-1/

Magento - Override adminhtml template file

I have read several posts on stack overflow
Overriding a Magento Adminhtml template file
Magento - overriding Adminhtml block
and a couple threads on the magento forum
http://www.magentocommerce.com/boards/viewthread/21978/
However, None of these posts attempt to do what I am trying to do
I would like to override the
app/design/adminhtml/default/default/template/widget/grid.phtml
file, as this file contains a portion of html that allows anyone to export from the sales->order view.
Note: We have disabled all of the export options for this user role in the permissions->role view
The code that displays the "Export to: " -> "CSV/Excel XML" feature is included in the path I have listed above. I would like to remove that chunk of html and override the file included with Magento.
Adminhtml uses the same theming fallback as the frontend, therefore you need only declare a custom template theme for your installation in module config XML:
<stores>
<admin>
<design>
<theme>
<template>custom</template>
</theme>
</design>
</admin>
</stores>
Then you can create app/design/adminhtml/default/custom/template/widget/grid.phtml with any customizations you like, and this file will be used in preference to the one from the default/default adminhtml theme. Your solution then would be to add an ACL check in the logic which renders the export control:
<?php if($this->getExportTypes() && {ACL LOGIC}}): ?>
<td class="export a-right">
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
<?php foreach ($this->getExportTypes() as $_type): ?>
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
<?php endforeach; ?>
</select>
<?php echo $this->getExportButtonHtml() ?>
</td>
<?php endif; ?>
While this logic might be more appropriately implemented in the block class, the class rewrite system does not accommodate rewriting of parent classes, leaving you to rewrite every subclass. In this instance, obeying DRY outweighs embedding too much logic in templates. Moreover, the change is obvious and easily maintained.
Ideally the core team would have implemented this check in the Mage_Adminhtml_Block_Widget_Grid class or at least provided a public setter for the _exportTypes property, which would have made this logic a bit cleaner to implement.
It might seem the simplest solution to rewrite the block but that's more of a dirty hack than a clean solution. Class rewrites should be used very carefully and always avoided if possible. Otherwise you will quickly run into conflicts and also updating Magento gets a hell.
Usually you can change templates by a custom layout update (i.e. in your local.xml), but in this case it is a widget, which are not configured via layout XML.
So, enter observers: create a module that contains the following in its config.xml
<adminhtml>
<events>
<adminhtml_block_html_before>
<observers>
<yourmodulename_observer>
<class>yourmodulename/observer</class>
<method>changeWidgetTemplate</method>
</yourmodulename_observer>
</observers>
</adminhtml_block_html_before>
</events>
</adminhtml>
If you don't understand any of the above, read about Magento Events and Observers.
Now you will need the observer itself to actually change the template, but only for this block type:
class Your_Modulename_Observer
{
public function changeWidgetTemplate(Varien_Event_Observer $observer)
{
$block = $observer->getEvent()->getBlock();
if ($block instanceof Mage_Adminhtml_Block_Widget_Grid) {
// consider getting the template name from configuration
$template = '...';
$block->setTemplate($template);
}
}
}
Magento - Override adminhtml template file
add below code to config.xml file of extension (you created)
<stores>
<admin>
<design>
<theme>
<default>default</default>
<template>rwd</template>
</theme>
</design>
</admin>
</stores>
Now create rwd folder under adminhtml/default/rwd package.
and create template and layout file as you want to override.
like we want to override order comment history.phtml file.
<root>\app\design\adminhtml\default\default\template\sales\order\view\history.phtml
<root>\app\design\adminhtml\default\rwd\template\sales\order\view\history.phtml
Template definition can be found here
class Mage_Adminhtml_Block_Widget_Grid extends Mage_Adminhtml_Block_Widget
in
public function __construct($attributes=array())
So you need to rewrite sales grid block if you want to remove export csv from Sales Order Grid (use this guide if you don't know how http://www.magentocommerce.com/wiki/groups/174/changing_and_customizing_magento_code) and to change __construct to be like
public function __construct($attributes=array())
{
parent::__construct($attributes);
$this->setTemplate('...'); //here is your template
}

Change Magento frontend router to custom URL

I would like to rename the URL path of the shopping cart from checkout/cart to checkout/adverts.
I have tried the following two methods:
Catalog > URL Rewrite Management: Custom
I have also tried doing it using a custom module, with the following in my config.xml:
<global>
<rewrite>
<mynamespace_mymodule_checkout_cart>
<from><![CDATA[#^/checkout/cart#]]></from>
<to>/checkout/adverts</to>
</mynamespace_mymodule_checkout_cart>
</rewrite>
</global>
Both methods have gone to the correct URL path, but shown a 404 Error page - is there something else I need to do? Magento ver. 1.5.0.1
What happen if you add a empty controller to your custom module
<?php
require_once('Mage/Checkout/controllers/CartController.php');
class Mynamespace_Mymodule_CartController extends Mage_Checkout_CartController
{
}
As R.S said you have to extend CartController.php in your module
<?php
require_once('Mage/Checkout/controllers/CartController.php');
class Mynamespace_Mymodule_CartController extends Mage_Checkout_CartController
{
}
?>
in it copy the indexAction() of Mage/Checkout/controllers/CartController.php
Also in your local.xml write
<mymodule_cart_adverts>
// copy the xml code inside <checkout_cart_index> ... </checkout_cart_index> here
</mymodule_cart_adverts>
I havent tried it but it should work

Resources