Skip to content

Commit

Permalink
Fixed order create from store front
Browse files Browse the repository at this point in the history
  • Loading branch information
elkhoudh committed Sep 21, 2022
1 parent 34ec9b3 commit cd20c39
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 18 deletions.
14 changes: 1 addition & 13 deletions Observer/CheckoutSuccessActionObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,7 @@ public function execute(EventObserver $observer)
* @var \Magento\Customer\Model\Customer $customer
* @var \Magento\Store\Model\Store $store
*/
$orderId = $observer->getEvent()->getData()['order_ids'][0];
$order = $this->__orderRepository->get($orderId);


if (empty($order))
{
if (!empty($this->logger))
{
$this->logger->warning('kustomer: no order found with id '.$orderId.'. skipping.');
}
return;
}

$order = $observer->getEvent()->getData()['order'];
$eventName = $observer->getEvent()->getName();
$customer = $order->getCustomerId();
$store = $order->getStoreId();
Expand Down
2 changes: 1 addition & 1 deletion Observer/KustomerEventObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function publish($dataType, $data, $customer, $store = null, $eventName =
$customer = $this->__getCustomerById($customer->getId());
}

if ((!$customer instanceof CustomerInterface) && ($eventName === 'checkout_onepage_controller_success_action')) {
if ((!$customer instanceof CustomerInterface) && ($eventName === 'checkout_submit_all_after')) {
$customer = $this->__guestCustomerFromOrder($data);
} elseif (!$customer instanceof CustomerInterface) {
$this->logger->error('no customer provided for event '.$eventName);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "kustomer/kustomer-integration",
"description": "Integrate Magento eCommerce site with Kustomer service",
"type": "magento2-module",
"version": "1.1.6",
"version": "1.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
ports:
- "3333:80"
db:
platform: linux/x86_64
image: mysql:5.7
env_file: .env
ports:
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</group>
<group id="event" translate="label" type="text" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Event Publication Settings</label>
<field id="checkout_onepage_controller_success_action" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="checkout_submit_all_after" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>New Order</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
Expand Down
2 changes: 1 addition & 1 deletion etc/events.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_onepage_controller_success_action">
<event name="checkout_submit_all_after">
<observer name="kustomer_order_create" instance="Kustomer\KustomerIntegration\Observer\CheckoutSuccessActionObserver" />
</event>
<event name="customer_register_success">
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Kustomer_KustomerIntegration" setup_version="1.1.6">
<module name="Kustomer_KustomerIntegration" setup_version="1.1.7">
<sequence>
<module name="Magento_Store"/>
</sequence>
Expand Down

0 comments on commit cd20c39

Please sign in to comment.