Order failed after chossing different billing address. Magento 2

• Cannot check “bogus” info yet, because you cannot place an order w/ a different billing address • Looks like Magento is try to pull in First and Last Name for billing address (we never had the option to enter a different name). Is this a Magento error If Magento, can we disable it? If not, can we have the name = the delivery name always … and just not display it?. Error message: Please check the billing address information firstname is a required field. lastname is a required field.

I appreciated your help.

Correct event to get order information after successful order

My requirement is to change order status when an order is placed successfully in Magento 2 .what is the event can I use so that I can change order status ,I have tried sales_order_save_after event but it will triggers whenever an order is saved ,I can’t use this event and my orders are placed through cron also I mean if I use checkout_submit_all_after event it will only triggers only from frontend .can I know what is the best event to do this job.please suggest me .

Does second order ZFC consistently extend first order ZFC?

  1. If I replace the axiom schema of specification in ZFC by a single axiom in second order logic, and similarly do same thing for the axiom schema of replacement, is this version of “second order ZFC” stronger then the original one when it proves first order sentences?

  2. If it is, is there any example proved in second order ZFC but not in first order ZFC?

  3. If not, is there any effective algorithm to convert proof of first order sentence in second order ZFC to that in first order ZFC?

  4. How about PA, or other axiomatic systems including axiom schema easily translated into single second order axiom? Is there any general result? If so, where can I find it?(reference?)

Thank you.

How to transform a quote into an order from CALLBACK HOOKS, MAGENTO 2.3

I’m trying to integrate a payment gateway. And they provide a callback hooks i’ve set for them to return me the CartID (Quote’s entity_id).

But from here on, it feels like it isnt right for me to call guest API, as the cart belongs to an actual customer’s cart. Neither do i have the access tokens when the callback hook is being sent to the API i’ve created.

How can i create the order (sales_order table & sales_order_grid) based on the quote i could receive ?

Please advise what should i do as im stuck on this for 3 days.

Mageento2 – New order e-mail for us

we have an extension that sends out a new order e-mail to our own private mailbox. Which is different from the ones that customers get. We print these mails automatically on a receit printer.

We use magento 2.1.16.

But not all orders are being printed. Cancelled and sometimes regular orders are not printed.

This extension is abandoned by its developer …. so i have to figure it out myself.

Can someone have a look at this?

I think this file takes care of the sending …. Observer/NewEmail.php

