How can I override magento 2 adminhtml template file? - magento2

I want to override vendor/magento/module-sales/view/adminhtml/templates/order/view/items/renderer/default.html file in magento 2. Please help.

You can set the theme fallback as it works in the frontend
<config>
<stores>
<admin>
<design>
<theme>
<default>new_theme</default>
</theme>
</design>
</admin>
</stores>
</config>
then you can copy under the right path in the app/design/adminhtml/default/new_theme/

Related

Eclipse file template plugin doesn't use my template file

I am not really familliar with this topic but I want to create a plugin described at this page:
HowTo extend CDT with custom file templates.
So far as described in the Link I got it working. But in the example the template format is directly described in the <template>...</template>-Node:
// ${file_name}
// Test Source
But what I want to do is not to write my file template format into the XML-File of the plugin. Instead I want to have a file that is used with the file temlate, in my example H_Template.h. But I don't know how to include that file. Does anyone know?
I tried to use the attribute <include file="H_Template.h"/> with an relative path to the file from my plugin location. Or is it the relative path to my eclipse folder?
template.xml:
<templates>
<template name="Source template"
id="test.codetemplates.csourcefile"
description=" "
context="org.eclipse.cdt.core.cSource.contenttype_context"
enabled="true">
// ${file_name}
// Test Source
</template>
<template name="Header template"
id="test.codetemplates.headerfile"
description=" "
context="org.eclipse.cdt.core.cHeader.contenttype_context"
enabled="true">
<include file="H_Template.h"/> <!-- <<<<<<<< ??? -->
</template>
</templates>
H_Template.h:
// ${file_name}
// Test Header
There is no support for this. The template code must be included as part of the template.xml file.
The Eclipse code which reads the template is org.eclipse.jface.text.templates.persistence.TemplateReaderWriter.

My custom extension is not visible on admin panel Magento 2.0

I installed my custom extension via composer.
I can confirm that app/code/vendor/package_name generated on the server by composer.
However,on admin panel under stores/configuration/advanced I can not see my extension.
What I've tried so far are as following ;
Flushing Magento 2.0 cache and disabling caching
Changing extension file permissions to 777
Deleting files under var/cache manually
Logging out and logging in again
None of them solved my problem.
How can I see my custom extension under admin stores / configuration / advanced on Magento 2.0 ?
I am not sure if it any helps but I posted my config.xml and module.xml
Thanks in advance,
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Fusion_CODFee" schema_version="0.0.1"></module>
</config>
<?xml version="1.0" ?>
<config>
<modules>
<Fusion_CODFee>
<version>0.1.0</version>
</Fusion_CODFee>
</modules>
</config>
According to me setup_version is missing from module.xml. It should be like this :
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Fusion_CODFee" schema_version="0.0.1" setup_version="0.0.1"></module>
</config>
you shoul try php bin/magento setup:upgrade command so that your magento upgrade itself with the new extension, also check for config.php in app/etc folder ,your module should be there if is active in case it is not then under array() tag add this "Fusion_CODFee=>1" and then run upgrade command in your rootdirectory, it might help you.
I've tried following code that's working for me please have look
Fusion\CODFee\etc\module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Fusion_CODFee" setup_version="2.0.0">
</module>
</config>
Now next you have to register your module with registration.php
create registration.php under Fusion\CODFee\registration.php and put below code inside it.
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Fusion_CODFee',
__DIR__
);
Now clearing you cache and if still not working then fire below command from your root directory of magento installation
If your system is ubuntu then => sudo php bin\magento setup:upgrade or for window system remove sudo
then change permission and that's it
Let me know if still have any query

Overwriting a Magento core class using custom module

I encouraged to post a question here for the first time, so here it goes!
I'm trying to overwrite Magento core class for the first time; Mage_CatalogInventory_Model_Stock_Item located # /app/code/core/Mage/CatalogInventory/Model/Stock/Item.php, but for some reason I'm not having any success as executing;
$object = Mage::getModel('cataloginventory/stock_item');
var_dump(get_class($object));
outputs
string 'Mage_CatalogInventory_Model_Stock_Item' (length=38)
I created a new directory under /app/code/local/Rage and copied the Item.php to /app/code/local/Rage/CatalogInventory/Model/Stock/Item.php renaming it to
class Rage_CatalogInventory_Model_Stock_Item extends Mage_CatalogInventory_Model_Stock_Item { ... }
I also made a couple of xml files. One to app/etc/modules/Rage_CatalogInventory.xml, which contains following;
<?xml version="1.0"?>
<config>
<modules>
<Rage_CatalogInventory>
<active>true</active>
<codepool>local</codepool>
</Rage_CatalogInventory>
</modules>
</config>
and another to app/code/local/Rage/CatalogInventory/etc/config.xml;
<?xml version="1.0" ?>
<config>
<modules>
<rage_cataloginventory>
<version>0.0.1</version>
</rage_cataloginventory>
</modules>
<global>
<models>
<cataloginventory>
<rewrite>
<stock_item>Rage_CatalogInventory_Model_Stock_Item</stock_item>
</rewrite>
</cataloginventory>
</models>
</global>
</config>
I just can't make it work even after a couple of hours trying... This is driving me crazy. Hope you can help me out!
Many many thanks in advance.
EDIT: Fixed config.xml as Amit pointed out. It turned out that Magento had compiler in use. I figured out that could've something to this. So disabled that and cleared the includes/src -folder contents, but still nothing is happening...
issue in config.xml and here rage_cataloginventory should be Rage_CatalogInventory and here total config.xml
<?xml version="1.0" ?>
<config>
<modules>
<Rage_CatalogInventory>
<version>0.0.1</version>
</Rage_CatalogInventory>
</modules>
<global>
<models>
<cataloginventory>
<rewrite>
<stock_item>Rage_CatalogInventory_Model_Stock_Item</stock_item>
</rewrite>
</cataloginventory>
</models>
</global>
</config>
Ok, this is just a guess and don´t be mad if i pointed something out that was clear to you;)
However: You did clear the config-cache, right?
(And keep the compiler disabled for development-environment, that saves you from some trouble if you forget that you have it active.)
The xml so far looks very correct to me, so that shouldn´t be the issue.
What to check:
Is the module loaded at all? (See under System->Config->Advanced)?
Is it working with any other model or just this one?
Any log output that gives a hint as to maybe the config.xml has an error (hidden chars etc.)?

