You are here

interface CommerceShippingQuoteInterface in Commerce Shipping 7

Declares an interface for shipping quote classes

Hierarchy

Expanded class hierarchy of CommerceShippingQuoteInterface

All classes that implement CommerceShippingQuoteInterface

File

plugins/quotes/quote_base/CommerceShippingQuote.class.php, line 13
Contains the CommerceShippingQuote class and CommerceShippingQuoteInterface interface.

View source
interface CommerceShippingQuoteInterface {

  /**
   * Used to customize the Rules settings form for rules activating the shipping quote.
   *
   * @param $form
   *    RulesDataUI InputForm
   * @param $rules_settings
   *    Array of values passed by rules.
   */
  public function settings_form(&$form, $rules_settings);

  /**
   * Function to dynamically set the label
   *
   * @param $order
   *    Optionally pass the order, if the class wasn't instantiated with the order.
   */
  public function form_label($order = NULL);

  /**
   * Allow quote to add an form displayed when the shipping quote is selected.
   *
   * @param $pane_values
   *    $form_state['values'] from the pane where the form is located
   * @param $checkout_pane
   *    $checkout_pane passed by commerce.
   * @param $order
   *    Optionally pass the order, if the class wasn't instantiated with the order.
   */
  public function submit_form($pane_values, $checkout_pane, $order = NULL);

  /**
   * Perform validation on submit_form
   *
   * @param $pane_values
   *    $form_state['values'] from the pane where the form is located
   * @param $checkout_pane
   *    $checkout_pane passed by commerce.
   * @param $form_parents
   *    The submit_form's parents, which can be used when setting form_errors
   * @param $order
   *    Optionally pass the order, if the class wasn't instantiated with the order.
   */
  public function submit_form_validate($pane_form, $pane_values, $form_parents = array(), $order = NULL);

  /**
   * Called After shipping items is created.
   *
   * @param $pane_values
   *    $form_state['values'] from the pane where the form is located
   * @param $checkout_pane
   *    $checkout_pane passed by commerce.
   * @param $order
   *    Optionally pass the order, if the class wasn't instantiated with the order.
   */
  public function shipping_items_created($pane_values, $checkout_pane, $order = NULL);

  /**
   * Do the actual shipping cost calculation.
   *
   * @param $currency_code
   *    The currency code that the shipping should use when returning the cost.
   * @param $form_values
   *    Array of values inputted in the submit form by the user.
   * @param $order
   *    The order for which operations should be done.
   * @param $pane_form
   *    The complete form array of the pane that shipping method is located on.
   * @param $pane_values
   *    The complete $form_state of the pane that shipping method is located on.
   *
   * @return array of values, one for each line item created containing one of.
   *  - (array) containing any of these keys: 'amount', 'currency_code', 'quantity', 'label'
   *  - (int) the price of the shipping, the order currency will be used, formatted as integer.
   */
  public function calculate_quote($currency_code, $form_values = array(), $order = NULL, $pane_form = NULL, $pane_values = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
CommerceShippingQuoteInterface::calculate_quote public function Do the actual shipping cost calculation. 1
CommerceShippingQuoteInterface::form_label public function Function to dynamically set the label 1
CommerceShippingQuoteInterface::settings_form public function Used to customize the Rules settings form for rules activating the shipping quote. 1
CommerceShippingQuoteInterface::shipping_items_created public function Called After shipping items is created. 1
CommerceShippingQuoteInterface::submit_form public function Allow quote to add an form displayed when the shipping quote is selected. 1
CommerceShippingQuoteInterface::submit_form_validate public function Perform validation on submit_form 1