Tuesday, 11 February 2014

MAGENTO

HOW TO INSTALL MAGENTO
--------------------------------------------------------------------------------------------------
Download->extract here->copy paste in ->Xampp->htdocs->and change name where you want->create database same name->then url type localhost->installation-> license agreement accept->localization->locale settings->no any changes->continue->configuration->db name,user-root->session storage-File System->Create Admin Account->Continue->you are all set->survey ignore



magento instal successfully then go Magento Site Backend ->go-> app->design->frontend->default->avail 4 themes copy 1 and paste and name change(mytheme)->Then Go->site ->skin->frontend->default->modern -copy and paste change name same mytheme(same as app)->then go magento admin panel->system->configuration->design->themes(default->mythemes)->save config->then go backend->app->mytheme->template->page->html->header.phtml and footer.phtml

HOW TO CHANGE MAGENTO DEFAULT LOGO OR WELCOME MSG
================================================================
Frontend Detail
---------------------------------
GO -> Magento Admin Panel -> System ->Configuration -> Design ->Header

Backend Detail
--------------------------------------------------
yoursite\skin\frontend\default\default\images
(this is default theme root)

Change default welcome msg
-------------------------------
GO -> Magento Admin Panel -> System ->Configuration -> Design ->Header
==============================================================
CREATE CATEGORIES AND SUBCATEGORIES
===================================================
GO -> Magento Admin Panel ->Catalog ->manage categories

========================================================================

HOW TO CALL IMAGES IN MAGENTO .phtml file
---------------------------------------------------------------
src="<?php echo $this->getSkinUrl('images/fbicon.png');?>">

full code
src="<?php echo $this->getSkinUrl('images/joinnow_icon.png'); ?>">


================================================
HOW TO CALL TOP SEARCH
====================================================
<?php echo $this->getChildHtml('topSearch') ?>

========================================================
How to add category
==========================================
admin->catalog->manage categories-> add subcategory->(always add in inner default category)


How to call category
====================================
<?php echo $this->getChildHtml('topMenu') ?>



how to add top_links
===================================
<?php echo $this->getChildHtml('topLinks') ?>

My Account,My Wishlist,top-link-checkout, Log In
---------------------------------------------------

how to call welcome message
===================================
<?php echo $this->getChildHtml('welcome') ?>
--------------------------------------------------

How to create static block
=============================================
Go->cms->static blocks
----------------------------------
this code paste footer.phtml file & set block id
-------------------------------------------------

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_custom')->toHtml() ?>
=========================================================================

How to call image in static block
*******************************************

{{skin url='images/media/about_us_img.jpg'}}

full code
<img src="{{skin url='images/01.png'}}" alt="twitter" />

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

How to add extension in magento
===================================================================
go->system->magento connect->magento connect manager

=================================================================
free install slider in magento
then select
Magento Connect 2.0
and copy extension key

and paste magento coonect manager->extension-> 






customer-feedback-extension
**********************************************************************



*****************************************************************
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/13404/



1. Free YouAMA jQuery Nivo Slider Youama Slider!
*******************************************************
extension key: http://connect20.magentocommerce.com/community/Youama_Slider



You will find the Slider's settings on the System -> Configuration -> YouAMA -> Slider page. Many options available here, it's really limitless.
You've got a new block by this module, the "youamaslider". You should copy and past this code to any page to shows the Slider.
 {{block type="youama_slider/slider" name="youamaslider" alias="youamaslider" template="youama/slider/slider.phtml"}}

2. INSTAAL TWITER TWEETS
********************************************
http://connect20.magentocommerce.com/community/Adodis_Latesttweets

Use blow code to call it in any cms page Call below block In any of the cms page or static block to display RECENT TWEETS

{{block type="latesttweets/latesttweets" name="latesttweets" template="latesttweets/latesttweets.phtml"}}
**************************************************************************
HOW TO ADD SUBCATEGORY CUSTOM (HOME) LINK
**********************************************************************
ADD this code topmenu.phtml file and cache disable always
<ul id="nav">


    <li><a href="<?php echo $this->getUrl('home'); ?>">Home</a></li>
        <?php echo $_menu ?>
     
    </ul>
-------------------------------------------------
When Need footer links above
-----------------------------------------
and go subcategory-> about us->display settings= Static block only->cms block= footer links-> in anchor= no


