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 custom option for product item on success.phtml page
 
joff
Jr. Member
 
Total Posts:  27
Joined:  2008-06-27
 

On the success.phtml page we need to grab the value of a products’ custom option for some additional processing. Our personalized products have a required field for gender: [radio] Male [radio] Female. For each product item ordered we need to know the gender.

How can I get this information? This is what I have so far ...

// set the order model
$order = Mage::getModel(’sales/order’);

// get the order id
$order_id = Mage::getSingleton(’checkout/session’)->getLastOrderId();

// load the order with the successful order id
$order->load($order_id);

// get order items
$items = $order->getItemsCollection();

foreach ($items as $item) {

// want to do something like $item->getProductOptions()->label(’Gender’)->value();
// to get the value for gender radio button. When I print_r( $item ) I see the option
// but not clear how to grab.

}

Tx!
Joff

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andre N
Sr. Member
 
Avatar
Total Posts:  186
Joined:  2009-12-09
CA
 

Has anyone been able to get a product’s custom option value (the customer selection or input) ? There has to be a way to get it…

 
Magento Community Magento Community
Magento Community
Magento Community
 
EricO
Member
 
Total Posts:  63
Joined:  2010-04-02
 

Sorry I don’t have the answer, but I just wanted to post and say I am another person interested in knowing how to get custom options for a product.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andre N
Sr. Member
 
Avatar
Total Posts:  186
Joined:  2009-12-09
CA
 

I was able to get all the product custom option info I needed. I posted how I did it in this thread:
http://www.magentocommerce.com/boards/viewthread/196241/

The code is attached to that thread because it was more than the posting character limit, so I won\’t try to post it here because it won\’t fit wink

Good luck!

 
Magento Community Magento Community
Magento Community
Magento Community
 
EricO
Member
 
Total Posts:  63
Joined:  2010-04-02
 

Thanks for posting your code iturner5150.  smile

I suppose my situation is a bit different though, because at the point where I want to get the item options, the order hasn’t been placed yet.  I’m trying to get the custom options in the cart, before the order has been placed.

There’s a place in your code where you do this:

$optionsArr $item->getProductOptions();
I tried to do that, but it did not return anything.
 
Magento Community Magento Community
Magento Community
Magento Community
 
trouble.tribbles
Jr. Member
 
Total Posts:  17
Joined:  2010-04-13
 

Eric0 any luck? I’m trying to show them in cart as well.

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