Saturday, March 28, 2015

Magento Error: You cannot define a correlation name 'my_attribute' more than once

When you call "catalog/layer_view" module twice, this type of error is generated.

You need to search 'type="catalog/layer_view"' in your xml files and remove the block which you don't need. This will fix the error that 'You cannot define a correlation name 'my_attribute' more than once'.

Redirect to cms page after subscription of Newsletter

You can redirect to any page after subscription of newsletter.


Copy 
app\code\core\Mage\Newsletter\controllers\SubscriberController.php
to
app\code\local\Mage\Newsletter\controllers\SubscriberController.php


Open created file and search this code: $this->_redirectReferer();

and replace it to following code to redirect to your cms page.

$this->_redirectUrl(Mage::getBaseUrl().'cms-page-Identifier');


you can redirect it to base url by using following code instead of above.

$this->_redirectUrl(Mage::getBaseUrl());

Delete/Remove System Attribute

There is no option to delete or remove system attribute in magento admin.

I would suggest not to delete any system attribute. But as per client's requirement if you want to remove some attribute then you need to do following settings:

1) Go to PhpMyAdmin.
2)  Go to your database.
3) Go to eav_attribute table.
4) Search your attribute_code.
5) Edit that attribute_code's row.
6) Set 1 in 'is_user_defined' column.
7) After setting 1, you can go to magento admin. Here, you will find that the attribute which is set 1 for 'is_user_defined'  is no longer remain system attribute.so you are now able to delete it.

I will suggest you that do not delete any attribute if you don't want. Better to remove it only from desired attribute set if you don't require it.

Set session time out limit for magento frontend

You can set session time out limit from magento admin for front end by doing following settings:

Go to System->Configuration->Advanced->Admin->Security and set the session lifetime.This time is number of seconds.

Authorize.net gateway Test Account Setup

Once you have test account of authorize.net, you need to do following settings in magento admin.

Magento admin > System > Configuration >sales > Payment method > expand Authorize.net

Here, you need to enter your test account's Login Id and Transaction key.

The most important configuration is Gateway URL for test account.

For Test account Gateway URL is:

If you do not change gateway url for test account then magento will show following error and you will not able to finish transaction:
The merchant login ID or password is invalid or the account is inactive.

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

While development of magento application,  many times we get following error:

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

You need to delete  maintenance.flag file in root folder of magento to fix this problem.

When Magento is performing certain tasks, it temporarily creates maintenance.flag file which should be deleted automatically once processing  task get finished but sometimes this file don't get deleted and remain on root folder which causes above error. So, simply delete  this file to get back to development again!


Saturday, February 21, 2015

Redirect to Same Page in magento

In your controller's action means in module/controller/action,call following function:
$this->_redirectReferer();

call newsletter block in footer in magento

You can do this in local.xml

I had done following code for local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
<!-- remove the newsletter block from left navigation -->
        <remove name="left.newsletter" /> 
        <!-- call newsletter block in footer -->
        <reference name="footer">
            <block type="newsletter/subscribe" name="newsletter" as="newsletter" template="newsletter/subscribe.phtml" before="-" />
        </reference>
    </default>
</layout>

change layout of category page in magento

You can do this either in catalog.xml or in local.xml

I had done following code for local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
   <catalog_category_default translate="label">
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
   </catalog_category_default>
</layout>

call static block in magento

You can call static blocks by using following ways:
1) In CMS page or block:
{{block type="cms/block" block_id="custom_block_id"}}

2) In PHP code:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('custom_block_id')->toHtml(); ?>

3) In XML file:
<block type="cms/block" name="custom_block_id" after="-">
      <action method="setBlockId"><block_id>custom_block_id</block_id></action>
</block>

Remove block from magento left or right column

In your layout.xml
<remove name="block.name" />

Following code will remove default sidebar blocks:

<default>

<remove name="customer_account_navigation"/><!--Customer navigation-->
<remove name="sale.reorder.sidebar"/><!--Sales reorder sidebar when customer logged in Dashboard-->

<remove name="catalog.product.related"/><!--Related products sidebar-->
<remove name="catalog.compare.sidebar"/><!--Compare product sidebar-->
<remove name="catalog.leftnav"/><!--Layered navigation-->
<remove name="catalogsearch.leftnav"/><!--Layered navigation on search result page-->

<remove name="right.permanent.callout"/><!--Right Callout Sample Data-->
<remove name="right.reports.product.viewed"/><!--Recently Viewed Products-->
<remove name="right.reports.product.compared"/><!--Compared Products-->
<remove name="right.poll"/><!--Poll-->

<remove name="left.newsletter"/><!--Sidebar Newsletter-->
<remove name="left.permanent.callout"/><!--Left Callout Sample Data-->

<remove name="wishlist_sidebar"/><!--Wishlist Sidebar-->
<remove name="paypal.partner.right.logo"/><!--Paypal logo Sample Data-->

<remove name="tags_popular"/><!--Popular Tags-->
<remove name="cart_sidebar"/><!--Cart sidebar-->

</default>

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...