-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1258 from algolia/develop
Release/3.9.0
- Loading branch information
Showing
56 changed files
with
1,756 additions
and
924 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,54 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Block\Cart; | ||
|
||
use Algolia\AlgoliaSearch\Helper\ConfigHelper; | ||
use Magento\Checkout\Model\Session; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Framework\View\Element\Template\Context; | ||
|
||
class Recommend extends Template | ||
{ | ||
/** | ||
* @var Session | ||
*/ | ||
protected $checkoutSession; | ||
|
||
/** | ||
* @var ConfigHelper | ||
*/ | ||
protected $configHelper; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Session $checkoutSession | ||
* @param ConfigHelper $configHelper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Session $checkoutSession, | ||
ConfigHelper $configHelper, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->checkoutSession = $checkoutSession; | ||
$this->configHelper = $configHelper; | ||
} | ||
|
||
/** | ||
* @return array | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function getAllCartItems() | ||
{ | ||
$cartItems = array(); | ||
$itemCollection = $this->checkoutSession->getQuote()->getAllVisibleItems(); | ||
foreach ( $itemCollection as $item) { | ||
$cartItems[] = $item->getProductId(); | ||
} | ||
return array_unique($cartItems); | ||
} | ||
|
||
} |
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
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,39 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Block\Widget; | ||
|
||
use Magento\Framework\Math\Random; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Widget\Block\BlockInterface; | ||
|
||
class TrendsItem extends Template implements BlockInterface | ||
{ | ||
protected $_template = 'recommend/widget/trends-item.phtml'; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Random $mathRandom | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Random $mathRandom, | ||
array $data = [] | ||
) { | ||
$this->mathRandom = $mathRandom; | ||
parent::__construct( | ||
$context, | ||
$data | ||
); | ||
} | ||
|
||
/** | ||
* @return string | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function generateUniqueToken() | ||
{ | ||
return $this->mathRandom->getRandomString(5); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.