diff --git a/controllers/admin/AdminEverPsQuotationController.php b/controllers/admin/AdminEverPsQuotationController.php index af3c71c..b940528 100644 --- a/controllers/admin/AdminEverPsQuotationController.php +++ b/controllers/admin/AdminEverPsQuotationController.php @@ -61,7 +61,7 @@ public function __construct() INNER JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country INNER JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON ( country.`id_country` = country_lang.`id_country` - AND country_lang.`id_lang` = ' . (int)$this->context->language->id . ' + AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ' )'; $this->_orderBy = 'id_everpsquotation_quotes'; $this->_orderWay = 'DESC'; @@ -73,6 +73,11 @@ public function __construct() 'align' => 'text-center', 'class' => 'fixed-width-xs' ), + 'id_cart' => array( + 'title' => $this->l('ID cart'), + 'align' => 'text-center', + 'class' => 'fixed-width-xs' + ), 'customer' => array( 'title' => $this->l('Customer'), 'havingFilter' => true, @@ -155,7 +160,7 @@ public function __construct() $moduleConfUrl .= Tools::getAdminTokenLite('AdminModules'); $this->context->smarty->assign(array( 'moduleConfUrl' => $moduleConfUrl, - 'everpsquotation_dir' => Tools::getHttpHost(true).__PS_BASE_URI__.'/modules/everpsquotation' + 'everpsquotation_dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . '/modules/everpsquotation' )); } @@ -219,7 +224,7 @@ public function postProcess() } if (Tools::getIsset('statusvalideverpsquotation_quotes')) { $quote = new EverpsquotationClass( - (int)Tools::getValue('id_everpsquotation_quotes') + (int) Tools::getValue('id_everpsquotation_quotes') ); $quote->valid = !$quote->valid; if (!$quote->update()) { @@ -228,10 +233,10 @@ public function postProcess() } if (Tools::getIsset('deleteeverpsquotation_quotes')) { $quote = new EverpsquotationClass( - (int)Tools::getValue('id_everpsquotation_quotes') + (int) Tools::getValue('id_everpsquotation_quotes') ); $quote_cart = new EverpsquotationCart( - (int)$quote->id_cart + (int) $quote->id_cart ); if (!$quote->deleteQuoteCart() || $quote_cart->dropQuoteCartProducts()) { $this->errors[] = Tools::displayError('An error has occurred: Can\'t update the current object'); @@ -242,9 +247,9 @@ public function postProcess() (int) Tools::getValue('id_everpsquotation_quotes') ); $products = EverpsquotationDetail::getQuoteDetailByQuoteId( - (int)$quote->id, - (int)$this->context->shop->id, - (int)$this->context->language->id + (int) $quote->id, + (int) $this->context->shop->id, + (int) $this->context->language->id ); $cart = new Cart(); $cart->id_customer = (int) $quote->id_customer; @@ -278,7 +283,7 @@ public function displayDropQuoteLink($token, $id_everpsquotation) } $quote_controller_link = 'index.php?controller=AdminEverPsQuotation&token='; $quote_controller_link .= Tools::getAdminTokenLite('AdminEverPsQuotation'); - $quote_controller_link .= '&id_everpsquotation_quotes='.(int)$id_everpsquotation; + $quote_controller_link .= '&id_everpsquotation_quotes=' . (int) $id_everpsquotation; $quote_controller_link .= '&deleteeverpsquotation_quotes'; $this->context->smarty->assign(array( @@ -288,10 +293,17 @@ public function displayDropQuoteLink($token, $id_everpsquotation) )); return $this->context->smarty->fetch( - _PS_MODULE_DIR_.'everpsquotation/views/templates/admin/helpers/lists/list_action_drop_quote.tpl' + _PS_MODULE_DIR_ . 'everpsquotation/views/templates/admin/helpers/lists/list_action_drop_quote.tpl' ); } + public function displayViewCartLink($token, $id_everpsquotation) + { + if (!$token) { + return; + } + } + public function displayConvertToOrderLink($token, $id_everpsquotation) { if (!$token) { @@ -299,7 +311,7 @@ public function displayConvertToOrderLink($token, $id_everpsquotation) } $quote_controller_link = 'index.php?controller=AdminEverPsQuotation&token='; $quote_controller_link .= Tools::getAdminTokenLite('AdminEverPsQuotation'); - $quote_controller_link .= '&id_everpsquotation_quotes='.(int)$id_everpsquotation; + $quote_controller_link .= '&id_everpsquotation_quotes=' . (int) $id_everpsquotation; $quote_controller_link .= '&convert_to_order'; $this->context->smarty->assign(array( @@ -320,7 +332,7 @@ protected function processTransformCartToQuote() ); Hook::exec('actionBeforeCreateEverQuote'); $id_quote_cart = EverpsquotationCart::copyCartToQuoteCart( - (int)$cart->id + (int) $cart->id ); if (!Validate::isInt($id_quote_cart)) { die($this->trans('An error has occured.', array(), 'Modules.Everpsquotation.Shop')); @@ -333,31 +345,31 @@ protected function processTransformCartToQuote() return; } $quote = new EverpsquotationClass(); - $quote->reference = (string)Configuration::get('EVERPSQUOTATION_PREFIX'); - $quote->id_shop_group = (int)$cart->id_shop_group; - $quote->id_shop = (int)$cart->id_shop; - $quote->id_carrier = (int)$cart->id_carrier; - $quote->id_lang = (int)$cart->id_lang; - $quote->id_customer = (int)$cart->id_customer; - $quote->id_cart = (int)$cart->id; - $quote->id_currency = (int)$cart->id_currency; - $quote->id_address_delivery = (int)$cart->id_address_delivery; - $quote->id_address_invoice = (int)$cart->id_address_invoice; + $quote->reference = (string) Configuration::get('EVERPSQUOTATION_PREFIX'); + $quote->id_shop_group = (int) $cart->id_shop_group; + $quote->id_shop = (int) $cart->id_shop; + $quote->id_carrier = (int) $cart->id_carrier; + $quote->id_lang = (int) $cart->id_lang; + $quote->id_customer = (int) $cart->id_customer; + $quote->id_cart = (int) $cart->id; + $quote->id_currency = (int) $cart->id_currency; + $quote->id_address_delivery = (int) $cart->id_address_delivery; + $quote->id_address_invoice = (int) $cart->id_address_invoice; $quote->secure_key = (string)$cart->secure_key; - $quote->recyclable = (int)$cart->recyclable; - $quote->total_discounts = (float)$cartdetails['total_discounts']; - $quote->total_discounts_tax_incl = (float)$cartdetails['total_discounts']; - $quote->total_discounts_tax_excl = (float)$cartdetails['total_discounts_tax_exc']; - $quote->total_paid_tax_incl = (float)$cartdetails['total_price']; - $quote->total_paid_tax_excl = (float)$cartdetails['total_price_without_tax']; - $quote->total_products = (float)$cartdetails['total_products']; - $quote->total_products_wt = (float)$cartdetails['total_products_wt']; - $quote->total_shipping = (float)$cartdetails['total_shipping']; - $quote->total_shipping_tax_incl = (float)$cartdetails['total_shipping']; - $quote->total_shipping_tax_excl = (float)$cartdetails['total_shipping_tax_exc']; - $quote->total_wrapping = (float)$cartdetails['total_wrapping']; - $quote->total_wrapping_tax_incl = (float)$cartdetails['total_wrapping']; - $quote->total_wrapping_tax_excl = (float)$cartdetails['total_wrapping_tax_exc']; + $quote->recyclable = (int) $cart->recyclable; + $quote->total_discounts = (float) $cartdetails['total_discounts']; + $quote->total_discounts_tax_incl = (float) $cartdetails['total_discounts']; + $quote->total_discounts_tax_excl = (float) $cartdetails['total_discounts_tax_exc']; + $quote->total_paid_tax_incl = (float) $cartdetails['total_price']; + $quote->total_paid_tax_excl = (float) $cartdetails['total_price_without_tax']; + $quote->total_products = (float) $cartdetails['total_products']; + $quote->total_products_wt = (float) $cartdetails['total_products_wt']; + $quote->total_shipping = (float) $cartdetails['total_shipping']; + $quote->total_shipping_tax_incl = (float) $cartdetails['total_shipping']; + $quote->total_shipping_tax_excl = (float) $cartdetails['total_shipping_tax_exc']; + $quote->total_wrapping = (float) $cartdetails['total_wrapping']; + $quote->total_wrapping_tax_incl = (float) $cartdetails['total_wrapping']; + $quote->total_wrapping_tax_excl = (float) $cartdetails['total_wrapping_tax_exc']; $quote->valid = 0; $quote->date_add = date('Y-m-d H:i:s'); $quote->date_upd = date('Y-m-d H:i:s'); @@ -366,30 +378,30 @@ protected function processTransformCartToQuote() //Now create new Everpsquotationdetail object foreach ($cartproducts as $cartproduct) { $quotedetail = new EverpsquotationDetail(); - $quotedetail->id_everpsquotation_quotes = (int)$quote->id; - $quotedetail->id_shop = (int)$cartproduct['id_shop']; - $quotedetail->product_id = (int)$cartproduct['id_product']; - $quotedetail->product_attribute_id = (int)$cartproduct['id_product_attribute']; - $quotedetail->id_customization = (int)$cartproduct['id_customization']; - $quotedetail->product_name = (string)$cartproduct['name']; - $quotedetail->product_quantity = (int)$cartproduct['cart_quantity']; - $quotedetail->product_quantity_in_stock = (int)$cartproduct['stock_quantity']; + $quotedetail->id_everpsquotation_quotes = (int) $quote->id; + $quotedetail->id_shop = (int) $cartproduct['id_shop']; + $quotedetail->product_id = (int) $cartproduct['id_product']; + $quotedetail->product_attribute_id = (int) $cartproduct['id_product_attribute']; + $quotedetail->id_customization = (int) $cartproduct['id_customization']; + $quotedetail->product_name = (string) $cartproduct['name']; + $quotedetail->product_quantity = (int) $cartproduct['cart_quantity']; + $quotedetail->product_quantity_in_stock = (int) $cartproduct['stock_quantity']; $quotedetail->product_price = $cartproduct['price']; - $quotedetail->product_ean13 = (string)$cartproduct['ean13']; - $quotedetail->product_isbn = (string)$cartproduct['isbn']; - $quotedetail->product_upc = (string)$cartproduct['upc']; - $quotedetail->product_reference = (string)$cartproduct['reference']; - $quotedetail->product_supplier_reference = (string)$cartproduct['supplier_reference']; - $quotedetail->product_weight = (float)$cartproduct['weight']; - $quotedetail->tax_name = (string)$cartproduct['tax_name']; - $quotedetail->ecotax = (float)$cartproduct['ecotax']; - $quotedetail->unit_price_tax_excl = (float)$cartproduct['price']; - $quotedetail->total_price_tax_incl = (float)$cartproduct['total_wt']; - $quotedetail->total_price_tax_excl = (float)$cartproduct['total']; + $quotedetail->product_ean13 = (string) $cartproduct['ean13']; + $quotedetail->product_isbn = (string) $cartproduct['isbn']; + $quotedetail->product_upc = (string) $cartproduct['upc']; + $quotedetail->product_reference = (string) $cartproduct['reference']; + $quotedetail->product_supplier_reference = (string) $cartproduct['supplier_reference']; + $quotedetail->product_weight = (float) $cartproduct['weight']; + $quotedetail->tax_name = (string) $cartproduct['tax_name']; + $quotedetail->ecotax = (float) $cartproduct['ecotax']; + $quotedetail->unit_price_tax_excl = (float) $cartproduct['price']; + $quotedetail->total_price_tax_incl = (float) $cartproduct['total_wt']; + $quotedetail->total_price_tax_excl = (float) $cartproduct['total']; $quotedetail->add(); } Hook::exec('actionAfterCreateEverQuote'); - if ((bool)Configuration::get('EVERPSQUOTATION_RENDER_ON_VALIDATION') === true) { + if ((bool) Configuration::get('EVERPSQUOTATION_RENDER_ON_VALIDATION') === true) { $pdf = new PDF($quote->id, 'EverQuotationPdf', Context::getContext()->smarty); $pdf->render(); } diff --git a/controllers/front/quote.php b/controllers/front/quote.php index 5eec282..051350a 100644 --- a/controllers/front/quote.php +++ b/controllers/front/quote.php @@ -72,7 +72,7 @@ public function displayAjaxSetQuote() if (!$id_attribute) { $id_attribute = 0; } - $sql = 'SELECT minimal_quantity FROM '._DB_PREFIX_.'product WHERE id_product = '. (int) Tools::getValue('everid_product') . ''; + $sql = 'SELECT minimal_quantity FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . (int) Tools::getValue('everid_product') . ''; $minimalQuantity = (int) Db::getInstance()->getValue($sql); @@ -137,7 +137,11 @@ private function triggerGtmTag($quoteId) private function createSimpleProductQuote($id_product, $id_product_attribute, $id_customization, $qty) { - $cart = Context::getContext()->cart; + $cart = new Cart(); + $cart->id_customer = $this->context->customer->id; + $cart->id_address_delivery = $this->context->cart->id_address_delivery; + $cart->id_currency = $this->context->cart->id_currency; + $cart->add(); // Important d'ajouter le panier à la base de données $cart->updateQty( $qty, $id_product, @@ -147,7 +151,7 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i // Récupérez tous les transporteurs disponibles $carriers = Carrier::getCarriers( - Context::getContext()->language->id, + $this->context->language->id, true, false, false, @@ -155,50 +159,6 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE ); - // Initialisez une variable pour stocker le premier transporteur payant - $first_paid_carrier = null; - $deliveryAddress = new Address( - $cart->id_address_delivery - ); - $country = new Country( - (int) $deliveryAddress->id_country - ); - $zone = new Zone( - (int) $country->id_zone - ); - - foreach ($carriers as $carrier) { - $carrier = new Carrier( - (int) $carrier['id_carrier'] - ); - // Vérifiez si le transporteur est disponible pour la destination du panier - if (Carrier::checkCarrierZone( - $carrier->id, - (int)$zone->id - )) { - $deliveryPriceByWeight = $carrier->getDeliveryPriceByWeight( - $cart->getTotalWeight(), - $zone->id - ); - // Vérifiez si le coût du transporteur est supérieur à zéro - if ($deliveryPriceByWeight > 0) { - $first_paid_carrier = $carrier; - break; - } - } - } - - if ($first_paid_carrier !== null) { - $id_first_paid_carrier = $first_paid_carrier->id; - $id_cart = $cart->id; - $id_address_delivery = $cart->id_address_delivery; - $delivery_option = array( - $id_address_delivery => $id_first_paid_carrier.',' // Notez la virgule à la fin - ); - $cart->setDeliveryOption($delivery_option); - $cart->update(); - } - Hook::exec('actionBeforeCreateEverQuote'); // First create Quote Cart @@ -232,35 +192,36 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i $cart_details = $ever_cart->getSummaryDetails( (int)$cart->id ); + // die(var_dump($cart_details)); $cart_products = $ever_cart->getProducts(); // Now create quotation $quote = new EverpsquotationClass(); - $quote->reference = (string)Configuration::get('EVERPSQUOTATION_PREFIX'); - $quote->id_shop_group = (int)$cart->id_shop_group; - $quote->id_shop = (int)$cart->id_shop; - $quote->id_carrier = (int)$cart->id_carrier; - $quote->id_lang = (int)$cart->id_lang; - $quote->id_customer = (int)$cart->id_customer; - $quote->id_cart = (int)$cart->id; - $quote->id_currency = (int)$cart->id_currency; - $quote->id_address_delivery = (int)$cart->id_address_delivery; - $quote->id_address_invoice = (int)$cart->id_address_invoice; - $quote->secure_key = (string)$cart->secure_key; - $quote->recyclable = (int)$cart->recyclable; - $quote->total_discounts = (float)$cart_details['total_discounts']; - $quote->total_discounts_tax_incl = (float)$cart_details['total_discounts']; - $quote->total_discounts_tax_excl = (float)$cart_details['total_discounts_tax_exc']; - $quote->total_paid_tax_incl = (float)$cart_details['total_price']; - $quote->total_paid_tax_excl = (float)$cart_details['total_price_without_tax']; - $quote->total_products = (float)$cart_details['total_products']; - $quote->total_products_wt = (float)$cart_details['total_products_wt']; - $quote->total_shipping = (float)$cart_details['total_shipping']; - $quote->total_shipping_tax_incl = (float)$cart_details['total_shipping']; - $quote->total_shipping_tax_excl = (float)$cart_details['total_shipping_tax_exc']; - $quote->total_wrapping = (float)$cart_details['total_wrapping']; - $quote->total_wrapping_tax_incl = (float)$cart_details['total_wrapping']; - $quote->total_wrapping_tax_excl = (float)$cart_details['total_wrapping_tax_exc']; + $quote->reference = (string) Configuration::get('EVERPSQUOTATION_PREFIX'); + $quote->id_shop_group = (int) $cart->id_shop_group; + $quote->id_shop = (int) $cart->id_shop; + $quote->id_carrier = (int) $cart->id_carrier; + $quote->id_lang = (int) $cart->id_lang; + $quote->id_customer = (int) $cart->id_customer; + $quote->id_cart = (int) $cart->id; + $quote->id_currency = (int) $cart->id_currency; + $quote->id_address_delivery = (int) $cart->id_address_delivery; + $quote->id_address_invoice = (int) $cart->id_address_invoice; + $quote->secure_key = (string) $cart->secure_key; + $quote->recyclable = (int) $cart->recyclable; + $quote->total_discounts = (float) $cart_details['total_discounts']; + $quote->total_discounts_tax_incl = (float) $cart_details['total_discounts']; + $quote->total_discounts_tax_excl = (float) $cart_details['total_discounts_tax_exc']; + $quote->total_paid_tax_incl = (float) $cart_details['total_price']; + $quote->total_paid_tax_excl = (float) $cart_details['total_price_without_tax']; + $quote->total_products = (float) $cart_details['total_products']; + $quote->total_products_wt = (float) $cart_details['total_products_wt']; + $quote->total_shipping = (float) $cart_details['total_shipping']; + $quote->total_shipping_tax_incl = (float) $cart_details['total_shipping']; + $quote->total_shipping_tax_excl = (float) $cart_details['total_shipping_tax_exc']; + $quote->total_wrapping = (float) $cart_details['total_wrapping']; + $quote->total_wrapping_tax_incl = (float) $cart_details['total_wrapping']; + $quote->total_wrapping_tax_excl = (float) $cart_details['total_wrapping_tax_exc']; $quote->valid = 0; $quote->date_add = date('Y-m-d H:i:s'); $quote->date_upd = date('Y-m-d H:i:s'); @@ -269,46 +230,46 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i // Add ever cart to quotation details foreach ($cart_products as $cart_product) { $product_stock = StockAvailable::getQuantityAvailableByProduct( - (int)$cart_product['id_product'], - (int)$cart_product['id_product_attribute'] + (int) $cart_product['id_product'], + (int) $cart_product['id_product_attribute'] ); $price_with_tax = Product::getPriceStatic( - (int)$cart_product['id_product'], + (int) $cart_product['id_product'], true, - (int)$cart_product['id_product_attribute'] + (int) $cart_product['id_product_attribute'] ); $price_without_tax = Product::getPriceStatic( - (int)$cart_product['id_product'], + (int) $cart_product['id_product'], false, - (int)$cart_product['id_product_attribute'] + (int) $cart_product['id_product_attribute'] ); - $total_wt = (float)$price_with_tax * (int)$cart_product['cart_quantity']; - $total = (float)$price_without_tax * (int)$cart_product['cart_quantity']; + $total_wt = (float) $price_with_tax * (int) $cart_product['cart_quantity']; + $total = (float) $price_without_tax * (int) $cart_product['cart_quantity']; // $product_taxes = $price_with_tax - $price_without_tax; // $total_product_taxes = $total_wt - $total; // die(var_dump($price_without_tax)); $quotedetail = new EverpsquotationDetail(); - $quotedetail->id_everpsquotation_quotes = (int)$quote->id; + $quotedetail->id_everpsquotation_quotes = (int) $quote->id; // $quotedetail->id_warehouse = (int)$cart_details['total_discounts']['id_warehouse']; - $quotedetail->id_shop = (int)$cart_product['id_shop']; - $quotedetail->product_id = (int)$cart_product['id_product']; - $quotedetail->product_attribute_id = (int)$cart_product['id_product_attribute']; - $quotedetail->id_customization = (int)$cart_product['id_customization']; - $quotedetail->product_name = (string)$cart_product['name']; - $quotedetail->product_quantity = (int)$cart_product['cart_quantity']; - $quotedetail->product_quantity_in_stock = (int)$product_stock; - $quotedetail->product_price = (float)$price_without_tax; - $quotedetail->product_ean13 = (string)$cart_product['ean13']; - $quotedetail->product_isbn = (string)$cart_product['isbn']; - $quotedetail->product_upc = (string)$cart_product['upc']; - $quotedetail->product_reference = (string)$cart_product['reference']; - $quotedetail->product_supplier_reference = (string)$cart_product['supplier_reference']; - $quotedetail->product_weight = (float)$cart_product['weight']; + $quotedetail->id_shop = (int) $cart_product['id_shop']; + $quotedetail->product_id = (int) $cart_product['id_product']; + $quotedetail->product_attribute_id = (int) $cart_product['id_product_attribute']; + $quotedetail->id_customization = (int) $cart_product['id_customization']; + $quotedetail->product_name = (string) $cart_product['name']; + $quotedetail->product_quantity = (int) $cart_product['cart_quantity']; + $quotedetail->product_quantity_in_stock = (int) $product_stock; + $quotedetail->product_price = (float) $price_without_tax; + $quotedetail->product_ean13 = (string) $cart_product['ean13']; + $quotedetail->product_isbn = (string) $cart_product['isbn']; + $quotedetail->product_upc = (string) $cart_product['upc']; + $quotedetail->product_reference = (string) $cart_product['reference']; + $quotedetail->product_supplier_reference = (string) $cart_product['supplier_reference']; + $quotedetail->product_weight = (float) $cart_product['weight']; // $quotedetail->tax_name = (string)$cart_product['tax_name']; - $quotedetail->ecotax = (float)$cart_product['ecotax']; - $quotedetail->unit_price_tax_excl = (float)$price_without_tax; - $quotedetail->total_price_tax_incl = (float)$total_wt; - $quotedetail->total_price_tax_excl = (float)$total; + $quotedetail->ecotax = (float) $cart_product['ecotax']; + $quotedetail->unit_price_tax_excl = (float) $price_without_tax; + $quotedetail->total_price_tax_incl = (float) $total_wt; + $quotedetail->total_price_tax_excl = (float) $total; $quotedetail->add(); } Hook::exec('actionAfterCreateEverQuote'); @@ -322,13 +283,13 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i // Subject $ever_subject = $this->module::getConfigInMultipleLangs('EVERPSQUOTATION_MAIL_SUBJECT'); - $subject = $ever_subject[(int)Context::getContext()->language->id]; + $subject = $ever_subject[(int) Context::getContext()->language->id]; // Filename $filename = $this->module::getConfigInMultipleLangs('EVERPSQUOTATION_FILENAME'); - $ever_filename = $filename[(int)Context::getContext()->language->id]; + $ever_filename = $filename[(int) Context::getContext()->language->id]; - $id_shop = (int)Context::getContext()->shop->id; - $mailDir = _PS_MODULE_DIR_.'everpsquotation/mails/'; + $id_shop = (int) Context::getContext()->shop->id; + $mailDir = _PS_MODULE_DIR_ . 'everpsquotation/mails/'; $pdf = new PDF($quote->id, 'EverQuotationPdf', Context::getContext()->smarty); $customer = Context::getContext()->customer; $customerNames = $customer->firstname.' '.$customer->lastname; @@ -342,26 +303,26 @@ private function createSimpleProductQuote($id_product, $id_product_attribute, $i (string)$subject, array( '{shop_name}'=>Configuration::get('PS_SHOP_NAME'), - '{shop_logo}'=>_PS_IMG_DIR_.Configuration::get( + '{shop_logo}'=>_PS_IMG_DIR_ . Configuration::get( 'PS_LOGO', null, null, (int)$id_shop ), - '{firstname}' => (string)$customer->firstname, - '{lastname}' => (string)$customer->lastname, + '{firstname}' => (string) $customer->firstname, + '{lastname}' => (string) $customer->lastname, ), - (string)$customer->email, - (string)$customerNames, - (string)$everShopEmail, + (string) $customer->email, + (string) $customerNames, + (string) $everShopEmail, Configuration::get('PS_SHOP_NAME'), $attachment, null, $mailDir, false, null, - (string)$everShopEmail, - (string)$everShopEmail, + (string) $everShopEmail, + (string) $everShopEmail, Configuration::get('PS_SHOP_NAME') ); $cart->updateQty( @@ -401,7 +362,7 @@ private function setCartAsQuote(): int if ($total_cart <= 0) { Tools::redirect('index.php?controller=order&step=1'); } - if ((float)Configuration::get('EVERPSQUOTATION_MIN_AMOUNT') > 0 + if ((float) Configuration::get('EVERPSQUOTATION_MIN_AMOUNT') > 0 && $total_cart < Configuration::get('EVERPSQUOTATION_MIN_AMOUNT')) { Tools::redirect('index.php?controller=order&step=1'); } @@ -485,13 +446,13 @@ private function setCartAsQuote(): int // Subject $ever_subject = $this->module::getConfigInMultipleLangs('EVERPSQUOTATION_MAIL_SUBJECT'); - $subject = $ever_subject[(int)Context::getContext()->language->id]; + $subject = $ever_subject[(int) Context::getContext()->language->id]; // Filename $filename = $this->module::getConfigInMultipleLangs('EVERPSQUOTATION_FILENAME'); - $ever_filename = $filename[(int)Context::getContext()->language->id]; + $ever_filename = $filename[(int) Context::getContext()->language->id]; - $id_shop = (int)Context::getContext()->shop->id; - $mailDir = _PS_MODULE_DIR_.'everpsquotation/mails/'; + $id_shop = (int) Context::getContext()->shop->id; + $mailDir = _PS_MODULE_DIR_ . 'everpsquotation/mails/'; $pdf = new PDF($quote->id, 'EverQuotationPdf', Context::getContext()->smarty); $customerNames = $customer->firstname.' '.$customer->lastname; $attachment = array(); @@ -510,20 +471,20 @@ private function setCartAsQuote(): int null, (int)$id_shop ), - '{firstname}' => (string)$customer->firstname, - '{lastname}' => (string)$customer->lastname, + '{firstname}' => (string) $customer->firstname, + '{lastname}' => (string) $customer->lastname, ), - (string)$customer->email, - (string)$customerNames, - (string)$everShopEmail, + (string) $customer->email, + (string) $customerNames, + (string) $everShopEmail, Configuration::get('PS_SHOP_NAME'), $attachment, null, $mailDir, false, null, - (string)$everShopEmail, - (string)$everShopEmail, + (string) $everShopEmail, + (string) $everShopEmail, Configuration::get('PS_SHOP_NAME') ); return (int) $quote->id;