Joomla 3.1.4 ,JInstaller: :Install: Cannot find Joomla XML setup file,error

I have setup already joomla 3.1.4 and I tried to install a plugin,But Im getting this error:
JInstaller: :Install: Cannot find Joomla XML setup file
This is my xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd">
<extension version="3.1" type="plugin" group="content" client="myjoomlasite">
<name>plg_content_helloworld</name>
<author>Tahsin Çetin</author>
<creationDate>July 27th,2013</creationDate>
<copyright>Tahsin Çetin</copyright>
<licence>GNU General Public License</licence>
<authorEmail>tcetin#yandex.com</authorEmail>
<authorUrl>http://tahsincetin.com</authorUrl>
<version>1.1.0</version>
<description>Simple Hello World plugin</description>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
<filename>helloworld.xml</filename>
</files>
</extension>
You do not need to specify "helloworld.xml" in your xml file.Remove file and install again.This will be your final xml file-
<?xml version="1.0" encoding="UTF-8"?>
<extension version="3.1" type="plugin" group="content" client="myjoomlasite">
<name>plg_content_helloworld</name>
<author>Tahsin Çetin</author>
<creationDate>July 27th,2013</creationDate>
<copyright>Tahsin Çetin</copyright>
<licence>GNU General Public License</licence>
<authorEmail>tcetin#yandex.com</authorEmail>
<authorUrl>http://tahsincetin.com</authorUrl>
<version>1.1.0</version>
<description>Simple Hello World plugin</description>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
</files>
</extension>
Hope this will help.
The "Cannot find Joomla XML setup file" usually means you are trying to install an extension that wasn't designed for the version of Joomla you are installing to.
Read more here
In your opening <extension> tag, you do not need to specify a client attribute.
Where is the XML file in relation to your ZIP package? If it isn't at the top level of the ZIP, it won't be found.
Generally when this happens something is wrong with the XML file. If you have made any changes, try to think where those changes were and find a problem with the XML file.
Problems could be:
No opening or closing tag. Closing tags are easy to miss. Count them, make sure there's an opening and a closing tag.
Duplicated tags. It's easy to add two labels or showons for example, especially if you are copying and pasting.
Space before the opening XML tag
No closing fieldset tag
No closing extension or config tag. Easily deleted if you are replacing the file
You can easily use a tool like this:
https://www.w3schools.com/xml/xml_validator.asp
Which will help you to find issues such as missing opening and closing tags.

Magento does not recognize new module

i tried like all tutorials out there and i still cannot get a custom created module to work in Magento.
This is the path where i created the XML file on the server to tell Magento what the module is:
app/etc/modules/Multiplies_HelloWorld.xml
<?xml version="1.0"?>
<config>
<modules>
<Multiplies_HelloWorld>
<active>true</active>
<codePool>local</codePool>
</Multiplies_HelloWorld>
</modules>
</config>
This is the module path:
app/code/local/Multiplies/HelloWorld/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Multiplies_HelloWorld>
<version>0.0.1</version>
</Multiplies_HelloWorld>
</modules>
</config>
when i go to System/Configuration/Advanced i see a whole bunch of other modules except mine.
I tried to flush the cash, disable it, clear it manualy, restart browser, relog but still no module in my list.
The version im using is magento 1.7.0.2 (free)
Im using FileZilla to upload files.
Any suggestions would be really appreciated.
This may be a bit late, but I was just having this same problem.
After 20 minutes of chin scratching I tried resetting all caches (System > Cache Management) and then it popped up!
I'm disabling the "configuration" cache while heavily developing a module. I think that'll help reduce friction.
Make sure your etc/module.xml looks like this:
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="OrgName_ModuleName" setup_version="1.0.0">
</module>
</config>
Make sure your composer.json has this:
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"OrgName\\ModuleName\\": ""
}
}
Make sure your registration.php looks like this:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'OrgName_ModuleName',
isset($file) && realpath($file) == __FILE__ ? dirname($file) : __DIR__
);
If your module is contained in a symlinked directory that is outside of magento root directory (happens when you use local "path": as a module's repository description in composer), you have to allow magento for symlinks with: bin/magento config:set dev/template/allow_symlink 1 . See https://magento.stackexchange.com/a/315525/88882 for more info.