News:

Looking for documentation? Take a look on our wiki

Main Menu

Add metod :: getProductRelatedIds ($product_id)

Started by exolut, July 03, 2012, 16:42:36 PM

Previous topic - Next topic

exolut

I suggest adding the following method to extract the id of the related products
in administrator / com_virtuemart / models / product.php

function getProductRelatedIds ($product_id) {

if (empty($product_id)) {
return array();
}
$db = JFactory::getDBO ();
$db->setQuery (' SELECT field.`custom_value` FROM `#__virtuemart_customs` AS C LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id` WHERE `virtuemart_product_id` ='. (int)$product_id .' AND `field_type` = "R"' );

return $db->loadResultArray ();

}


I think it is useful to know immediately what products are related and may be used in the detail page without using the $ field-> display