How to rewrite that Magento admin action after applying 6788? - magento

This is my old XML:
<config>
<menu>
<customactions_menu translate="title" module="giftcard">
<title>my title</title>
<sort_order>9999</sort_order>
<action>giftcard/admin/coupons</action>
</customactions_menu>
</menu>
</config>
This action does not work any longer after applying patch 6788. How do I have to write that action so it works again?
I already changed my route for the module in config.xml according to the suggestion from https://github.com/rhoerr/supee-6788-toolbox.
Thanks!

For a module controller structure like following
app\code\local\AW\Followupemail\controllers\Adminhtml\Followupemailadmin\
CouponsController.php
The action section will be like following (for index action)
<action>adminhtml/followupemailadmin_coupons</action>
If you can update your question with your config.xml and directory structure, I can try to help in better manner.

Related

Arabic words in invoice pdf print Magento

I'm trying to fix this problem by using integration TCPDF in magento but i don't know how do that
this is my try in this file
\app\code\core\Mage\Sales\Model\Order\Pdf\Abstract.php
require_once('TCPDF/TCPDF.php');
$pdf = new TCPDF_TCPDF
(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true,'UTF-8', false);
I don't know waht i'm doing wrong. thank you.
1) Don't edit core files.
2) There are multiple invoice generators in magento: invoice from the backend, invoice on success page etc. So make sure that you are editing and testing the right one. The example below works for invoices in the backend.
3) There may be custom modules that are overwriting your xml, like Webshopapps_Invoicing, check that or it will not work (that's the issue that I had when trying something similar).
After you copied TCPDF to your magento lib folder so that you will have now root/TCPDF/TCPDF.php edit TCPDF.php by changing the class name from tcpdf to TCPDF_TCPDF
Go into code/local/Yourcompany and create the folder invoices. In this folder create etc/config.xml with this content:
<?xml version="1.0"?>
<config>
<modules>
<Yourcompany_Invoices>
<version>0.0.1</version>
</Yourcompany_Invoices>
</modules>
<global>
<models>
<sales>
<rewrite>
<order_pdf_invoice>Yourcompany_Invoices_Sales_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
</global>
</config>
Create another folder structure in code/local/Yourcompany like this Sales/Model/Order/Pdf and add Invoice.php:
class Yourcompany_Invoices_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Invoice {
// it can be another class if you have a custom module overwriting it, like Webshopapps_Invoicing_Sales_Model_Order_Pdf_Invoice
$pdf = new TCPDF_TCPDF();//your stuff here
}
Then submit a test order and go into admin and check a pdf invoice.

understanding adminhtml url paths

I am following this tutorial from alan storm "magento_admin_hello_world_revisited" and it has been a great help in understanding the basics in putting together something for the admin section. Unfortunately, I'm left feeling a little confused on setting the URL path and as a result I have got a 404 error when I click on my link in the menu bar.
The tutorial says that I need to add
<action>adminhtml/Adminprefcentre/index</action>
to my adminHtml.xml for the menu link. Later in the tutorial it mentions that I need to add
<Adminprefcentre after="Mage_Adminhtml">Adminprefcentre</Adminprefcentre>
to my config.xml (NOTE: I have included the other relevant nodes described in the article into the config.xml).
As I was adding the <action> node I took that to mean the link which will be clicked on from the menu bar. As I added the <Adminprefcentre> node I believed that meant it was something to do with rewriting the admin frontName which is mentioned. Is this wrong?
I have created a controller in the usual way Name_Module_AdminprefcentreController and given it an action of indexAction.
When I click on my link in the menu bar i get .../admin/adminprefcentre/index/key/ae6a... and a 404 not found.
I am obviously misunderstanding what is being taught so
1 - what is the section that I am adding to my config.xml file doing?
2 - where should I look to resolve my 404 message?
In config.xml
<config>
.....
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<MagePal_Adminprefcentre before="Mage_Adminhtml">MagePal_Adminprefcentre_Adminhtml</MagePal_Adminprefcentre>
</modules>
</args>
</adminhtml>
</routers>
</admin>
Your Controller path
/app/code/local/MagePal/Adminprefcentre/controllers/Adminhtml/AdminprefcentreController.php
in adminhtml.xml
<children>
<adminprefcentre module="adminprefcentre">
<title>menu title</title>
<sort_order>15</sort_order>
<children>
<magepal_adminprefcentre module="adminprefcentre">
<title>Submenu Title</title>
<sort_order>15</sort_order>
<action>adminhtml/adminprefcentre</action> <!-- call index action in your controller -->

how to add extra filter to custom product reports in magento

I am doing custom product reports in magento. I followed as the steps in the url
But how can I add extra filter after "from:","to:","show By:". I know where to edit in core file(adminhtml/default/default/template/report/grid.php). But it is not the correct way. how to override this filter block for custom reports.
If you want to edit the template file, implement your own module, add a section to the config.xml
<config>
<stores>
<admin>
<!-- override default admin design package and theme -->
<design>
<package>
<name>default</name>
</package>
<theme>
<default>CHOOSE_A_NICE_NAME</default>
</theme>
</design>
</admin>
</stores>
</config>
and then start changing your template in
adminhtml/default/CHOOSE_A_NICE_NAME/template/report/grid.php
Thanks for you swift reply Fabian Blechschmidt...almost I did the same but I overrode the template file.
adminhtml/default/mytheme/template/reportnew/grid.php
I just copied all the report files to mytheme/template folder (reportnew) and its working fine.
I have managed to add two extra fields viz country and a custom attribute "myattrib". But now I am unable to fetch the values from the grid to the model so that I can filter results based on these fields.
Thanks Murali

Magento - Clean custom Account/Registration Fields

I followed this tutorial to add fields in the registration form of a customer under Magento, I succeed to run the example, but I know that It is not clean, for upates later...
What' the best way to rewrite all the files used in the tutorial, in a clean way :
app/design/frontend/default/yourtheme/template/customer/form/register.phtml
app/design/frontend/default/yourtheme/template/customer/form/edit.phtml
app/code/core/Mage/Customer/Model/Entity/Setup.php
app/code/core/Mage/Customer/etc/config.xml
app/code/core/Mage/Customer/controllers/AccountController.php
Thanks a lot
You need to create your own module. Never edit files in app/code/core/ folder. If you want to add functionality to Magento, you need to rewrite the base classes.
Alan Storm has good tutorials to follow:
How to create a simple 'Hello World' module in Magento?
To rewrite a controller (AccountController in your case), and after you create you own module, you can follow this tutorial.
Configure the Layout
In your app/code/local/MyCompany/Module/etc/config.xml:
<?xml version="1.0"?>
<config>
<frontend>
<layout>
<updates>
<mydesign>
<file>myfile.xml</file>
</mydesign>
</updates>
</layout>
(...)
Then you could update your layout in app/design/frontend/default/mydesign/layout/myfile.xml.

Magento - Adding Files to Local/Mage has no Effect

I would like to make changes to some Magento core files. To make sure the changes are future proof I copy the file from code/core/Mage to code/local/Mage.
I keep the file structures and file names consistent. The problem is when I do this the changes have no effect (I've refreshed the cache)
Any ideas where I'm going wrong? If I edit the core files directly the changes take place.
You should create a new local module and define rewrites in the config.xml file:
Create app/code/local/MyCompany/MyModule directory. Add subfolders etc and model.
Now create etc/config.xml file containing:
<?xml version="1.0" encoding="utf-8?>
<config>
<modules>
<MyCompany_MyModule>
<version>0.1.0</version>
</MyCompany_MyModule>
</modules>
<global>
<models> <!-- type of class to rewrite -->
<catalog> <!-- base module to rewrite -->
<rewrite>
<product>MyCompany_MyModule_Model_Product</product>
</rewrite>
</catalog>
</models>
</global>
</config>
Implement model/Product.php with your changes. Easiest way is to inherit from the base class and rewrite the metho.
Also remember to activate your module in app/etc/modules.
The above poster is correct in that the preferred way to edit core functionality is to use rewrites. In some cases, though, this isn't possible, in which case you should be able to place core files into the /app/code/local/Mage directory to get them to work. Block and Model files should work immediately in this way, as should controllers if I remember correctly. Other files (such as config files) may not be automatic.
Could you post the details of a particular file that doesn't respond as you expect? It's easier to debug particulars than generalities. Also, make sure that you have shut off any opcode cache that you have installed on the server in addition to flushing the normal cache.
Thanks,
Joe
You can easily overwrite xml settings using local.xml. So, if you want to overwrite/add to app/code/core/Mage/Customer/etc/config.xml you just add it to app/etc/local.xml.

Resources