Christopher Shennan’s Blog

A day in the life of…

Browsing Posts published in November, 2009

csNews Pro

No comments

It’s taken me a while but I’ve finally managed to create the “My Projects” section started although in all likelyhood I’ll not have much time to devote to my projects.

I’ve started off by resurrection an old project that I worked on while I was self employed as Design2Host Ltd.  csNews Pro (formerly V-Desk Newsletter System Pro) has had a few cosmetic details changed (changed the name, removed the licence key limitions) but it’s exactly the same project and it is compatible with the paid version that was original available so you can easily convert from the previous paid version across to the free version when any updates become available.

Feel free to download and play with csNews Pro and feel free to give my any feedback on it.

Bookmark and Share

I am often importing data into a symfony project from an existing site or a CSV file and re-writing this data into the fixtures.yml is usually too complicated or time consuming so I end up writing bespoke import actions.

While I am writing these actions I often find that I have to delete the contents of the MySQL tables as you can never write the routine complete and accurate in one go so as you build it up in smaller steps you find that you have to get rid of the previously old data.

This presented me with 2 problems:-

  • Using DELETE FROM [TABLENAME] does not reset the auto-incrementing fields so if you have anything that is based on the id during the rest of the import then you’re going to have issues.
  • There is a lot of clicking in phpMyAdmin to empty the tables, especially if you forget about the foreign key relationships.

continue reading…

Bookmark and Share

Another day… another magento problem!

I was asked to look into a problem with an automated stock level update script not updating the stock levels.  This update script was using the Magento API and on the face of things everything looked ok as the script ran without any errors, the product prices got updated but the stock levels never changed.

After a bit of investigating I found the problem was caused by an incorrect usage of the Magento API and the original update statement was similar to:-

$proxy->call($sessionId, 'product.update',
	array('PRD0001', 
		array(
			'price'=>12.50, 
			'qty'=>12, 
			'is_in_stock'=>1, 
			'discontinued'=>0
		)
	)
);

However, the update of the is_in_stock and qty fields is not done against the product (via product.update) but against the product inventory (via product_stock.update) so this code had to be updated to the following:-
continue reading…

Bookmark and Share