2016-08-03 26 views
0

Ich möchte die Kabeljagd Lieferung Feature auf der Bestellseite von Prestashop 1.6.3 deaktivieren, wenn 100/50 Bestellungen (dies wird ein Parameter sein) ist abgeschlossen pro Tag.Ich möchte Kabeljau deaktivieren, wenn 100 Kabeljau Bestellungen in Prestashop abgeschlossen ist

Wie Sie dies programmgesteuert deaktivieren, indem Sie herausfinden, ob 100 cod abgeschlossen ist.

enter image description here

+0

Sie können dies nicht von out-of-the-box Prestashop. Sie müssen ein eigenes Modul erstellen und die Zahlungshaken anklicken, um die DB abzufragen und zu sehen, wie viele Nachzahlungen an einem bestimmten Tag geleistet wurden. –

+0

"Wählen Sie Anzahl (*) AS cod_count von ps_orders wo Modul = 'callondelivery' und Datum (date_add) = CURDATE() und (current_state = 3 oder current_state = 4)" - Diese Abfrage ist Ritus? Bitte überprüfen Sie meine Antwort, die ich gepostet habe Ich werde die hookPayment in candondelivery Modul ändern –

Antwort

1

Ich werde die hookPayment() in cashondelivery Modul ändern, dies zu tun:

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

Sounds über richtig, haben Sie das getestet? –