-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a29fed
Showing
21 changed files
with
935 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/app/etc/local.xml | ||
|
||
/errors/local.xml | ||
|
||
/details5.php | ||
/var | ||
/media | ||
/details5.php | ||
/details5.php | ||
|
||
/app/code/community/Fera/Aiconnector/CustomerBalance/license.txt | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Fera.ai Magento 2 Extension | ||
This extension makes it easy to use Fera.ai to offer customers a live shopping experience in your product pages. To learn more about Fera go to https://www.fera.ai | ||
|
||
|
||
## Installation | ||
### 1. Create An Account | ||
Go to https://app.fera.ai/signup?platform=magento and create a new account. | ||
|
||
### 2. Follow the instructions to install the extension. | ||
You will be provided with a link to the latest install files. Follow the instructions to install the app into your Magento store. | ||
|
||
*That's it!*. If you follow the instructions described then your store will automatically be configured to connected to the Fera.ai servers. | ||
|
||
## Usage | ||
Go to https://app.fera.ai/skills to customize your experience! | ||
|
||
## Help | ||
If you're seeing this repo you're probably a trusted developer - so just feel free to email help a-t fera dot ai with any questions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/** | ||
* @author: Sviatoslav Lashkiv | ||
* @email: ss.lashkiv@gmail.com | ||
* @team: MageCloud | ||
*/ | ||
|
||
namespace Fera\Ai\Block; | ||
|
||
use Magento\Framework\View\Element\Template; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Customer\Model\Session as CustomerSession; | ||
use Fera\Ai\Helper\Data; | ||
|
||
/** | ||
* Class Footer | ||
* @package Fera\Ai\Block | ||
*/ | ||
class Footer extends Template | ||
{ | ||
/** | ||
* @var CustomerSession | ||
*/ | ||
protected $customerSession; | ||
|
||
/** | ||
* @var Data | ||
*/ | ||
protected $helper; | ||
|
||
/** | ||
* Footer constructor. | ||
* @param Context $context | ||
* @param CustomerSession $customerSession | ||
* @param Data $helper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
CustomerSession $customerSession, | ||
Data $helper, | ||
array $data = []) | ||
{ | ||
$this->customerSession = $customerSession; | ||
$this->helper = $helper; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
public function isEnabled() | ||
{ | ||
return $this->helper->isEnabled(); | ||
} | ||
|
||
public function getDebugJs() | ||
{ | ||
return $this->helper->getDebugJs(); | ||
} | ||
|
||
public function getPublicKey() | ||
{ | ||
return $this->helper->getPublicKey(); | ||
} | ||
|
||
public function getApiUrl() | ||
{ | ||
return $this->helper->getApiUrl(); | ||
} | ||
|
||
public function getJsUrl() | ||
{ | ||
return $this->helper->getJsUrl(); | ||
} | ||
|
||
public function getShopperData() | ||
{ | ||
$customer = $this->customerSession->getCustomer(); | ||
|
||
if (!$customer->getId()) return false; | ||
|
||
$shopperData = [ | ||
'customer_id' => $customer->getId(), | ||
'email' => $customer->getEmail(), | ||
'name' => $customer->getName(), | ||
]; | ||
|
||
return $this->helper->jsonEncode($shopperData); | ||
} | ||
|
||
public function getCartJson() | ||
{ | ||
return $this->helper->getCartJson(); | ||
} | ||
|
||
public function jsonEncode($data) | ||
{ | ||
return $this->helper->jsonEncode($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
/** | ||
* @author: Sviatoslav Lashkiv | ||
* @email: ss.lashkiv@gmail.com | ||
* @team: MageCloud | ||
*/ | ||
|
||
namespace Fera\Ai\Block\Footer\Checkout; | ||
|
||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Checkout\Model\Session as CheckoutSession; | ||
use Magento\Sales\Model\Order\Config; | ||
use Magento\Framework\App\Http\Context as HttpContext; | ||
use Magento\Customer\Model\Session as CustomerSession; | ||
use Magento\Directory\Helper\Data as DirectoryHelperData; | ||
use Fera\Ai\Helper\Data as FeraHelper; | ||
|
||
/** | ||
* Class Success | ||
* @package Fera\Ai\Block\Footer\Checkout | ||
*/ | ||
class Success extends \Magento\Checkout\Block\Onepage\Success | ||
{ | ||
/** | ||
* @var CustomerSession | ||
*/ | ||
protected $customerSession; | ||
|
||
/** | ||
* @var DirectoryHelperData | ||
*/ | ||
protected $directoryHelper; | ||
|
||
/** | ||
* @var FeraHelper | ||
*/ | ||
protected $helper; | ||
|
||
/** | ||
* Success constructor. | ||
* @param Context $context | ||
* @param CheckoutSession $checkoutSession | ||
* @param Config $orderConfig | ||
* @param HttpContext $httpContext | ||
* @param CustomerSession $customerSession | ||
* @param DirectoryHelperData $directoryHelper | ||
* @param FeraHelper $helper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
CheckoutSession $checkoutSession, | ||
Config $orderConfig, | ||
HttpContext $httpContext, | ||
CustomerSession $customerSession, | ||
DirectoryHelperData $directoryHelper, | ||
FeraHelper $helper, | ||
array $data = [] | ||
) | ||
{ | ||
$this->customerSession = $customerSession; | ||
$this->directoryHelper = $directoryHelper; | ||
$this->helper = $helper; | ||
parent::__construct($context, $checkoutSession, $orderConfig, $httpContext, $data); | ||
} | ||
|
||
/** | ||
* @return bool|mixed | ||
*/ | ||
public function isEnabled() | ||
{ | ||
return $this->helper->isEnabled(); | ||
} | ||
|
||
/** | ||
* Get last order, JSONify it and return it. | ||
* @return String | ||
*/ | ||
public function getOrderJson() | ||
{ | ||
$order = $this->_checkoutSession->getLastRealOrder(); | ||
|
||
$customer = null; | ||
if (!empty($this->customerSession->getCustomerId())) { | ||
$customer = $this->customerSession->getCustomer(); | ||
$address = $customer->getDefaultShippingAddress(); | ||
|
||
if (!empty($address)) { | ||
$address = $address->getData(); | ||
} | ||
|
||
$customer = [ | ||
'id' => $this->customerSession->getCustomerId(), | ||
'first_name' => $this->customerSession->getCustomer()->getFirstname(), | ||
'email' => $this->customerSession->getCustomer()->getEmail(), | ||
'address' => $address | ||
]; | ||
} | ||
|
||
$currencyCode = $this->_storeManager->getStore()->getCurrentCurrencyCode(); | ||
$total = $order->getGrandTotal(); | ||
$totalUsd = $this->directoryHelper->currencyConvert($total, $currencyCode, 'USD'); | ||
|
||
$orderData = [ | ||
'id' => $order->getId(), | ||
'number' => $order->getIncrementId(), | ||
'total' => $total, | ||
'total_usd' => $totalUsd, | ||
'created_at' => $this->helper->formatDate($order->getCreatedAt()), | ||
'modified_at' => $this->helper->formatDate($order->getUpdatedAt()), | ||
'line_items' => $this->helper->serializeQuoteItems($order->getAllItems()), | ||
'customer' => $customer, | ||
'source_name' => 'web' | ||
]; | ||
|
||
return $this->helper->jsonEncode($orderData); | ||
} | ||
|
||
} |
Oops, something went wrong.