Subscribe To RSS Feed


Mike D's SharpBlog

Just another Sharpdot weblog

Archive for the ‘Uncategorized’ Category

Zend Framework (zf): Multi-Step Form with dynamic Elements

- Monday, July 26th, 2010 -

Coming Soon: Tutorial on how to make a multi-page form and also how to use dynamic elements on the form.

Posted in Uncategorized | No Comments »

Zend Studio: How to fix Code Completion, when it stops working

- Sunday, July 25th, 2010 -

I have ran into an issue/bug with zend studio/eclipse IDE, every once an a while code completion will stop working. I have not been able to pin down what exactly causes the problem, but here is my fix.

Delete the following file in the Zend Studio workspace:

Zend/workspaces/<your workspace name>/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.dltk.ui.prefs

Posted in Uncategorized | No Comments »

Magento: Upgrading to 1.4

- Wednesday, June 9th, 2010 -

This is my upgrading Magento to Version 1.4 journey.

Here is how I decided to go about it.

  • Backup the database!!
  • Clear all cache and disable caching
  • Move code into a SVN Branch (assuming you use source controll, if you don’t you should!)
  • Remove Old Core Magento Code (just leave community and local modules, keep my theme folder)
  • Download Full Release from Magento’s Website(don’t use the downloader, use the full release!)
  • Extract the New Release into the SVN Branch that was created earlier
  • If your template was a sub-template of anther theme then you need to merge them together to use in 1.4. This is due to the fact that 1.4 changed a bunch of classes and layouts. Or you could start from a fresh theme and re code it.
  • Change the theme to a default theme until you are sure that the update went ok.

Errors and Bugs I came across:

  • When Trying to run indexing I got the following error, “can’t initialize indexer process”. This was because I was missing some database tables that failed to install during the upgrade. I installed and ran the database repair tool.
  • Had to disable WYSIWYG so that page templates did not get messed up.
  • The file “catalog/product/list/toolbar.phtml” changed quite a bit, so if you modified this file grab the new one then start from there. Also the file “page/html/pager.phtml” needs to be update the the 1.4 version if you modified this file.
  • When editing or adding products the Category Tree was only showing the Default or Root Category.
    To Fix this I just created a new subcategory of the root catalog and move all the categories into this new category then move them back to there original position. This must rebuild what ever was messed up in the database.

Posted in Uncategorized | No Comments »

Drupal: Adding Nodes Programaticly using drupal_execute()

- Friday, June 4th, 2010 -

I recently had to migrate data into Drupal. To do this I decided to just run drupal_execute(), to create the nodes. I ran into a few quirks and thought I would share my trials with the world.

My first issue was, How do I get the new node id that was created by drupal_execute(). Well It was easier than I thought. I did a little goggling and found people saying that you should use db_last_id(), well that did not work for me. Instead I used the “$form_state” variable that I passed into the drupal_execute function. I noticed that after running drupal_execute() I could use $form_state['nid'] to retrieve the nodes id. Wow wasn’t that easy.

The nodes I was creating were using cck fields. I noticed that only the first node’s cck fields were created correctly. All subsequent nodes were created with cck fields containing just 1 character(I believe this only happened on select fields). To fix this issue I had to use the node id that I retireved and set the cck fields again. Then do a node_save(). Now all my fields are correct and I can go Fishing.:)

Posted in Uncategorized | No Comments »

Magento – module not working on unix/linux server

- Thursday, March 19th, 2009 -

I am writing this more as a reminder to my self and anyone else who makes a module for magento. I created a module and it was working fine locally on my windows machine. When I uploaded the site to a unix/linux server the module seemed to stop functioning correctly. Here was the problem:

I had a Block class called SideNavigation.php. I called it using a layout file. It was suppose to provide custom CMS functionality with a side navigation menue.

Below is the code from the layout file that did not work.

<?xml version="1.0"?>
     <layout version="0.1.0">
          <cms_page>
               <reference name="left">
                    <block type="advancedcms/sidenavigation" name="advancedcms.sidenav" />
               </reference>
          </cms_page>
     </layout>

The reason this did not work is because unix machines are case sensitive where as Windows is not case sensitive. Magento turns sidenavigation in the above code into Sidenavigation. It allways capitalizes the first letter. So windows would match Sidenavigation to SideNavigation because it is case insensitive. unix/linux machines would not match Sidenavigation to SideNavigation. So I had to change my code to the following to work.

<?xml version="1.0"?>
     <layout version="0.1.0">
          <cms_page>
               <reference name="left">
                    <block type="advancedcms/sideNavigation" name="advancedcms.sidenav" />
               </reference>
          </cms_page>
     </layout>

Now magento turns it into SideNavigation and the layout file correctly points to the SideNavigation.php file.

Hope this helps anyone with a simmilar problem.

Just a closing thought: Wouldn’t it be nice to be able to make windows case sensitive, so you don’t have to do trouble shooting like this.

Posted in Uncategorized | 2 Comments »