Search This Blog

Mind freaker Stuff

Please Visit my new blog http://www.mindfreakerstuff.com for new articles related to web and mobile designing.
Showing posts with label Magento. Show all posts
Showing posts with label Magento. Show all posts

Thursday, April 12, 2012

How to Change My Cart Link Name : Magento (using CSV file)

To Change " My Cart "  Link Name  in   Magento using CSV file   or  To Add custom label name to "My Cart" Using translate.CSV


1) Open  translate.CSV  file  

    (If your using English translation)
   CSV Path =   app\design\frontend\default\Your_Theme_Name\locale\en_US\ translate.CSV


2) Add Following Lines 
"My Cart (%s item)", "Shopping Bag ( %s )"
"My Cart (%s items)", "Shopping Bag ( %s )"
"My Cart", "Shopping Bag"


3) Save File and Clear Magento Cache .
Login to the admin and refresh the cache by going to System->Cache Management.




Cheers...... :)

How to Add Custom Class to top links and footer links : Magento

To Add Custom Class to top links  in Magneto

1) Open XML files for Top links And Add following tag

<liParams/> 
<aParams>class="logged-out"</aParams>

Suppose you want to add custom class to logout link.

<customer_logged_out>
    <
reference name="top.links">
       
<!--Add 'Log In' link -->
        <
action method="addLink" translate="label title" module="customer">
            <
label>Log In</label>
            <
url helper="customer/getLoginUrl"/>
            <
title>Log In</title>
            <
prepare/>
            <
urlParams/>
            <
position>100</position>

            <liParams/>
            <aParams>class="logged-out"</aParams>

        </action>
    </
reference>
</
customer_logged_out>

    


Thats it your done :) ........


Where are the files for the links located


Top  Links XML Path =  app\design\frontend\default\your_Theme\layout 


  • The “My Account” link is found in the customer.xml file
  • The “My Wishlist” link is found in the wishlist.xml file
  • The “My Cart” and “Checkout” links are both found in the checkout.xml file these links have class by default 
  • The “Login” and “Log Out” links are found in the customer.xml file



Friday, October 21, 2011

How to get My Cart Quantity : Magento


 <?php $Mycart =Mage::getModel('checkout/cart')->getItemsQty(); ?>
   <?php if($Mycart ){  ?>

    <div > <?php echo $Mycart  ?></div>

    <?php } else { ?>

          <div > <?php echo $this->__('Cart is Empty.') ?></div>


   <?php } ?>

Monday, October 17, 2011

Creating Simple Blank Theme for Magento


1)      Create Copy of  \skin\frontend\default \  “Blank” folder and rename to your theme name “mytheme”

2)      Copy  “app\design\frontend\base\default” folder to “app\design\frontend\default\”  folder with your theme Name “mytheme”.

3)      Go to Admin Panel > System> Design > Add Design Changes > Select your theme 

Saturday, October 15, 2011

SEO "Use Web Server Rewrites" 404 Error : Magento

Admin Path:

System > Configuration > Web > Search Engines Optimization >  'Use Web Server Rewrites' > Yes

 Error: 

404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Solution : 

Magento can use more human looking and search engine friendly addresses for it's pages if you switch on 'Use Web Server Rewrites'. This relies on two things.
  1. Apache's mod_rewrite module. All our servers have this installed and enabled.
  2. A .htaccess file in the same folder as your Magento install. Magento comes with a .htaccess file for you to use that should work as is.
If you switch on 'Use Web Server Rewrites' and get 404 errors then check that the .htaccess file is installed.
Some FTP programs may not show .htaccess files or upload them without switching on an option to show 'hidden' files. On UNIX based operating systems, files beginning with a period such as .htaccess are not shown in listings with the usual ls command. You can view them on the command line with 'ls -a' to show all files.


Ref- http://aegishosting.co.uk/support/knowledgebase/7/Using-Web-Server-Rewrites.html

Wednesday, October 12, 2011

customize Email template with variable : Magento

PHP file Code