*****************************************************************
HOW TO ADD LINK IN FOOTER OR ANYWHERE
********************************************************************
<li><a href="<?php echo Mage::getUrl('about-us')?>">About us </a></li>

**********************************************************************

HOW TO ADD BANNER ANY PAGE
*******************************************************

<div id="banner"><img src="<?php echo $this->getSkinUrl('images/banner.png'); ?>"></div>

*******************************************************
HOW TO ADD LINK PDF FILE IN CMS BLOCK
*******************************************************
<p>
<a target="_blank" href="{{skin url='images/preparing-files-colors.pdf'}} "><img src="{{skin url='images/pre_but.png'}}" alt="" /></a>
</p>

**********************************************************************
HOW TO ADD 2 OR 3 TABER IN MAGENTO THEN PROCESS

1 CREATE COPY(ABOUT_US.PHTML) AND CHANGE NAME (ABC.PHTML)
2 THEN changes link values and paths
3 then create cms page & call (abc.phtml content)
4 then create 2 or more need cms block & paste content when your requirement

***********************************************************************
HOW TO ADD PHTML FILE IN STATIC BLOCK
***************************************************
{{block type="core/template" template="contacts/form.phtml"}}

*******************************************************************************
HOW TO ADD CMS PAGE (url key) in CMS STATIC BLOCK
*****************************************************************************
<ul>
<li><a href="{{store direct_url="terms-conditions"}}">Terms and Conditions</a></li>
<li class="last privacy"><a href="{{store direct_url="testimonials"}}">Testimonials</a></li>
</ul>

****************************************************************************
HOW TO MANAGE LANGUAGE STORE
****************************************************************************
this paste header.php
<div class="stor_lan"><?php echo $this->getChildHtml('store_language')?></div>

this paste footer.php
<?php //echo $this->getChildHtml('store_switcher') ?>

this paste page.xml

<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>

**********************************************************************
How to click any category then myaccount/dashboard page or login page
**************************************************************
1- create support.phtml(this paste in page/html/here)
<?php  if(Mage::getSingleton('customer/session')->isLoggedIn()): echo 'in'; ?>
<?php $url=Mage::getUrl('customer/account/index'); ?>
<?php header('Location: customer/account/index/');?>
<?php //$this->_redirect($url); ?>

<?php else: ?>
<?php  $url=Mage::getUrl('customer/account/login');
 header('Location: customer/account/login/');
 //$this->_redirect($url);  ?>
<?php endif  ?>
<?php //return $this;?>
<!--<div class="container">
            <h3>Support</h3>
            <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
            </div>-->

2-  call static block support
<p>{{block type="core/template" name="support" template="page/html/support.phtml"}}</p>

3- select static block in category(support)

*********************************************************************
HOW TO CREATE MODULE
***********************************************************
http://magento4u.wordpress.com/2009/06/08/create-new-module-helloworld-in-magento/
-------------------------------------
Hey, new module is ready to run and hit browser with url http://127.0.0.1/projectname/index.php/helloworld/
-----------------------------
Target: Create a new module called “HelloWorld”
Step 1: Module Declaration
Create app/etc/modules/M4U_HelloWorld.xml and write below code
1
2
3
4
5
6
7
8
9
<?xml version="1.0"?>
<config>
         <modules>
                <M4U_HelloWorld>
                        <active>true</active>
                        <codePool>local</codePool>
                </M4U_HelloWorld>
         </modules>
</config>
Step 2: Module Configuration
a. Create a controller class app/code/local/M4U/HelloWorld/controllers/IndexController.php
1
2
3
4
5
6
7
8
class M4U_HelloWorld_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
     $this->loadLayout(array('default'));
     $this->renderLayout();
    }
}
b. Create a Block class app/code/local/M4U/HelloWorld/Block/HelloWorld.php
1
2
3
4
class M4U_HelloWorld_Block_HelloWorld extends Mage_Core_Block_Template
{
  // necessary methods
}
c. create configuration xml in app/code/local/M4U/HelloWorld/etc/config.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0"?>
<config>
    <global>
        <modules>
                <m4u_helloworld>
                        <version>0.1.0</version>
                </m4u_helloworld>
        </modules>
    <blocks>
            <helloworld>
                <rewrite>
         <helloworld>M4U_HelloWorld_Block_HelloWorld</helloworld>
        </rewrite>
            </helloworld>
     </blocks>
        </global>
       <frontend>
                <routers>
                        <helloworld>
                                <use>standard</use>
                                <args>
                                      <module>M4U_HelloWorld</module>
                                      <frontName>helloworld</frontName>
                                </args>
                        </helloworld>
                </routers>
        <layout>
            <updates>
                <helloworld>
                      <file>helloworld.xml</file>
                </helloworld>
            </updates>
            </layout>
        </frontend>
