Author Archives: Jason

Magento Get Category List As Admin Select

Magento CE 1.8.0.0 Sometimes we want to retrieve a list of all categories on site to populate a select input field in admin. Here’s one way this can be achieved. I’m assuming we have a custom module called My_Module in the community folder. File: app/code/community/My/Module/Helper/Data.php 12345678910111213141516171819202122232425262728… public function getAllCategoriesArray($optionList = false) {     $categoriesArray […]

Useful Function To Get The Full URL Path In Magento

Magento CE 1.8.0.0 I recently needed to build the full URL for Magento from a relative path. I wrote this little function for my helper and I thought someone else might want to use it. 1234567891011121314151617181920212223242526272829public function buildFullPathUrl($path,$type) {     $relative = ltrim($path, ‘/’);     switch ($type) {         case […]

Manipulating Files Using Terminal Commands

CentOS 6.4 Here’s a few very quick and basic commands to do things with files via the terminal. These can be vastly improved upon; please comment if you have better methods for this. Basic commands 123456// view the first 25 lines in a file $ head -25 filename.sql // view the last 25 lines in […]