jrb / module-ordercontroller
To implement guest order history feature
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 1
Type:magento2-module
This package is not auto-updated.
Last update: 2024-10-10 17:34:35 UTC
README
Decription
Implement guest order history feature with a new controller that takes parameter(s) to query a single order and returns a json with information about order status, total, items (sku, item_id, price) and total invoiced.
Installation
Composer Package
-
Go to Magento® 2 root folder
-
Enter following commands to install module:
composer require jrb/module-ordercontroller dev-guestorderhistory
Wait while dependencies are updated.
-
Enter following commands to enable module:
php bin/magento module:enable JRB_OrderController php bin/magento setup:upgrade php bin/magento cache:clean
Manually
-
Go to Magento® 2 root folder
-
paste all code in a foler app/code/JRB/OrderController
-
Enter following commands to enable module:
php bin/magento module:enable JRB_OrderController php bin/magento setup:upgrade php bin/magento cache:clean
How to use
by calling rest api
end point:
rest/V1/guestorder/getGuestOrderHistory/:param
param can be 1,2,.. all
<?php
/*
* init curl
*/
/*
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'http://hostname/rest/V1/guestorder/getGuestOrderHistory/1');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
$output=curl_exec($ch);
curl_close($ch);
echo $output;
?>
or by calling simple controller
<?php
/*
* init curl
*/
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'http://hostname/ordercontroller/guestorderhistory?total_guest_order=1');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
$output=curl_exec($ch);
curl_close($ch);
echo $output;
?>