没有从自定义前端控制器 Prestashop 1.6.1.8 获得任何 POST 值

问题描述 投票:0回答:0

我希望通过 POST 请求获取一些数据到 Prestashop 1.6.1.8 中的自定义前端控制器。但是当我做

var_dump($_POST)
时,它显示
array(0) { }
.

我尝试使用另一个 Prestashop 的安装(相同版本)但是在 Docker 容器上,它工作得很好。只是不是在实时网站上。

这里是函数的完整代码:

public function postProcess(){
        $obj_advansedcoupons = new advansedcoupons();
        $data_translate = $obj_advansedcoupons->translateCustom();
        $type = Tools::getValue('type');
        $amount = Tools::getValue('amount');
        $email = Tools::getValue('accemail');
        var_dump($_GET);
        var_dump($_POST);
        print_r($type);
        print_r($amount);
        print_r($email);
        $b_type_voucher = Tools::strtoupper($type);
        
        $validity = $data_translate['voucher_duration'].date('Y-m-d', time() + 30*24*60*60);

        $sql_customer_by_email = 'SELECT id_customer FROM '._DB_PREFIX_.'customer WHERE email = "'.$email.'";';
        $id_customer = Db::getInstance()->getValue($sql_customer_by_email);
        if($id_customer){
            if($type && $amount && $email && $validity){
                $cartRule = new CartRule(
                    null,
                    Configuration::get('PS_LANG_DEFAULT'),
                    Configuration::get('PS_SHOP_DEFAULT')
                );
                $cartRule->name = .$email;
                $cartRule->reduction_percent = (float)$amount;
                $cartRule->date_to = date('Y-m-d H:i:s', time() + (int)30*24*60*60);
                $cartRule->quantity = 1;
                $cartRule->quantity_per_user = 1;
                $cartRule->date_from = date('Y-m-d H:i:s', time());
                $cartRule->code = Configuration::get('COUPON_PREF_'.$b_type_voucher).Tools::passwdGen(6);
                $cartRule->id_customer = (int)$id_customer;
                $cartRule->shop_restriction = (Shop::isFeatureActive())? 1: 0;
                $cartRule->add();
    
                $sql = 'INSERT INTO '._DB_PREFIX_.'ws_coupons (email, type, code, amount, validity) VALUES ("'.$email.'", "'.$type.'", "'.$cartRule->code.'", "'.$amount.'", "'.$cartRule->date_to.'")';   
                Db::getInstance()->execute($sql);
            }
        }
    }

有没有人遇到过这个问题?

post prestashop-1.6
© www.soinside.com 2019 - 2024. All rights reserved.