This example to show you override edit action from ProductController.php is located app/code/core/Mage/Adminhtml/controllers/Catalog

Step 1: Create new module from app/etc/JPK_New.xml

<?xml version="1.0"?>
<config>
<modules>
<JPK_New>
<active>true</active>
<codePool>local</codePool>
</JPK_new>
</modules>
</config>

Step 2: Make config.xml from app/code/local/JPK/New/etc/config.xml

<?xml version="1.0"?>
<config>

<modules>
<JPK_New>
<version>0.0.1</version>
</JPK_New>
</modules>

<admin>
<routers>
<adminhtml>
<args>
<modules>
<JPK_New before="Mage_Adminhtml">JPK_New</JPK_New>
</modules>
</args>
</adminhtml>
</routers>
</admin>

</config>

Using above code you want to override any action from any adminhtml controller. Only you need to make controller file for that.

Step 3: Make controller file from app/code/local/JPK/New/controllers/Catalog/ProductController.php

And first include your default controller class file then write new controller class for update then extends your new controller file to your default controller class like here extends with “Mage_Adminhtml_Catalog_ProductController”.

<?php
include_once("Mage/Adminhtml/controllers/Catalog/ProductController.php");
class JPK_New_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
{
public function saveAction(){
echo "Testing";exit;
}
}
?>

Notice : Check the name of routers path is same for which module you are going to override. here it is adminhtml (After  <admin><routers> )
But instead of adminhtml some custom downloaded modules seems to be using other names like admin_catalog or admin_blog etc..
So ensure that name need to gave after <admin><routers><—custom name same origianl config.xml—->

Getting 404 for checkout controllers from 1.6, but it was working fine with 1.5

Try by removing the entire rewrite part from config.xml, then use frontend routers like below.

Remove below code

    <global>
        <rewrite>
            <MyNameSpace_MyModule_cart>
                <from><![CDATA[#^/checkout/cart#]]></from>
                <to>MyNameSpace_MyModule/cart</to>
                <override_actions>false</override_actions>
            </MyNameSpace_MyModule_cart>
        </rewrite>
    </global>

Use below code only…

    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>

It working for me.. let me know if have any suggetions…

Follow below step to add custom attribute in magento customer module…

Include below script some where in your template file and load it once…

<?php
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'customcode', array(
 'label'        => 'customcode',
 'type'        => 'varchar',
 'visible'    => true,
 'required'    => false,
'sort_order' = > 10
 ));

?>

After run it once, please remove the above code.
Remove cache and check customer adding area in backend.

For removing any custom attributes…run below code from some where in your loading templates

<?php

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('customer', 'customcode');

?>

Once run , please remove above code…
Let me know your comments….

Hope many getting the same version when trying upgrading from 1.4.2 to 1.5.
Try to follow below steps to resolve the issue…

1. Set folder permissions according to Magento Wiki

2. Clear out all downloaded extensions by running below mentioned script file…

sh /downloader/pearlib/clear
OR
those who didn’t have shell acess to run sh, please view that file. You can see that script deletes some of the files in this folder.

3. Disable Cache, remove current session and cache files from var folder.

4. Then run magento-core/Mage_All_Latest from Magento connect manager
After first run you may get same version again (1.4.2) .  But now you can able to upgrade by manually select each package or by running below string in key field.
http://connect20.magentocommerce.com/community/Mage_All_Latest

Feedbacks are very much helpfull…

1)  Check version release notes:

Check the version release notes from magento site. May be there is some special instructions for coming versions…

2) Backup your files

Backup all files manually or from linux shell. Before backup try to remove all cache files

3) Backup your database

mysqldump -u username -h localhost -ppassword database > my_database_name.sql

4) Disable cache from admin.

5) Delete cache and session directories  located here:
/var/cache
/var/session

6) Execute “clean” bash script located in /downloader/pearlib directory

a) Run chmod +x clean  to be able to execute this script
b) ./clean to execute script

7) Finally go to Magento connect manager from your Magento admin
Paste this extension to upgrade Magento: magento-core/Mage_All_Latest
If its not working try below one in key field
Using: http://connect20.magentocommerce.com/community/Mage_All_Latest

