2

Is there a way I could retrieve all the custom options and their values? (not from a specific product, but just all of the options)

2 Answers 2

2

I found this solution:

    $tableName = $this->_resourceConnection->getTableName('catalog_product_option_type_title');

    $connection = $this->_resourceConnection->getConnection();
    $query = "SELECT * FROM " . $tableName;
    $resultOptions = $connection->fetchAll($query);
2

If you are trying to retrieve custom options and their values for one time you can use mysql query else you can have your own kind of implementations based on the below sql.

mysql> select t4.title as 'Custom Option', t3.Custom_Option_Values from (select t2.option_id, t1.option_type_id,t1.title as 'Custom_Option_Values' from catalog_product_option_type_title t1 left join catalog_product_option_type_value t2 on t1.option_type_id = t2.option_type_id) t3 left join catalog_product_option_title t4 on t3.option_id = t4.option_id;

Your Answer

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

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