Magento Custom Controller Layout

You will need some debugging techniques to get the handle of your controller. In your controller: Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles()); Output: array(5) { [0] => string(7) “default” [1] => string(13) “STORE_default” [2] => string(30) “THEME_frontend_default_default” [3] => string(27) “brymayor_custom_upload_index” [4] => string(19) “customer_logged_out”

Tagged with: , ,
Posted in Magento

List of Magento Admin Form Fields

On our previous post, we learned how to create Magento Adminhtml grids. All the codes below should be written in the class Foo_Bar_Block_Adminhtml_Baz_Edit_Form (assuming it doesn’t have tabs) inside the _prepareForm() function. Text Field $fieldset->addField(‘title’, ‘text’, array( ‘label’ => $this->__(‘Title’),

Tagged with: , , , , , , , , ,
Posted in Magento

How To Create a MySQL Database and Set Privileges to a User

In this tutorial, I will explain how to create a database as well as the user. Given that your have an access to the database, we are going to create a database called jungle which will be accessible from localhost

Tagged with: , ,
Posted in MySQL

How to Reduce Video Size in Ubuntu

FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec – the leading audio/video codec library. See the documentation for a complete feature list. To install FFmpeg on your Ubuntu machine, you need

Tagged with: , , , , , , ,
Posted in Linux

Syntax for a Secure Copy (SCP)

SCP allows files to be copied from, to, or between different hosts. It uses SSH for data transfer and it provides the same authentication and level of security as that of SSH. Following are some example commands you can run

Tagged with: , , , ,
Posted in Linux

Create Basic Custom Payment Method in Magento

This is the basic payment method tutorial and does not cover if there is a payment integration. First we need to decide on a unique code for the payment method, in the following example, I used the code new_pay and the

Tagged with: ,
Posted in Magento

Custom Renderer For a Custom Column in Magento Admin Grid

Let’s take a look at the listing admin grid we created here. On your app/code/local/Foo/Bar/Block/Adminhtml/Baz/Grid.php, insert the renderer line on the addColumn statement: $this->addColumn(‘status’, array( ‘header’=> $this->__(‘Status’), ‘renderer’ => ‘Foo_Bar_Block_Adminhtml_Baz_Renderer_Status’, ) ); Make directory called Renderer inside directory where your Grid.php

Tagged with: , , , ,
Posted in Magento

Get URL for a Magento Category By Category Name or Category ID

/** * Load URL by category name */ Mage::getModel(‘catalog/category’)->loadByAttribute(‘name’, ‘Category Name’)->getUrl(); /** *Load URL by category ID */ Mage::getModel(‘catalog/category’)->load(4021993)->getUrl();  

Tagged with: , ,
Posted in Magento

Load Magento Product By Name, SKU, or by ID

/** * Load by name */ $_category = Mage::getModel(‘catalog/category’)->loadByAttribute(‘name’, ‘Category Name’); $_product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘name’, ‘custom product’); /** *Load by SKU */ $_product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘sku’, ‘productSku123′); /** *Load by ID */ $_product = Mage::getModel(‘catalog/product’)->load($productID);    

Tagged with: ,
Posted in Magento

Recursively Delete All “.svn” Directories From the Current Path

If you need to delete all redundant .svn directories from a given path and all its subdirectories, use this unix command: find . -name “.svn” -print0 | xargs -0 -n 1024 -r rm -rf where: -n prevents rm too many

Tagged with: , ,
Posted in Subversion
Tailored Tweets