-
Notifications
You must be signed in to change notification settings - Fork 18
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 #12 from FACT-Finder-Web-Components/develop
Develop
- Loading branch information
Showing
37 changed files
with
752 additions
and
2,208 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
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,121 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: soroush | ||
* Date: 13/12/17 | ||
* Time: 15:00 | ||
*/ | ||
|
||
namespace Omikron\Factfinder\Block\FF; | ||
|
||
use Magento\Catalog\Model\Product; | ||
use \Magento\Framework\View\Element\Template; | ||
|
||
class Recommendation extends Template | ||
{ | ||
/** | ||
* @var Product | ||
*/ | ||
protected $_product = null; | ||
|
||
/** | ||
* Core registry | ||
* | ||
* @var \Magento\Framework\Registry | ||
*/ | ||
protected $_coreRegistry = null; | ||
|
||
/** @var \Magento\Catalog\Helper\Image */ | ||
protected $_imageHelper; | ||
|
||
/** @var \Omikron\Factfinder\Helper\Data */ | ||
protected $_helper; | ||
|
||
/** @var \Magento\Directory\Model\Currency */ | ||
protected $_currency; | ||
|
||
/** | ||
* Recommendation constructor. | ||
* @param Template\Context $context | ||
* @param \Magento\Framework\Registry $registry | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Template\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
\Magento\Directory\Model\Currency $currency, | ||
\Magento\Catalog\Helper\Image $imageHelper, | ||
\Omikron\Factfinder\Helper\Data $helper, | ||
array $data = [] | ||
) | ||
{ | ||
$this->_coreRegistry = $registry; | ||
$this->_currency = $currency; | ||
$this->_imageHelper = $imageHelper; | ||
$this->_helper = $helper; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* @return Product | ||
*/ | ||
public function getProduct() | ||
{ | ||
if (!$this->_product) { | ||
$this->_product = $this->_coreRegistry->registry('product'); | ||
} | ||
return $this->_product; | ||
} | ||
|
||
/** | ||
* Get the placeholder image url for products | ||
* | ||
* @return string | ||
*/ | ||
public function getProductImagePlaceholder() | ||
{ | ||
return $this->_imageHelper->getDefaultPlaceholderUrl('image'); | ||
} | ||
|
||
/** | ||
* Get the url for submitting the addToCart form | ||
* | ||
* @return string | ||
*/ | ||
public function getAddToCartUrl() | ||
{ | ||
return $this->getUrl('checkout/cart/add'); | ||
} | ||
|
||
/** | ||
* Test if the addToCart is enabled in the factfinder options | ||
* | ||
* @return mixed | ||
*/ | ||
public function isAddToCartEnabled() | ||
{ | ||
return $this->_helper->getShowAddToCartButton(); | ||
} | ||
|
||
/** | ||
* Get current store currency code | ||
* | ||
* @return string | ||
*/ | ||
public function getCurrentCurrencyCode() | ||
{ | ||
|
||
return $this->_storeManager->getStore()->getCurrentCurrencyCode(); | ||
} | ||
|
||
/** | ||
* Get currency symbol for current locale and currency code | ||
* | ||
* @return string | ||
*/ | ||
public function getCurrentCurrencySymbol() | ||
{ | ||
return $this->_currency->getCurrencySymbol(); | ||
} | ||
|
||
} |
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,121 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: soroush | ||
* Date: 13/12/17 | ||
* Time: 15:00 | ||
*/ | ||
|
||
namespace Omikron\Factfinder\Block\FF; | ||
|
||
use Magento\Catalog\Model\Product; | ||
use \Magento\Framework\View\Element\Template; | ||
|
||
class Similar extends Template | ||
{ | ||
/** | ||
* @var Product | ||
*/ | ||
protected $_product = null; | ||
|
||
/** | ||
* Core registry | ||
* | ||
* @var \Magento\Framework\Registry | ||
*/ | ||
protected $_coreRegistry = null; | ||
|
||
/** @var \Magento\Catalog\Helper\Image */ | ||
protected $_imageHelper; | ||
|
||
/** @var \Omikron\Factfinder\Helper\Data */ | ||
protected $_helper; | ||
|
||
/** @var \Magento\Directory\Model\Currency */ | ||
protected $_currency; | ||
|
||
/** | ||
* Recommendation constructor. | ||
* @param Template\Context $context | ||
* @param \Magento\Framework\Registry $registry | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Template\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
\Magento\Directory\Model\Currency $currency, | ||
\Magento\Catalog\Helper\Image $imageHelper, | ||
\Omikron\Factfinder\Helper\Data $helper, | ||
array $data = [] | ||
) | ||
{ | ||
$this->_coreRegistry = $registry; | ||
$this->_currency = $currency; | ||
$this->_imageHelper = $imageHelper; | ||
$this->_helper = $helper; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* @return Product | ||
*/ | ||
public function getProduct() | ||
{ | ||
if (!$this->_product) { | ||
$this->_product = $this->_coreRegistry->registry('product'); | ||
} | ||
return $this->_product; | ||
} | ||
|
||
/** | ||
* Get the placeholder image url for products | ||
* | ||
* @return string | ||
*/ | ||
public function getProductImagePlaceholder() | ||
{ | ||
return $this->_imageHelper->getDefaultPlaceholderUrl('image'); | ||
} | ||
|
||
/** | ||
* Get the url for submitting the addToCart form | ||
* | ||
* @return string | ||
*/ | ||
public function getAddToCartUrl() | ||
{ | ||
return $this->getUrl('checkout/cart/add'); | ||
} | ||
|
||
/** | ||
* Test if the addToCart is enabled in the factfinder options | ||
* | ||
* @return mixed | ||
*/ | ||
public function isAddToCartEnabled() | ||
{ | ||
return $this->_helper->getShowAddToCartButton(); | ||
} | ||
|
||
/** | ||
* Get current store currency code | ||
* | ||
* @return string | ||
*/ | ||
public function getCurrentCurrencyCode() | ||
{ | ||
|
||
return $this->_storeManager->getStore()->getCurrentCurrencyCode(); | ||
} | ||
|
||
/** | ||
* Get currency symbol for current locale and currency code | ||
* | ||
* @return string | ||
*/ | ||
public function getCurrentCurrencySymbol() | ||
{ | ||
return $this->_currency->getCurrencySymbol(); | ||
} | ||
|
||
} |
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
20 changes: 20 additions & 0 deletions
20
Omikron/Factfinder/view/frontend/layout/catalog_product_view.xml
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,20 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<head> | ||
<css src="Omikron_Factfinder/::css/ff/recommendation.css"/> | ||
<css src="Omikron_Factfinder/::css/ff/record-list.css"/> | ||
<css src="Omikron_Factfinder/::css/ff/similar.css"/> | ||
</head> | ||
<body> | ||
<referenceContainer name="content"> | ||
<block class="Omikron\Factfinder\Block\FF\Recommendation" ifconfig="factfinder/components/ff_recommendation" template="Omikron_Factfinder::ff/recommendation.phtml" /> | ||
<block class="Omikron\Factfinder\Block\FF\Similar" ifconfig="factfinder/components/ff_similar" template="Omikron_Factfinder::ff/similar.phtml" /> | ||
</referenceContainer> | ||
</body> | ||
</page> |
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.