@@ -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,19 +123,19 @@ 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 untranslated value for ') . $dbField); |
|
| 134 | + if ($fields->dataFieldByName($useField)) { |
|
| 135 | + $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ').$dbField); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - if($this->exists() && $this->ParentID) { |
|
| 138 | + if ($this->exists() && $this->ParentID) { |
|
| 139 | 139 | $fields->addFieldToTab( |
| 140 | 140 | 'Root.ParentPage', |
| 141 | 141 | CMSEditLinkField::create( |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | ) |
| 211 | 211 | ); |
| 212 | 212 | $this->extend('updateFieldsToReplace', $al); |
| 213 | - foreach($al as $fieldToReplace) { |
|
| 214 | - $ignoreField = 'UseOriginal' . $fieldToReplace->PageField; |
|
| 215 | - if(!empty($this->owner->$ignoreField)) { |
|
| 213 | + foreach ($al as $fieldToReplace) { |
|
| 214 | + $ignoreField = 'UseOriginal'.$fieldToReplace->PageField; |
|
| 215 | + if (!empty($this->owner->$ignoreField)) { |
|
| 216 | 216 | $al->remove($fieldToReplace); |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $link = $this->Parent()->Link(); |
| 236 | 236 | if ($this->EcommerceCountryID) { |
| 237 | 237 | $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($link); |
| 238 | - if($hasCountrySegment){ |
|
| 238 | + if ($hasCountrySegment) { |
|
| 239 | 239 | $link = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($this->EcommerceCountry()->Code, $link); |
| 240 | 240 | } |
| 241 | 241 | else { |
@@ -250,20 +250,20 @@ discard block |
||
| 250 | 250 | parent::requireDefaultRecords(); |
| 251 | 251 | //get rid of rogue entries: |
| 252 | 252 | DB::query('DELETE FROM CountryPrice_Translation WHERE EcommerceCountryID = 0 OR ParentID = 0'); |
| 253 | - if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) { |
|
| 253 | + if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) { |
|
| 254 | 254 | $prices = CountryPrice::get(); |
| 255 | 255 | $ecommerceCountries = array(); |
| 256 | - foreach($prices as $price) { |
|
| 257 | - if($countryObject = $price->CountryObject()) { |
|
| 258 | - if($buyable = $price->Buyable()) { |
|
| 259 | - if($buyable instanceof Product) { |
|
| 260 | - if($buyable->ID && $countryObject->ID) { |
|
| 256 | + foreach ($prices as $price) { |
|
| 257 | + if ($countryObject = $price->CountryObject()) { |
|
| 258 | + if ($buyable = $price->Buyable()) { |
|
| 259 | + if ($buyable instanceof Product) { |
|
| 260 | + if ($buyable->ID && $countryObject->ID) { |
|
| 261 | 261 | $filter = array( |
| 262 | 262 | 'EcommerceCountryID' => $countryObject->ID, |
| 263 | 263 | 'ParentID' => $buyable->ID |
| 264 | 264 | ); |
| 265 | 265 | $ecommerceCountries[$countryObject->ID] = $countryObject; |
| 266 | - if(! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 266 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 267 | 267 | DB::alteration_message( |
| 268 | 268 | 'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code, |
| 269 | 269 | 'created' |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - if(count($ecommerceCountries)) { |
|
| 281 | - foreach(ProductGroup::get() as $productGroup) { |
|
| 282 | - foreach($ecommerceCountries as $countryID => $countryObject) { |
|
| 280 | + if (count($ecommerceCountries)) { |
|
| 281 | + foreach (ProductGroup::get() as $productGroup) { |
|
| 282 | + foreach ($ecommerceCountries as $countryID => $countryObject) { |
|
| 283 | 283 | $filter = array( |
| 284 | 284 | 'EcommerceCountryID' => $countryObject->ID, |
| 285 | 285 | 'ParentID' => $productGroup->ID |
| 286 | 286 | ); |
| 287 | - if(! CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 287 | + if (!CountryPrice_Translation::get()->filter($filter)->first()) { |
|
| 288 | 288 | DB::alteration_message( |
| 289 | 289 | 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code, |
| 290 | 290 | 'created' |