Back to PhocacartAttribute class

Method getCombinationsDataByProductId

public static
getCombinationsDataByProductId
(mixed $id)

Method getCombinationsDataByProductId - Source code

public static function getCombinationsDataByProductId($id)
{
    if ($id > 0) {
        $db = Factory::getDBO();
        $query = ' SELECT a.product_id, a.product_key, a.stock, a.price, a.sku, a.ean, a.image' . ' FROM #__phocacart_product_stock AS a' . ' WHERE a.product_id = ' . (int) $id . ' ORDER BY a.id';
        $db->setQuery($query);
        $combinations = $db->loadAssocList();
        $combinationsNew = array();
        if (!empty($combinations)) {
            foreach ($combinations as $k => $v) {
                $newK = $v['product_key'];
                $combinationsNew[$newK] = $v;
            }
        }
        return $combinationsNew;
    }
    return false;
}