I have a stock product with some custom options. I would like to fetch the custom options for this product in the view.phtml of my rwd-based theme.

Now I thought this would be possible through

$myoptions = $_product->getOptions();

But instead of giving me back the options, the page loads for a long time and then outputs lots of unrelated stuff. At least it looks like this.

Is this the right way to fetch the custom options of a product? Is there another (better) way to do it?

1 Answer 1


The code will be somewhat like:-

$productSku = "ABCDE";
$product = Mage::getModel('catalog/product');
$productId = $product->getIdBySku( $productSku );

 * In Magento Models or database schema level, the product's Custom Options are
 * executed & maintained as only "options". So, when checking whether any product has
 * Custom Options or not, we should check by using this method "hasOptions()" only.
if($product->hasOptions()) {
    echo '<pre>';

    foreach ($product->getOptions() as $o) {
        $optionType = $o->getType();
        echo 'Type = '.$optionType;

        if ($optionType == 'drop_down') {
            $values = $o->getValues();

            foreach ($values as $k => $v) {
        else {

    echo '</pre>';
  • For some reason this does not work. The product page is showing the custom options just fine with its standard behaviour, but has_options() does not return a result, just like there are none.
    – flomei
    Jul 16, 2018 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.