</config>
Define Frontend Template :
1. Define page layout in app/design/frontend/M4U/default/layout/helloworld.xml
N.B: Use default instead of M4U as template location if you use default design packages. Means create file in app/design/frontend/default/default/layout/helloworld.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0"?>
    <layout version="0.1.0">
        <helloworld_index_index>
            <reference name="root">
                <action method="setTemplate"><template>page/1column.phtml</template></action>
            </reference>
            <reference name="content">
                <block type="helloworld/helloworld" name="hello" template="helloworld/helloworld.phtml"/>
            </reference>
        </helloworld_index_index>
    </layout>
2. Create template file app/design/frontend/M4U/default/template/helloworld/helloworld.phtml and write down
N.B: Use default instead of M4U as template location if you use default design packages. Means create file in app/design/frontend/default/default/template/helloworld/helloworld.phtml
Hello World ! I am a Magento Guy..
Hey, new module is ready to run and hit browser with url http://127.0.0.1/projectname/index.php/helloworld/
and see result.

That’s it……..
******************************************************************************
HOW TO CHANGE LANGUAGE DROP-DOWN
*******************************************************************
1. go home page select all store
2. select particular language and select language when you need show
3. and select every banner in all store
***********************************************************************
HOW TO ADD SORT BY IN CATEGORY PAGE
*******************************************************************
this code add list.phtml
<?php echo $this->getToolbarHtml();
*******************************************************************

HOW TO ADD CROSSEL PRODUCT ADD IN VIEW PAGE CHECKOUT
===========================================================
GO -> THEME ->  LAYOUT-> checkout.xml
<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
-> copy this line and paste in       catalog.xml in same folder after upsells
******************************************************************
HOW TO SET HPERLINK IN MENU
==================================
Go -> catalog -> url rewrite mgmt -> and search request path -> current link (about-us.html)
request path: current link
id path: system generatd(category/4 )
target path: when you want click new url
-------------------------------------------------
delete this and ->Add URL REwrite-> Create URL Rewrite: Custom->
ID Path *
Request Path *
Target Path *
==================================================

HOW TO CALL SUBCATEGORY BASED ON ID WITH IMAGES
==========================================================
<?php
    //gets all sub categories of parent category
    $cats = Mage::getModel('catalog/category')->load(25)->getChildren();
    $catIds = explode(',',$cats);

    $categories = array();
    foreach($catIds as $catId) {
        $category = Mage::getModel('catalog/category')->load($catId);
        $categories[$category->getName()] = array(
            'url' => $category->getUrl(),
            'img' => $category->getImageUrl(),
'order by' => 'name'
        );
    }

    ksort($categories, SORT_STRING);
?>
    <ul>
        <?php foreach($categories as $name => $data): ?>
            <li>
                <a href="<?php echo $data['url']; ?>" title="<?php echo $name; ?>"><?php echo $name; ?> </a>
                    <img class="cat-image" src="<?php echo $data['img']; ?>" />
             
            </li>
        <?php endforeach; ?>
    </ul>
======================================================================
only category call
=======================

<?php /*?><?php
$root = Mage::getModel('catalog/category')->load(25);
$subCat = explode(',',$root->getChildren());

$collection  = $root
             ->getCollection()
             ->addAttributeToSelect("*")
             ->addFieldToFilter("entity_id", array("in", $subCat) );

foreach($collection as $catname){
echo $catname->getName()."</br>";
}
?><?php */?>
=====================================================

Display Top Level Categories Only

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/*
 * http://fishpig.co.uk - Magento Tutorials
 *
 * Display top level categories
 *
**/
?>
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php if (count($_categories) > 0): ?>
    <ul>
        <?php foreach($_categories as $_category): ?>
            <li>
                <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
                    <?php echo $_category->getName() ?>
                </a>
            </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>

