Search This Blog

Mind freaker Stuff

Please Visit my new blog http://www.mindfreakerstuff.com for new articles related to web and mobile designing.

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>








Add www to your website link (Missing www in website name)


for  Linux Server Only

Open ".htaccess" fiile from root and add or modify following content

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursitename.com [NC]
RewriteRule ^(.*)$ http://www.yoursitename.com/$1 [L,R=301] 


It  will convert  http://yoursitename.com to  http://www.yoursitename.com




---- Enjoy

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 }?>