function sendTestMail($emailId,$VariableName,$name)
{
        $mailer = Mage::getModel('core/email_template_mailer');
        $emailInfo = Mage::getModel('core/email_info');
        $emailInfo->addTo($emailId, $name);
        if ($copyTo && $copyMethod == 'bcc') {
            // Add bcc to customer email
            foreach ($copyTo as $email) {
                $emailInfo->addBcc($email);
            }
        }
        $mailer->addEmailInfo($emailInfo);

        // Email copies are sent as separated emails if their copy method is 'copy'
        if ($copyTo && $copyMethod == 'copy') {
            foreach ($copyTo as $email) {
                $emailInfo = Mage::getModel('core/email_info');
                $emailInfo->addTo($email);
                $mailer->addEmailInfo($emailInfo);
            }
        }

        // Set all required params and send emails
        $mailer->setSender(Mage::getStoreConfig('sales_email/order/identity', $storeId));
        $mailer->setStoreId($storeId);
        $mailer->setTemplateId(1);   //"1" is email Template ID
        $mailer->setTemplateParams(array(
                'customer_name'        => $name,
                'VariableName'        => $VariableValue
            )
        );
      
        $mailer->send();
        return;
    }


Code Inside Email Template
Magento Admin >System >  Transnational Emails > Select Email Template > Template Content

- {{var VariableName}}

eg. <span>{{var VariableName}} </span>








Monday, October 3, 2011

Remove (Did You Know Image) and PayPal logo: Magento

To Remove Did You Know Image


You will  find  Image block is being added onto your Magento install via catalog.xml
Got to
app/design/frontend/*/*/layout/catalog.xml

Commnet Flolloing Tags

<action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>




 To Remove Paypal Logo

 1. Login to your Admin Panel of your Store. Go to System -> Configuration and click on  PayPal logo from the options on the left  side.
2. Then you will get the whole settings of Paypal in your Magento Store. Click on the Tab “Front end Experience settings“
3. Select “No Logo” from the drop down list of the PayPal Product Logo field.



for ref- http://haijerome.wordpress.com/2010/11/26/magento-remove-paypal-logo/



Magento : 1.4,1.5,....

Show Block on Home Page only :Mageto (Phtml File changes)

 <?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home'  && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')
                            {?>  
                         <div class="static_blocks">
                                <!--Your Content Here-->
                         </div>
<?php }?>

Friday, September 30, 2011

Editing the Footer in a stock magento build

The items in the footer area are in two different locations. One part is a static block created within the magento admin area (CMS > Static Block). The other part is held in the related .phtml / .php / .xml files within the design files.
First off, the XML files

