function getItemPrice($promo, &$items) { $promodisc = DigiComSiteHelperDigiCom::getPromoDisc($promo, $items); foreach ($items as $i => $item) { if ($i < 0) { continue; } if (isset($item->discounted_price) && $item->discounted_price) { $price = $item->discounted_price; } else { if (isset($item->no_discounted_price) && $item->no_discounted_price) { $price = $item->no_discounted_price; } else { $price = $item->price; } } $price -= $promodisc; $items[$i]->cart_price = $price; } }