Wednesday, November 21, 2012
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 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
);
}
}
}
}
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());
}
?>
Friday, September 14, 2012
Pisc Euvat extension error
I was implementing this module https://support.pillwax.com/open-source/doku.php?id=magento:euvat
but got the below mentioned error
Column not found: 1054 Unknown column '_table_taxvat.value' in 'where clause'";i:1;s:7921:"#0
To resolve this i just removed the sql conditions like below in file Grid.php
at path: app/code/local/Pisc/Euvat/Block/Adminhtml/Customer/Invalidstatus
change the below lines
"(_table_taxvat.value IS NOT NULL AND (".$collection->getTable('euvat/vies_cache').".response LIKE '%valid=1;%') AND tax_class_id<>".$config->getTaxClass_EuBusiness()." AND tax_class_id<>".$config->getTaxClass_DefaultCountry().")".
to
"( (".$collection->getTable('euvat/vies_cache').".response LIKE '%valid=1;%') AND tax_class_id<>".$config->getTaxClass_EuBusiness()." AND tax_class_id<>".$config->getTaxClass_DefaultCountry().")".
As u can see i just removed the red colored line "_table_taxvat.value IS NOT NULL AND" , just do the same for all occurance of that line.
but got the below mentioned error
Column not found: 1054 Unknown column '_table_taxvat.value' in 'where clause'";i:1;s:7921:"#0
To resolve this i just removed the sql conditions like below in file Grid.php
at path: app/code/local/Pisc/Euvat/Block/Adminhtml/Customer/Invalidstatus
change the below lines
"(_table_taxvat.value IS NOT NULL AND (".$collection->getTable('euvat/vies_cache').".response LIKE '%valid=1;%') AND tax_class_id<>".$config->getTaxClass_EuBusiness()." AND tax_class_id<>".$config->getTaxClass_DefaultCountry().")".
to
"( (".$collection->getTable('euvat/vies_cache').".response LIKE '%valid=1;%') AND tax_class_id<>".$config->getTaxClass_EuBusiness()." AND tax_class_id<>".$config->getTaxClass_DefaultCountry().")".
As u can see i just removed the red colored line "_table_taxvat.value IS NOT NULL AND" , just do the same for all occurance of that line.
Wednesday, August 29, 2012
magento- Stock Status Index process is working now. Please try run this process later.
To remove this error first thing you have to do is to clear the content of locks folder under var folder.
If this didn't solved your problem then check out the file permission of locks folder and change it to 777
If this didn't solved your problem then check out the file permission of locks folder and change it to 777
magento remove index.php
Under "Search Engine Optimization" set value of "Use Web Server Rewrite" to "Yes"
Under "Secure" section set "Use Secure URLs in Frontend" to "Yes".
Now,
Add the following lines to your .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
If your magento setup is under some folder like Clients/testsite then use followin lines
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Clients/testsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Clients/testsite/index.php [L]
</IfModule>
Monday, August 13, 2012
magento ecommerce google analytics
BELOW IS THE CODE THAT I USED IN MY PROJECT
File: success.phtml
path: app/design/frontend/default/mytheme/template/checkout
<?php
$order1 = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
$subtotal = $order1->getSubtotal();
$order_id = $order1->getId(); //the id of the order
//$order->getIncrementId();//the increment id of the order
$gtotal = $order1->getGrandTotal();//grand total of the order
//echo "<pre />";
//print_r($order->getBillingAddress()->getData());
$address = $order1->getBillingAddress()->getData();
$city = $address['city'];
$state = $address['region'];
$country = $address['country_id'];
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17916440-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'<?php echo $order_id; ?>', // order ID - required
'steigerhoutstunter.nl', // affiliation or store name
'<?php echo $gtotal;?>', // total - required
'0', // tax
'0', // shipping
'<?php echo $city;?>', // city
'<?php echo $state;?>', // state or province
'<?php echo $country;?>' // country
]);
<?php
$order_items = $order1->getAllItems();
$itemcount=count($order_items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($order_items as $key => $item)
{?>
_gaq.push(['_addItem',
'<?php echo $order_id; ?>', // order ID - required
'<?php echo $item->getSku(); ?>', // SKU/code - required
'<?php echo $item->getName(); ?>', // product name
'category name', // category or variation
'<?php echo $item->getPrice(); ?>', // unit price - required
'<?php echo $item->getQtyToInvoice(); ?>' // quantity - required
]);
<?php
}
?>
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Monday, July 30, 2012
magento sage pay error: SagePay Payment Has Failed, Please Reload Checkout Page And Try Again. Your Card Has Not Been Charged
Actually at my setup sagepay wasn't working with firecheckout.
you have to buy the paid latest version of firecheckout in order to make it work with sagepay.
I had downloaded latest verision of sagepay and had to impelement it on magento 1.7.0.1 , I used simulation mode.
you have to buy the paid latest version of firecheckout in order to make it work with sagepay.
I had downloaded latest verision of sagepay and had to impelement it on magento 1.7.0.1 , I used simulation mode.
Don't forget to make
simulator account in sage pay in order
to use it in simulator mode.
Monday, July 23, 2012
Magento error "You cannot define a correlation name more than once"
solution:
This is a layered navigation error.
This is a layered navigation error.
In your catalog.xml search for
"layer_view" . If you find two occurences for this, then remove one that you
don't need.
I commented the
second one that I didn't needed and fixed the error.
<reference
name="right">
<block
type="catalog/layer_view" name="catalog.leftnav"
after="currency" template="catalog/layer/view.phtml"/>
</reference>
<!-- <reference name="left">
<block
type="catalog/layer_view" name="catalog.leftnav"
after="currency" template="catalog/layer/view.phtml"/>
</reference>-->
Thursday, July 5, 2012
Get payment code in event observer
$paymentcode = $observer->getEvent()->getPayment()->getMethodInstance()->getCode();
Tuesday, July 3, 2012
magento get payment method in onepagecontroller.php
$params=$this->getRequest()->getParams();
$payment_method=$params['payment']['method'];
$payment_method=$params['payment']['method'];
MAGENTO-REMOVE ALL ITEMS FROM THE CART
//THIS WORKED FINE FOR ME :)
$session= Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$cart = Mage::getModel('checkout/cart');
$cartItems = $cart->getItems();
foreach ($cartItems as $item)
{
$quote->removeItem($item->getId())->save();
}
$session= Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$cart = Mage::getModel('checkout/cart');
$cartItems = $cart->getItems();
foreach ($cartItems as $item)
{
$quote->removeItem($item->getId())->save();
}
Get order id from page url
simple use this:
$orderId = (int) $this->getRequest()->getParam('order_id');
$orderId = (int) $this->getRequest()->getParam('order_id');
Thursday, May 10, 2012
HCL Technologies magento interview questions
Recently my friends went for interview for magento developer profile at HCL, where they were asked several questions like below. I will keep updating this post regularly.
1.WHAT IS module conflicts?
Ans: when two modules override same controller then module conflict arises.
2. How can we remove module conflict?
Ans: http://www.magestore.com/blog/2011/12/21/magento-methods-to-resolve-the-module-conflicts-in-magento/
15.what is mage regisry? How we register a variable?
Ans: http://blog.chapagain.com.np/magento-how-to-set-and-get-registry/
1.WHAT IS module conflicts?
Ans: when two modules override same controller then module conflict arises.
2. How can we remove module conflict?
Ans: http://www.magestore.com/blog/2011/12/21/magento-methods-to-resolve-the-module-conflicts-in-magento/
3.What is code pool?
Ans: it is a concept to pull the code in magento structured format.
magento
|_app
|_code
|_community
|_core
|_local
4. Can we override Community Module?
Ans: yes we can override to the local.
5.What is Module conflict?
Ans: We install one module(Extension Conflict) to findout that Class which is Conflict. We have to written only one config file for both module.
6. Difference between javascript and jquery?
javascript: it is Client side scripting/programming language.
Jquery: Jquery is library buit in javascript.
7. Final Class && Abstract Class
Ans:Final Class: A Class which Can't be inherited by other class, that class is called final class.
You all knows that final class is inbuilt in java. But in C++ you have to create final class.Two types of Final class, you can create . One who want to create object of final class on Heap and other who wants to create object of Final class on stack.
=>It makes use of private constructor, virtual inheritance and friend class.
=>In place of priavte constructor, use private Destructor. Because Constructor can be overloaded and Destructor can'nt be overloaded.
8. why Interface used.?
9.can used Protected Class outside Function.?
10.CURL & Php.ini
11. .htaccss
12. database engine
13. Primary key and Unique Key
14. EAV Concept
Ans: http://blog.chapagain.com.np/magento-how-to-set-and-get-registry/
Thursday, April 12, 2012
magento get admin form key
Here is how you can get admin form key in your frontend form. I used the admin form key to login from frontend to admin dashboard.
step1: create object
<?php $adminobj= new Mage_Adminhtml_Block_Template(); ?>
step2: I used the value in hidden field like below:
<input name="form_key" type="hidden" value="<?php echo $adminobj->getFormKey() ?>" />
step1: create object
<?php $adminobj= new Mage_Adminhtml_Block_Template(); ?>
step2: I used the value in hidden field like below:
<input name="form_key" type="hidden" value="<?php echo $adminobj->getFormKey() ?>" />
magento login to admin from frontend error:404 error page not found
Hi,
I was trying to login to admin panel by using frontend login template.
Here is my form whose action post to admin login action.
<form action="http://www.mysite.com/bgsh/index.php/admin" method="post" id="customer-form">
I was trying to login to admin panel by using frontend login template.
Here is my form whose action post to admin login action.
<form action="http://www.mysite.com/bgsh/index.php/admin" method="post" id="customer-form">
I changed the action to :
action="http://www.mysite.com/bgsh/index.php/admin/admin"
and BINGO:
no error on login.(Did you noticed the double admin words in the action value?)
If you request, then i can explain and provide code in details how i manage to login from frontend using vendor credentials, and after logout redirected to the frontend in case the vendor is logged in from frontend.
Thursday, April 5, 2012
setting session variable in php file outside magento structure
Hi,
today i was working on a project and i had to redirect user('vendor') to frontend from where he has logged in to the system.I already created user registration from frontend. Now i had to maintain session variable so that i can check whether the particular vendor was logged in from frontend. If so, he will be redirected to the frontend.
To store session variable i sent an ajax hit to http://www.mywebsite.com/setSessionVar.php file. As you can see that file is situated in root directory.
setSessionVar.php
<?php
require 'app/Mage.php';
Mage::app();
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
Mage::getSingleton('core/session')->setMyloginvalue('vendor');
?>
To redirect to frontend i put a check when user click on "logout" link in the dashboard area.
i.e. in file IndexController.php under
/app/code/core/Mage/Adminhtml/controllers
public function logoutAction()
{
//GET LOGIN TYPE . if vendor loggedin from frontend then it's "vendor"
$loginvalue=Mage::getSingleton('core/session')->getMyloginvalue();
if($loginvalue=="vendor")
{
Mage::getSingleton('core/session')->unsMyloginvalue();
$location=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
header("location:$location");exit;
}
//END VENDOR LOGIN CHECK
//....rest of the code here
//....
}
today i was working on a project and i had to redirect user('vendor') to frontend from where he has logged in to the system.I already created user registration from frontend. Now i had to maintain session variable so that i can check whether the particular vendor was logged in from frontend. If so, he will be redirected to the frontend.
To store session variable i sent an ajax hit to http://www.mywebsite.com/setSessionVar.php file. As you can see that file is situated in root directory.
setSessionVar.php
<?php
require 'app/Mage.php';
Mage::app();
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
Mage::getSingleton('core/session')->setMyloginvalue('vendor');
?>
To redirect to frontend i put a check when user click on "logout" link in the dashboard area.
i.e. in file IndexController.php under
/app/code/core/Mage/Adminhtml/controllers
public function logoutAction()
{
//GET LOGIN TYPE . if vendor loggedin from frontend then it's "vendor"
$loginvalue=Mage::getSingleton('core/session')->getMyloginvalue();
if($loginvalue=="vendor")
{
Mage::getSingleton('core/session')->unsMyloginvalue();
$location=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
header("location:$location");exit;
}
//END VENDOR LOGIN CHECK
//....rest of the code here
//....
}
Wednesday, April 4, 2012
get agent status in zopim using javascript
I implemented zopim in a site and had to change class of a div according to the current agent's status.
<script type="text/javascript">
//YOUR ZOPIM SCRIPT HERE
</script>
//updatestatus function
function updateStatus(s) //NOTICE "s" here it contains agent's current status
{
switch(s)
{
case 'online':
jQuery('.chatbox').addClass('online');
break;
case 'offline':
jQuery('.chatbox').removeClass('online');
break;
case 'away':
jQuery('.chatbox').removeClass('online').addClass('away');
break;
}
<div class="chatbox" onclick="$zopim.livechat.window.toggle();">sow chat</div>
<script type="text/javascript">
//YOUR ZOPIM SCRIPT HERE
</script>
$zopim(function() {
$zopim.livechat
.setOnStatus(updateStatus);
});
.setOnStatus(updateStatus);
});
//updatestatus function
function updateStatus(s) //NOTICE "s" here it contains agent's current status
{
switch(s)
{
case 'online':
jQuery('.chatbox').addClass('online');
break;
case 'offline':
jQuery('.chatbox').removeClass('online');
break;
case 'away':
jQuery('.chatbox').removeClass('online').addClass('away');
break;
}
Monday, April 2, 2012
Calendar._MN is undefined magento
Today i was implementing caledar feature in frontend. I have included all the required js and css file for that.
Still it was showing this error."Calendar._MN is undefined"
After some R&D i found out that i missed to include some javascript that is necessary for calendar to work.
I just included following lined on the page and it begins to work smoothly.
<link rel="stylesheet" type="text/css" href="http://www.beds.sg/v2/ js/calendar/calendar-win2k-1. css" />
<script type="text/javascript" src="http://www.beds.sg/v2/js/ calendar/calendar.js"></ script>
<script type="text/javascript" src="http://www.beds.sg/v2/js/ calendar/calendar-setup.js"></ script>
Still it was showing this error."Calendar._MN is undefined"
After some R&D i found out that i missed to include some javascript that is necessary for calendar to work.
I just included following lined on the page and it begins to work smoothly.
<script type="text/javascript">
//<![CDATA[
enUS = {"m":{"wide":["January"," February","March","April"," May","June","July","August"," September","October"," November","December"],"abbr":[ "Jan","Feb","Mar","Apr","May", "Jun","Jul","Aug","Sep","Oct", "Nov","Dec"]}}; // en_US locale reference
Calendar._DN = ["Sunday","Monday","Tuesday"," Wednesday","Thursday","Friday" ,"Saturday"]; // full day names
Calendar._SDN = ["Sun","Mon","Tue","Wed","Thu" ,"Fri","Sat"]; // short day names
Calendar._FD = 0; // First day of the week. "0" means display Sunday first, "1" means display Monday first, etc.
Calendar._MN = ["January","February","March", "April","May","June","July"," August","September","October", "November","December"]; // full month names
Calendar._SMN = ["Jan","Feb","Mar","Apr","May" ,"Jun","Jul","Aug","Sep","Oct" ,"Nov","Dec"]; // short month names
Calendar._am = "AM"; // am/pm
Calendar._pm = "PM";
// tooltips
Calendar._TT = {};
Calendar._TT["INFO"] = "About the calendar";
Calendar._TT["ABOUT"] =
"DHTML Date/Time Selector\n" +
"For latest version visit: http://www.dynarch.com/ projects/calendar/\n" +
"\n\n" +
"Date selection:\n" +
"- Use the \xab, \xbb buttons to select year\n" +
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)";
Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)";
Calendar._TT["GO_TODAY"] = "Go Today";
Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)";
Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)";
Calendar._TT["SEL_DATE"] = "Select date";
Calendar._TT["DRAG_TO_MOVE"] = "Drag to move";
Calendar._TT["PART_TODAY"] = ' (' + "Today" + ')';
// the following is to inform that "%s" is to be the first day of week
Calendar._TT["DAY_FIRST"] = "Display %s first";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";
Calendar._TT["CLOSE"] = "Close";
Calendar._TT["TODAY"] = "Today";
Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
// date formats
Calendar._TT["DEF_DATE_FORMAT" ] = "%b %e, %Y";
Calendar._TT["TT_DATE_FORMAT"] = "%B %e, %Y";
Calendar._TT["WK"] = "Week";
Calendar._TT["TIME"] = "Time:";
CalendarDateObject._LOCAL_ TIMZEONE_OFFSET_SECONDS = -28800;
CalendarDateObject._SERVER_ TIMZEONE_SECONDS = 1333496531;
//]]>
</script>
Monday, March 26, 2012
USING SPECIAL CHARACTERS IN MAGENTO EMAIL TEMAPLATES
It took me quite a few hours to figure out that email templates does not support special characters ,
So i replaced special characters in all phtml file with the corresponding character code.
You can find all character code in the below mentioned site.
http://www.utexas.edu/learn/html/spchar.html
So i replaced special characters in all phtml file with the corresponding character code.
You can find all character code in the below mentioned site.
http://www.utexas.edu/learn/html/spchar.html
Saturday, March 24, 2012
Magento cron jobs and cron scripts
http://fishpig.co.uk/magento-tutorials/magento-cron-jobs
http://inchoo.net/ecommerce/magento/creating-cron-script-in-magento/
magento:set custom theme for a particular page
We can set custom theme for a particular page in magento by adding following code in the corresponding controller:
In the example below i have applied custom theme for subscribe action, You can apply to your action e.g. indexAction,checkoutAction..etc.
public function subscribeAction()
}
In the example below i have applied custom theme for subscribe action, You can apply to your action e.g. indexAction,checkoutAction..etc.
public function subscribeAction()
{
..
..
..
Mage::getDesign ()->setTheme('fYour theme name'); /* Now you know the secret */
$this->loadLayo ut();
$this->renderLa yout();
$this->loadLayo
$this->renderLa
}
magento get store email address and name code
$frm_name = Mage::getStoreConfig('trans_email/ident_general/name'); //fetch sender name in Admin
$frm_email = Mage::getStoreConfig('trans_email/ident_general/email'); //fetch sender email Admin
Wednesday, March 21, 2012
REMOVING FACEBOOK COMMENT PLUGIN WARNING
My problem solved by
adding a forward slash "/" in href attribute value.
<fb:comments
href="http:www.mywebsiteurl.com/xyz/prodcuct.phtml/" width="670"
></fb:comments>
Sunday, March 18, 2012
REMOVING ERROR: llegal scheme supplied, only alphanumeric characters are permitted
HI, this error occured when i was installing magento 1.6 on the server. But the solution in the following post worked for me like charm.
All you have to do is
step1: clean your cache i.e. var/cache folder
step2: clean browser cookies
step3: download the attachment in the following post and upload the folder to your server.That's all.
http://www.danneh.org/2011/11/bug-magento-1-6-1-0-affecting-development-sites-base_url/
All you have to do is
step1: clean your cache i.e. var/cache folder
step2: clean browser cookies
step3: download the attachment in the following post and upload the folder to your server.That's all.
http://www.danneh.org/2011/11/bug-magento-1-6-1-0-affecting-development-sites-base_url/
Friday, March 16, 2012
MAGENTO set default zoom level in unirgy store locator
This will work in case of unirgy store locator, if you have already
configured store locator and the map is successfully displaying store
location.
You have to make small change in map.phtml
Here are the steps:
1.Go to frontend/default/default/template/unirgy/storelocator
2.In function searchLocationsNear() you will see map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
3.just change map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
To
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)-5); //I used 5 here , you can user any no. u want acording to the zoom level.
You have to make small change in map.phtml
Here are the steps:
1.Go to frontend/default/default/template/unirgy/storelocator
2.In function searchLocationsNear() you will see map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
3.just change map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
To
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)-5); //I used 5 here , you can user any no. u want acording to the zoom level.
Wednesday, March 7, 2012
Prototype document.ready equivalent
Event.observe(window, 'load', function()
{
//do your stuff here
});
MAGENTO SET SUCCESS MESSAGE
Mage::getSingleton('checkout/session')->addSuccess("Your
Event has been created successfully!");
Tuesday, February 21, 2012
GET CKEDITOR VALUE JQUERY
jQuery("#cke_contents_comments iframe").contents().find("body").text();
In my case the textarea id was comments so i have used #cke_contents_comments
In my case the textarea id was comments so i have used #cke_contents_comments
Wednesday, February 15, 2012
jQuery restrict upload file types
var ExtensionList = ['jpeg', 'jpg', 'png', 'gif', 'bmp'];
jQuery("#file").change(function () {
if (jQuery.inArray(jQuery(this).val().split('.').pop().toLowerCase(), ExtensionList ) == -1) {
alert("Only \'jpeg\', \'jpg\', \'png\', \'gif\', \'bmp\' are allowed.");
jQuery(this).val('');
}
});
jQuery("#file").change(function () {
if (jQuery.inArray(jQuery(this).val().split('.').pop().toLowerCase(), ExtensionList ) == -1) {
alert("Only \'jpeg\', \'jpg\', \'png\', \'gif\', \'bmp\' are allowed.");
jQuery(this).val('');
}
});
Tuesday, February 14, 2012
SET DEFAULT STORE VIEW FOR CATEGORY AND PRODUCT LIST IN ADMIN MAGENTO
adminhtml/default/default/template/store/switcher.phtml
CHANGE THE FOLLOWING LINE OF CODE
<option value="<?php echo
$store->getId() ?>"<?php if($this->getStoreId() ==
$store->getId()): ?> selected="selected"<?php endif;
?>> <?php echo
$store->getName() ?></option>
TO
<option value="<?php echo $store->getId() ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php elseif($store->getId()==4):echo "selected='selected'"; endif; ?>> <?php echo $store->getName() ?></option>
PROTOTYPE /JQUERY CONFLICT IN MAGENTO.
To rectify the error just open the jquery’s js file ,scroll down to bottom and write
jQuery.noConflict();
at the end of file.
jQuery.noConflict();
at the end of file.
REMOVE WARNING : event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
Use the following code:
jQuery(function(){
// remove layerX and layerY
var all = jQuery.event.props,
len = all.length,
res = [];
while (len--) {
var el = all[len];
if (el != 'layerX' && el !=
'layerY') res.push(el);
}
jQuery.event.props = res;
}());CHANGE LANGUAGE DROPDOWN INTO LINKS MAGENTO
GOTO: /app/design/frontend/*/template/page/switch
There You will find languages.phtml
Replace the code with:
<?php if(count($this->getStores())>1): ?>
<div class="form-language cls-lang">
<ul class='cls-ul-lang'>
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<li>
<a href="<?php echo $_lang->getCurrentUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/flags/' . $this->htmlEscape($_lang->getCode()) . '.jpg') ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Now in the frontend you will see links instead of dropdown.
upload images for the links in the path by inspecting those links.
create flags folder under
/skin/frontend/base/default/images/
and upload images there
Replace the code with:
<?php if(count($this->getStores())>1): ?>
<div class="form-language cls-lang">
<ul class='cls-ul-lang'>
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<li>
<a href="<?php echo $_lang->getCurrentUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/flags/' . $this->htmlEscape($_lang->getCode()) . '.jpg') ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Now in the frontend you will see links instead of dropdown.
upload images for the links in the path by inspecting those links.
create flags folder under
/skin/frontend/base/default/images/
and upload images there
Removing cart from magento home page
Please visit the site below for this.
http://anasabdullatheef.com/magento/how-to-remove-mini-cart-from-magento-home-page/
http://anasabdullatheef.com/magento/how-to-remove-mini-cart-from-magento-home-page/
Using toplinks in footer or in any phtml file
<?=$this->getLayout()->getBlock('top.links')->toHtml()?>
Subscribe to:
Posts (Atom)