Esempio n. 1
0
 public static function defaultList()
 {
     $conditions = array('enabled' => 1);
     $settings = \Shop\Models\Settings::fetch();
     if ($settings->countries_sort == 'name') {
         $conditions['sort'] = array('name' => 1);
     }
     $result = \Shop\Models\Countries::find($conditions);
     return $result;
 }
Esempio n. 2
0
 public function forSelection()
 {
     $term = $this->input->get('q', null, 'default');
     $key = new \MongoRegex('/' . $term . '/i');
     $results = \Shop\Models\Countries::forSelection(array('name' => $key));
     $response = new \stdClass();
     $response->more = false;
     $response->term = $term;
     $response->results = $results;
     return $this->outputJson($response);
 }
Esempio n. 3
0
    }
    ?>
><?php 
    echo $country->name;
    ?>
</option>
                    <?php 
}
?>
                    </select>
                </div>            
            </div>            
            <div class="row">
                <div class="form-group col-xs-12 col-sm-12 col-md-4">
                    <input type="text" class="form-control postal-code billing-postal_code" data-required="<?php 
echo \Shop\Models\Countries::fromCode($cart->billingCountry($cart->shippingCountry()))->requires_postal_code ? 'true' : 'false';
?>
" data-shipping="<?php 
echo $cart->{'checkout.shipping_address.postal_code'};
?>
" name="checkout[billing_address][postal_code]" value="<?php 
echo $cart->billingPostalCode($cart->{'checkout.shipping_address.postal_code'});
?>
" placeholder="Postal Code" autocomplete="postal-code" <?php 
if ($cart->billingSameAsShipping()) {
    echo 'disabled';
}
?>
>
                </div>
                <div class="form-group col-xs-12 col-sm-12 col-md-8">
Esempio n. 4
0
        echo "selected";
    }
    ?>
><?php 
    echo $region->name;
    ?>
</option>
            <?php 
}
?>
            </select>                        
        </div>
        <div class="form-group col-xs-12 col-sm-12 col-md-6">
            <select class="form-control country" data-required="true" name="country" id="country" autocomplete="country">
            <?php 
foreach (\Shop\Models\Countries::find() as $country) {
    ?>
                <option value="<?php 
    echo $country->isocode_2;
    ?>
" <?php 
    if ($selected_country == $country->isocode_2) {
        echo "selected";
    }
    ?>
><?php 
    echo $country->name;
    ?>
</option>
            <?php 
}
Esempio n. 5
0
 /**
  * Gets the country model for this region
  *
  * @return unknown
  */
 public function country()
 {
     $country = \Shop\Models\Countries::fromCode($this->country_isocode_2);
     return $country;
 }
Esempio n. 6
0
            dataType: 'json',
            data: function (term, page) {
                return {
                    q: term
                };
            },
            results: function (data, page) {
                return {results: data.results};
            }
        }
        <?php 
if ($flash->old('geo_countries')) {
    ?>
        , initSelection : function (element, callback) {
            var data = <?php 
    echo json_encode(\Shop\Models\Countries::forSelection(array('isocode_2' => array('$in' => $flash->old('geo_countries')))));
    ?>
;
            callback(data);            
        }
        <?php 
}
?>
    
    });
        
    jQuery("#geo_regions").select2({
        allowClear: true, 
        placeholder: "Search...",
        multiple: true,
        minimumInputLength: 3,
Esempio n. 7
0
 /**
  * Gets a list of countries
  */
 public function countries()
 {
     $result = \Shop\Models\Countries::defaultList();
     return $this->outputJson($this->getJsonResponse(array('message' => \Dsc\System::instance()->renderMessages(), 'result' => $result)));
 }