Friday, May 14, 2010

Everything you need to learn about Magento Open Source and Beginners guide to manage Magento Demo Store

Hello friends
Today i am providing a Magento help file on a special request of my Developer friend Mr. Vinayak Jee.
This file is very useful and each line written in this file is written by me manually. So if you find any problem in any line of code written below please feel free to ask me by posting a comment. I will reply very soon.

Every question and their answers can be found and solved here about Megento.


Install a fresh copy of magento theme
Login to magento admin
http://vaseem/IEC/magento/index.php/admin/

go to System-> Theme, select current theme, delete it in next window,


1) Delete the content of the folder /var

2) Change the values of the file /app/etc/local.xml
There you can find your connection string data (database user, host and name) and table prefix.

3) Once you got your database uploaded, you need to make some changes.
- Run this query:
SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';


------------------------------------------

How to Reset admin password in magento
You need to go into PHPMyAdmin and connect to your Magento database on your server.
UPDATE admin_user SET password=MD5('pass') WHERE username='admin';


------------------------------------------
Customizing magento template
http://www.themeswiki.org/Customizing_Magento

admin panel
http://localhost/magento/index.php/admin

run magento from local to online
http://www.magentocommerce.com/boards/viewthread/27272/

------------------------------------------
path of magento config file
E:WampwwwmagentoappcodecoreMageInstallModelInstaller

------------------------------------------
add front footer and meta and keyword

1. Open the Magento admin panel
2. Select the "System" tab
3. Click the "Configuration" menu item
4. Select the "Design" menu item
5. Click the "Footer" tab. Here you can change the copyright notification
6. With that done, click the "Save Configure" button.


------------------------------------------
send mails to admin after product sale and invoice and more mails here

Log in into admin area,  System->Configuration menu. Scroll down to Sales section and click on the Sales Emails and select the first section Orders. Enter your admin e-mail in the field “Send Order Email Copy To”.

Sending an email to notify admin where there's a new review posted
Admin Review Notification
http://www.magentocommerce.com/extension/1869/admin-review-notification


------------------------------------------
get product name and id on templatecatalogproductlist.phtml page

echo $Product_Name = $this->htmlEscape($_product->getName());
$Product_Id = $this->getAddToCartUrl($_product);

how i used
<?php $Product_Name = $this->htmlEscape($_product->getName());
      $Product_Id = $this->getAddToCartUrl($_product);
      $Product_Id = strstr($Product_Id,'product');
      $Pro_arr = explode("product", $Product_Id);
      $Product_Id = str_replace("/","",$Pro_arr[1]);
      $Product = $Product_Id .'-'. $Product_Name;        // getting product name and id
?>
<div class="out-of-stock"><a href="<?php echo $this->getUrl() ?>send_query?<?=$Product;?>"><?php echo $this->__('Send Query') ?></a></div>

                          
------------------------------------------

delete all categories before uplaoding your demo website to online category table
TRUNCATE TABLE `catalog_category_entity`;
    TRUNCATE TABLE `catalog_category_entity_datetime`;
    TRUNCATE TABLE `catalog_category_entity_decimal`;
    TRUNCATE TABLE `catalog_category_entity_int`;
    TRUNCATE TABLE `catalog_category_entity_text`;
    TRUNCATE TABLE `catalog_category_entity_varchar`;
    TRUNCATE TABLE `catalog_category_product`;
    TRUNCATE TABLE `catalog_category_product_index`;
 
    insert  into `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`position`,`level`,`children_count`) values (1,3,0,0,'0000-00-00 00:00:00','2009-02-20 00:25:34','1',1,0,1),(2,3,3,0,'2009-02-20 00:25:34','2009-02-20 00:25:34','1/2',1,1,0);
    insert  into `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,32,0,2,1),(2,3,32,1,2,1);
    insert  into `catalog_category_entity_varchar`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,31,0,1,'Root Catalog'),(2,3,33,0,1,'root-catalog'),(3,3,31,0,2,'Default Category'),(4,3,39,0,2,'PRODUCTS'),(5,3,33,0,2,'default-category');
    
    
    
------------------------------------------

export categories with id in csv file
create a file and save it in tempalte folder /catalog/allcategories.phtml
<?
$category = Mage::getModel ( 'catalog/category' );
$tree = $category->getTreeModel ();
$tree->load ();

