Saturday, July 25, 2009

Wordpress template excerpt

I needed to add excerpt functionality to a custom WordPress theme and found the following article to be just the ticket.

Replacing Wordpress content with an excerpt without editing the theme files

Magento multi store granular permissions

Magento eCommerce allows granular permissions in there community edition. Granular permissions are accessed by creating a role and assigning users to roles. However the community editions granular permissions apply to all stores multi-store install. For granular permissions per store instance on a single install you need to purchase Enterprise which costs $8,900+ per year.

Wednesday, July 22, 2009

PHP and type casting

I was going through some of my notes and found an issue that gave me some trouble. About a year ago I was working on a custom shopping cart, and ran into trouble with PHP's type casting. I was multiplying a float (price) by an int (quantity) and PHP was converting the float to an int by dropping the decimal part of the number before doing the multiplication. Obviously this was causing trouble with the total price charged. The fix was to force the int to a float before the multiplication.
$lineTotal = (float) $price * $quantity;

Magento eCommerce

One of my clients is setting up a multi-store instance of Magento - and wanted to change each stores home page. I have not used Magento in a multi-store instance before so I had to look up the details.

Ok - here is what you want to know - I updated one of the stores - the required steps as follows
1) create a new page in the cms (named something like store-home)
2) If you have not already, create the new store
3) in admin open menu System->configuration
4) select box at top left - choose the entry 'english' under 'Maria's Botique'
5) left menu - choose 'web'
6) on right choose 'default pages'
7) modify the 'cms home page' by choosing the custom page we created in step 1
8) done

My reference material can be found here

Saturday, July 18, 2009


One of my clients is implementing an instance of SugarCRM - the recently setup several webToLead forms and wanted to require a set of fields other than the default. After poking around a little (on the documentation) I took a look at the page source. The solution proved quite simple.

<input id="req_id" name="req_id" value="first_name; last_name;webtolead_email1;" type="hidden">

As you can see - adding new id entries to the value of this field makes those fields required.
P.S. name and id appear to be set the same on every field - but the javascript appears to be using the id for verification.

Facebook advertising

One of my clients has decided to run a simple advertisement on facebook - the stats so far are interesting. We choose to go with pay per impressions to start with. The ad links through to a page on facebook, so there is a 'fan' link at the bottom of each ad.

Currently we are seeing
a) 1000 impressions per actions
b) 1.8 actions per fan
c) 8 fans per person who follows one of the links on the facebook page through to our website
d) 2 people on our website per 1 who fills out the form for the free promotional item.

This will bear watching to see how things develop as we attempt to tweak the settings

(UPDATE) We tried an ad the directed people to the website form directly instead of going through a facebook page - all that seemed to do was drop us straight down to step c - which means fewer fans but the same number of website visits per advertising $.

Development challange

I have recently been working on Joomla - running among other things an instance of Mosets tree 2.1. I have been working on a custom import from an external database. While you can get Mosets to rebuild its hierarchy using
this will not always manipulate your data into a form that Mosets can use.
I ran into trouble until I found that the root element must have an id of 0 and it must have a parent of -1. Any id other than 0 will not fail catastrophically, however it will not work properly either (I was seeing around 5% of the elements in the table showing up).

Desktop utility

I don't find myself using many windows add-ons - but this one is actually proving useful.
Stardock Fences

Business counsel

Radical Career success in a down economy - just finished listening and found many interesting points. In my opinion just about any employee or entrepreneur can benefit from many of the concepts presented.