yf_shop__order_validate_delivery user module

Fileplugins/shop/modules/shop/yf_shop__order_validate_delivery.class.php
Usemodule('shop__order_validate_delivery'), URL ?object=shop__order_validate_delivery

Public properties

PropertyDefaultDescription
None declared in this class.

Public methods 1

None without a leading underscore.

Methods starting with _ hooks and helpers; not routable as page actions

public function _order_validate_delivery()

Order validation.

    public function _order_validate_delivery()
    {
        $_POST['exp_date'] = ($_POST['exp_date_mm'] ?? null) . ($_POST['exp_date_yy'] ?? null);

        $force_ship_type = module('shop')->FORCE_GROUP_SHIP[module('shop')->USER_GROUP];
        if ($force_ship_type) {
            $_POST['ship_type'] = $force_ship_type;
        }
        if ( ! strlen(($_POST['ship_type'] ?? '')) || ! isset(module('shop')->_ship_types[$_POST['ship_type']])) {
            _re('Shipping type required');
        }
        foreach ((array) module('shop')->_b_fields as $_field) {
            if ( ! strlen(($_POST[$_field] ?? '')) && in_array($_field, module('shop')->_required_fields)) {
                _re(t(str_replace('b_', 'Billing ', $_field)) . ' ' . t('is required'));
            }
        }
        if (($_POST['email'] ?? null) != '' && ! common()->email_verify(($_POST['email'] ?? null))) {
            _re('email not valid.');
        }
    }