$ids = $tree->getCollection ()->getAllIds ();

if ($ids) {
$fp = fopen('var/import/catwithid.csv', 'a');
fwrite($fp,  'catId, catNamen');
foreach ( $ids as $id ) {
                $string = $id . ', ' .$category->load($id)->getName() . 'n';
fwrite($fp,  $string);
}
fclose($fp);
}
?>

in admin manage pages - create new page
Export-Categories
and run it like this
http://indianexportcenter.com/Export-Categories

{{block type="core/template" template="catalog/allcategories.phtml"}}
it will run the file and save a file here var/import/catwithid.csv this file must exist there.
------------------------------------------

magento db database and tables


cataloginventory_stock_status  it have stock quantity field which must be more than zero to make send query work

`catalogsearch_fulltext` saves meta tag and meta desc of products
`catalog_product_entity_varchar` saves product name and other info

------------------------------------------
manage pages in admin saves in `cms_page` table
so you can upload this table to online for changing manage pages same as local

category comes from table `catalog_category_entity_varchar`

------------------------------------------
mails from magento

all mails in admin can be set here System -> Configuration -> Store Email Addresses

mail to user after account creation
after newsletter subscribe



------------------------------------------
recover admin password reset
UPDATE `admin_user` SET `password`=MD5('pass') WHERE `username`='admin';

------------------------------------------
set title of pages in frontend of magento store
open page.xml and write this line at line no 60

<action method="setTitle" translate="title"><title>Indian Export Center Store for All People's need</title></action>
------------------------------------------
create module with mysql query or db integration custom table
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

------------------------------------------


simple contact form module custom with mail sending and notification
1.    appetcmodulesVaseem_SimpleContact.xml
<?xml version="1.0"?>
<config>
    <modules>
        <Vaseem_SimpleContact>
            <active>true</active>
            <codePool>local</codePool>
        </Vaseem_SimpleContact>
    </modules>    
</config>

2.    appcodelocalVaseemSimpleContactetcconfig.xml
<?xml version="1.0"?>
 
<config>
    <modules>
        <Vaseem_SimpleContact>
            <version>0.1.0</version>
        </Vaseem_SimpleContact>
    </modules>   
 
    <frontend>
        <routers>
            <JustSomeFreeRouterNameHereNo1>
                <use>standard</use>
                <args>
                    <module>Vaseem_SimpleContact</module>
                    <!--front end will be accessed like this http://vaseem/IEC/magento/index.php/vaseem-simplecontact/    -->
                    <frontName>vaseem-simplecontact</frontName>        
                </args>
            </JustSomeFreeRouterNameHereNo1>
        </routers>
    </frontend>    
</config>

appcodelocalVaseemSimpleContactcontrollersIndexController.php
<?php
 
class Vaseem_SimpleContact_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        //Get current layout state
        $this->loadLayout();   
 
        $block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'vaseem.simple_contact',
            array(
                'template' => 'vaseem/simple_contact.phtml'
            )
        );
 
        $this->getLayout()->getBlock('content')->append($block);
        //$this->getLayout()->getBlock('right')->insert($block, 'catalog.compare.sidebar', true);
 
        $this->_initLayoutMessages('core/session');
 
        $this->renderLayout();
    }
 
    public function sendemailAction()
    {
        //Fetch submited params
        $params = $this->getRequest()->getParams();
 
        $mail = new Zend_Mail();
        $mail->setBodyText($params['comment']);
        $mail->setFrom($params['email'], $params['name']);
        $mail->addTo('somebody_else@example.com', 'Some Recipient');
        $mail->setSubject('Test Vaseem_SimpleContact Module for Magento');
        try {
            $mail->send();
        }        
        catch(Exception $ex) {
            Mage::getSingleton('core/session')->addError('Unable to send email. Sample of a custom notification error from Vaseem_SimpleContact.');
 
        }
 
        //Redirect back to index action of (this) vaseem-simplecontact controller
        $this->_redirect('vaseem-simplecontact/');        
        // after mail send this page comes so this name must be same as frontName in config.xml  of etc folder
    }
}
 
?>


3.    appdesignfrontenddefaultiectemplatevaseemsimple_contact.phtml
<div class="box simple_contact">
 
