Create a theme directory

Go to /app/design/frontend

1.Declare your theme


<?xml version="1.0" encoding="UTF-8"?>
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
     <title>My First Theme</title> <!-- your theme's name -->
     <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
     <media>
         <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
     </media>
 </theme>

2.Add registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/stark/my-first-theme',
    __DIR__
);

Magento 2 Index Management

|| Magento2 reindex on local server

You can’t reindex from admin web. you have to reindex from command line

  1. go to command line from magento2 installation root directory

  2. php bin/magento indexer:reindex

if you got any error like ‘php’ is not recognized as an internal or external command,

so you need to Add E:\xampp\php to your PATH Environment Variable.

final command:
E:\xampp\htdocs\magento2>php bin/magento indexer:reindex

Image upload error

|| Magento 1.9.2 and php7 – image upload error:
check console: Uncaught Error: Function name must be a string in store.com/lib/Varien/File/Uploader.php:259

$params['object']->$params['method']($this->_file['tmp_name']);

to

$params['object']->{$params['method']}($this->_file['tmp_name']);

Catalogsearch form:

Catalogsearch > form.mini.phtml


$category = Mage::getModel('catalog/category');
if (is_object(Mage::registry('current_category'))) {
    $current_category_path = Mage::registry('current_category')->getPathIds();
} else {
    $current_category_path = array();
}
$category->load(Mage::app()->getStore()->getRootCategoryId());
$children_string = $category->getChildren();
$children = explode(',', $children_string);
$extra_options = '';
foreach ($children as $c) {
    $selected = (in_array($c, $current_category_path)) ? 'SELECTED' : '';
    $extra_options.= '<option value="' . $c . '" ' . $selected . '>' . $category->load($c)->getName() . '</option>' . "\n";
}
?>
 
<form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get">
    <fieldset>
        <legend><?php echo $this->__('Search Site') ?></legend>
        <span style="float: left; position: relative; top: 8px; left: 15px;">Search</span>
        <div class="mini-search">
            <select name="cat" id="cat" class="input-text">
                <option value="">All Products</option>
                <?= $extra_options ?>
            </select>
            <input id="search" type="text" class="input-text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>"  placeholder="<?php echo $this->quoteEscape($this->__('Search entire store here...')) ?>" />
            <button type="submit" title="<?php echo $this->quoteEscape($this->__('Search')) ?>" class="button search-button" value="Go"><span><span><?php echo $this->__('Search') ?></span></span></button>
            <div id="search_autocomplete" class="search-autocomplete"></div>
            <script type="text/javascript">
                //<![CDATA[
                var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search your products') ?>');
                searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>', 'search_autocomplete');
                //]]>
            </script>
        </div>
    </fieldset>
</form>




Installation Problem:

|| Fatal error: Uncaught Error: Function name must be a string in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout.php:555

$out .= $this->getBlock($callback[0])->$callback[1]();

to

$out .= $this->getBlock($callback[0])->{$callback[1]}();

|| Maximum execution time of 30 seconds exceeded in magento installation.

/* solve */
go to xampp/php/php.ini and search by 

max_execution_time=30  replace to 600
max_input_time=60      replace to 600
memory_limit=128M      replace to 1000m

|| PHP extension soap must be loaded

I edited php.ini and removed the leading semicolon ( ; ) from extension=php_soap.dll.
After restarting Apache I was able to proceed with the installation without any other issues.

Upgrade magento from 1.7 to latest 1.9.2.4

1st way to upgrade :

Use the Magento Connect method:
Within each Magento installation, you can easily upgrade Magento via Magento Connect. The steps to upgrade via Magento Connect include:

  • Login to the Magento admin
  • Move to system- Magento Connect- Connect manager
  • Login to Magento Connect
  • Click on ‘check for upgrades’
  • Upgrade ‘Mage _All_Latest’. This will upgrade Magento.

2nd way to upgrade:

  1. Take a backup of current database and current 1.7 code. place maintenance.flag file inside 1.7 code folder to put website offline.
  2. Download latest magento from the http://www.magentocommerce.com/download
  3. Remove all folders and files from your 1.7 code except maintenance.flag (but you should have backup somewhere) and place all folders and files from the 1.9.
  4. Now from your 1.7 merge your following custom folders into the 1.9
    • Community app/code/community
    • Local app/code/local
    • Media
    • your theme or package (app/design/frontend/default/<your theme> or app/design/frontend/<your package>)
    • custom folders from Skin (both for adminhtml and frontend).
    • copy your custom xml files from app/etc/modules/ to current app/etc/modules/
    • any custom admin theme folder from adminhtml/default/yourtheme.
    • copy your custom folders from adminhtml/default/default/ (1.7) to adminhtml/default/default/ (1.9).
    • custom js files if any from app/js/.
  5. Now go to app/etc/local.xml.Edit database details their.put your database username and password and database name.
  6. Remove maintenance.flag file and check the site in the browser. it is done.

Magento mysql dump file

Importing phpMyAdmin Database Dump File

When importing a MySQL dump file that’s been generated using phpMyAdmin, you need to put the following at the beginning of the file:

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;


And the following at the end of the file:

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;
SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;
SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;
SET SQL_NOTES=@OLD_SQL_NOTES;

PHP extension is missing


|| New version magento 2 PHP Extension intl is missing   
1. Go to the file php.ini 
2. Search for ;extension=php_intl.dll
3. Remove semicolon and restart server. It will work.


|| Magento 1.4v-1.9.1 version 
1. Go to the file php.ini 
2. Search for ;extension=php_curl.dll
3. Remove semicolon and restart server. It will work.