Source of file CountryPrice_OrderFormAddressExtension.php
Size: 1,171 Bytes - Last Modified: 2021-12-23T10:40:38+00:00
/var/www/docs.ssmods.com/process/src/code/forms/CountryPrice_OrderFormAddressExtension.php
12345678910111213141516171819202122232425262728 | <?php class CountryPrice_OrderFormAddressExtension extends Extension { public function updateFields($fields) { $shippingField = $fields->dataFieldByName('ShippingCountry'); $originalSource = $shippingField->getSource(); $newSource = $originalSource; $allowedCountries = CountryPrice_EcommerceCountry::get_sibling_countries(); $allowedCountries = $allowedCountries->exclude('OnlyShowChildrenInDropdowns', true); if ($allowedCountries->count()) { $allowedCountryCodes = $allowedCountries->column('Code'); foreach ($newSource as $key => $value) { if (! in_array($key, $allowedCountryCodes)) { unset($newSource[$key]); } } $shippingField->setSource($newSource); $js = ' var CountryPrice_SetCountriesForDelivery_Original = '.Convert::array2json($originalSource).'; var CountryPrice_SetCountriesForDelivery_New = '.Convert::array2json($newSource).';'; Requirements::customScript($js, 'CountryPrice_OrderFormAddressExtension_updateFields'); } } } |