How would I go about retrieving the product Id's of a parent products child products.
Is there already a variable that contains this data, or would it have to be retrieved from the database?
Joomla 3.0.12
Virtuemart 3.4.8
PHP 5.6.20
in administrator\components\com_virtuemart\models\product.php
function getProductChildIds ($product_id) {
if (empty($product_id)) {
return array();
}
$db = JFactory::getDBO ();
$db->setQuery (' SELECT virtuemart_product_id FROM `#__virtuemart_products` WHERE `product_parent_id` =' . (int)$product_id.' ORDER BY pordering, created_on ASC');
return $db->loadColumn ();
}
so something like
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductChildIds( $product_id);