<?php  namespace Neworderemail\Adminemails\Observer;  use Magento\Framework\Event\ObserverInterface; use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Sales\Model\Order\Email\Container\OrderIdentity; use Magento\Sales\Model\Order\Address\Renderer;  class NewEmail implements ObserverInterface {      /**      * @var \Magento\Framework\Translate\Inline\StateInterface      */     protected $  inlineTranslation;      /**      * Store manager      *      * @var \Magento\Store\Model\StoreManagerInterface      */     protected $  _storeManager;      /**      * @var \Magento\Framework\Mail\Template\TransportBuilder      */     protected $  _transportBuilder;      /**      * @var \Magento\Framework\App\Config\ScopeConfigInterface      */     protected $  _scopeConfig;      /**      * Get extension configuration helper      * @var \Neworderemail\Adminemails\Helper\Config      */     public $  dataHelper;      /**      * Pricing Helper      * @var \Magento\Framework\Pricing\Helper\Data      */     public $  curHelper;      /**      * Order sender      */     public $  orderSender;      /**      * Sales order Model      * @var \Magento\Sales\Model\Order      */     protected $  order;      /**      * Initialize dependencies.      *      * @param \Magento\Framework\Translate\Inline\StateInterface $  inlineTranslation      * @param \Magento\Store\Model\StoreManagerInterface $  storeManager      * @param \Magento\Framework\Mail\Template\TransportBuilder $  transportBuilder      * @param \Magento\Framework\App\Config\ScopeConfigInterface $  scopeConfig      * @param \Neworderemail\Adminemails\Helper\Config $  dataHelper      */     public function __construct(         \Magento\Framework\Translate\Inline\StateInterface $  inlineTranslation,         \Magento\Store\Model\StoreManagerInterface $  storeManager,         \Magento\Framework\Mail\Template\TransportBuilder $  transportBuilder,         \Magento\Framework\App\Config\ScopeConfigInterface $  scopeConfig,         \Magento\Sales\Model\Order $  order,         \Neworderemail\Adminemails\Helper\Data $  dataHelper,         \Magento\Framework\Pricing\Helper\Data $  curHelper,         PaymentHelper $  paymentHelper,         OrderIdentity $  identityContainer,         Renderer $  addressRenderer      ) {         $  this->inlineTranslation = $  inlineTranslation;         $  this->_storeManager = $  storeManager;         $  this->_transportBuilder = $  transportBuilder;         $  this->_scopeConfig = $  scopeConfig;         $  this->order = $  order;         $  this->dataHelper = $  dataHelper;         $  this->curHelper = $  curHelper;         $  this->paymentHelper = $  paymentHelper;         $  this->addressRenderer = $  addressRenderer;         $  this->identityContainer = $  identityContainer;     }       /**      * Private method to send email      */     protected function _sendEmail($  from, $  to, $  templateId, $  vars, $  store, $  area = \Magento\Framework\App\Area::AREA_FRONTEND) {         $  this->inlineTranslation->suspend();         $  this->_transportBuilder                 ->setTemplateIdentifier($  templateId)                 ->setTemplateOptions([                     'area' => $  area,                     'store' => $  store->getId()                 ])                 ->setTemplateVars($  vars)                 ->setFrom($  from)                 ->addTo($  to['email'], $  to['name']);         $  transport = $  this->_transportBuilder->getTransport();         $  transport->sendMessage();          $  this->inlineTranslation->resume();          return true;     }      /**      * Get payment info block as html      *      * @param Order $  order      * @return string      */     public function getPaymentHtml($  order)     {         return $  this->paymentHelper->getInfoBlockHtml(             $  order->getPayment(),             $  this->identityContainer->getStore()->getStoreId()         );     }      /**      * @param Order $  order      * @return string|null      */     public function getFormattedShippingAddress($  order)     {         return $  order->getIsVirtual()             ? null             : $  this->addressRenderer->format($  order->getShippingAddress(), 'html');     }      /**      * @param Order $  order      * @return string|null      */     public function getFormattedBillingAddress($  order)     {         return $  this->addressRenderer->format($  order->getBillingAddress(), 'html');     }      /**      *      * @param \Magento\Framework\Event\Observer $  observer      * @return $  this      */     public function execute(\Magento\Framework\Event\Observer $  observer) {         $  isNewOrderEnable = $  this->dataHelper->getConfigVal('adminemailssection/generalgroup/enabled');          // Check if new order email notification enabled         if($  isNewOrderEnable){              // Set current order details             $  orderIds = $  observer->getEvent()->getOrderIds();             $  order = $  this->order->load($  orderIds);             $  orderIncId = $  order->getIncrementId();              // Set email config options             $  store = $  this->_storeManager->getStore();             $  from = $  this->dataHelper->getConfigVal('adminemailssection/generalgroup/send_from');             $  to = [                 'email' => $  this->dataHelper->getConfigVal('adminemailssection/generalgroup/email'),                 'name' => 'Administrator'             ];             $  templateId = $  this->dataHelper->getConfigVal('adminemailssection/generalgroup/template');              //Start set template vars             $  transport = [                 'order' => $  order,                 'billing' => $  order->getBillingAddress(),                 'payment_html' => $  this->getPaymentHtml($  order),                 'store' => $  order->getStore(),                 'formattedShippingAddress' => $  this->getFormattedShippingAddress($  order),                 'formattedBillingAddress' => $  this->getFormattedBillingAddress($  order),             ];              $  transport = new \Magento\Framework\DataObject($  transport);             $  vars = $  transport->getData();              // Call send email function with the necessary parameters             $  this->_sendEmail($  from, $  to, $  templateId, $  vars, $  store);         }     } } 

Magento 2 Module Observer Sequence order and Sales Order Event

We have two modules which fires the same event checkout_submit_all_after.But i need to give a preference for this , i tried giving sequence in module b but it won’t work.For ex Module A and Module B triggers same event , but module B triggers first , my requirement is to trigger Module A and after Module B , is there any way i can do this.And what are the events triggers when order is placed through cron jobs , i have use checkout_submit_all_after , does this event fires if the order is placed through crons?.Please give me any solution for to go forward. Thank You

add sum Specific value In Swift using for loop how it achieve using higher order function in swift

** i want to find sum of particular element in array. this is my code which is working find but i want achieve this using Higher order function in Swift how i can get **

 let arrData = [2,5,7,6,9,-9,10]     let arr = arrData.sorted { $  0>$  1     }     for i in 0...arr.count-1{         for j in 1..<arr.count-1{             if arr[i] + arr[j] == 17{                  print(arr[i] + arr[j])                 return             }          }     } 

Magento 2 product collection getSelect Order by Case unException Unknown column ‘name’ in ‘order clause’

I need to use ORDER BY CASE name which is product name

Query:

SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`,  `stock_status_index`.`stock_status` AS `is_salable`  FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index`  ON cat_index.product_id=e.entity_id AND cat_index.store_id=1  AND cat_index.category_id='3' LEFT JOIN `cataloginventory_stock_status` AS `stock_status_index`  ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1  ORDER BY CASE WHEN `name` LIKE '%banana%' THEN 1  WHEN `name` LIKE '%apple%' THEN 2  ELSE 3 END 

... $ collection->addCategoryFilter($ category) $ collection->getSelect()->order(new \Zend_Db_Expr("CASE WHENnameLIKE '%banana%' THEN 1 WHENnameLIKE '%apple%' THEN 2 ELSE 3 END")); ...

Exception #1 (PDOException): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'order clause'

If do setOrder instead of order then it Works but it just order alphabetically like so:

$ collection->addCategoryFilter($ category)->setOrder('name', 'ASC');

I need Expression what is going wrong?