Pregunta

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)

¿Fue útil?

Solución

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);

Otros consejos

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;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top