Keeping your Yii Models Lean – Use Behaviors

Standard

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
Standard

Scenario:
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

mouseover with delay (using hoverIntent plugin)

Standard

hoverIntent is a plug-in that attempts to determine the user’s intent… like a crystal ball, only with mouse movement! It works like (and was derived from) jQuery’s built-in hover. However, instead of immediately calling the onMouseOver function, it waits until the user’s mouse slows down enough before making the call.

Why? To delay or prevent the accidental firing of animations or ajax calls. Simple timeouts work for small areas, but if your target area is large it may execute regardless of intent.

var config = {    
     over: makeTall, // function = onMouseOver callback (REQUIRED)    
     timeout: 500, // number = milliseconds delay before onMouseOut    
     out: makeShort // function = onMouseOut callback (REQUIRED)    
};

$("#demo3 li").hoverIntent( config )

Download hoverIntent r6 (fully-commented, uncompressed)

Download hoverIntent r6 (minified)

Authorize.net integration with Magento

Standard

1- Create a test account on Authorize.net (https://developer.authorize.net/testaccount/)

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 Authorize.net
  3. Insert “API Login ID” and “Transaction Key” into this form and make other settings as shown below

authorize.net

6. Save Configuration and you are DONE!