Magento - Can't login to admin in localhost

I am currently working on magento version 1.3.2.4. When i login to admin, it looks like i have entered proper username and password because it doesn't show any error like "Invalid username or password". When i try with fake login I do get error. Even i am not getting any error it stays on the login page.
So, I had to go through code and comment out few lines after which I was able to login and access admin again.
app\code\core\Mage\Core\Model\Session\Abstract\Varien.php line 77: original:
// set session cookie params
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath(),
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()
);

Commented out three lines:
// set session cookie params
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath() /*,
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()*/
);

Hide "Showing posts with label" message in blogger

  • First go to Template > Edit HTML
  • In Blogger default templates, search for <body> and in custom templates, search for <body>
  • Add the below code just after above code.
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<b:if cond='data:blog.searchLabel'>
<style>
.status-msg-wrap{display:none;}
</style>
</b:if>
</b:if>
Now Save the template and check the result by clicking any of your labels 

How to call an attributes on product page in Magento

Create a new attribute or find a existing attribute to call on product page.

Step 1:- First of all go to catalog->attributes->manage attributes on this page you will see a list of attributes under attribute code you will see all the attribute code copy any code. For example “cost” to display it on front end on product view page.

Step 2:- Open \template\catalog\product\view.phtml now find this code line.

“<?php $_product = $this->getProduct(); ?>”

After this code we call our attribute by this code.

<?php
If($_product->getCost ()):
echo $_product->getCost ()
endif;
?>


That’s it.

How to make a module in Magento Part 1

So here is our file and folder structure for module.


A)     app\etc\modules\Summer_Spring.xml (Create a file for Module Configuration file).
B)     \app\code\local\Summer (Create a namespace folder).C)     \app\code\local\Summer\Spring (Create a module folder).D)     \app\code\local\Summer\Spring\controllers (Create a controller folder).E)      \app\code\local\Summer\Spring\etc (Create a Configuration folder).F)      \app\code\local\Summer\Spring\etc\config.xml (Create a Configuration file).G)    \app\code\local\Summer\Spring\controllers\IndexController.php (Create a Controller file).

How to install Magento On wamp Server.

Please follow these instruction to install Magento on local Server,  

Step 1:- For Download magento go To             http://www.magentocommerce.com/download and download latest version.

Step 2:- Extract Magento folder and copy in your localhost folder.
Step 3:- Create database in phpnyadmin database name should be in lower case.
Before go further we have to make some changes So let’s do it now.

How to Setup multiple Store in Magento

Please Follow these steps to create  multiple Store  in Magento.
Step 1:- Login in admin panel Go to Catalog and click on manage categories.
  
Step 2:- Now click on Add Root Category button.
Step 3:- On general information page fill name for category For example:-
Name = arunstore,
Is Active = Yes
Page Title = Arun store
Include in Navigation Menu = Yes

Remove sidebar content block In Magento.

If you want to remove any Block from you home page, cart page or Product view page  it’s so simple just go to your layout folder find your xml file and add remove following method for exp see below.We are going to remove Pool Block from “Product view page” and home page. I am currently using “2-columns-right” template for my home page so follow these steps :-

Step 1 :- Go to your \app\design\frontend\<your theme package>\<your theme>\layout\poll.xml and now open “poll.xml” add following code between </layout> code….</layout>.
<!-- Remove poll block from product view page -->                 <catalog_product_view> <!--- You can find this in catlog.xml  ->                  <reference name="right">                 <action method="unsetChild"><name>right.poll</name></action>                </reference>                </catalog_product_view><!--remove poll block from page two columns right page-->                 <page_two_columns_right> <!--- You can find this in page.xml  ->                   <reference name="right">                 <action method="unsetChild"><name>right.poll</name></action>                </reference>                 </page_two_columns_right>

By using same method you can remove your block another method to disable your module block follow these steps .

Step 1 :- Go to Your admin  and then Go System and click on drop down menu Configuration  and find Advance from left side bottom click on it.
Step 2 :- Click on Disable Module Output find your module for example I am disabling poll module “Mage_Poll” uncheck the box now select disable from drop down and now click on save config button.
Now go to your website and refresh it you will see the change.

