Engine23

Development

Seamless CSS and JavaScript Minification in PhpStorm

If you are using PhpStorm then css and javascript minification is a set it and forget it process that requires no maintenance after setup.  As a programmer it doesn’t get any better than that, so I felt very silly for not doing a good job of it over the years when I figured out this trick.  It took a minute to figure out as i’m using Mac OSX Maverick, and all of the articles on it were for Windows.  So, if you’re stuck and on windows you should be good to find specifics with a quick google.  Alright, lets get going.

 

First, this was also my introduction to Node.js, but not to worry if it is yours too, we will only be using it as a simply command line utility.  Head over to http://nodejs.org/ and click install to download, and then run the pkg, defaults will work.  Then go into PhpStorm and install the node.js plugin to finish that integration.  A little note, /usr/local/lib/node_modules  is the important directory and it should hold by default npm ( Node Package Manager ). And by default everything should be symlinked so the npm command will work anywhere.

 

Download:

Read more

Magento - Remove the trailing slash getUrl

Here is how you can use the URL key for a product, using getUrl and avoid the trailing slash

If you use

$box_url = Mage::getUrl('our-box.html');

and echo that string you will get something like

http://whatever.com/our-box.html/

That of course is not right and you probably will get a 404 page. Unless you did a URL rewrite but that is another topic all together. Here is how to use the same function, but use a parameter instead

$box_url = Mage::getUrl('', array('_direct'=>'our-box.html'));

That will get us what is needed so echoing this string gets us

http://whatever.com/our-box.html

Magento - Getting rid of the sidebar Compare Products

Some times, your theme does not need the compare products in the sidebar for a 2 column layout.

Here is the xml you add to your app/desing/PACKAGENAME/THEMEFOLDER/layout/local.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<span ><reference name="right">
<span ><action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</reference>

</default>
</layout>

Make sure you refresh your caches and you should see that go away.

Read more

Mysql - File not found

If you have a mac and have upgraded to the latest operating system 10.10, you may find that mysql is not able to connect.

The fix is pretty easy, its an update to the php.ini

What we need to do is tell mysql to connect through localhost instead of 127.0.0.1

First locate the php.ini you can use the following command in terminal

locate php.ini

Look for something like /private/etc/php.ini

This is an example of what may come back

/Users/engine23/php.ini
/private/etc/php.ini-5.2-previous
/private/etc/php.ini.default
/private/etc/php.ini.default-5.2-previous

You may have may of them and if you dont have one called /private/etc/php.ini it may be named /private/etc/php.ini.default, if so copy that and rename it to just php.ini.

sudo cp /private/etc/php.ini.default /private/etc/php.ini

Now you know what file to edit, using terminal edit that file

sudo vim /private/etc/php.ini

Read more

Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server

mysql> CREATE USER 'edreamery_prod'@'localhost' IDENTIFIED BY 'edreamery_prod'; Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'edreamery_prod'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec) mysql> CREATE USER 'edreamery_prod'@'%' IDENTIFIED BY 'edreamery_prod';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'edreamery_prod'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)

Magento - SOAP Fatal Error unable to connect

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://dev.magento19.com/index.php/api/soap/index/?wsdl=1' : Extra content at the end of the document in /Users/engine23/Sites/local.magento18.com/test.php:5 Stack trace: #0 /Users/engine23/Sites/local.magento18.com/test.php(5): SoapClient->__call('login', Array) #1 /Users/engine23/Sites/local.magento18.com/test.php(5): SoapClient->login('rjalbin', 'peanut') #2 {main} thrown in /Users/engine23/Sites/local.magento18.com/test.php on line 5

So, basically it boils down to bad URL in the request.


	login('rjalbin', 'peanut');
// View all customers
var_dump($proxy->call($sessionId, 'customer.list', array('filters', '*')));
?>

Read more