Problems With Magento Installation

1 08 2010

Problem 1. Installing MCrypt on Mac
Mac OS X comes with pre-installed PHP which needs to be switched on and most likely updated to the latest version of PHP which is simple enough however installing MCrypt is a major pain. After spending 2 hours on this, I think the best thing to do is to use MAMP instead. Comes with Apache, PHP and MySQL.. SWEET!!!

Problem 2. Can’t log into admin
So Magento is installed on the localhost and now I can’t log into admin..

There are lots of workaround like changing the Varien.php file if you google this however they didn’t work for me so..

Please uninstall and make sure you reinstall Magento on http://127.0.0.1 instead of http://localhost/

Advertisements




Escape special characters in SQL statement

1 08 2010

mysql_real_escape_string(string,connection)

$user = mysql_real_escape_string($user);
$pwd = mysql_real_escape_string($pwd);
$sql = "SELECT * FROM users WHERE user='" . $user . "' AND password='" . $pwd . "'"





Change Last Modified Header

1 08 2010

At the top of the file in php tags:

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");





CSS Gradient

1 08 2010

IE
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#cccccc’, endColorstr=’#000000′);

Safari/Chrome
background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000));

Firefox 3.6+
background: -moz-linear-gradient(top, #ccc, #000);





How to edit email templates

1 08 2010

1. Create new template in System -> Transactional Emails -> [Add New Template]
2. Select [Template] to edit
3. [Template Name]: Unique name to identify template
4. [Template Subject]: The subject of the email

Variables for Subject:
Customer Name: {{var customer.name}}
Order No.: {{var order.increment_id}}
Store Name: {{var store.getFrontendName()}}
Shipping No.: {{var shipment.increment_id}}

5. [Template Content]: Easier to grab existing template to modify in (app/locale/en_US/template/email)
6. [Save]

7. Change Customer Email in System->Customer Configuration
8. Change Orders/Shipping Email in System->Sales Emails





Min-Height Fix

1 08 2010

IE6 Compatability.. ARGH

content {
  min-height:300px;
  height:auto !important;
  height:300px;
}





Select Random Row

29 06 2010

Select id FROM table ORDER BY RAND() LIMIT 1