Exemple #1
0
        }
        foreach ($_POST as $name => $value) {
            //have to do a discount code check here - otherwise things just don't work - but fine for free shipping codes
            if (strstr($name, 'amount_')) {
                if (isset($_SESSION['eshop_discount' . $blog_id]) && eshop_discount_codes_check()) {
                    $chkcode = valid_eshop_discount_code($_SESSION['eshop_discount' . $blog_id]);
                    if ($chkcode && apply_eshop_discount_code('discount') > 0) {
                        $discount = apply_eshop_discount_code('discount') / 100;
                        $value = number_format(round($value - $value * $discount, 2), 2);
                        $vset = 'yes';
                    }
                }
                if (is_discountable(calculate_total()) != 0 && !isset($vset)) {
                    $discount = is_discountable(calculate_total()) / 100;
                    $value = number_format(round($value - $value * $discount, 2), 2);
                }
            }
            if (sizeof($stateList) > 0 && ($name == 'state' || $name == 'ship_state')) {
                if ($value != '') {
                    $value = $eshopstatelist[$value];
                }
            }
            $p->add_field($name, $value);
        }
        if ($eshopoptions['status'] != 'live' && is_user_logged_in() && current_user_can('eShop_admin') || $eshopoptions['status'] == 'live') {
            $echoit .= $p->submit_cash_post();
            // submit the fields to cash
            //$p->dump_fields();      // for debugging, output a table of all the fields
        }
        break;
}