class cPrice public static function GetExtra Product EXTRA if substr_c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class cPrice {
public static function GetExtra( $Product ){
$EXTRA = 1.2;
if ( substr_count( mb_strtoupper( trim( $Product[ 'BRAND' ] ) ) , 'SCARABEO' ) ){
$EXTRA = 1.3;
}
return $EXTRA;
}
public static function GetRates( $FROM , $TO ){
if ( $FROM == 'EUR' && $TO == 'RUR' ){
return (float)50;
}
}
public static function GetPriceRUR( $Product ){
$EXTRA = self::GetExtra( $Product );
$CUR_RATE = self::GetRates( 'EUR' , 'RUR' );
if ( $Product[ 'PRICE_RUR' ] > 0 ){
$Product[ 'PRICE_RUR' ] = $Product[ 'PRICE_RUR' ] * $EXTRA;
} elseif ( $Product[ 'PRICE_EUR' ] > 0 ) {
$Product[ 'PRICE_RUR' ] = $Product[ 'PRICE_EUR' ] * $CUR_RATE * $EXTRA;
} else {
$Product[ 'PRICE_RUR' ] = 0;
}
return $Product[ 'PRICE_RUR' ];
}
}