troubleshooting


12
Nov 09

How to install Google Affiliate pixel tracking code in Magento

Took me a day of scouring the web to figure out how to get this to work. After adding this code do a test order and view source and confirm it worked.

#copy and paste to the bottom of
#app/design/frontend/default/theme_name/template/checkout/success.phtml
$companyID = "K123456"; #provided by Google
$category = urlencode("Your product category");
$lastorderid = Mage::getSingleton('checkout/session')->getLastOrderId();
$_order = Mage::getModel('sales/order')->load($lastorderid);
$orderID = $this->getOrderId(); #get the order ID
$aProduct = array();
$totalAmt = 0;
$prdsku = "";
$prdnm = "";
$prdqn = "";
$prdpr = "";
$prcatid = "";

###########store order data in array of objects###########
foreach ($_order->getAllItems() as $item) {
	$oProduct = new stdClass();
	$oProduct->sku = $item->getSku(); #sku
	$oProduct->price = $item->getPrice(); #price
	$totalAmt = $totalAmt + ($oProduct->price * $item->getQtyOrdered()); #total amt (excl.tax/shipping)
	$oProduct->qty = $item->getQtyOrdered(); #quantity
	$oProduct->name = $item->getName(); #product name
	$oProduct->category = $category;
	array_push($aProduct, $oProduct);
	$oProduct = NULL; #nuke it
}
###########build query string variables###########
for ($i=0; $i < count($aProduct); $i++) {
	if ($i == count($aProduct)-1) {
		$prdsku .= urlencode($aProduct[$i]->sku);
		$prdnm .= urlencode($aProduct[$i]->name);
		$prdqn .= urlencode($aProduct[$i]->qty);
		$prdpr .= urlencode($aProduct[$i]->price);
		$prcatid .= urlencode($aProduct[$i]->category);
	} else {
		$prdsku .= urlencode($aProduct[$i]->sku) . "^";
		$prdnm .= urlencode($aProduct[$i]->name) . "^";
		$prdqn .= urlencode($aProduct[$i]->qty) . "^";
		$prdpr .= urlencode($aProduct[$i]->price) . "^";
		$prcatid .= urlencode($aProduct[$i]->category) ."^";
	}
}
?>



17
Sep 08

What happens if you break your iPhone in Canada?

http://farm4.static.flickr.com/3044/2865235637_4caa172910_m.jpgMy friend Paul broke the glass of his iPhone this past weekend, a horrific sight for any iPhone owner. In Canada, you can’t buy the 3G iPhone from Apple directly, you have to go through Rogers and that requires signing up for a 3 year contract. When he went to Rogers, they said the only way they could ’sell’ him a new phone was if he paid out the remainder of his existing contract, which works out to about $3,000 CDN…THREE THOUSAND DOLLARS!

After much arguing / pleading with store managers and speaking with the staff at the Apple store in the Eaton’s Center he was still unable to get a replacement. Not really surprising though, If the damage is inflicted by you, and not a fault of the device – i.e shattering the screen, you are on your own. The bottom line is, in these situations your best option is to speak with Apple to find a certified iPhone repair depot which can fix the damage for you. One unfortunate side effect of repairs such as replacing the glass screen is they void your warranty.


17
Jul 08

How to clean up your address book for MobileMe

If you’re like me, you’ve imported your contact list from Gmail which means thousands of names & email addresses you don’t really care about – ugh what a mess! What i am now doing is trying to maintain proper groups for family, friends & business contacts. So how do you get rid of all the clutter? First get the contacts you care about into an address book group – doesn’t matter what you call it. In my case i called it “Friends & Family”. Then create a smart group that looks for your contacts that are NOT in your groups. Go into that smart group, select everything (CMD+A) and delete. You now how have a nice clean address book which will sync between your iphone / mac / pc.


5
May 08

Sendmail says: stat=Deferred: Connection reset

I have been struggling with this problem for the last 2 days and finally figured out the solution. Your mileage may vary depending on your network configuration but first some background on mine. I have a Lighttpd web server that i am running some PHP mail scripts on. We are trying to use our company’s MTA to relay messages so i had this line in the sendmail.cf file, with 10.0.0.116 being the IP address of our MTA.

define(`SMART_HOST', `10.0.0.116')dnl

Still, things didn’t seem to want to work. My network administrator wasn’t evening seeing the mail attempts on our mail server so the problem was definitely on the webserver.
Turns out (as these things often are) that it was a dumb syntax problem. The following change fixed everything:

define(`SMART_HOST', `[10.0.0.116]')dnl

Hope this helps if you are having a similar problem.


31
Mar 08

Phpmyadmin error: “Cannot start session without errors”

I have been trying to get phpmyadmin working on my Fedora 8 server i’ve been setting up, and struggled for the past day or so on this error:

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

Turns out it’s very easy to fix. First thing you’ll want to do is have a look at your error logs. For me this was in /var/log/lighttpd/error.log (i’m using lighttpd instead of Apache). Have a look at your error log and you will probably see errors referencing permission errors writing to your session directory.

Simply chmod 777 that directory and you should be good to go.


4
Mar 08

How to setup a static route in OSX Leopard

I am in a situation at my office where i need a few static routes to reach external webservers. I had this working in 10.4 thanks to the tip over @ Macosxhints however after upgrading to Leopard my routes didn’t seem to get added to my routing table. I called Apple support this morning and they had no idea and actually said they don’t support this sort of thing either. Google searches came up dry however i figured out via a few terminal commands you can get it working manually. Here’s how. Pop open Terminal, and type:

su

You’ll then need to enter your root password. Strangely this didn’t work for me at first. If you have this problem too, open up Directory Utility (apps/utilities) and then click on ‘edit’ and ‘enable root user’.
Once you have root access, you can create your static routes, here is the command:

route add –net 192.168.5.0 10.0.1.5

192.168.5.0 is the network i’m trying to reach, via the gateway 10.0.1.5.

Update: Recently this stopped working for me, not sure if it was an OSX update or something with our internal network. In any case, this solved the problem for me:

sudo route add -net 192.168.5.0/24 10.0.1.5