/**
  * Get the shipping restrictions in the google filter module format for a specific zone
  * so we can add it as part of the shipping rules
  *
  * @return object
  **/
 private function GetShippingRestrictions($zone)
 {
     $Gfilter = new GoogleShippingFilters();
     // Handle the default zone
     if (!isset($zone['locationtype'])) {
         $Gfilter->SetAllowedWorldArea(true);
         return $Gfilter;
     }
     switch ($zone['locationtype']) {
         case 'zip':
             foreach ($zone['locations'] as $location) {
                 $pos = strpos($location['locationvalue'], '?');
                 if ($pos === false) {
                     $Gfilter->AddAllowedZipPattern($location['locationvalue']);
                 } else {
                     $tmp = substr($location['locationvalue'], 0, $pos);
                     $tmp .= '*';
                     $Gfilter->AddAllowedZipPattern($tmp);
                 }
             }
             break;
         case 'state':
             foreach ($zone['locations'] as $location) {
                 $country = GetCountryISO2ById($location['locationcountryid']);
                 $state = GetStateISO2ById($location['locationvalueid']);
                 if (empty($state)) {
                     $state = GetStateById($location['locationvalueid']);
                 }
                 if (empty($location['locationvalueid']) && $country == 'US') {
                     // If they have selected all states in the us, handle it differently
                     $Gfilter->SetAllowedCountryArea('ALL');
                     continue;
                 } elseif (empty($location['locationvalueid'])) {
                     $Gfilter->AddAllowedPostalArea($country);
                     continue;
                 }
                 if ($country == 'US' && $this->GetDefaultCurrencyCode() == 'USD') {
                     $Gfilter->AddAllowedStateArea($state);
                 } else {
                     $Gfilter->AddAllowedPostalArea($country, $state);
                 }
             }
             break;
         case 'country':
             foreach ($zone['locations'] as $location) {
                 $Gfilter->AddAllowedPostalArea(GetCountryISO2ById($location['locationvalueid']));
             }
             break;
     }
     return $Gfilter;
 }