2016-08-03 50 views
0

我想在prestashop 1.6.3的命令页中禁用鳕鱼发送功能,当100/50个命令(这将是一个参数)每天完成时。我想在prestashop中完成100个cod命令时禁用cod 0

如何通过编程来查找是否已完成100个鳕鱼。

enter image description here

+0

不能从出的现成的Prestashop做到这一点。您必须创建您自己的模块,并挂钩Payment钩子来查询数据库,并查看给定日期内已完成多少COD付款。 –

+0

“select count(*)AS从ps_orders的cod_count其中module ='cashondelivery'和日期(date_add)= CURDATE()和(current_state = 3或current_state = 4)” - 此查询是礼仪? 请检查我的回复,我发布我将修改hookondell在cashondelivery模块 –

回答

1

我将修改hookPayment()在cashondelivery模块要做到这一点:

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'); 
} 
+0

关于正确的声音,你测试了吗? –