Shop_CountryState
The Shop_CountryState class represents a state of a country. You can manage countries and states on the System/Countries page. You may need to work with objects of this class when you create the Billing Information and Shipping information steps of the Checkout page. Usually you do not need to create objects of this class manually. The shop:checkout action automatically creates a list of states in the $states variable. Please refer the Creating the Checkout page article for details.
Parent class: Db_ActiveRecord
Class fields
- $name – a state name
- $code – a state code
Class methods
- static create() - creates an instance of the class
- find_by_code($code) - finds a state by the country code (for example 'CA'). Returns an object of the Shop_CountryState class. You can use the following code for loading a specific state from the database:
$california = Shop_CountryState::create()->find_by_code('CA'); - find_by_id($id) - finds a state by its identifier). Returns an object of the Shop_CountryState class. Example:
$state = Shop_CountryState::create()->find_by_id(1');
Next: Shop_CustomGroup
Previous: Shop_Country
Return to Reference


Comments
No comments posted so far.
Add your comment
Loading form...