Add custom Javascript in Magento admin form


Magento is flexible enough to insert your custom JavaScript code snippets in forms created by your very own Magento modules & extensions.

Continue reading


Create custom WordPress form and handle submission?


 * Plugin Name: Custom Form
 * Plugin URI: http://
 * Description: Creates a custom form through shortcode and handles the submit event.
 * Version: 1.0
 * Author: Tahir Yasin
 * Author URI:
 * License: GPL2

class CustomForm

    public function __construct()
        add_action('init', array($this, 'init'));
        add_shortcode('custom_form', array($this, 'shortcode'));

    public function init()
        if (!empty($_POST['nonce_custom_form']))
            if (!wp_verify_nonce($_POST['nonce_custom_form'], 'handle_custom_form'))
                die('You are not authorized to perform this action.');
            } else
                $error = null;
                if (empty($_POST['name']))
                    $error = new WP_Error('empty_error', __('Please enter name.', 'tahiryasin'));
                    wp_die($error->get_error_message(), __('CustomForm Error', 'tahiryasin'));
                    die('Its safe to do further processing on submitted data.');

    function shortcode($atts)
        return "<form method='post' action=''>
    <input name='name' type='text' value='' />
    " . wp_nonce_field('handle_custom_form', 'nonce_custom_form') . "
        <input type='submit' value='Submit'/>


$CustomForm = new CustomForm();

Get custom attribute value in Magento


Simplest way:

echo $_product->getAttributeText('custom_attribute_code');


You will get a fetal error if the attribute is not already registered.

Fatal error: Call to a member function getSource() on a non-object in D:\..\app\code\core\Mage\Catalog\Model\Product.php on line 1389


$attribute = $_product->getResource()->getAttribute('custom_attribute_code');
if ($attribute)
	echo $attribute_value = $attribute ->getFrontend()->getValue($_product);

This code will first check if the attribute code exists and gets its value if its there.

Keeping your Yii Models Lean – Use Behaviors


Active Record models are fantastic for consolidating “black box” logic and keeping your models self-aware of their business logic, but what do you do when the business rules and object specific operations keep adding up?

Do yourself a favor, and get into the habit of putting those business logic methods into attachable behaviors.
Continue reading

How to save multiple related models in yii [Complete Solution]

How to save multiple related models in yii

You are in a situation where you have two related tables a Parent and a child table. You need to create a user experience in which user presses Save button only once, meaning by, user enters all the data in parent model fields, then enters data in all child model fields, optionally generates more child model fields and then presses the save button.
Continue reading integration with Magento


1- Create a test account on (

2- On successful signup you will see following info, save them at safe place.

  1. API Login ID
  2. Transaction Key

3- Login to your Magento Admin panel and navigate to

  1. System -> Configuration -> Payment Methods
  2. Expand
  3. Insert “API Login ID” and “Transaction Key” into this form and make other settings as shown below

6. Save Configuration and you are DONE!