| @@ -99,11 +99,11 @@ discard block | ||
| 99 | 99 | $countryDropdownField = DropdownField::create( | 
| 100 | 100 | 'EcommerceCountryID', | 
| 101 | 101 |              $fields->dataFieldByName('EcommerceCountryID')->Title(), | 
| 102 | -            array('' => '-- make sure to select a country --')+$countries | |
| 102 | +            array('' => '-- make sure to select a country --') + $countries | |
| 103 | 103 | ); | 
| 104 | 104 | |
| 105 | 105 |          $fields->removeFieldFromTab("Root.Main", 'ParentID'); | 
| 106 | -        if($this->WithoutTranslation) { | |
| 106 | +        if ($this->WithoutTranslation) { | |
| 107 | 107 | return FieldList::create( | 
| 108 | 108 | array( | 
| 109 | 109 | $countryDropdownField, | 
| @@ -123,16 +123,16 @@ discard block | ||
| 123 | 123 | ); | 
| 124 | 124 | } | 
| 125 | 125 | $dbFields = $this->inheritedDatabaseFields(); | 
| 126 | -        foreach($dbFields as $dbField => $fieldType) { | |
| 126 | +        foreach ($dbFields as $dbField => $fieldType) { | |
| 127 | 127 | $useField = 'UseOriginal'.$dbField; | 
| 128 | -            if(!empty($this->$useField)) { | |
| 128 | +            if (!empty($this->$useField)) { | |
| 129 | 129 | $fields->replaceField( | 
| 130 | 130 | $dbField, | 
| 131 | 131 | $fields->dataFieldByName($dbField)->performReadonlyTransformation() | 
| 132 | 132 | ); | 
| 133 | 133 | } | 
| 134 | -            if($fields->dataFieldByName($useField)){ | |
| 135 | -                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use original value for ') . $dbField); | |
| 134 | +            if ($fields->dataFieldByName($useField)) { | |
| 135 | +                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use original value for ').$dbField); | |
| 136 | 136 | } | 
| 137 | 137 | } | 
| 138 | 138 | $fields->addFieldToTab( | 
| @@ -206,9 +206,9 @@ discard block | ||
| 206 | 206 | ) | 
| 207 | 207 | ); | 
| 208 | 208 |          $this->extend('updateFieldsToReplace', $al); | 
| 209 | -        foreach($al as $fieldToReplace) { | |
| 210 | - $ignoreField = 'UseOriginal' . $fieldToReplace->PageField; | |
| 211 | -            if(!empty($this->owner->$ignoreField)) { | |
| 209 | +        foreach ($al as $fieldToReplace) { | |
| 210 | + $ignoreField = 'UseOriginal'.$fieldToReplace->PageField; | |
| 211 | +            if (!empty($this->owner->$ignoreField)) { | |
| 212 | 212 | $al->remove($fieldToReplace); | 
| 213 | 213 | } | 
| 214 | 214 | } | 
| @@ -231,7 +231,7 @@ discard block | ||
| 231 | 231 | $link = $this->Parent()->Link(); | 
| 232 | 232 |          if ($this->EcommerceCountryID) { | 
| 233 | 233 | $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($link); | 
| 234 | -            if($hasCountrySegment){ | |
| 234 | +            if ($hasCountrySegment) { | |
| 235 | 235 | $link = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($this->EcommerceCountry()->Code, $link); | 
| 236 | 236 | } | 
| 237 | 237 |              else { | 
| @@ -244,20 +244,20 @@ discard block | ||
| 244 | 244 | public function requireDefaultRecords() | 
| 245 | 245 |      { | 
| 246 | 246 | parent::requireDefaultRecords(); | 
| 247 | -        if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) { | |
| 247 | +        if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) { | |
| 248 | 248 | $prices = CountryPrice::get(); | 
| 249 | 249 | $ecommerceCountries = array(); | 
| 250 | -            foreach($prices as $price) { | |
| 251 | -                if($countryObject = $price->CountryObject()) { | |
| 252 | -                    if($buyable = $price->Buyable()) { | |
| 253 | -                        if($buyable instanceof Product) { | |
| 254 | -                            if($buyable->ID && $countryObject->ID) { | |
| 250 | +            foreach ($prices as $price) { | |
| 251 | +                if ($countryObject = $price->CountryObject()) { | |
| 252 | +                    if ($buyable = $price->Buyable()) { | |
| 253 | +                        if ($buyable instanceof Product) { | |
| 254 | +                            if ($buyable->ID && $countryObject->ID) { | |
| 255 | 255 | $filter = array( | 
| 256 | 256 | 'EcommerceCountryID' => $countryObject->ID, | 
| 257 | 257 | 'ParentID' => $buyable->ID | 
| 258 | 258 | ); | 
| 259 | 259 | $ecommerceCountries[$countryObject->ID] = $countryObject; | 
| 260 | -                                if(! CountryPrice_Translation::get()->filter($filter)->first()) { | |
| 260 | +                                if (!CountryPrice_Translation::get()->filter($filter)->first()) { | |
| 261 | 261 | DB::alteration_message( | 
| 262 | 262 | 'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code, | 
| 263 | 263 | 'created' | 
| @@ -271,14 +271,14 @@ discard block | ||
| 271 | 271 | } | 
| 272 | 272 | } | 
| 273 | 273 | } | 
| 274 | -            if(count($ecommerceCountries)) { | |
| 275 | -                foreach(ProductGroup::get() as $productGroup) { | |
| 276 | -                    foreach($ecommerceCountries as $countryID => $countryObject) { | |
| 274 | +            if (count($ecommerceCountries)) { | |
| 275 | +                foreach (ProductGroup::get() as $productGroup) { | |
| 276 | +                    foreach ($ecommerceCountries as $countryID => $countryObject) { | |
| 277 | 277 | $filter = array( | 
| 278 | 278 | 'EcommerceCountryID' => $countryObject->ID, | 
| 279 | 279 | 'ParentID' => $productGroup->ID | 
| 280 | 280 | ); | 
| 281 | -                        if(! CountryPrice_Translation::get()->filter($filter)->first()) { | |
| 281 | +                        if (!CountryPrice_Translation::get()->filter($filter)->first()) { | |
| 282 | 282 | DB::alteration_message( | 
| 283 | 283 | 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code, | 
| 284 | 284 | 'created' |