After this is done, you should have new Magento, however if there was some custom coding, you should really know what is going on with your code.
Usually installation ends up with some minor problems that should be handled manually, sometimes even on default installations if you have really old version of Magento that you would like to upgrade.

8) Make proper testing before doing this production server

 

Step 6 is not necessary one…

Feedbacks are very helpful …

HTML Part for adding calendar picker in admin side

<input name="dob" id="dob" value="" type="text" style="width:110px !important;" /> <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="" id="_accountdob_trig" title="Select Date" style="" />
 <script type="text/javascript">
 //<![CDATA[
 Calendar.setup({
 inputField: "dob",
 ifFormat: "%m/%e/%y",
 showsTime: false,
 button: "_accountdob_trig",
 align: "Bl",
 singleClick : true
 });
 //]]>
 </script>

in PHP Side

$dob = Mage::app()->getLocale()->date($postData['dob'], Zend_Date::DATE_SHORT);
 $customer->setDob($dob->toString('YYYY-MM-dd'));

Here $customer is using for customer model and storing the dob.

 

From
 http://www.mysite.com/admin
To
 http://www.mysite.com/sitemanager

1) Open app/etc/local.xml
2) Find this code:

 <config>
.
.
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
.
.
</config> 

3) In that code, change

 <frontName><![CDATA[admin]]></frontName> 

to

 <frontName><![CDATA[sitemanager]]></frontName> 

4) Save the local.xml file

5) Remove everything under var/cache/
6) Remove everything under var/session/

Then try the url….

Run below commands from shell

For Directory permission

find . -type d -exec chmod 0755 {} \;

For file permission

find . -type f -exec chmod 0644 {} \;

To change a Customer group from general to something special during a special event, like when purchase a particluar total amount , special product or any date etc…

$session  = Mage::getSingleton('customer/session');
$customer = $session->getCustomer();
if($customer->getId()) {
 $customer->setEmail($customer->getData('email'));
 $customer->setGroupId('5'); // custom group id
 $customer->save();
 Mage::getSingleton('customer/session')->loginById($customer->getId());
 }

Please suggest is there any other good methods….

For version 1.4.0.1  follow the steps…

1.  Take phpMyadmin access from your control panel and select database sql window in order to run following SQL statements

2. We have to insert data in to 3 tables

  1. eav_attribute
  2. catalog_eav_attribute
  3. eav_entity_attribute

Try to replicate already existing table fields with your required changes in id, name and code.

Below i am trying to replicate the description field of category like a second description.

Please note: field values NULL and BLANK have importance , so keep exact same field values when replicating.

INSERT INTO `eav_attribute` (`attribute_id`, `entity_type_id`, `attribute_code`, `attribute_model`, 

`backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, 

`frontend_label`, `frontend_class`, `source_model`, `is_required`, `is_user_defined`, 

`default_value`, `is_unique`, `note`) VALUES('', 9, 'description_second', NULL, '', 'text', '', '', 

'textarea', 'Second Description', NULL, '', 0, 0, '', 0, '');

So here we need to note the new generated row for taking new ‘attribute_id’ , let it be as NEWID.

INSERT INTO `catalog_eav_attribute` (`attribute_id`, `frontend_input_renderer`, `is_global`, `is_visible`, `is_searchable`, `is_filterable`, `is_comparable`, `is_visible_on_front`, `is_html_allowed_on_front`, `is_used_for_price_rules`, `is_filterable_in_search`, `used_in_product_listing`, `used_for_sort_by`, is_configurable`, `apply_to`, `is_visible_in_advanced_search`, `position`, `is_wysiwyg_enabled`) VALUES(981, NULL, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, '', 0, 1, 0);

Here  please note NEWID , you need to replace it with newly generated id from first query.

INSERT INTO `eav_entity_attribute` (`entity_attribute_id` ,`entity_type_id` ,`attribute_set_id` ,`attribute_group_id` ,`attribute_id` ,`sort_order`)
VALUES (NULL , '9', '12', '7', 'NEWID', '2');

Please note NEWID.

Now delete entire cache and re login to admin and check catalog manage area.

For calling in front area

$_category->getData('description_second')

Let me know if have any issue…

© 2014 Developers Corner Suffusion theme by Sayontan Sinha