How to get important url in Magento

First of all we will present you how to get skin url, get media url, get base url, get store url to retrieve an URL path in STATIC BLOCK

1. How to Get skin url

ANSWER: {{skin url=’images/sampleimage.jpg’}}


2. How to Get media url

ANSWER: {{media url=’/sampleimage.jpg’}}

How to Display all products on homepage in Magneto

Today I will show you how to display all the products of a Magento store on its HomePage. This can be used also to display all the products on a particular page or maybe a custom Page.

Step 1: Login into your Magento Admin Dashboard;
Step 2: Go to: CMS -> Pages -> And choose Home Page;
Step 3: Now you must see the some edit options which will be applied for the HomePage.
Step 4: Go to: Contet Tab from left;
Step 5: Add following snippet in the WYSIWYG (As know as “What You See Is What You Get”);
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}}

Final: Now you must be able to see all the products on your homepage.

How to make a module to interact with database in magento

How to make a module in Magento to show data in front end.

Step 1:-

Go to your magento root directory   and create File’s and folders:-

1.       Create a xml configuration file in magento\app\etc\modules\Summer_Spring.xml.
2.       Create a namespace Folder under named “Summer” where “Summer” is namespace for our module magento\app\code\local\Summer.
3.       Create a Module folder under our namespace folder named with Spring so now we have module magento\app\code\local\Summer\Spring.
4.       Under our module we have to create five new folder’s  and relative files:-
 A)  etc/config.xml.
 B) controller/ IndexController.php     (controller name should start in lower case).
C)   Block/Index.php   (Block name should start in lower case).
D)  Helper / Data.php  Block name should start in lower case).
E)  Model/ Spring.php  Block name should start in lower case).
F)  Model/ Mysql4/ Spring.php
G)  Model/ Mysql4/ Spring/ Collection.php
5.       Under  Your theme section you have to create a config file For template. So create this file in magento\app\design\frontend\<Your theme package >\<Your theme>\layout\spring.xml
6.       Now create a folder in magento\app\design\frontend\<Your theme package >\<Your theme>\template\spring
7.       Now under “spring” create a file index.phtml
Ok now we have created all the files and folders for our Module. So let’s start coding
8.       First Open Summer_Spring.xml. and add the following code in this file and save it

How to show related product any where in magento

1. Copy and paste this code in your template page.

<!--- Code Start from here   -->

<div class="related_product"><?php $related_prods = $_product->getRelatedProductIds();foreach($related_prods as $related){   $_item = Mage::getModel('catalog/product')->load($related);    //echo $_rel->getName() . " " . $_rel->getSku();  ?>

Auto-Resize WordPress Featured Image

Auto-Resize WordPress Featured Image and Crop if Necessary

If you are creating a WordPress site for a user, you want to make sure everything is as easy as possible for them. One trick that can make things easier is to have images automatically resize when they are used for a featured image in WordPress. Resizing images may be easy for developers and graphic designers, but some end-users don’t have the skills or time to resize an image to fit perfectly in your design. Luckily, this is simple to set up.
 Steps
  1. Before we even start, make sure that your theme supports thumbnails. To do this just make sure the the following line of code is in your functions.php file.
add_theme_support( 'post-thumbnails' );
  1. The next step is to put the following line of code in the WordPress theme’s functions.php file.
add_image_size($name, $width, $height, $cropBoolean);
  1. The add_image_size(); function has 4 parameters. $name is the name that you want to call your image with. $width is the width you want the image to crop to in pixels. $height is the height you want the image to crop to in pixels. $cropBoolean is a true or false parameter. If set to true the image will crop itself automatically.
  2. In the example below, the name I use to call the cropped image is “featuredImageCropped”. The height and width are 250px and 200px respectively, and the image is set to crop.
add_image_size('featuredImageCropped', 250, 200, true);
  1. The next step is to reference the new image size in your theme. Place the following code wherever you would like to see your cropped image:
<?php the_post_thumbnail('featuredImageCropped'); ?>