<form id="simple_contact_form" name="simple_contact_form" action="<?php echo $this->getUrl('vaseem-simplecontact/') ?>index/sendemail" method="post">
 
    <fieldset class="group-select">
        <h4 class="legend">Vaseem_SimpleContact module sample</h4>
        <ul>
        <li>
                <div class="input-box">
                    <label for="name">Gimme your name <span class="required">*</span></label><br />
 
                    <input name="name" id="name" title="Name" value="" class="required-entry input-text" type="text" />
                </div>
 
                <div class="input-box">
                    <label for="email">And your email <span class="required">*</span></label><br />
                    <input name="email" id="email" title="Email" value="" class="required-entry input-text validate-email" type="text" />
                </div>
 
                <div class="clear"></div>
 
                <div class="input-box">
           &nbsp;        <label for="comment">Some comment?</label><br />
 
                    <textarea name="comment" id="comment" title="Comment" class="required-entry input-text" style="height:100px;" cols="50" rows="3"></textarea>
                </div>
                </li>
                </ul>
    </fieldset>
    <div class="button-set">
        <p class="required">* Required Fields</p>
        <button class="form-button" type="submit"><span>Submit</span></button>
 
    </div>
</form>
 
</div>


4.    run like this http://vaseem/IEC/magento/index.php/vaseem-simplecontact/


------------------------------------------
custom hello world module in magento and call that phtml page directly in url
this module is using IndexController.php method

1. create xml file at
appetcmodulesVaseem_Example.xml
<?xml version="1.0"?>
<config>
  <modules>
      <Vaseem_Example>            
          <active>true</active>
          <codePool>local</codePool>
      </Vaseem_Example>
  </modules>
</config>

    
2.    create folder case sensitive like this
appcodelocalVaseemExamplecontrollers
appcodelocalVaseemExampleBlock
appcodelocalVaseemExampleetc

now create files here appcodelocalVaseemExamplecontrollersIndexController.php
<?
class Vaseem_Example_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
     $this->loadLayout(array('default'));
     $this->renderLayout();
    }
}
?>

appcodelocalVaseemExampleBlockExample.php
<?
class Vaseem_Example_Block_Example extends Mage_Core_Block_Template
{
  // necessary methods
}
?>

appcodelocalVaseemExampleetcconfig.xml
<?xml version="1.0"?>
<config>
    <global>
        <modules>
                <vaseem_example>
                        <version>0.1.0</version>
                </vaseem_example>
        </modules>
    <blocks>
            <example>
                <rewrite>
         <example>Vaseem_Example_Block_Example</example>
        </rewrite>
            </example>
     </blocks>

        </global>
       <frontend>
                <routers>
                        <example>
                                <use>standard</use>
                                <args>
                                      <module>Vaseem_Example</module>
                                      <frontName>example</frontName>
                                </args>
                        </example>
                </routers>
        <layout>
            <updates>
                <example>
                         <file>example.xml</file>
                </example>
            </updates>
               </layout>
        </frontend>
</config>


3.    Define Frontend Template : xml file in layout folder

go theme folder appdesignfrontenddefaultieclayoutexample.xml
<?xml version="1.0"?>
    <layout version="0.1.0">
        <example_index_index>
            <reference name="root">
                <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
                </reference>
            <reference name="content">
                <block type="example/example" name="hello" template="example/example.phtml"/>
            </reference>
        </example_index_index>
    </layout>
    

4.    Create template file appdesignfrontenddefaultiectemplateexampleexample.phtml
Hello World ! I am a Magento Guy Vaseem Ansari..

Hey, new module is ready to run and hit browser with url <br />
http://localhost/project_name/index.php/example/
<br />
and see result. Is it easy or not ? what you think ?


5.    run the file http://vaseem/IEC/magento/index.php/example/




------------------------------------------
custom hello world module in magento and call it in admin

1. create xml file at
appetcmodulesVaseem_All.xml

<?xml version="1.0"?>
<config>
  <modules>
      <Vaseem_Example>            <!-- MyCompany is folder in appcodelocalMyCompany and Vaseem is folder in MyCompany-->
<!-- this is an active module -->
          <active>true</active>
<!-- this module will be located in app/code/local code pool -->
          <codePool>local</codePool>
      </Vaseem_Example>
  </modules>
</config>

