-
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
Showing
13 changed files
with
277 additions
and
210 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
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 |
---|---|---|
@@ -1,42 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* @Author: nguyen | ||
* @Date: 2021-06-17 09:57:16 | ||
* @Last Modified by: nguyen | ||
* @Last Modified time: 2021-06-17 09:57:48 | ||
*/ | ||
|
||
namespace Magiccart\Testimonial\Block; | ||
|
||
class Testimonial extends \Magento\Framework\View\Element\Template { | ||
|
||
protected $_testimonialFactory; | ||
protected $testimonials; | ||
|
||
protected $testimonialFactory; | ||
|
||
public function __construct( | ||
\Magento\Framework\View\Element\Template\Context $context, | ||
\Magiccart\Testimonial\Model\TestimonialFactory $testimonialFactory, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
|
||
$this->_testimonialFactory = $testimonialFactory; | ||
|
||
|
||
$this->testimonialFactory = $testimonialFactory; | ||
} | ||
|
||
/** | ||
* Add elements in layout | ||
* | ||
* @return | ||
*/ | ||
protected function _prepareLayout() { | ||
protected function _prepareLayout() | ||
{ | ||
return parent::_prepareLayout(); | ||
} | ||
|
||
|
||
public function getTestimonials() | ||
{ | ||
if(!$this->_testimonials){ | ||
if(!$this->testimonials){ | ||
$store = $this->_storeManager->getStore()->getStoreId(); | ||
$testimonials = $this->_testimonialCollectionFactory->create() | ||
$testimonials = $this->testimonialFactory->create()->getCollection() | ||
->addFieldToFilter('stores',array( array('finset' => 0), array('finset' => $store))) | ||
->addFieldToFilter('status', 1); | ||
$this->_testimonials = $testimonials; | ||
$this->testimonials = $testimonials; | ||
} | ||
return $this->_testimonials; | ||
|
||
return $this->testimonials; | ||
} | ||
|
||
} |
Oops, something went wrong.