app/design/frontend/*/*/layout/page.xml
Here you will find some footer reference:
<block type="page/html_footer" name="footer" as="footer" 
template="page/html/footer.phtml">
<block type="page/switch" name="store_switcher" 
as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" 
as="footer_links" template="page/template/links.phtml"/>
</block>
app/design/frontend/*/*/layout/cms.xml
<reference name="footer">
<block type="cms/block" name="cms_footer_links" before="footer_links">
<!--
The content of this block is taken from the database by its block_id.
You can manage it in admin CMS -> Static Blocks
-->
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</reference>
You can see that the footer area of each page (page.xml) adds footer links via:
app/design/frontend/*/*/template/page/html/footer.phtml
This file (footer.phtml) contains a method to get it’s children HTML as referenced in the page.xml file – ($this->getChildHtml();)
-app/design/frontend/*/*/template/page/switch.phtml
-app/design/frontend/*/*/template/page/template/links.phtml
footer.phtml is basically a “shell” which includes the “report bugs to magento” text. It also calls the getChildHtml method to get the rest in there.
One important part of the footer’s children HTML are the links:
The .phtml file , however, grabs links from the method “$this->getLinks()” found in the Block .php file controlling the template…. so the hunt begins.
The Block file controlling this template is:
app/code/core/mage/page/Template/Links.php
However, here you will find that this only has generic code for entering links! Where, then, are these links coming from? Well…a lot of places :(


<!--contacts.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" 
ifconfig="contacts/contacts/enabled"><label>Contact Us</label>
<url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
</reference>

<!--rss.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="rss" 
ifconfig="rss/config/active"><label>RSS</label><url>rss</url>
<title>RSS testing</title><prepare>true</prepare><urlParams/>
<position/><li/><a>class="link-feed"</a></action>
</reference>

<!--catalogsearch.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" 
module="catalogsearch" ifconfig="catalog/seo/search_terms">
<label>Search Terms
</label><url helper="catalogsearch/getSearchTermUrl" />
<title>Search Terms</title></action>
<action method="addLink" translate="label title" 
module="catalogsearch"><label>Advanced Search</label>
<url helper="catalogsearch/getAdvancedSearchUrl" /><
title>Advanced Search</title></action>
</reference>

<!--catalog.xml-->
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog" 
ifconfig="catalog/seo/site_map"><label>Site Map</label>
<url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
</reference>


Now, as for the other links (About Us and Customer Service) they are 
merely created in the Admin section as mentioned. Admin > CMS > 
Static Blocks.

They are referenced in cms.xml as shown above. You can use this method to
 show static blocks creating in the CMS area of the admin section anywhere (the
 much-repeated emphasis on being able to use PHP code to do the job of 
the XML (or visa versa) is handy to add a static block somewhere in your
 code instead of using xml).
 
 
 
For More Details
 
ref - 


http://www.exploremagento.com/magento /editing-the-footer-in-a-stock-magento-build.php

Magento: Add Javascript or CSS to Home Page Only (Or Any CMS Page)

CMS pages in Magento allow you to modify the layout XML specific to that page. So, all you need to do is open up the CMS page in Magento that you want to add the javascript to, click on the “Custom Design” tab on the left, and in the “Layout Update XML” field add the following:



“Custom Design” tab on the left, and in the “Layout Update XML” field add the following:
<reference name="head">
  <action method="addItem">
    <type>skin_js</type><script>yourfile.js</script>
  </action>
</reference>
 
Or, if you want to just put the javascript in the /js/ directory of your app, you can change the “skin_js” to just “js”.

Ref - http://prattski.com/2010/03/08/magento-add-javascript-to-home-page-only-or-any-cms-page/

Thursday, June 16, 2011

Remove ,Modify ( Reorder ) or Add external Link to Top links Magento

ADD External Link ---

Where are the files for the links located

app\design\frontend\default\your_Theme\layout 

  • The “My Account” link is found in the customer.xml file
  • The “My Wishlist” link is found in the wishlist.xml file
  • The “My Cart” and “Checkout” links are both found in the checkout.xml file
  • The “Login” and “Log Out” links are found in the customer.xml file

You will find the links in between <reference name="top.links"> linking code is in here.. </reference>.
 
---------------------------------------------------------------------- 
 
<reference name="top.links">
    <action method="addLink" translate="label title">
        <label>example</label>
        <url>http://myotherexampledomain.com</url> 
        <title>example</title>
        <prepare/>
        <urlParams/> 
        <position>100</position>
        <liParams/>
        <aParams>class="top-link-example"</aParams>
        <beforeText></beforeText>
        <afterText></afterText>
    </action>
</reference>
 
--------------------- Tested on Magento 1.5 ------------------ 
Basically, prepare needs to be unset because, if it is set to "true" or
 "false", it will append the URL to your site's base URL. 
(<prepare>true</prepare>)  To append URL 
  
 
 
 
Reordering Top links  ----
 
Change or add position to links reference 
 
<reference name="top.links">
    <action method="addLink" translate="label title">
        <label>example</label>
        <url>http://myotherexampledomain.com</url> 
        <title>example</title>
        <prepare/>
        <urlParams/> 
        <position>100</position>
        <liParams/>
        <aParams>class="top-link-example"</aParams>
        <beforeText></beforeText>
        <afterText></afterText>
    </action>
</reference>  
 

Adding A Home link To the Top Links

You can add a link to your homepage by pasting in the code below in to your customer.xml file in the same place as above:
<action method="addLink" translate="label title" module="customer">
     <label>Home</label>
     <url></url>
     <title>Home</title>
     <prepare>true</prepare>
     <urlParams/>
     <position>1</position>
</action>

Adding To The Top Links On Certain Pages Only

The examples so far have added the links to all the pages, if you wanted to add, say for instance, the “Shipping Terms” link only to your “My Cart” page you would paste the following code in your checkout.xml file:
<reference name="top.links">
     <action method="addLink" translate="label title">
          <label>Shipping Terms</label>
          <url>shipping</url>
          <title>Shipping Terms</title>
         <prepare>true</prepare>
         <urlParams helper="core/url/getHomeUrl"/>
          <position>2</position>
     </action>
</reference>
 

Wednesday, May 11, 2011

Display Static Block With Title : Magento

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


By calling the static block model, you can then get all fields associated with that block such as the  
static block title

<?php
$block = Mage::getModel('cms/block')->load('identifier');
echo $block->getTitle();
echo $block->getContent();
?>

Monday, May 9, 2011

get URL paths : Magento

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
//http://magento.demo/js/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
//http://magento.demo/index.php/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
//http://magento.demo/media/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
//http://magento.demo/skin/

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
//http://magento.demo/