Display Top Level Categories and ALL Subcategories

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
 * http://fishpig.co.uk - Magento Tutorials
 *
 * Display top level categories and subcategories
 *
**/
?>
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
    <ul>
        <?php foreach($_categories as $_category): ?>
            <li>
                <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
                    <?php echo $_category->getName() ?>
                </a>
                <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
                <?php $_subcategories = $_category->getChildrenCategories() ?>
                <?php if (count($_subcategories) > 0): ?>
                    <ul>
                        <?php foreach($_subcategories as $_subcategory): ?>
                            <li>
                                <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
                                    <?php echo $_subcategory->getName() ?>
                                </a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>
********************************************************************************
BREAK UL INSIDE FIX LI(means only 4 li in one ul when above then break)  ACCORDING TO NEED
********************************************************************************
<?php
$i = 0;
$collection = $this->getCouponCollection();
foreach($collection as $coupon) {
    if ($i % 3 == 0) { echo '</ul><ul>'; } ?>
    <li class="allcoupon"><div class="coupon">
            <h3> <?php echo $coupon->getTitle(); ?></h3>
            <div class="couponDescription"><?php echo $coupon->getDescription(); ?></div>
            <div class="couponImage"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."/".$coupon->getCouponImg(); ?>" width="100%" height="180px;" title="<?php echo $coupon->getTitle(); ?>"/></div>
        <div class="couponendTime"><label class="ecms_label">Expires:</label><span class="itemEndTime"><?php $s =  $coupon->getExpireDate(); $dt = new DateTime($s);

echo $date = $dt->format('d/m/Y');?>
         
            </span></div>
            <div class="printCoupon" ><img onclick="openPopupWindow('<?php echo $coupon->getCouponId(); ?>',this);" title="Print" src="<?php echo $this->getSkinUrl('images/print.png'); ?>" class="printerIcon-img"></div>
        </div></li>
  <?php  $i ++;
}
?></ul>
----------------------------------------------------------------
CUSTOMIZE CODE BREAK UL & LI
----------------------------------------------------
<?php
$i = 0;

foreach($categories as $name => $data):
    if ($i % 4 == 0) { echo '</ul><ul>'; } ?>
    <li class="allcoupon" style="list-style-type: none; margin-bottom: 20px; width: 20%; float: left; text-align: center;">
            <img class="cat-image" src="<?php echo $data['img']; ?>" height="150" width="150" />
                <h2 style="margin-top: 0px;"><a href="<?php echo $data['url']; ?>" title="<?php echo $name; ?>"><?php echo $name; ?> </a></h2>
       </li>
  <?php  $i ++;
endforeach;
?></ul>
******************************************************************************
HOW TO ENTER  ZIP CODE 4 OR MORE VALUE THEN SHOW MESSAGE
******************************************************************************

<script type="text/javascript">
    jQuery(document).ready(function() {
jQuery("#zip").keyup(function (e) {

//removes spaces from username
jQuery(this).val(jQuery(this).val().replace(/\s/g, ''));

var zip = jQuery(this).val();
if(zip.length < 4){jQuery("#user-result").html('');return;}

if(zip.length >= 4){
jQuery("#user-result").html('<img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif');?>" />');
jQuery.post('<?php echo $this->getBaseUrl()?>onibi_storelocator/index/valid', {'zip':zip}, function(data) {
 jQuery("#user-result").html(data);
});
}
});
});
</script>
----------------------------------------------------
 <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
       
                    <div class="input-box">
                        <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
                    </div>


                 <span id="user-result">Currently we don't provide service in your area. Please subscribe to our newsletter to get update when we are providing service in your area  
    <script type="text/javascript">
//alert("vikas");
jQuery('#submitbtn').attr('disabled', 'disabled');</script>
</span>
***************************************************************************
ADD CUSTOM ONE CATEGORY IN SHOW ALL CATEGORY PRODUCT IN DIFFRENT STYLE
**************************************************************************
GO ->catalog -> manage categories -> and click any category ->custom design -> Custom Layout Update->paste this code->>><reference name="product_list">
    <action method="setTemplate"><template>catalog/product/list2.phtml</template></action>
</reference> ->>>and create a template file list2.phtml in under template/catalog/product
***************************************************************************
HOW TO UPLOAD SITE CHANGE DATABASE PATH
*************************************************************************
GO-> App ->etc -> local.xml -> give username, host_name, password created by live server database

