11/21/2012

MAGENTO CHANGE CAPTCHA BACKGROUND LINES AND DOTS DENSITY

I had to reduce the density of dots and lines in captcha because it was un readable sometimes.

so here what i did.

Go to:

lib/Zend/Captcha/Image.php

protected $_dotNoiseLevel = 10;
protected $_lineNoiseLevel = 0;



magento:IP SPECIFIC LANGUAGE

 First download currency switcher from   
http://www.magentocommerce.com/magento-connect/auto-currency-switcher-8671.html
//CODE TO DISPLAY LANGUAGE ACCORDING TO IP ADDRESS
if(Mage::getConfig()->getModuleConfig('Chapagain_AutoCurrency')->is('active', 'true'))
{
$geoIp = Mage::helper('autocurrency')->loadGeoIp();
$ipAddress = Mage::helper('autocurrency')->getIpAddress();
// get country code from ip address
$countryCode = geoip_country_code_by_addr($geoIp, $ipAddress);
$germancountries=array('CH','DE');
if(!isset($_COOKIE['frontstoreloc']))
{
//$siteurl= $this->getUrl();
$siteurl= "http://".$_SERVER['SERVER_NAME'];
setcookie("frontstoreloc",session_id(),time()+60*60*24,"/","");
switch(trim($countryCode))
{
case 'CH':
$url = $siteurl . '?___store=german';
header( 'Location:' . $url);die;
break;
case 'DE':
$url = $siteurl . '?___store=german';
header( 'Location:' . $url);die;
break;
case 'IN':
$url = $siteurl . '?___store=english';
header( 'Location:' . $url);die;
break;
default:
$url = $siteurl . '?___store=usa';
header( 'Location:' . $url);die;
break;
}
}
}

MAGENTO GET STORE SPECIFIC ATTRIBUTE LABEL:

 <?php echo $_product->getResource()->getAttribute($_attribute->getAttributeId())->getStoreLabel();?>  

Magento error :Mage registry key "_singleton/core/resource" already exists

Magento invoice pdf : display custom options in one line



open default.php
at path:

app/code/local/Mage/Sales/Model/Order/Pdf/Items/Invoice

//REPLACE THE LINES  one that starts with if ($options) {
        //foreach ($options as $option) { with the followin lines.

       
       $options = $this->getItemOptions();
    if ($options) {
        foreach ($options as $option) {
            if ($option['value']) {
                $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
                $values = explode(', ', $_printValue);
                foreach ($values as $value) {
                    $optlabel= Mage::helper('core/string')->str_split(strip_tags($option['label']), 70, true, true);
                    $optval = Mage::helper('core/string')->str_split($value, 50, true, true);
                    $lines[][] = array(
                        'text' => htmlspecialchars_decode ($optlabel[0]." : ".$optval[0]),
                        'feed' =>35
                    );
                }
            }
        }
    }

Cargowiz issue bd.addClass is not a function ext-tree.js (line 33)




Open file
js/extjs/ext-tree.js

Search for bd.className
Replace bd.addClass(cls);  by  bd.className+=cls;


firefox screen shot of the error:

Magento connect installation error Connection string is empty


Click on "settings" tab
And fill up "FTP Host","Ftp login","Ftp Password","Installation Path:"


Magento REMOVE CACHE INVALIDATION ERROR(THOUGH IT'S NOT A BUG ;))


YOU HAVE TO PUT CACHE CLEAR CODE SOME WHERE IN ADMIN PHTML FILE.
i put that code in head.phtml
file:
head.phtml
path:
app/design/adminhtml/default/default/template/page

<?php
 try {
      Mage::app()->getCacheInstance()->cleanType('block_html');
  } catch (Exception $e) {
    // do something
    error_log($e->getMessage());
  }

 ?>