Recently I’ve had to import a client’s catalog data from Excel 2007 to the Magento eCommerce Platform. The data in Excel was unsurprisingly in a format that was unsupported by Magento’s import methods. Using code, I needed to parse Excel data into the format Magento required. In PHP, I wasn’t aware of any way to interface with .xls or .xlsx files, so I tried exporting the data to flat-file CSV, where it could be easily manipulated using PHP’s native CSV functions.
Category :: Programming
Aug 09
When using a chart control to plot data from a stored procedure (or any query for that matter), the stored procedure needs to return series’ in columns. Data to be plotted has to be in numeric form. How, then, can we label the series? Perhaps one would think to add a row at the top of the result set to contain the labels. But that won’t work because the column data types are numeric and the labels are most likely strings.
Aug 09
If you’re having trouble plotting series of data using the Chart Control, make sure that the data coming in is plottable.
That means using a numerical data type. Duh!
Aug 09
At some point in our programming careers, we’ve had to reorder server-side (probably database driven) lists. For example, allowing users to set the specific sequence that image thumbnails are displayed on the front-end of a photo album.
For “move-item-forwards” functionality, the logic may look like:
move_item_up( index ){ Store the element at index 3 to a temporary variable. Set the value of index 3 to the value of index 4. Set the value of index 4 to the temporary variable's value. }
The “technique” comes into play now, when you have to do the “move-item-backwards” functionality.
Instead of:
move_item_back( 4 );
Simply use:
move_item_up( 3 );
Moving an item backwards in a list is the same as moving the previous item forwards. This technique is rather simple and perhaps painfully obvious to some, though it may be useful to others.
Jun 09
Many of Microsoft’s development products, when given an SQL query, will try to perform all sorts of analysis and breakdowns on the query — usually in an attempt to visualize what’s going on. When the queries become too complex (as the tend to be), they just can’t be parsed and visualized. Furthermore, when the successful parsing of a query is critical to one of their “wizards”, your report creation process can be brought to a standstill.
Queries that have a few levels of subquery nesting, or that have UNIONs, for example, will sometimes break parsing.
So, if you don’t want your development tools (such as Visual Studio) to get in the way of completing a report wizard, put your SQL query in a stored procedure. This way, your tools won’t be concerned with the nitty gritty details of your query. You can still pass @variables to the query, and you can make changes to the query without stepping into your designer’s .rdlc files.
Jan 09
It’s been almost three weeks now since I’ve started learning the Magento ecommerce platform. With an impressive array of features, like product comparisons and a web services API, the platform sounds promising. I had hoped that by the time I’d revisit this topic, I’d be able to say I’ve successfully implemented the software. Instead I’m having trouble setting up my product catalog (it involves importing).  And how can I forget to mention the overall issue of speed?
Let’s start at the beginning, at installation. Your web server likely has capable hardware, so you need to be sure that your software configuration meets requirements. Luckily the host I’m on was set up just fine the way it was. Obviously you need to download the software – I chose to download the Full Release (version 1.1.8 at the time). Read more »
Jan 09
We’ve all seen long and unmanageable CSS files, sometimes hundreds or even thousands of lines long. Finding the exact declaration you’re looking for can be a royal pain in the arse. It’s worse when style declarations for a particular element can be found more than once in a file, such as when the coder wants to separate structural styling from say typography styling.
Jan 09
I had known for a while that there was an iPhone application for Wordpress but for the longest time I couldn’t get it to work properly. Thankfully, we have Google as a resource, and a little querying quickly led me to a solution.
This is a problem that is likely to affect shared hosting. You have to add the following lines to your .htaccess file (or create an .htaccess file with these lines):
Dec 08
Revisiting the topic of my previous post, I’ve played around some more with this PHP HTTP Class. This morning, I’ve figured out how to send files over HTTP (actually HTTPS, but it works the same way). If you’ve looked through the author’s test scripts, you see that for file uploads, the provided example is:
$arguments["PostFiles"] = array( "userfile" => array( "Data" => "This is just a plain text attachment file.", "Name" => "attachment.txt", "Content-Type" => "automatic/name", ), "anotherfile" => array( "FileName" => "test_http_post.php", "Content-Type" => "automatic/name", ) );




