I have a couple products at checkout that I need to be able to get all of the custom options that are selected for them through code.
Any help is much appreciated! <
For those who want to see selected custom options later in admin panel in Order/Invoice/Shipment/Creditmemo,
find files:
/app/design/adminhtml/[default]/default/template/sales/order/view/items/renderer/default.phtml
/app/design/adminhtml/[default]/default/template/sales/order/invoice/view/items/renderer/default.phtml
/app/design/adminhtml/[default]/default/template/sales/order/shipment/view/items/renderer/default.phtml
/app/design/adminhtml/[default]/default/template/sales/order/creditmemo/view/items/renderer/default.phtml
PS: I haven't changed configurated.phtml files for invoice/shipment/creditmemo
and insert code somewhere after getSku(); ?>
(be careful, it's different for each file)
Insert code:
_getData('product_options')) { // only for order item
if ($allOptions = $_item->getOrderItem()->getData('product_options')) { // for invoice, shipping, creditmemo
$options = unserialize($allOptions);
if (isset($options['options'])) {
foreach ($options['options'] as $optionValues) {
if ($optionValues['value']) {
echo ' '. $optionValues['label'].': ';
$_printValue = isset($optionValues['print_value']) ? $optionValues['print_value'] : strip_tags($optionValues['value']);
$values = explode(', ', $_printValue);
foreach ($values as $value) {
if (is_array($value))
foreach ($value as $_value)
echo $_value;
else echo $value;
}
echo '
';
}
}
}
}
//---------end:---------------
?>
Also note that in code there is a line (if sentence) that works only in order default.phtml file, and the second if sentence works in invoice/shipping/creditmemo files. It depends where you post the code, make sure the right sentence is commented out.
hope this helps, thanks also to Knowledge Craving whose code helped me quite a bit :-) jazkat