Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Get Product Custom option in order in magento
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

Hi,

If you need product custom option of order items use below code

$orderMage::getModel('sales/order')->load(71);
    
$items=$order->getAllItems();

    foreach(
$items as $item){
     $customOptions 
$item->getProductOptions();

        foreach (
$customOptions['options'as $_eachOption{
            
//print_r($_eachOption);
            
echo '<pre>';
            
print_r($_eachOption);
            echo 
'</pre>';
        
}
    }
File Attachments
order_customoption.php  (File Size: 1KB - Downloads: 31)
 
Magento Community Magento Community
Magento Community
Magento Community
 
macleon
Jr. Member
 
Total Posts:  9
Joined:  2011-07-01
 

Thank you!!!!!!!!!!!!

What a battle Magento can be.

 
Magento Community Magento Community
Magento Community
Magento Community
 
macleon
Jr. Member
 
Total Posts:  9
Joined:  2011-07-01
 

Pradeep

This has worked fine, but the trouble I’m having now is to capture a specific value assigned the label “Comments”. Once I have it save as a variable I can print it our using our custom module.

Any ideas how I might assign the value to a variable $comments?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 
macleon - 31 January 2013 03:29 AM

Pradeep

This has worked fine, but the trouble I’m having now is to capture a specific value assigned the label “Comments”. Once I have it save as a variable I can print it our using our custom module.

Any ideas how I might assign the value to a variable $comments?

this post to get if product has custom option which is created from admin side in product page

i just want to know Comments is custom option or config attribute or simply create one text filed in product view page ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mousie_meow
Jr. Member
 
Total Posts:  2
Joined:  2013-09-06
 
pradeep_kumar67 - 30 October 2012 02:15 AM

Hi,

If you need product custom option of order items use below code

$orderMage::getModel('sales/order')->load(71);
    
$items=$order->getAllItems();

    foreach(
$items as $item){
     $customOptions 
$item->getProductOptions();

        foreach (
$customOptions['options'as $_eachOption{
            
//print_r($_eachOption);
            
echo '<pre>';
            
print_r($_eachOption);
            echo 
'</pre>';
        
}
    }

Where do I add this code?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top