@@ 265-286 (lines=22) @@ | ||
262 | if ($currency) { |
|
263 | $currencyCode = strtoupper($currency->Code); |
|
264 | //1. exact price for country |
|
265 | if ($currencyCode) { |
|
266 | $prices = $this->owner->CountryPricesForCountryAndCurrency( |
|
267 | $countryCode, |
|
268 | $currencyCode |
|
269 | ); |
|
270 | if ($prices && $prices->count() == 1) { |
|
271 | self::$_buyable_price[$key] = $prices->First()->Price; |
|
272 | return self::$_buyable_price[$key]; |
|
273 | } elseif ($prices) { |
|
274 | if ($this->debug) { |
|
275 | debug::log('MAIN COUNTRY: There is an error number of prices: '.$prices->count().' based on a search for '.$countryCode.' - '.$currencyCode); |
|
276 | } |
|
277 | } else { |
|
278 | if ($this->debug) { |
|
279 | debug::log('MAIN COUNTRY: There is no country price: '); |
|
280 | } |
|
281 | } |
|
282 | } else { |
|
283 | if ($this->debug) { |
|
284 | debug::log('MAIN COUNTRY: There is no currency code '.$currencyCode.''); |
|
285 | } |
|
286 | } |
|
287 | } else { |
|
288 | if ($this->debug) { |
|
289 | debug::log('MAIN COUNTRY: there is no currency'); |
|
@@ 301-323 (lines=23) @@ | ||
298 | if ($distributorCurrency->ID == $currency->ID) { |
|
299 | $distributorCurrencyCode = strtoupper($distributorCurrency->Code); |
|
300 | $distributorCountryCode = $distributorCountry->Code; |
|
301 | if ($distributorCurrencyCode && $distributorCountryCode) { |
|
302 | $prices = $this->owner->CountryPricesForCountryAndCurrency( |
|
303 | $distributorCountryCode, |
|
304 | $distributorCurrencyCode |
|
305 | ); |
|
306 | if ($prices && $prices->count() == 1) { |
|
307 | self::$_buyable_price[$key] = $prices->First()->Price; |
|
308 | ||
309 | return self::$_buyable_price[$key]; |
|
310 | } elseif ($prices) { |
|
311 | if ($this->debug) { |
|
312 | debug::log('BACKUP COUNTRY: There is an error number of prices: '.$prices->count()); |
|
313 | } |
|
314 | } else { |
|
315 | if ($this->debug) { |
|
316 | debug::log('BACKUP COUNTRY: There is no country price: '); |
|
317 | } |
|
318 | } |
|
319 | } else { |
|
320 | if ($this->debug) { |
|
321 | debug::log('BACKUP COUNTRY: We are missing the distributor currency code ('.$distributorCurrencyCode.') or the distributor country code ('.$distributorCountryCode.')'); |
|
322 | } |
|
323 | } |
|
324 | } else { |
|
325 | if ($this->debug) { |
|
326 | debug::log('BACKUP COUNTRY: The distributor currency ID ('.$distributorCurrency->ID.') is not the same as the order currency ID ('.$currency->ID.').'); |