You can find the Magento events / observers of latest version at http://www.nicksays.co.uk/magento_events_cheat_sheet/
Thursday, 15 March 2012
Creating your own Magento session
Suppose you have to access your Magento session from outside the Magento system (and it’s folders), and also, you want to put some relevant data into session and retrieve it on the other side. The following procedure on the Magento side will allow you to do that:
where MyData is the name of your attribute, and you will retrieve it with getMyData. Here, you can use any name you wish, but try to avoid names which can collide with the existing API and reserved words.
On the other side you can access the session and get the data with the following code:
On the line 1 the access to the main Magento folder is required, so here you either specify relative or absolute path to the Mage.php. The parameter true on the line 7 function call is the flag for “retrieve and remove from session” .
I found this useful information here
1 | Mage::getSingleton('core/session')->setMyData('exampleString'); |
On the other side you can access the session and get the data with the following code:
1 2 3 4 5 6 7 | $mageFilename = realpath('MageShop/app/Mage.php'); require_once( $mageFilename ); umask(0); Mage::app(); $session = Mage::getSingleton('core/session', array('name' => 'frontend')); $data= $session ->getMyData(true); |
I found this useful information here
Friday, 9 March 2012
SKYPE and WAMP server conflicting
The issue is Skype and Wamp server both are using same port number 80.
Skype Tools->Options->Advanced->Connection->UNCHECK "use port 80 and 443 as alternative incomming ports".
That's all you are done!!!!!
Skype Tools->Options->Advanced->Connection->UNCHECK "use port 80 and 443 as alternative incomming ports".
That's all you are done!!!!!
Apache / Wamp not starting in Windows XP
1. Check the Apache, MySql and PHP log files for any errors.
2. Check whether any other application is running on same port as described below
Commands to see the process list along with Process ID (PID)
Netstat –o
netstat -aon
To Kill the process using ID
taskkill /PID 827To Forcefully Kill the process using ID
taskkill /F /PID 827More Information can be found at :
Add column to mysql table if it does not exist in the table
<?php
$DBHOST = 'HOSTNAME';
$DBUSER = 'USERNAME';
$DBPASS = 'PASSWORD';
$DATABASE = 'DBNAME';
$table = 'talble_name';
$column = "column_name";
mysql_connect($DBHOST,$DBUSER,$DBPASS) or die(mysql_error());
mysql_select_db($DATABASE) or die(mysql_error());
$result=mysql_query("SELECT $column FROM $table;");
if (mysql_errno())
{
echo "Unknown column CREATE one first";
// Alter table add column goes here
}
else
{
echo "column exists";
}
mysql_close();
?>
$DBHOST = 'HOSTNAME';
$DBUSER = 'USERNAME';
$DBPASS = 'PASSWORD';
$DATABASE = 'DBNAME';
$table = 'talble_name';
$column = "column_name";
mysql_connect($DBHOST,$DBUSER,$DBPASS) or die(mysql_error());
mysql_select_db($DATABASE) or die(mysql_error());
$result=mysql_query("SELECT $column FROM $table;");
if (mysql_errno())
{
echo "Unknown column CREATE one first";
// Alter table add column goes here
}
else
{
echo "column exists";
}
mysql_close();
?>
Wednesday, 7 March 2012
Magento: Format Price
<?php echo $formattedPrice = Mage::helper('core')->currency('100.00',true,false); ?>
OR
<?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?> 90.00
OR
<?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?> 90.00
Wednesday, 22 February 2012
Customizing the Magento Error Report and Maintenance Page
There are several Error Report and Maintenance Pages 404, 503 and Error report. Customizing the each page information can be found at below link.
http://magebase.com/magento-tutorials/customizing-the-magento-error-report-and-maintenance-page/
http://magebase.com/magento-tutorials/customizing-the-magento-error-report-and-maintenance-page/
Subscribe to:
Posts (Atom)