Showing posts with label Magento Paths. Show all posts
Showing posts with label Magento Paths. Show all posts

Tuesday, 6 November 2012

Magento - Steps to moving magento from one server to other

Step 1:

clear the /var/cache and /var/session directory which is allow more space to you
then add your magento folder into zip/rar file and extract them on the target server.

Step 2:

once you finished with the copying then you should set the correct permissions for
magento files and folders
as
/var and contents should have permissions “777″
/media and contents should have permissions “777″
/app/etc and contents should have permissions “777″

Step 3:

Now important part is that set the new database connection settings in the
file /app/etc/local.xml
as


<resources>
<db>
<table_prefix><![CDATA[db_prefix]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[db_host]]></host>
<username><![CDATA[db_user]]></username>
<password><![CDATA[db_password]]></password>
<dbname><![CDATA[db_name]]></dbname>
<initstatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdotype><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
</resources>

You need to replace db_prefix db_host db_user db_password etc.. with your values.

Step 4:

Now goto your Database admin panel like phpmyadmin and run the query below


UPDATE core_config_data SET VALUE="http://newhostsite.com/"
WHERE path="web/unsecure/base_url";
UPDATE core_config_data SET VALUE="http://newhostsite.com/"
WHERE path="web/unsecure/base_url";

Where “newhostsite.com” is a new server domain name.

Sunday, 15 July 2012

How to implement module creater in magento?

Download module creater from following link
--------------------------------------------------------------------------------
www.magentocommerce.com/magento-connect/modulecreator.html


install into local server  and execute by folllowing url
--------------------------------------------------------------------------------

http://127.0.0.1/modulecreater/

Namespace : Your company name
Module : module name
Root Directory :    ..\magento_blank (magento project name)
Design : default

Sunday, 8 July 2012

how to check home page in magento?

if(Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' )

How to define custom layout in magento like 1column,2-column right,3-columns


template/page/2columns-aboutus.phtml
-----------------------------------------------------------------------
layout/page.xml
-----------------------------------------------------------------------
find All Two-Column Layout Pages (Left Column) and place
-----------------------------------------------------------------------





1

-----------------------------------------------------------------------
now define global object in xml
app/code/local/companyname/modulename/etc/config.xml



page_two_columns_aboutus
Now go to admin login pages/ -----> 2 columns with About Us

How to define store path on backend side while create static block

{{store url='company-history'}}

How to get request on magento?

echo $this->getRequest()->getParams())

How to get cms page title in magento?

$pageTitle = Mage::getSingleton('cms/page')->getTitle();

How to get product details from product id in magento?

$model = Mage::getModel('catalog/product');
$_product = $model->load($productId);
echo $_product->getShortDescription();
echo $_product->getDescription();
echo $_product->getName();
echo $_product->getPrice();
echo $_product->getSpecialPrice();
echo $_product->getProductUrl();
echo $_product->getImageUrl();
echo $_product->getSmallImageUrl();
echo $_product->getThumbnailUrl();

How to get category details from category id on magento?

$category = Mage::getModel('catalog/category')->load($_category);
echo $category->getUrl();// category url
echo $category->getName();
echo $category->getImageUrl();
$categoryImage = $category->getImage();

Custom 'Sort by' drop-down menu options Lowest price, Higest price, Name A-Z, Name Z-A, Newest to Oldest & Oldest to Newest in magento


View following url
http://magento-talks.blogspot.in/2011/08/custom-sort-by-drop-down-menu-options.html

Magento all paths.


Mage::getBaseUrl() => Gets base url path e.g. http://my.website.com/
Mage::getBaseUrl(‘media’) => Gets MEDIA folder path e.g. http://my.website.com/media/
Mage::getBaseUrl(‘js’)                => Gets JS folder path e.g. http://my.website.com/js/
Mage::getBaseUrl(‘skin’)              => Gets SKIN folder path e.g. http://my.website.com/skin/
Mage::getBaseDir()             => Gives you your Magento installation folder / root folder e.g. /home/kalpesh/
Mage::getBaseDir(‘app’)             => Gives you your Magento’s APP directory file location e.g. /home/kalpesh/
Mage::getBaseDir(‘design’)            => Gives you your Magento’s DESIGN directory file location e.g. /home/kalpesh/wo
Mage::getBaseDir(‘media’) => Gives MEDIA directory file path
Mage::getBaseDir(‘code’) => Gives CODE directory file path
Mage::getBaseDir(‘lib’) => Gives LIB directory file path
Get Current URL – whole URL path
Mage::helper(‘core/url’)->getCurrentUrl()

How to display product price with currency on magento?

$formattedPrice = Mage::helper('core')->currency($objProduct->getPrice(),true,false);

How to change default image white space(background) on magento?

app/code/core/mage/catalog/model/Product/image.php

How to get products available stock quantity in magento?

echo $qtyStock = (int) Mage::getModel('cataloginventory/stock_item') ->loadByProduct($_product) ->getQty();

How to display static block content on front side?

$this->getLayout()->createBlock('cms/block')->setBlockId('identifier')->toHtml()

How to check customer is login or not?

Mage::getSingleton('customer/session')->isLoggedIn());

How to Get current Url of the page in magento?

$this->helper('core/url')->getCurrentUrl();

How to display product with specific height and width in magento?


$productId = 1;
$product = Mage::getModel('catalog/product') ->load($productId);
$path = Mage::helper('catalog/image') ->init($product, 'image') ->resize(75, 75);

How to set number of columns on product listing page?


getColumnCount(); ?>
              and replace it with:

How to create module in magento?


app/etc/modules/Custom_Manufacturerlogo.xml
app/code/local/Custom/Manufacturerlogo/Block/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/controllers/IndexController.php
app/code/local/Custom/Manufacturerlogo/etc/config.xml
app/code/local/Custom/Manufacturerlogo/Model/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Model/Mysql4/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Model/Mysql4/Manufacturerlogo/Collection.php
app/code/local/Custom/Manufacturerlogo/Model/Status.php
app/code/local/Custom/Manufacturerlogo/sql/manufacturerlogo_setup/mysql4-install-0.1.0.php
app/design/frontend/default/default/layout/manufacturerlogo.xml
app/design/frontend/default/default/template/manufacturerlogo/manufacturerlogo.phtml
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Grid.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Form.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Tabs.php
app/code/local/Custom/Manufacturerlogo/Block/Adminhtml/Manufacturerlogo/Edit/Tab/Form.php
app/code/local/Custom/Manufacturerlogo/controllers/Adminhtml/ManufacturerlogoController.php
app/code/local/Custom/Manufacturerlogo/Helper/Data.php
app/design/adminhtml/default/default/layout/manufacturerlogo.xml