我想在prestashop

时间:2016-08-03 07:27:12

标签: prestashop prestashop-1.6 prestashop-1.5 prestashop-1.7

我希望在每天完成100/50个订单(这将是一个参数)时,在prestashop 1.6.3的订单页面中禁用鳕鱼交付功能。

如何通过查找100鳕鱼是否已完成以编程方式禁用此功能。

enter image description here

1 个答案:

答案 0 :(得分:1)

我将在cashondelivery模块中修改hookPayment()来执行此操作:

 public function hookPayment($params)
{

    if (!$this->active)
        return ;

    global $smarty;

    // Check if cart has product download
    if ($this->hasProductDownload($params['cart']))
        return false;
    //Check whether the cod done exceeds the daily limit if yes dont display the cod option
    $cod_limit  = Configuration::get('PS_KITS_COD_DAILY_LIMIT');//  number of cod
    $sql        = "select count(*) AS cod_count from ps_orders where module='cashondelivery' and date(date_add) = CURDATE() and ( current_state= 3 or current_state=4)";    
    if ($row = Db::getInstance()->getRow($sql)){
    $cod_count        = $row['cod_count']; 
    }
    if ($cod_count  >= $cod_limit){
    return ;
    }
    $smarty->assign(array(
        'this_path' => $this->_path, //keep for retro compat
        'this_path_cod' => $this->_path,
        'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
    ));
    return $this->display(__FILE__, 'payment.tpl');
}