To make the theme preview work, in JS in the admin you will need to add… Then to output in your theme you can either output directly using… However, since we are saving this in the DB as an attachment ID, you will probably want to create a template tag function to convert it to […]
How to Setup a LAMP Stack on CentOS
For the purpose of this tutorial, we will use yourdomain.tdl as our domain. Anytime you see something like {yourdomain.tdl} or anything similar enclosed in curly braces, please replace with the text specific for your setup. Install Apache Server on CentOS Install [code]yum install httpd[/code] Set to startup Apache on boot [code]chkconfig –levels 235 httpd on[/code] […]
Strip slashes from arrays, objects and strings in PHP
I originally needed this in a PHP class that was pulling my data coming from MySQL. This function removes the slashes from varying input types of arrays, objects and strings so no matter what you input, you will get it back in the same format… minus the slashes, of course. To modify for use in […]
Magento Custom Price Lost on Order Edit
This is an annoying bug that is still an issue with the current version of Magento (v1.7.0.0 as of this writing). I have opened Issue #27867 with Magento and am hoping that this can finally be resolved in the core code. In the meantime, to fix this issue we need to make a tweak to […]
PHP Tips to Display Errors, Warnings and Notices
Adding these two little lines at the top of your code can often solve a world of questions you have on why your code isn’t working. Make sure they are placed at the very top right after the opening <?php tag. If anything is output before them it will not work properly. Another helpful tool […]
How to Fix Slow Product Saves in Magento
In earlier versions of Magento you may have noticed that saving products is horribly slow especially as your site grows. This problem originates from a bug in MySQL 5 (bug #42259) where using “IN” can dramatically decrease performance. This appears to have been corrected in Magento 1.7.x. However, if upgrading isn’t an option for you […]
Create MySQL Database and Add New User (command line)
Here is a quick example of how to create a database, assign a new user and set their password. Connect to MySQL server as user “root” (you will be prompted for a password) The “mysql>” prompt will now appear. Create new database… we’ll call it “orders” Give user (named “fluffy”) full permissions Set password for […]
Get file extension from a string in PHP
Sometimes you just need to get the file extension from a string. Here are a couple quick solutions to get it in literally 1 line of code. Option #1 Option #2
Tip for Validating Cookies
When displaying and using cookies it is important to validate them especially when they are integral to the functionality of the page. Make sure to check to see if the cookie is set before displaying it.