how to add a custom column in Magento sales/order grid


Step 1 :- Copy app\code\core\Mage\Adminhtml\Block\Sales\Order\grid.php
to
app\code\local\Mage\Adminhtml\Block\Sales\Order\grid.php now Find _prepareColumns() function to Add column use this code:-
$this->addColumn('color ', array(
    'header' => Mage::helper('sales')->__('color #'),
    'index' => 'color',
    'sortable'  => false,
    'filter'    => false,
    'renderer' => 'Mage_Adminhtml_Block_Sales_Order_Renderer_Productatt',
));
Step 2:- Create a new file at :-
app\code\local\Mage\Adminhtml\Block\Sales\Order\Renderer\Productatt.php add this code :-
<?php
class Mage_Adminhtml_Block_Sales_Order_Renderer_Productatt extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {                    

         $order = Mage::getModel('sales/order')->load($row->getData('entity_id'));              
            $attribute ="";

        foreach($order->getAllVisibleItems() as $_item){  
        $product    =   Mage::getModel('catalog/product')->load($_item->getProductId());         
       if($product->getAttributeText('color')){
            $attribute .= $product->getAttributeText('color');
       }
    }
        unset($order);
        return $attribute;      
    }       
}
?>

How to send custom attribute in magento Order email.

Recently i was working on a project and my client want to send a custom shipping note in order email.
So lets's see how to achieve this:-
Create a file On this location app/design/frontend/your_package/your_theme/template/email/shipnote.phtml in this file i am getting shipnote info i am installed following extension for it :-
https://github.com/drewhunter/ShipNote
Now in shipnote.phtml i have added following code.
<?php

$order = $this->getOrder();
$shipNoteId = $order->getShipNoteId();
$ShipnoteModel = Mage::getModel('shipnote/note')->load($shipNoteId);    
echo 'Pickup Location :- '.$ShipnoteModel->getNote();
?>
Now open your transactional email template you can find it system->>Transactional Emails or app/locale/en_US/template/email/sales/order_new.html and add following code in it:-
{{block type='core/template' area='frontend' template='email/shipnote.phtml' order=$order}}

Fix CSS hover on iPhone/iPad/iPod

Copy this code and paste it any where in your file.
Make sure jQuery included in your page.


How to Show product options in product list page in wordpress

In this article, we will recommend some effective methods to show options for the configurable and product options in product list. Check them out! Showing options for Configurable products :-

Open content-product.php file you can find this file at this location :-
wp-content\plugins\woocommerce\templates\content-product.php
Copy this code before end of li and after "do_action( 'woocommerce_after_shop_loop_item_title' )"
<?php	
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
		do_action( 'woocommerce_single_product_summary' );
	
?>

Odesk PHP Frontend Developer Test v2 answer

In this test there are 4 questions they are following.


Question no 1:- Fantastic three sequence

Solution :-
<?php
function fantastic3($n) {
$series = array(0,1,1,1);
for($i=3 ; $i<=$n ; $i++){
$a = (isset($series[ (int)$i-3 ]))?$series[ (int)$i-3 ]:0;
$b = (isset($series[ (int)$i-2 ]))?$series[ (int)$i-2 ]:0;
$c = (isset($series[ (int)$i-1 ]))?$series[ (int)$i-1 ]:0;
$d = ($a+$b+$c)-1;
if($d<0){
$d = 0;
}
$series[$i] = $d;
}
echo $series[ (int)$n-1 ];
}
// Do NOT call the fantastic3 function in the code
// you write. The system will call it automatically.
?>