Hello,
If you can access the Pektsekye_ProductOptions_Model_Option class:
include_once(Pektsekye_PO()->getPluginPath() . 'Model/Option.php');
$optionModel = new Pektsekye_ProductOptions_Model_Option();
To get all options of a product:
$productOptions = $optionModel->getProductOptions($productId);
To create a new text option:
$option = array(
'option_id' => -1,
'title' => "Choose Date",
'type' => 'field',
'required' => 1,
'sort_order' => 1
);
$optionModel->saveOptions($productId, array($option));
$optionId = $wpdb->insert_id;
To create a new drop-down option:
$option = array(
'option_id' => -1,
'title' => "Option title",
'type' => 'drop_down',
'required' => 1,
'sort_order' => 1,
'values' => array(array(
'value_id' => -1,
'title' => 'Value title 1',
'price' => 0,
'sort_order' => 0
))
);
$optionModel->saveOptions($productId, array($option));
$optionId = $wpdb->insert_id;
Available option types:
drop_down, radio, checkbox, multiple, field, area
To update an option:
$option = array(
'option_id' => 567,
'title' => "Option title",
'type' => 'drop_down',
'required' => 1,
'sort_order' => 1,
'values' => array(array(
'value_id' => 233,
'title' => 'Value title 1',
'price' => 0,
'sort_order' => 0
))
);
$optionModel->saveOptions($productId, array($option));
To delete an option:
$optionModel->deleteOption($optionId);
Or save it with is_delete = 1
$option = array(
'option_id' => 233,
'is_delete' => 1
);
$optionModel->saveOptions($productId, array($option));
Also you can edit/insert/delete the data directly in the database tables:
wp_pofw_product_option
wp_pofw_product_option_value
Stanislav