public function displayInfoByCart($id_cart) { $this->hooklog("displayInfoByCart", $id_cart); $this->myLog("POST=" . $this->logValue($_POST)); $this->myLog('dejala_action=' . Tools::getValue('dejala_action')); if (Tools::getValue('dejala_action') == 'order') { $this->myLog('inside - id_cart=' . $id_cart); $mOrderId = (int) Order::getOrderByCartId($id_cart); $mOrder = new Order($mOrderId); $this->placeOrder($mOrder); } $djlCart = new DejalaCart($id_cart); if ($djlCart && isset($djlCart->id_dejala_product) && isset($djlCart->shipping_date)) { $mDejalaProductID = $djlCart->id_dejala_product; $mShippingDate = $djlCart->shipping_date; echo '<h4 style="color:red;">'; if ($djlCart->mode !== 'PROD') { echo 'MODE : TEST<br/>'; } if (!empty($mShippingDate) && $mShippingDate != 0) { echo $this->l('Shipping date selected') . ' : ' . date('d/m/Y', $mShippingDate) . ', ' . $this->l('starting at') . ' : ' . date('H\\hi', $mShippingDate) . '<br/>'; } else { echo $this->l('Shipping date not yet selected by the customer') . '<br/>'; } if ($djlCart->id_delivery && Validate::isUnsignedId($djlCart->id_delivery)) { $l_delivery = array(); $l_delivery['id'] = $djlCart->id_delivery; $djlUtil = new DejalaUtils(); $response = $djlUtil->getDelivery($this->dejalaConfig, $l_delivery, $djlCart->mode); if ($response['status'] == 200) { if ($l_delivery && $l_delivery['status'] && $l_delivery['status']['labels'] && $l_delivery['status']['labels'][Language::getIsoById((int) $this->id_lang)]) { echo $this->l('Order') . ' ' . $l_delivery['status']['labels'][Language::getIsoById((int) $this->id_lang)] . '<br/>'; } else { echo $this->l('Order sent to Dejala') . '<br/>'; } } } else { $_html = ''; $_html .= '<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">'; $_html .= '<input type="hidden" name="dejala_action" value="order">'; $_html .= '<input type="submit" value="Commander la course">'; $_html .= '</form><br />'; echo $_html . ''; } echo '</h4>'; } }
public function displayInfoByCart($id_cart) { $this->hooklog("displayInfoByCart", $id_cart); $this->myLog("POST=" . $this->logValue($_POST)); $this->myLog('dejala_action=' . Tools::getValue('dejala_action')); if (Tools::getValue('dejala_action') == 'order') { $this->myLog('inside - id_cart=' . $id_cart); $mOrderId = Order::getOrderByCartId($id_cart); $mOrder = new Order($mOrderId); $this->placeOrder($mOrder); } $djlCart = new DejalaCart($id_cart); if ($djlCart && isset($djlCart->id_dejala_product) && isset($djlCart->shipping_date)) { $mDejalaProductID = $djlCart->id_dejala_product; $mShippingDate = $djlCart->shipping_date; echo utf8_encode('<h4 style="color:red;">'); if ($djlCart->mode !== 'PROD') { echo 'MODE : TEST<br/>'; } if (!empty($mShippingDate) && $mShippingDate != 0) { echo utf8_encode('Livraison souhaitée le ' . date('d/m/Y', $mShippingDate) . ' à partir de ' . date('H\\hi', $mShippingDate) . '<br/>'); } else { echo utf8_encode('Livraison dont la date doit être fixée avec le client' . '<br/>'); } if ($djlCart->id_delivery && Validate::isUnsignedId($djlCart->id_delivery)) { $l_delivery = array(); $l_delivery['id'] = $djlCart->id_delivery; $djlUtil = new DejalaUtils(); $response = $djlUtil->getDelivery($this->dejalaConfig, $l_delivery, $djlCart->mode); if ($response['status'] == 200) { if ($l_delivery && $l_delivery['status'] && $l_delivery['status']['labels'] && $l_delivery['status']['labels']['fr']) { echo utf8_encode('Commande ' . $l_delivery['status']['labels']['fr'] . '<br/>'); } else { echo utf8_encode('Commande envoyée à Dejala.fr<br/>'); } } } else { $_html = ''; //echo utf8_encode('<form Livraison souhaitée le '.date('d/m/Y',$mShippingDate).' à partir de '.date('H\hi', $mShippingDate) .'<br/>'); $_html .= '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">'; $_html .= '<input type="hidden" name="dejala_action" value="order">'; $_html .= '<input type="submit" value="Commander la course">'; $_html .= '</form><br />'; echo $_html . ''; } echo utf8_encode('</h4">'); } }