GO->DATA BASE ->TABLE SEARCH -> core_config_data ->change secure and unsecure url ->http://localhost/magento/testmagento/



KILLER TIPS MAGENTO
=====================================================================

IF YOU GET 500 INTERNAL ERROR

INDEX.HTML OR INDEX.PHP PERMISSION 644

DOWNLOAD FOLDER

INDEX.HTML OR INDEX.PHP PERMISSION 644

app\design\frontend\default\mytheme\template\page

header
footer
topmenu

app\design\frontend\default\mytheme\template\catalog\product

list (catalog page)
view (product page)
==============================================================
<!-- For Newsletter Create duplicate of subscribe.phtml and Call

any where -->
<?php echo $this->getLayout()->createBlock

('newsletter/subscribe')->setTemplate('newsletter/subscribe-

bottom.phtml')->toHtml(); ?>


<!-- call Static Block in phtml file -->
<?php echo $this->getLayout()->createBlock('cms/block')-

>setBlockId('footer_links')->toHtml(); ?>

<!-- call image in phtml file -->
<img src="<?php echo $this->getSkinUrl

('images/anyimage.png')?>">

<!-- Website Url -->
<a href="<?php echo $this->getUrl('')?>

<!-- static block -->
<ul>
<li><a href="{{store direct_url="about-magento-demo-

store"}}">About Us</a></li>
</ul>


<!-- call template file in cms block -->
{{block type="core/template" template="press/banner.phtml"}}


<!-- call image in static block -->
<p><img src="{{skin url='images/free-shiping.jpg'}}" alt=""

width="359" height="64" /></p>
==================================================================
HOW TO ADD VIDEO YOUTUBE IN CMS PAGE OR BLOCK
==========================================================
<iframe width="250" height="250" src="//www.youtube.com/embed/z86yoNp2Xis" frameborder="0" allowfullscreen></iframe>














*********************************************************************
HOW TO ADD JQUERY IN MAGENTO(VIEW.PHTML)
-----------------------------------------------------------
REPLACE $ TO jQuery   THEN NOT ADD MIN.JS
*********************************************************************
jQuery(document).ready(function(){
//open popup
jQuery("#pop").click(function(){
  jQuery("#overlay_form").fadeIn(1000);
  positionPopup();
});

//close popup
jQuery("#close").click(function(){
jQuery("#overlay_form").fadeOut(500);
});
});

//position the popup at the center of the page
function positionPopup(){
  if(!jQuery("#overlay_form").is(':visible')){
    return;
  }
  jQuery("#overlay_form").css({
      left: (jQuery(window).width() - jQuery('#overlay_form').width()) / 2,
      top: (jQuery(window).width() - jQuery('#overlay_form').width()) / 7,
      position:'absolute'
  });
}

//maintain the popup at center of the page when browser resized
jQuery(window).bind('resize',positionPopup);

</script>
*************************************************************

*********************************************************************************
HOW TO ADD ATTRIBUTES & SHOW IN FRONT END PRODUCT PAGE
*********************************************************************************

GO -> CATALOG ->ATTRIBUTE->MANAGE ATTRIBUTE -> THEN MANAGE ATTRIBUTE SET

-> THEN CREATE CATEGORIES
-> THEN ADD NEW PRODUCT

HOW TO SHOW FRONT END THIS CODE
-----------------------------------------
   <?php echo $_product->getResource()->getAttribute('lalit')->getFrontend()->getValue($_product); ?>

WHERE= lalit is name off attribute
echo $_product->getAttributeText('your_attribute_code');
************************************************************

=====================================================
DEMO SITE
================================================
http://demo.mage-world.com/live/index.php?id=37(magento slider)
http://kanoinfotech.in//zenfoods/html/zen/index.html



http://kanoinfotech.in/yoming
http://natuurvacht.nl/
http://kanoinfotech.in/wellcraft/
http://sundare.nu/


http://z-locker.com/new/
http://www.kanodistancelearning.com/magento/printstore/
http://kanoinfotech.in/happypeople/
-----------------------------------------------------------------------------------------
learn magento
----------------------------------------------------------------------------------
http://www.pierrefay.com/magento-developper-guide-howto-tutorial-5
--------------------------------------------------------------------------------------

No comments:

Post a Comment