Saturday 15 February 2014

How to desing Good theme in magento

how we can design good theme in magento? first of all we have to decide what type theme we are needed.

what step we have to follow.
1) First of all we have to look about theme brand and logo.
2) how many products and categories we have to use in our theme, store.
3) what type of products we want to sell
4) In what country our website will be published.
5) What languages we will use in our website.
6) how many slider and brand we are using in our theme.
------------------------------------------------------------------------------
we need follow more things for better designing...i will post soon more meter

Show all sub categories with thumbnail

create file in location: aa/desing/frontend/ theme/catelog/category/subcat.phtml
<?php
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
        ->addAttributeToSelect(array('name', 'thumbnail'))
        ->addAttributeToFilter('is_active', 1)
        ->addIdFilter($category->getChildren())
?>
<ul class="subcategories">
    <?php foreach ($categories as $category): ?>
        <li>
            <a href="<?php echo $category->getUrl() ?>"><img src="<?php echo Mage::getBaseUrl('media')?>catalog/category/<?php echo $category->getThumbnail() ?>" height="150" width="150" alt="<?php echo $this->htmlEscape($category->getName()) ?>" />
                <span><?php echo $category->getName() ?></span></a>
        </li>
    <?php endforeach; ?>
</ul>

how to call in:
{{block type="core/template" template="catalog/category/subcat.phtml"}}

create static block and past code: {{block type="core/template" template="catalog/category/subcat.phtml"}}

Now go to admin, select particualr category and click to display setting tab and select Display Mode "  static block only "  and select CMS Block...

ENJOY :)

Tuesday 18 June 2013

multistore with magento


<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

if (version_compare(phpversion(), '5.2.0', '<')===true) {
    echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">
Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer.
<a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a>
 Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}

/**
 * Error reporting
 */
error_reporting(E_ALL | E_STRICT);

/**
 * Compilation includes configuration file
 */
define('MAGENTO_ROOT', getcwd());

$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}

$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';

if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

/*$url_xyz=$main_url= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($url_xyz=='www.willowdalebotanicalscience.com' || $url_xyz=='http://www.willowdalebotanicalscience.com')
{
Mage::run("willowdalebotanicalscience","store");
}
elseif($url_xyz=='www.celluvati.com' || $url_xyz=='http://www.celluvati.com')
{
Mage::run("celluvati","store");
}
else
{
Mage::run("default", "store");
}*/



//Mage::run("celluvati","store");


//Mage::run($mageRunCode, $mageRunType);


   $x= $_SERVER['HTTP_HOST'];
 
switch ($x)
{
case 'celluvati.com':
 Mage::run("celluvati","store");
  break;
case 'www.celluvati.com':
 Mage::run("celluvati","store");
  break;
  case 'http://www.celluvati.com':
 Mage::run("celluvati","store");
  break;
  case 'https://www.celluvati.com':
 Mage::run("celluvati","store");
  break;


case 'wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'www.wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'http://www.wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'https://www.wbscience.com':
  Mage::run("wbscience","store");
  break;

 case 'willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'http://www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'https://www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;

default:
 Mage::run("default","store");
}



?>

how to configure multy store || multy domain website in magento

-:Replace this code with index.php file and change your domain name according to store name:-


<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

if (version_compare(phpversion(), '5.2.0', '<')===true) {
    echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">
Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer.
<a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a>
 Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}

/**
 * Error reporting
 */
error_reporting(E_ALL | E_STRICT);

/**
 * Compilation includes configuration file
 */
define('MAGENTO_ROOT', getcwd());

$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}

$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';

if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

/*$url_xyz=$main_url= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($url_xyz=='www.willowdalebotanicalscience.com' || $url_xyz=='http://www.willowdalebotanicalscience.com')
{
Mage::run("willowdalebotanicalscience","store");
}
elseif($url_xyz=='www.celluvati.com' || $url_xyz=='http://www.celluvati.com')
{
Mage::run("celluvati","store");
}
else
{
Mage::run("default", "store");
}*/



//Mage::run("celluvati","store");


//Mage::run($mageRunCode, $mageRunType);


   $x= $_SERVER['HTTP_HOST'];
  
switch ($x)
{
case 'celluvati.com':
 Mage::run("celluvati","store");
  break;
case 'www.celluvati.com':
 Mage::run("celluvati","store");
  break;
  case 'http://www.celluvati.com':
 Mage::run("celluvati","store");
  break;
  case 'https://www.celluvati.com':
 Mage::run("celluvati","store");
  break;


case 'wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'www.wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'http://www.wbscience.com':
  Mage::run("wbscience","store");
  break;
  case 'https://www.wbscience.com':
  Mage::run("wbscience","store");
  break;

 case 'willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'http://www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;
  case 'https://www.willowdalebotanicalscience.com':
  Mage::run("default","store");
  break;

default:
 Mage::run("default","store");
}



?>

Show brands in magento


<?php
$manufacturers = $this->getAllBrands();
?>


<?php /*?><h4><?php echo $this->__('Brands')?></h4><?php */?>
 <select class="brand" id="select1" onchange="goToPage('select1')">
<option selected="selected">Brand</option>
<?php foreach($manufacturers as $k=>$v): ?>
<option value="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) ?>shopbybrand?brand=<?php echo $v['value']?>" <?php if($_REQUEST['brand']==$v['value']) { ?> selected="selected" <?php } ?> ><?php echo $v['label']?></option>
<?php endforeach; ?>
</select>

<script>
  function goToPage( id ) {
var node = document.getElementById( id );
 window.location.href = node.options[node.selectedIndex].value;
}
</script>

Show all categories in magento


<?php //Display all category in all page  ?>

<?php foreach ($this->getStoreCategories() as $_category): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>">
<?php echo $this->htmlEscape($_category->getName()) ?>
</a>
<?php
$_catid = $_category->getId();
$category = Mage::getModel('catalog/category')->load($_catid);
$subcategory = $category->getAllChildren(true);
array_shift($subcategory);
if($subcategory!=null)
{?>
<ul>
<?php
foreach ($subcategory as $sub)
{
$sub1 = Mage::getModel('catalog/category')->load($sub);
?>
<li class="lvel<?php echo $sub1->getLevel(); ?>">
<a href="<?php echo $sub1->getUrl();?>"><span><?php echo $sub1->getName(); ?></span></a>
</li>
<?php } ?>
</ul>
<?php }?>
</li>
<?php endforeach ?>