Пример #1
0
 /**
  * Get list of required Agreement Ids
  *
  * @return int[]
  */
 public function getRequiredAgreementIds()
 {
     if (!$this->scopeConfig->isSetFlag(self::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
         return [];
     } else {
         return $this->agreementCollectionFactory->create()->addStoreFilter($this->storeManager->getStore()->getId())->addFieldToFilter('is_active', 1)->getAllIds();
     }
 }
Пример #2
0
 /**
  * @return mixed
  */
 public function getAgreements()
 {
     if (!$this->hasAgreements()) {
         if (!$this->_scopeConfig->isSetFlag('checkout/options/enable_agreements', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
             $agreements = array();
         } else {
             /** @var \Magento\CheckoutAgreements\Model\Resource\Agreement\Collection $agreements */
             $agreements = $this->_agreementCollectionFactory->create()->addStoreFilter($this->_storeManager->getStore()->getId())->addFieldToFilter('is_active', 1);
         }
         $this->setAgreements($agreements);
     }
     return $this->getData('agreements');
 }
 /**
  * {@inheritdoc}
  *
  * @return \Magento\CheckoutAgreements\Api\Data\AgreementInterface[] Array of checkout agreement data objects.
  */
 public function getList()
 {
     if (!$this->scopeConfig->isSetFlag('checkout/options/enable_agreements', ScopeInterface::SCOPE_STORE)) {
         return [];
     }
     $storeId = $this->storeManager->getStore()->getId();
     /** @var $agreementCollection AgreementCollection */
     $agreementCollection = $this->collectionFactory->create();
     $agreementCollection->addStoreFilter($storeId);
     $agreementCollection->addFieldToFilter('is_active', 1);
     $agreementDataObjects = [];
     foreach ($agreementCollection as $agreement) {
         $agreementDataObjects[] = $agreement;
     }
     return $agreementDataObjects;
 }
Пример #4
0
 /**
  * @return $this
  */
 protected function _prepareCollection()
 {
     $this->setCollection($this->_collectionFactory->create());
     return parent::_prepareCollection();
 }