Add code

Thursday 20 October 2016

Magento1: How to reinstall magento website without re uploading all files

To reinstall the Magento website without uploading all files to the server, we need to follow the following steps:
  1. Log in to the database at phpmyadmin and select your database.
  2. Empty the particular database or drop all tables from the selected.
  3. Goto app->etc folder and remove the local.xml file from the existed files.
  4. Now start the installation by running your domain url.

How to Change default homepage in magento-1 ?

Go to

 Admin -> System -> Configuration -> General (Left) -> Web > Default Pages ->  CMS Home Page

Select your required home page from drop-down.

You will have to change to the website / store view that you want to change (the drop down in the upper left corner).

How to enable contact us page in magento -1 ?

 1. Login to admin panel
 2. Goto admin-->system-->configuration-->General-->contacts
 3. Enable Contact Us->Yes
 4. Email options-->Send emails to-->(Enter your email id which you want to receive)

How to change page title of a category in magento-1 ?

 1. Login to admin panel
 2. Goto catalog-->manage categories
 3. Select category which you want to change the title
 4. Goto display options and enter there your desire page title
 5. Save category
 6. clear cache and refresh website frontend.

Friday 26 August 2016

How to enable login for custom cms page in magento-1.9

1) First of all, you need to create the page in admin panel for the custom page.
open  app/design/frontend/base/default/layout/customer.xml file  from your root folder.</br>
You need to write the following code out of <default>tag.

<customer_logged_in>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="cms"><label>Bulk orders</label><URL><![CDATA[https://www.domain.com/customage/]]></URL><title>Bulk orders</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</customer_logged_in>


<customer_logged_out>
 <reference name="top.links">
     <action method="addLink" translate="label title" module="customer"><label>Bulk orders</label><url helper="customer/getLoginUrl"/><title>Bulk orders</title><prepare/><urlParams/><position>10</position></action>
 </reference>
</customer_logged_out>

Thursday 28 July 2016

Shopping cart is going to empty after cancelled the payment at checkout page

Please `open app/code/core/Mage/Checkout/controllers/OnepageController.php`

Search for 

$this->getOnepage()->getQuote()->save();
 
 //this makes the cart empty (sets the quote as converted to order)
    if (isset($redirectUrl)) {
        $result['redirect'] = $redirectUrl;
    } 
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
And replace this with the following.

if (isset($redirectUrl)) {
    $result['redirect'] = $redirectUrl;
    $this->getOnepage()->getQuote()->setIsActive(1) ;
}
$this->getOnepage()->getQuote()->save();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

Friday 29 April 2016

How to Add the list of cities in states to Magento.


Adding the list of cities in states to Magento.
 I have tested this and worked for me on my server.
 I have used the Region & City Manager extension.
Region & City Manager extension allows you to add regions and cities for any countries in the world.

Check once the extension from here :

https://www.magentocommerce.com/magento-connect/catalog/product/view/id/30552/s/region-city-manager/

Monday 21 March 2016

Hide Magento Attributes with no Value

This can be done with a small piece of code. Find and open the attributes.phtml file. This file can be found here:/app/design/frontend/[theme name]/[package name]/template/catalog/product/view/attribute.phtml
Open the file and search for the following lines:


<?php foreach ($_additional as $_data): ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
<?php endforeach; ?>

Replace the entire foreach loop with the following lines of code:

<?php foreach ($_additional as $_data): ?>
    <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
    <?php } ?>
<?php endforeach; ?>

<?php foreach ($_additional as $_data): ?>
    <?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
    <tr>
        <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
        <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
    </tr>
    <?php } ?>
<?php endforeach; ?>

Friday 19 February 2016

How to move magento search bar from header to sidebar?

Edit "app/design/frontend/<your theme>/<your theme>/layout/catalogsearch.xml"

Fine the line:


<reference name="header">
    <block as="topSearch" name="top.search" template="catalogsearch/form.mini.phtml" type="core/template">
</block>
</reference>

Replace the reference name to left or right.

<reference name="left or right(your wish)">
    <block as="topSearch" name="top.search" template="catalogsearch/form.mini.phtml" type="core/template">
</block>
</reference>

Maximum execution time of 30 seconds exceeded

To fix it, open your php.ini and replace the value for 'max_execution_time' and 'max_input_time' as per below.


max_execution_time = 3600
max_input_time = 3600

How to show only first name in magento welcome message?

Comment the welcome message code in "template/page/html/header.phtml" and Use the below code to show first name only.



$customer = Mage::getSingleton('customer/session')->getCustomer()->getData();
if(Mage::getSingleton('customer/session')->isLoggedIn()){
   echo $this->__('Welcome, %s!', $customer['firstname']);
}else{
   echo $this->__('Welcome Guest');
}

How do I change SHOP BY text in left sidebar Magento?

Are you trying to replace the "SHOP BY" text? And failed to replace the text? Don't worry, that is not actually a text. That is Image.

Solution 1: You will need to replace the image under

"skin/frontend/default/default/images/bkg_block-layered-title.gif";


Solution 2: Locate a file

"app/design/frontend/default/YOURTHEME/template/catalog/layer/view.phtml" Change the class name "block-title" to something else.

Wednesday 10 February 2016

How to remove my account,my wishlist in magento account link on home page?

To remove My Account link :

Open the file /app/design/frontend/package/theme/layout/customer.xml and comment these lines
 
<!--<action method="addLink" translate="label title" module="customer">
<label>My Account</label>
<url helper="customer/getAccountUrl"/>
<title>My Account</title><prepare/><urlParams/>
<position>10</position>
</action>-->

To Remove Wishlist link :

Open the file /app/design/frontend/package/theme/layout/wishlist.xml and comment these lines.
<!--<reference name="top.links">
    <block type="wishlist/links" name="wishlist_link"/>
    <action method="addLinkBlock">
<blockName>wishlist_link</blockName>
</action>
</reference>--> 

To Remove My Cart link :

Open the file /app/design/frontend/package/theme/layout/checkout.xml and comment these lines
<!-- <action method="addCartLink"></action> -->

To Remove Checkout link :

Open same file, /app/design/frontend/package/theme/layout/checkout.xml and comment the lines
<!-- <action method="addCheckoutLink"></action>-->

Magento : 404 error is showing admin page

Hello, Sometimes we may get the error on admin page once done with the Magento installation. In that scenario, we have to do the following: ...