shopp('customer.billing-state')

Displays the customer billing state/province drop-down input field, populated with the currently stored billing state.

shopp('customer', 'billing-state', 'options')

@param string $object the object or object.tag combination, if object.tag is used, the tag parameter can be omitted
@param string $tag the tag, can be hyphenated or not. Prefix with 'get' as shorthand for the return=true option
@param mixed $options associative array, or url-style name=value pairs separated by ampersands (&). Each pair is passed to the theme api tag as an option.
@returns void by default, billing state drop-down menu or input field string if return option is used.

Alternative Forms

shopp('customer.billing-state', 'options');

Description

Displays the customer billing state/province drop-down input field, populated with the currently stored billing state.

If the currently selected country has states/provinces, this function will display a drop-down menu of state/provinces.

Universal Options

All Theme API calls have these options.

  • return: when set to true, 1, or on, this option forces the tag to return the value instead of displaying/echoing the value to the page. Alternatively, prefix the tag parameter with get to get the same effect. All theme api tags that return a boolean value will return by default.
  • echo: when set to false, 0, or off, this option forces the tag to display the value to the page. This is the default for all non-boolean tags.
  • is: when set to true, 1, or on, this option will evaluate the return of the theme api call as a boolean true or false value. See how values are converted to boolean.

Default Drop-Down Options

These options are used on theme api calls that output form input tags, to specify attributes.

  • class: option for the class input attribute. The option’s value added to the class attribute.
  • disabled: option for the disabled input attribute. Outputs a ‘disabled’ class and attribute if option is set to ‘true’,’on’,’1′.
  • required: option for the required input attribute. Output a ‘required’ class if option is set to ‘true’,’on’,’1′.
  • accesskey: option for the accesskey input attribute. The option’s value is output as the attribute.
  • size: option for the size input attribute. The option’s value is output as the attribute.
  • tabindex: option for the tabindex input attribute. The option’s value is output as the attribute.
  • title: option for the title input attribute. The option’s value is output as the attribute.

Options

The following options are valid.

  • mode: (default null) set to mode=value to display the current billing state stored for the customer.
  • selected: (defaults to the base state) set to a two-letter state code to set the current state in the option menu.
  • type: (defaults to menu) will display a drop-down menu when type=menu or the type option is not set. To display a text input use type=text.
  • value: (defaults to saved state) if type=text and there is no saved state/province for the customer, this option can be used to display a default value.

Examples

// display the current customer's billing state in a drop-down menu
shopp('customer.billing-state');
// display the current customer's billing state in a drop-down menu
// set Ohio as the selected state
shopp('customer.billing-state','selected=OH');
// display the current customer's billing state as an input field
shopp('customer.billing-state','type=text');
// display the current customer's billing state as an input field
// set the default value to OH
shopp('customer.billing-state','type=text&value=OH');
// display the current customer's billing state
shopp('customer.billing-state','mode=value');
// get the current customer's billing state
$state = shopp('customer.get-billing-state','mode=value');

See Also

  1. Avatar of wbickley

    It is worth noting that the example above for rendering input fields as opposed to dropdowns is incorrect.

    I believe the correct way of formatting this argument is ‘type=text’, eg:

    // display the current customer's billing state input field shopp('customer.billing-state','type=text');

    Reference: https://github.com/ingenesis/shopp/blob/a755e90a78f1d7e61a50d264bb77f8c6fcbf7982/api/theme/customer.php#L716

    June 16th   #

  2. Avatar of Ben Hutchings

    Good spot, thank you Warren. Corrected now.

    January 13th   #

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar