https://prnt.sc/tk57cd

bu şekilde bir fonksiyonum var ve verileri

https://prnt.sc/tk57l4

bu şekilde çekiyorum. Yaptığım işlem döviz kuru çevirisi, veritabanında ki price_currency_code alanına göre fiyatı çeviriyor [ ''USD,'EUR','TRY' ] buraya kadar sorun yok ama anasayfada ürün listelerken

https://prnt.sc/tk58cl

ürünlerin tamamına ilk fiyatı veriyor

//'price' => $this->conversationPriceCurrency($query->row['price'], $query->row['price_currency_code']),

bu kodu
//'price' => $row['price'],
bu yaptığım zaman normal ürün idsine göre sorunsuz çekiyor .
ama çevirme işleminde tüm ürünleri tek fiyat yapıyor.

https://github.com/ismail-bahar/test...r/product2.php

kodlarımın tamamı bu şekilde

Nerede hata yapıyorum nereyi düzeltmem gerekiyor yardım eder misiniz.
Şimiden Teşekkürler.



sorun fonsiyondan dönen veriyi bir çere çekiyor ve her yerde kullanıyor olması döngü her döndüğünde fonksiyon tekrar çalışmıyor veya fonskiyon çalışıyor ama aynı veriyi döndürüyor

        public function conversationPriceCurrency($price, $price_currency_code = '') {
        if ($price_currency_code=='USD') {
            return $this->currency->convert($price, $price_currency_code, $this->config->get('config_currency'));
            return $price;
            
        }
        if ($price_currency_code=='EUR') {
        return '7777';

//bunu yaptığım zaman tüm ürünlerin fiyatı 7.777₺  oluyor  
        }
        else{
                return $price;

        
        }

        
    }




        foreach ($query->rows as $row) {
      $result[$row['product_id']
  ] = array(
            'product_id' => $row['product_id'],
            'name' => $row['name'],
            'description' => $row['description'],
            'meta_title' => $row['meta_title'],
            'meta_description' => $row['meta_description'],
            'meta_keyword' => $row['meta_keyword'],
            'tag' => $row['tag'],
            'model' => $row['model'],
            'sku' => $row['sku'],
            'upc' => $row['upc'],
            'ean' => $row['ean'],
            'jan' => $row['jan'],
            'isbn' => $row['isbn'],
            'mpn' => $row['mpn'],
            'location' => $row['location'],
            'price_currency_code' => $row['price_currency_code'],
            'quantity' => $row['quantity'],
            'stock_status' => $row['stock_status'],
            'image' => $row['image'],
            'manufacturer_id' => $row['manufacturer_id'],
            'manufacturer' => $row['manufacturer'],
             'price' => $row['price'],
               şu kod normalde çalışıyor//= $this->conversationPriceCurrency($query->row['price'], $query->row['price_currency_code']),

            'discount' => $row['discount'],
            'special' => $row['special'],
            'reward' => $row['reward'],
            'points' => $row['points'],
            'tax_class_id' => $row['tax_class_id'],
            'date_available' => $row['date_available'],

            'weight' => $row['weight'],
            'weight_class_id' => $row['weight_class_id'],
            'length' => $row['length'],
            'width' => $row['width'],
            'height' => $row['height'],
            'length_class_id' => $row['length_class_id'],
            'subtract' => $row['subtract'],
            'rating' => round($row['rating']),
            'reviews' => $row['reviews'] ? $row['reviews'] : 0,
            'minimum' => $row['minimum'],
            'sort_order' => $row['sort_order'],
            'status' => $row['status'],
            'date_added' => $row['date_added'],
            'date_modified' => $row['date_modified'],
            'viewed' => $row['viewed'],
        );
        Şu kod sadece üste ki kod çalışıyorsa çalışıyor  //$query->row['price'] = $this->conversationPriceCurrency($query->row['price'], $query->row['price_currency_code']);

    }

Arkadaşlar sadece altta ki kod çalışsa sorun düzelecek gibi altta ki kodu nasıl tek başına çalıştırabilirim ?