0

I am trying to get the configurable product selected options value, option titles on clicking the Add to cart button. From the post content, I get the option_id but : How we can fetch the and Option Titles. For eg : (See Screenshot for reference )

enter image description here)

I have ten text fields and two select fields : So on submit I need can get the values entered by the user but I am not able to fetch the titles of the text fields or the titles of the selected options.

Note : I have used "bss dependtent custom option" extension for creating the options. Thanks!

0

I have resolved my problem with the following code, If anybody face the same issue you can try this method:

/*  SHOWING SELECTED CUSTOM OPTIONS ON AJAX CART POPUP  */
        $items = $this->_cart->getItems();
        foreach($items as $product) {
        $options = $product->getProduct()->getTypeInstance(true)->getOrderOptions($product->getProduct());
            if ($options)
            {
                if (isset($options['options']))
                {
                    $result = $options['options'];
                }
                    if ($i == $len - 1) { // get only last product details
                        foreach($result as $key =>$value){
                            echo "<strong>".$resultoption = $value['label'].'</strong>';
                            echo "<p> ".$resultoption =  $value['value'].'</p><br>';
                        }
                    }
            }
            else{
                echo "NO OPTIONS";  // nothing here
            }
            $i++;
        }

        /* SHOWING SELECTED CUSTOM OPTIONS ON AJAX CART POPUP */ ` : 

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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