コード例 #1
0
 /**
  * Get list of required Agreement Ids
  *
  * @return int[]
  */
 public function getRequiredAgreementIds()
 {
     $agreementIds = [];
     if ($this->scopeConfig->isSetFlag(self::PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
         $agreementCollection = $this->agreementCollectionFactory->create();
         $agreementCollection->addStoreFilter($this->storeManager->getStore()->getId());
         $agreementCollection->addFieldToFilter('is_active', 1);
         $agreementCollection->addFieldToFilter('mode', AgreementModeOptions::MODE_MANUAL);
         $agreementIds = $agreementCollection->getAllIds();
     }
     return $agreementIds;
 }
コード例 #2
0
 /**
  * @return mixed
  */
 public function getAgreements()
 {
     if (!$this->hasAgreements()) {
         $agreements = [];
         if ($this->_scopeConfig->isSetFlag('checkout/options/enable_agreements', ScopeInterface::SCOPE_STORE)) {
             /** @var \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection $agreements */
             $agreements = $this->_agreementCollectionFactory->create();
             $agreements->addStoreFilter($this->_storeManager->getStore()->getId());
             $agreements->addFieldToFilter('is_active', 1);
         }
         $this->setAgreements($agreements);
     }
     return $this->getData('agreements');
 }
コード例 #3
0
 /**
  * {@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();
     $this->extensionAttributesJoinProcessor->process($agreementCollection);
     $agreementCollection->addStoreFilter($storeId);
     $agreementCollection->addFieldToFilter('is_active', 1);
     $agreementDataObjects = [];
     foreach ($agreementCollection as $agreement) {
         $agreementDataObjects[] = $agreement;
     }
     return $agreementDataObjects;
 }
コード例 #4
0
 /**
  * @return $this
  * @codeCoverageIgnore
  */
 protected function _prepareCollection()
 {
     $this->setCollection($this->_collectionFactory->create());
     return parent::_prepareCollection();
 }