2.    create folder case sensitive like this
appcodelocalVaseemExampleetc
appcodelocalVaseemExampleBlock

now create file here appcodelocalVaseemExampleetcconfig.xml
<?xml version="1.0"?>
    <config>
        <modules>
            <Vaseem_Example>
                <version>0.1.0</version>
            </Vaseem_Example>
        </modules>
        
        <global>
            <blocks>
                <vaseem_example>
                    <class>Vaseem_Example_Block</class>
                </vaseem_example>
            </blocks>
        </global>
    </config>


now create file here appcodelocalVaseemExampleBlockView.php

<?php
/**
* Example View block
*
* @codepool   Local
* @category   Vaseem
* @package    Vaseem_Example
* @module     Example
*/

class Vaseem_Example_Block_View extends Mage_Core_Block_Template
{
    private $message;
    private $att;
    
    protected function createMessage($msg) {
    $this->message = $msg;
    }
    
    public function receiveMessage() {
    if($this->message != '') {
    return $this->message;
    } else {
    $this->createMessage('Hello Vaseem');
    return $this->message;
    }
    }
    
    protected function _toHtml() {
    $html = parent::_toHtml();
    
    if($this->att = $this->getMyCustom() && $this->getMyCustom() != '') {
    $html .= '<br />'.$this->att;
    } else {
    $html .= '<br />No Custom Attribute Found';
    }
    
    return $html;
    }
}

    
3.    go theme folder appdesignfrontenddefaultiectemplate
create folder exampleview.phtml
<?php

/**
* Fido view template
*
* @see Fido_Example_Block_View
*
*/
?>
<div>
<span><strong>This is the output of the Vaseem example:</strong></span><br />
<span style="color:#FF9933;">
<?php
echo $this->receiveMessage();
?>
</span>
</div>


4.    in admin manage pages -> home page
call your view.phtml file like this
{{block type="vaseem_example/view" my_custom="Test" template="example/view.phtml" }}

or
call in xml file
<reference name="right">
    <block type="fido_example/view" my_custom="Test" template="example/view.phtml" />
</reference>
//this will add your block in the right column


------------------------------------------
show product quantity with add to cart button
show product available quantity in store

use this
<?= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?>
i used in calatog/product/list.phtml

------------------------------------------
delete all products in magento
TRUNCATE TABLE `catalog_product_entity`;

or to completely remove all use this

    TRUNCATE TABLE `catalog_product_bundle_option`;
    TRUNCATE TABLE `catalog_product_bundle_option_value`;
    TRUNCATE TABLE `catalog_product_bundle_selection`;
    TRUNCATE TABLE `catalog_product_entity_datetime`;
    TRUNCATE TABLE `catalog_product_entity_decimal`;
    TRUNCATE TABLE `catalog_product_entity_gallery`;
    TRUNCATE TABLE `catalog_product_entity_int`;
    TRUNCATE TABLE `catalog_product_entity_media_gallery`;
    TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
    TRUNCATE TABLE `catalog_product_entity_text`;
    TRUNCATE TABLE `catalog_product_entity_tier_price`;
    TRUNCATE TABLE `catalog_product_entity_varchar`;
    TRUNCATE TABLE `catalog_product_link`;
    TRUNCATE TABLE `catalog_product_link_attribute`;
    TRUNCATE TABLE `catalog_product_link_attribute_decimal`;
    TRUNCATE TABLE `catalog_product_link_attribute_int`;
    TRUNCATE TABLE `catalog_product_link_attribute_varchar`;
    TRUNCATE TABLE `catalog_product_link_type`;
    TRUNCATE TABLE `catalog_product_option`;
    TRUNCATE TABLE `catalog_product_option_price`;
    TRUNCATE TABLE `catalog_product_option_title`;
    TRUNCATE TABLE `catalog_product_option_type_price`;
    TRUNCATE TABLE `catalog_product_option_type_title`;
    TRUNCATE TABLE `catalog_product_option_type_value`;
    TRUNCATE TABLE `catalog_product_super_attribute`;
    TRUNCATE TABLE `catalog_product_super_attribute_label`;
    TRUNCATE TABLE `catalog_product_super_attribute_pricing`;
    TRUNCATE TABLE `catalog_product_super_link`;
    TRUNCATE TABLE `catalog_product_enabled_index`;
    TRUNCATE TABLE `catalog_product_website`;
    TRUNCATE TABLE `catalog_product_entity`;
    TRUNCATE TABLE `cataloginventory_stock`;
    TRUNCATE TABLE `cataloginventory_stock_item`;
    TRUNCATE TABLE `cataloginventory_stock_status`;
    insert  into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell');
    insert  into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal');
    insert  into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');

