shopp('checkout.payment-options')

This multipurpose tag by default is used to render a selection menu on the checkout page for one or multiple payment options.

shopp('checkout', 'payment-options', '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 when not in loop mode; payment option markup returned when return option is used. boolean true while looping through payment options, false when finished looping

Alternative Forms

shopp('checkout.payment-options', 'options');
shopp('checkout.pay-options', 'options');

Description

Payment option menu, or loop iterator.

By default it renders the options as a drop-down menu (HTML <select>) but can also display an unordered-list of radio buttons or a hidden input that can be manipulated by custom front-end scripting to set the appropriate payment value. Alternatively, this tag can be used as an iterator function, in conjunction with the shopp(‘checkout’,’payment-option’) theme api call to build your own menu.

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.

Options

The following options are valid.

  • mode – (Default unset) Specify mode=loop if you would like to treat payment-options as an iterator. default, type, and exclude options do not apply when in loop mode.
  • type – Can be of type list, hidden, or menu. Defaults to type menu. Determines whether the tag will output a selection menu, list of radios, or a hidden input for the paymethod field. Option not used when in loop mode.
  • default – Set the default payment option by specifying the slug of the Option Name value you set for the payment method in the Payment Settings. For example, if you called the payment method Offline Payment, use default=offline-payment. Option not used when in loop mode.
  • exclude – Specify the payment method/s to be excluded from the options. To exclude multiple options, separate the payment method slugs with commas. For example, to exclude methods named Offline Payment and Credit Card, use exclude=offline-payment,credit-card. Option not used when in loop mode.

Examples

For programmers that need the iterator behavior use:

while(shopp('checkout.payment-options','mode=loop')) {
    shopp('checkout','payment-option','option...'); // Build your own menu
}

Get the markup for a single default payment method, labeled 2Checkout, as a hidden input.

$payoption_input = shopp('checkout.get-pay-options',array(
    'default'=>'2Checkout',
    'type'=>'hidden'
));

echo $payoption_input;

Output a select drop-down menu of payment options, excluding those labeled Test Mode and Offline Payments

shopp('checkout.pay-options',array(
    'type' => 'menu',
    'exclude' => 'Test Mode,Offline Payments'
));

For menu selecting defaults and excluding certain payment options:

// display list of payment option radios, with default to payment option with Credit Card, and exclude PayPal and Google Checkout from list 
<?php shopp('checkout','payment-options','type=list&default=credit-card&exclude=paypal,google-checkout'); ?>

See Also

  1. Avatar of Chris

    It should be noted that default checks against the payment type slug, so in the last example default=Credit Card should actually be default=credit-card.

    November 4th   #

  2. Avatar of Ben Hutchings

    I’ve corrected that, and tried to explain it a little better in the options. Thanks

    January 13th   #

You must be logged in to post a comment.

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

Skip to toolbar