Joomla Save Module As Another Copy - joomla

I'm using Joomla 2.5.3.
I have this module that incorporates with authentication. For some reasons I want this module to be duplicated, so I save it as another copy.
Now, as its Module Type is same as the original one,say Auth, how do I customize the files of the copied module?
There is no folder for the copied module inside modules. Only the original one is there.
Thanks.

It depends on what you want to modify and how the module was created.
If the module was created using the MVC design pattern you want to modify ONLY the view (layout, html, css, js), then you'll need to check if the module supports multiple views/layouts or override the layout and create a view for each module depending on its Id. http://www.minitek.gr/tutorials/joomla-16-tutorials/item/21-how-to-create-a-new-custom-module-in-joomla-16.html
If the module wasn't created using the MVC design pattern, you could duplicate the module folder with another name and modify the name of the module in the xml, however it also depends on what the module does (does it write anything to the db?).
Maybe the easiest (probably not the best), would be modifying the current module depending on the module id. Check this out: http://docs.joomla.org/JModuleHelper/getModule

Think of a module as being similar to a class. You have one instance of the module created already. When you either clone the current instance or create a new instance there is still only one underlying set of files.
Each instance of the module contains its own individual settings so they should not clash with each other.
I can't think of any reason why you would need to customise the underlying files. If you do find a need then your best bet is to copy all of the files from the original module and use them as a base to build your own - entirely new - module, with a new name, new class names, etc.

Related

Duplicate field issue in form view odoo

I have create one field in stock.quant.package model.
tracking_ref=fields.Char("Tracking Ref")
This field is used in two separate modules and I am not able to give module dependency because both are separate modules.
It may be possible that both modules are installed in same database or it may
be possible that in some database only one module is installed.
Due to that reason i have create same field & view in both modules.
But now issue is that if both modules are installed then field is
available two times in the form view.
Is there any possibility that if we install both modules then field will visible only one time in form view.
I am not sure it is the best solution. Just try:
Create a new Module, say module_common
Put all common fields and functions in new module module_common
Make this module dependent of another two modules.
Ex: module_a depends module_common and module_common depends module_common.
Hope it will resolve your problem.

Magento Module Development

I need to modify Menu.php located at app/code/core/Mage/Adminhtml/Block/Page/Menu.php. My question is can I change the directory path to local (app/code/local/Mage/Adminhtml/Block/Page/Menu.php) without having any issues in the future?
The best practice for overriding a Magento core class is explained in the following article
You need to create your own basic module, and rewrite the core class to point to your module's class. That class may then extend the existing Magento core class, overriding or extending any methods.
However, you could simply copy the file and its path to the local directory, since Magento's autoloader defaults there first when looking for classes. The problem with this is that, when you decide to upgrade Magento, you must fully copy the new file to your path (if it were modified by the upgrade) and reapply your modifications.
The rewrite/extend is a much more maintainable solution, but the latter is quick and easy. The choice is yours!

How to load a library from Module using codeigniter modular extensions

i need to load a library from my module using Modular Extensions
my structure like this
modules/
modules/categories/library
categories_class.php
modules/categories/controllers/
categories.php
I need to load categories library in categories controller .
any one cane help me?
I see two problems..
Problem 1
According to your question, your categories module is not organized properly. The whole purpose of HMVC is compartmentalizing of code e.x; modules. Given your present question how does that structure allow you to copy your modules folder and paste it into another app? Answer: It doesnt..
Follow the example below
It should be the following from the app root:
/application/
config
modules/
categories/
views
controllers/
categories.php
libraries/
categories_class.php
models
libraries
core
controllers
Problem 2
per the user guide: https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
You must prefix the module name in front of anything referenced inside the modules folder.
e.g: $this->load->library('module/library');
or in your case: $this->load->library('categories/categories_class');
I have attempted previously to exclude the modules folder name and have never gotten it to work.
Controllers can be loaded as class variables of other controllers
using $this->load->module(’module/controller’); or simply
$this->load->module(’module’); if the controller name matches the
module name.
Any loaded module controller can then be used like a library, ie:
$this->controller->method(), but it has access to its own models and
libraries independently from the caller.
I have another perspective for this error behavior, that make me spend about 3 hours, actually I am always using combination of Uppercase and Lowercase on my custom libraries on Codeigniter.
For wiredesigz of Codeigniter HMVC, remember the libraries loader behavior as same as CI itself, always use lowercase of your library classes name instead of actual class name (Maybe combination of uppercase and lowercase)

Properly override a admin template file in Magento

I want to properly override this admin template file app/design/adminhtml/default/default/template/sales/order/create/form/address.phtml
From what I have found, the proper way is to create a layout file in a new module, set template path inside my module directory and reference that template file using reference node. But I have no clue how to do that.
I don't understand how the layout is controlled using xml as of now. Can someone show how to actually do that?
You should really create your own module, which you can then create a new template.
If you want to force is you need setTemplate() which takes your phtml path as a param. $this->getLayout()->createBlock('my_module/blockname')->setTemplate('my_module/template.phtml');
Bear in mind that the two slash notations here are different.
createBlock() is for a block, so will be in /app/code/<codePool>/My/Module/Blocks/<blockname.php>
setTemplate() is for the template, so will be in /app/design/<area>/default/default/template/template.phtml
Your <area> will be /adminhtml as you're in the admin backend.
In order to get the template working you'll need to create a new module and extend the adminhtml block file which uses this template. You'll have to find the block from the layout.xml and then you can extend the Block and specify a new template.
That's how I'd go about it, but I'm also really finding it hard to override things in the Adminhtml module.

Best way to link Category to customized Modul

So far i have found two ways of liking a category to a customized module. By Category i mean created in Admin->Catalog->Manage Categories->created new category. By Customized module i mean module created in code(app/code/local)
way to link
Till today I used Admin->Catalog->Url Rewrite Manager to direct some category(blog) to some customized module(blog/index/index). So, in Url Rewrite manager I created rewrite entry that had Request-Path hold Category Url-key(blog-index.phtml) and Target-Path hold my costumized module path (blog/index/index). It stop redirecting today by having automatically putting different target path (catalog/category/view/s/blog-index/id/)...i am not sure why
2.way to link
In category layout xml file I put handle
This does the work but it requires to mess with category module that i prefer not to do. It also has link(catalog/category/view/s/blog-index/id/) that does not favor search engines
Is there better way to link category to my costumized module?
The layout XML can go in your module's layout XML file (layout/blog.xml for example) if you'd prefer, the file that layout XML resides in has little importance (you'll need a <layout> section in your config.xml if you don't already have one)

Resources