Related Options
The different option values in a product can be related. For example, a size 46 red t-shirt has the related values "red" and "46".
Related values share a common price and quantity.
In OpenCart, all options are independent, which means that if you do not use a third-party module, the number of products during import will increase twice: 5pcs "red" + 5pcs. "46" total 10 T-shirts. In addition, OpenCart will allow you to choose a t-shirt in size 46, white, which is out of stock.
We recommend the module " Related Options".
Related options in the price list
The plugin considers option values as related if they are in the same line of the price list and have a common "Quantity" column:
If in the "Options" tab settings, the same column 5 is set for the "Color" option quantity and the "Size" option quantity:
the plugin will process these options as related.
After processing such a price list by the module, in the product mantis_1900245 there will be 4 choices:
- color White - size X
- color Orchid - size L
- color Platinum - size M
- color Platinum - size XL
and the Related Options module will ensure that other color and size combinations cannot be selected.
Related Options module troubleshooting
The plugin creates its own related options table in the database, and, in theory, should only display data from this table on the site.
But unfortunately, it also uses data from the standard OpenCart options table:
which often contradict data from the related options table.
You can correct this conflict by cleaning the OpenCart options table with this tool:
after the product update from the price list.
Or include in the admin/model/catalog/suppler.php file an automatic options removal code.
To do this, before the line unset($rows1); insert in this place:
the following code:
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "relatedoptions WHERE `product_id` = '" . $old_product_id . "'");
if (!empty($query->rows)) {
$this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . $old_product_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_option WHERE product_id = '" . $old_product_id . "'");
}