Buying stuff from amazon, use this link:
Amazon link
Domain referal
MageRun magento scanning command line
go here:
https://github.com/netz98/n98-magerun/blob/master/readme.rst
Nexcess Australian Magento Hosting
Correcting Magento Migration to local server error
to correct this error on importing the database you need to open the .sql file in a large text editor like Elitepad Lite then remove all occurrences of:
ROW_FORMAT=FIXED
from the file then import,
THE ERROR CODE IS:
ERROR 1031 (hy000) AT LINE XXX TABLE STORAGE ENIGINE FOR ” DOESNT HAVE THIS OPTION
Connect to MySQL with PDO
This code connects to the DB and closes it:
/*** mysql hostname ***/
$hostname = ‘localhost’;
/*** mysql username ***/
$username = ‘username’;
/*** mysql password ***/
$password = ‘password’;
try {
$dbh = new PDO(“mysql:host=$hostname;dbname=mysql”, $username, $password);
/*** echo a message saying we have connected ***/
echo ‘Connected to database’;
/*** close the database connection ***/
$dbh = null;
}
catch(PDOException $e)
{
echo $e->getMessage();
}
Insert into database, put before close the DB
/*** INSERT data ***/
$count = $dbh->exec("INSERT INTO animals(animal_type, animal_name) VALUES ('kiwi', 'troy')");
/*** echo the number of affected rows ***/
echo $count;
Select from the DB:
/*** The SQL SELECT statement ***/
$sql = "SELECT * FROM animals";
foreach ($dbh->query($sql) as $row)
{
print $row['animal_type'] .' - '. $row['animal_name'] . '
';
}
Insert into DB:
/*** INSERT data ***/
$count = $dbh->exec("UPDATE animals SET animal_name='bruce' WHERE animal_name='troy'");
/*** echo the number of affected rows ***/
echo $count;
Fetch Code
/*** The SQL SELECT statement ***/
$sql = "SELECT * FROM animals";
/*** fetch into an PDOStatement object ***/
$stmt = $dbh->query($sql);
/*** echo number of columns ***/
$result = $stmt->fetch(PDO::FETCH_ASSOC);
/*** loop over the object directly ***/
foreach($result as $key=>$val)
{
echo $key.’ – ‘.$val.’
‘;
}
Fetch object
/*** The SQL SELECT statement ***/
$sql = "SELECT * FROM animals";
/*** fetch into an PDOStatement object ***/
$stmt = $dbh->query($sql);
/*** echo number of columns ***/
$obj = $stmt->fetch(PDO::FETCH_OBJ);
/*** loop over the object directly ***/
echo $obj->animal_id.’
‘;
echo $obj->animal_type.’
‘;
echo $obj->animal_name;
Create RSS feed from DB
RSS.class.php
class RSS
{
public function RSS()
{
// get database details from external file
require_once ('mysql_connect.php');
}
public function GetFeed()
{
return $this->getDetails() . $this->getItems();
}
private function dbConnect()
{
DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD));
}
private function getDetails()
{
$details = '
';
/* can add this in if needs be
*/
return $details;
}
private function getItems()
{
$itemsTable = "aw_blog";
$this->dbConnect($itemsTable);
$query = "SELECT * FROM ". $itemsTable . " WHERE store_id = 0 AND status = 1 ORDER BY post_id DESC ";
$result = mysql_db_query (DB_NAME, $query, LINK);
$items = '';
while($row = mysql_fetch_array($result))
{
$link = "http://www.quickplaysport.com/blog/" . $row['identifier'];
$attribution_link = "The article " . $row['title'] . " first appeared on Quickplaysport.com
";
$items .= '
}
$items .= '
';
return $items;
}
}
?>
[/code]
mysql_connect.php
DEFINE ('DB_USER', '*****');
DEFINE ('DB_PASSWORD', '****');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', '****');
// Make the connnection and then select the database.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
?>
index.php
include 'add_store_codes.php';
header("Content-Type: application/xml; charset=ISO-8859-1");
include("classes/RSS.class.php");
$rss = new RSS();
echo $rss->GetFeed();
?>
Turbosquid affiliate link
Homepage Only Links
this code displays a link only on the homepage:
<?
$currentpage = $_SERVER[‘REQUEST_URI’];
if ($currentpage == “” || $currentpage == “/” || $currentpage == “/index.php” || $currentpage == “/index.php/”) {
echo “Site sponsored by <a href=’http://www.quickplaysport.com/’ title=’Football Equipment from quickplaysport’>Quickplay Sport</a>”;
}
?>
get skinURL and Base URL in phtml and content blocks
GET SKIN URL, GET MEDIA URL, GET BASE URL, GET STORE URL
To Retrieve URL path in STATIC BLOCK
To get SKIN URL
{{skin url=’images/sampleimage.jpg’}}
To get Media URL
{{media url=’/sampleimage.jpg’}}
To get Store URL
{{store url=’mypage.html’}}
To get Base URL
{{base url=”}}
TO Retrieve URL path in PHTML
Not secure Skin URL
<?php echo $this->getSkinUrl(‘images/sampleimage.jpg’) ?>
Secure Skin URL
<?php echo $this->getSkinUrl(‘images/ sampleimage.gif’,array(‘_secure’=>true)) ?>
Get Current URL
<?php $current_url = Mage::helper(‘core/url’)->getCurrentUrl();?>
Get Home URL
<?php $home_url = Mage::helper(‘core/url’)->getHomeUrl();?>
Get Magento Media Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);?>
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);?>
Get Magento Skin Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>
Get Magento Store Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>
Get Magento Js Url
<?php Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);?>