------------------------------------------
display new products on magento home page
type this in admin home page
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}


------------------------------------------

how to delete test orders before launch of magento store
admin-> sales-> you find nothing so u need to run manual query in db

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE `sales_order`;
TRUNCATE `sales_order_datetime`;
TRUNCATE `sales_order_decimal`;
TRUNCATE `sales_order_entity`;
TRUNCATE `sales_order_entity_datetime`;
TRUNCATE `sales_order_entity_decimal`;
TRUNCATE `sales_order_entity_int`;
TRUNCATE `sales_order_entity_text`;
TRUNCATE `sales_order_entity_varchar`;
TRUNCATE `sales_order_int`;
TRUNCATE `sales_order_text`;
TRUNCATE `sales_order_varchar`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;

ALTER TABLE `sales_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;

-- reset customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
TRUNCATE `log_customer`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;

ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `log_customer` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;

-- Reset all ID counters
TRUNCATE `eav_entity_store`;
ALTER TABLE  `eav_entity_store` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

u are done now

------------------------------------------
send emails on users shopping

email templates reside in this folder
applocaleen_UStemplateemail
so if u wanna make changes in these tempaltes dont make change at above location just copy them at this folder

appdesignfrontenddefaultieclocaleen_UStemplateemail
and now u can make changes in them

calling emails address in email tempaltes dynamically
if u write this sales@{{var customer.store.name}}.com  instead of dummyemail@magentocommerce.com in e mail templates it will work.

override email tempaltes
http://yviktorov.github.com/magento/2009/05/23/override-email-templates.html

when user buy some product he get mails
so we can just change the template of those e mails by doing this
those e mail tempaltes are in this folder
applocaleen_UStemplateemail

so just copy them to hered
appdesignfrontenddefaultieclocaleen_UStemplateemail

now we need to override them so when mails go they will use our tempaltes, if we dont copy those tempaltes when user updates magento all will wasted.

now copy all these folder in your magento app folder
folder are here in vaseem magento help for magento

replacements are

replace alt="Magento” with alt="your store name”
replace Magento Demo Store with your store name
replace mailto:magento@varien.com with mailto:email@yourstore.com
replace dummyemail@magentocommerce.com with email@yourstore.com
replace (800) DEMO-STORE with (0800) YOUR STORE NUMBER
replace Monday - Friday, 8am - 5pm PST with your own store opening times and timezone

------------------------------------------
change your website name store name
once you send mails or user get mails after shopping, he get name as  Main Store
so you can change this here
System-> Manage Store

store name saved in this table
SELECT * FROM `core_store_group` WHERE `name` like '%Main Store%'

main website name table `core_website`
 
------------------------------------------
404 error page
http://www.lotusseedsdesign.com/blog/spice-up-404-page

------------------------------------------
change contents of email templates (while users shop or visit something admin or users get mail that they have shop for particular product so we can change these info like magento default logo and main store)

admin->

------------------------------------------
force contact us form to mail details to your business id
change this
Configuration-> Contacts  and set options accordingly

add more fields in this form
http://www.lotusseedsdesign.com/blog/spice-up-contact-form-in-magento

------------------------------------------
change text in admin
System->Configuration menu
in left side Current Configuration Scope:
Default Config

Advanced->Developer
Translate Inline >     Enabled for Admin = Yes
now you can see the book on each text just click and change the text and refresh the page to see changes.

------------------------------------------
admin emails notification, enable emails when user place and order or do some more things.
go here in admin to enable these settings
System->Configuration menu. Scroll down to Sales section and click on the Sales Emails and select the first section Orders.



------------------------------------------
change currency Rp to Rs
libZendLocaleData/en.xml
find this <currency type="INR"> and change symbol to Rs
<symbol>Rs</symbol>
now go to admin system - config - currency set up
Base currency = indian rupee
Default display currency = indian rupee
Allowed currencies = indian rupee and others


------------------------------------------
this means it wont show right col in that page
suppose i wrote the below line in customer.xml file so when this xml loads it wont show right part
<remove name="right"/>

------------------------------------------
upload megento online server steps to be taken while uploading all local files and db to online
moving files and database

I assume these two steps are obvious:
   1. copy all of your local files to production server
   2. dump your magento local db and import it into your production server db

editing in production server

now on your production server you need to follow these two steps:
   1. edit app/etc/local.xml file and change database info
   2. in production db,in its core_config_data table, you should find every records containing the url of your local installation, then you need to update those values;which can be found with this query:

     SELECT * FROM `core_config_data` WHERE `value` LIKE 'http://vaseem%';
    
3. Do not forget to delete var folder contents
4. it'd better if you remove the content of app/etc/use_cache.ser too
Make sure you delete the contents of the var directory.
done

When u export ur local db to online there u find problem that u did not used table prefix at local but at online u have table prefix
so u can open the appetclocal.xml file online and remove the table prefix.
if u dont want to remove the table prefix then u can do this
u need to rename table with that prefix.

so u can run this query
rename table
tb1 to tb11,
tb2 to tb22


featured product slider
6 Steps to creating a featured products jQuery slider for Magento
http://onerutter.com/web/6-steps-to-creating-a-featured-products-jquery-slider-for-magento.html

------------------------------------------
calling custom phtml files or custom phtml pages in admin
block type for manullay created phtml files we write this block type in content of admin
{{block type="catalog/product_list" template="catalog/product/categories.phtml"}}

------------------------------------------
show best selling products on home page from particular category

<h3>Best Selling Products</h3>
{{block type="catalog/product_list" category_id="8" template="catalog/product/homelist.phtml"}}  
homelist.phtml can be found here
http://www.magentocommerce.com/wiki/how_to/add_featured_products_to_home_page

create a category in admin named as featured and note down its id in our example it is 8
and all products under this category will shown in home page.

------------------------------------------
show tags in front
just write this in admin in manage pages
{{block type="tag/popular" template="tag/popular.phtml"}}

------------------------------------------
Polls
=====
remove poll from home page
admin -> System -> Configuration -> Advanced -> Mage_Poll = Disable
go to poll.xml in layout folder and comment few lines
it can be removed from admin view this link or image
http://www.codestash.com/etc/pollandnews.jpg
http://www.codestash.com/2008/08/removing-callouts-like-polls-newsletter-in-magento-homepage/

by default poll html comes from this page
appdesignfrontendblanklloydstemplatepollactive.phtml

------------------------------------------

how to change the default layout of categories view page to 3 col to 2column left/right
magento/index.php/catalog/category/view/s/living-room/id/22/
this page layout is by default 3 col but we can change it by opening page.xml file
and find this
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
and write this
<block type="page/html" name="root" output="toHtml" template="page/2columns-right.phtml">
done

------------------------------------------


bestseller module in magento
{{block type=”ActiveCodeline/Bestseller” template=”activecodeline/bestseller.phtml”}}


static blocks creation and calling
create a block in admin with identifier="menu" and contents

<li><a href="{{store url="about"}}"><span>About Us</span></a></li>
<li><a href="{{store url="testimonials"}}"><span>Testimonials</span></a></li>
<li><a href="{{store url="contacts"}}"><span>Contact Us</span></a></li>


------------------------------------------
write this code in any phtml file to show categories in verticle manner
<ul>
<?php
$obj = new Mage_Catalog_Block_Navigation();
$store_cats    = $obj->getStoreCategories();
$current_cat     = $obj->getCurrentCategory();
 
$current_cat    = (is_object($current_cat) ? $current_cat->getName() : '');
 
foreach ($store_cats as $cat) {
    if ($cat->getName() == $current_cat) {
        echo '<li class="current"><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>n<ul>n";
        foreach ($obj->getCurrentChildCategories() as $subcat) {
            echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>n";
        }
        echo "</ul>n</li>n";
    } else {
        echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>n";
    }
}
?>
</ul>




show category in left side
write this in admin manage pages-->home page--> custom design
<reference name="right">
    <block type="catalog/navigation" name="catalog.leftnavig" before="-" template="catalog/navigation/left_menu1.phtml"/>
{{block type=”featuredproducts/listing” template=”inchoo/block_featured_products.phtml”}}
</reference>

and create page  template/catalog/navigation/
<div class="box layered-nav">
    <div class="head">
      <h3><?php echo $this->__('Browse By') ?></h3>
    </div>
    <div class="border-creator">
      <div class="narrow-by">
           <dl id="narrow-by-list">
           
         <dd>
         <ol>        
        <?php foreach ($this->getStoreCategories() as $_category): ?>
            <dt>
             <a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="active"<?php endif ?>><?php echo $this->htmlEscape($_category->getName()) ?></a>
            </dt>
        <?php endforeach ?>
        
       </ol>
      </dd>
      </dl><script type="text/javascript">decorateDataList('narrow-by-list')</script>
    </div>
   </div>
</div>



------------------------------------------

show categories in left sidebar in verticle and horizontal manner
open templatecatalognavigationtop.phtml
by default this code is there
cats will be in horizontal manner and hover on them will show subcats in verticle menu
<ul id="nav">
    <?php foreach ($this->getStoreCategories() as $_category): ?>
    <?php echo $this->drawItem($_category) ?>
    <?php endforeach ?>
</ul>
so categories are showing 1 2 3 4 and hover on them will show subcats in verticle fashion, this is good when we want to show cats in header menu like i did in real estate website pconstructions.gr

but if we want to show cats and its subcats in left sidebar and hover on cats will show subcats in horizontal manner then use this
cats will be in verticle manner and hover on them will show subcats in horizontal+verticle menu
1
    11    
    12    
    13 (hope u understood)
2
3
4
use this
<ul id="nav">
    <li><a href="<?php echo $this->getUrl() ?>"><?php echo $this->__('Home') ?></a></li>
    <li onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)">
        <a href="<?php echo $this->getUrl('') ?>"><?php echo $this->__('Products') ?></a>
        <ul>
            <?php foreach ($this->getStoreCategories() as $_category): ?>
                <?php echo $this->drawItem($_category) ?>
            <?php endforeach ?>
        </ul>
    </li>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('menu')->toHtml(); ?>
</ul>




show cats and subscats in left nav
# Furniture

    * Living Room
    * Bedroom

# Electronics

    * Cell Phones
    * Cameras
          o Accessories
          o Digital Cameras
    * Computers
    
    
    to show like above
    go to admin home page and custom layout
    add this
<reference name="left">
  <block type="catalog/navigation" before="-" name="catalog.sidebar" template="catalog/navigation/sidebar.phtml"/>
</reference>

    
------------------------------------------
languages show defaultdefaulttemplatepageswitch
        
------------------------------------------
sitemap in magento
url index.php/catalog/seo_sitemap/category/
 
advanced search
index.php/catalogsearch/advanced/

------------------------------------------
use this code in phtml file to show static blocks created in admin
the pages u created in admin and enabled will show on front on link.
ex
    * Home page
    * About Us
    * Customer Service
    * Enable Cookies
    * Help Page
 
<div>
    <?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
    <?php  $collection->getSelect()
          ->where('is_active = 1'); ?>
    <ul>
    <?php foreach ($collection as $page): ?>
      <?php $PageData = $page->getData(); ?>
      <?php if($PageData['identifier']!='no-route') { ?>
      <li>
        <a href="<?=$this->getBaseUrl(''); echo $PageData['identifier']?>"><?php echo $PageData['title'] ?></a>
      </li>
      <?php } ?>
    <?php endforeach; ?>
</div>



show categories in left sidebar as verticle navigation
http://www.magentocommerce.com/boards/viewthread/4722/


------------------------------------------
call phtml files in admin

just at home page custom design
write this in custom design and layout must be 2colm with right
<reference name="right">
    <block type="newsletter/subscribe" name="subscribe" before="-" template="newsletter/subscribe.phtml"/>
</reference>

write this in general info
{{block type="banner/banner" template="banner/banner.phtml"}}
{{block type="contest/contest" template="contest/contest_home.phtml"}}
{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml"}}
{{block type="catalog/navigation" template="catalog/product/list_random.phtml"}}


create static block in cms and call it at home page from cms as well like this
{{block type="cms/block" block_id="advertise-management"}}

------------------------------------------
Simple random banner rotator in Magento using static blocks
http://asia-connect.com.vn/2009/10/simple-random-banner-rotator-in-magento-using-static-blocks/

------------------------------------------

run magento local on other computers in lan
go this table
core_config_data
and replace localhost to ur pc name like vaseem
u need to replace only 2 entries
but to work on all the pages of magento need to make changes in 3 more tables.


------------------------------------------

magento extensions
lightbox = magento-community/magento_easy_lightbox setting must be beta
RicoNeitzel_VertNav = categories in left side


captcha
magento-community/Fontis_Recaptcha
after install log out from admin
go here  admin -> configuration -> recaptcha in bottom
set public and private keys in that


show in stock products on home page
magento-community/Lucky_InStockOnly
this extension wont show products which are out of stock in frontend

------------------------------------------
echo  in mgento
<?php echo $this->__('vaseem') ?>

------------------------------------------
show product of particular category at home page
manage pages --> home page --> custom layout
<reference name="right">
    <block type="catalog/product_list" category_id="10"  before="-" template="catalog/product/list.phtml"/>
</reference>

------------------------------------------

how to get child of categories in left nav or anywhere on home page
http://www.magentocommerce.com/boards/viewthread/14901/
implemented in magento

------------------------------------------
call a static block created in admin(cms-->static block) in phtml template file
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('left_cat')->toHTML();?>


------------------------------------------
call phtml in xml file
open page.xml and write
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer2.phtml">

suppose u want to show vert_nav in left then open catalog xml and do this
<reference name="right">
    <block type="catalog/navigation" name="catalog.vertnav" before="-" template="catalog/navigation/vert_nav.phtml"  />
</reference>



guide to magento, start magento here

Important points that will afeect your working and productivity
1. first of all off the cache in admin here
system> cache mgt  select all cache = no cache
select All Cache = disable


admin login problem in magento

appcodecoreMageCoreModelSessionAbstractVarien.php
line no 78 comment last 3 lines
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath()
    //$this->getCookie()->getDomain(),
    //$this->getCookie()->isSecure(),
    //$this->getCookie()->getHttponly()
);
        
$this->getSkinUrl('images/logo.gif');
 
skin url  <?=$this->getSkinUrl();?> to be written on phtml pages
and in admin u can write this
{{skin url='images/media/best_selling_img01.jpg'}}
<img src="{{skin url=""}}images/payments.gif" alt="payments" /> // to call a single image in some static block

show newsletter in front from admin type this in admin home page
{{block type='core/template' name='contactForm' template='newsletter/subscribe.phtml'}}


homepage url baseurl use in phtml files
<?=$this->getBaseUrl();?>

use this in admin
<a href="{{store url=""}}">Home</a>


<!-- HOME BUTTON HACK -->
    <li><a href="<?=$this->getUrl('')?>">Home</a></li>
<!-- HOME BUTTON HACK -->


breadcrumb
http://activecodeline.com/add-breadcrumbs-in-magento-to-pages-that-dont-have-them

categories menu in top comes from appdesignfrontenddefaultchildcaretemplatecatalognavigationtop.phtml


import/export products in magento
http://chasesagum.com/how-to-import-products-into-magento

System >> Import/Export >> Profiles
http://vaseemansari.blogspot.com/2010/01/how-to-import-products-into-magento.html


---------------------------------------------------
After upgrade from 1.3.1.1 to 1.3.2, when I try to save a product, it reports error SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘created_at’ in ‘field list’....................what should I do???
Column not found: 1054 Unknown column 'created_at' in 'field list'

System > Cache Management > Rebuild Catalog Index/Rebuild Flat Catalog Category/Rebuild Flat Catalog Product
Click rebuild for each one and it’ll add that field into the new database

---------------------------------------------------
Community Poll
Compare Products
Newsletter
My Cart  all above comes from appdesignfrontenddefaultiectemplatecatalogproductcompare

---------------------------------------------------
Magento – Display new products on the home page
go to home page in admin
CMS “Manage Pages” and select “Home Page”

write this
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}
or
{{block type="catalog/product_new" template="catalog/product/new.phtml"}}

now in manage products only those products which are marked as  new using “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin tool will be shown.)



Dynamic Category Landing Pages
http://asia-connect.com.vn/2009/07/tips-for-creating-dynamic-category-landing-pages/



How to show particular C

No comments:

Post a Comment