$q .= " WHERE p.products_id = {$pid}";
 $r = tep_db_query($q);
 $no_old_price = '<span style="color:#ababab;">No Old Price</span>';
 while ($row = tep_db_fetch_array($r)) {
     $price_old = round($product['p']['products_price_old'], 2);
     $price = round($product['p']['products_price'], 2);
     $net_price = product::calculateNetPrice($price, VAT);
     $mat_expense = $product['p']['material_expenses'];
     $cogs = product::calculateCOGS($mat_expense, $product['p']['complexity']);
     $profit = product::calculateProfit($net_price, $cogs);
     $profit_old = product::calculateProfit($net_price, $mat_expense);
     $margin = product::calculateMargin($profit, $net_price);
     $margin_is_good = $class_pm->priceMargindIsGood($price, $margin);
     $margin_old = product::calculateMargin($profit_old, $net_price);
     $margin_old_is_good = $class_pm->priceMargindIsGood($price, $margin_old);
     $premium = $class_pm->calcPremiumPrice($price, $cogs);
     $premium_old = $class_pm->calcPremiumPrice($price, $mat_expense);
     $purchase_price = product::calculatePurchasePrice($cogs);
     $purchase_price_old = product::calculatePurchasePrice($mat_expense);
     $is_active = $row['products_status'] == '1';
     $status_price = $row['jng_status_price'];
     $jng_icon_eye = $is_active ? getIconEyePricesBasedOnRules($status_price, 'jg') : array();
     $jng = '<img src="/images/icon-tick' . ($is_active ? '' : '-dis') . '.png" class="activation" />';
     $jng .= '<br /><br />';
     if ($row['jng_price_old'] > 0) {
         $jng_price_old = '<span class="price-old">' . displayCurrency('EUR', $row['jng_price_old']) . '</span>';
         $jng .= $jng_price_old . $jng_icon_eye['price_old'];
     } else {
         $jng_price_old = $no_old_price;
         $jng .= $no_old_price;
     }