Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-checkout-agreements
Model
ResourceModel
Agreement
Collection.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\CheckoutAgreements\Model\ResourceModel\Agreement
;
7
11
class
Collection
extends
\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
12
{
16
protected
$_map
= [
17
'fields'
=> [
18
'agreement_id'
=>
'main_table.agreement_id'
19
]
20
];
21
27
protected
$_isStoreFilterWithAdmin
=
true
;
28
34
protected
function
_construct
()
35
{
36
$this->
_init
(
37
\
Magento
\CheckoutAgreements\Model\Agreement::class,
38
\
Magento
\CheckoutAgreements\Model\
ResourceModel
\Agreement::class
39
);
40
}
41
48
public
function
addStoreFilter
(
$store
)
49
{
50
// check and prepare data
51
if
(
$store
instanceof \
Magento
\Store\Model\Store) {
52
$store
= [
$store
->getId()];
53
}
elseif
(is_numeric(
$store
)) {
54
$store
= [
$store
];
55
}
56
57
$alias
=
'store_table_'
. implode(
'_'
,
$store
);
58
if
($this->
getFlag
(
$alias
)) {
59
return
$this;
60
}
61
62
$storeFilter = [
$store
];
63
if
($this->_isStoreFilterWithAdmin) {
64
$storeFilter[] = 0;
65
}
66
67
// add filter
68
$this->
getSelect
()->join(
69
[
$alias
=> $this->
getTable
(
'checkout_agreement_store'
)],
70
'main_table.agreement_id = '
.
$alias
.
'.agreement_id'
,
71
[]
72
)->where(
73
$alias
.
'.store_id IN (?)'
,
74
$storeFilter
75
)->group(
76
'main_table.agreement_id'
77
);
78
79
$this->
setFlag
(
$alias
,
true
);
80
return
$this;
81
}
82
90
public
function
setIsStoreFilterWithAdmin
(
$value
)
91
{
92
$this->_isStoreFilterWithAdmin = (bool)
$value
;
93
return
$this;
94
}
95
}
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection\getTable
getTable($table)
Definition:
AbstractCollection.php:475
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection\addStoreFilter
addStoreFilter($store)
Definition:
Collection.php:48
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection\setIsStoreFilterWithAdmin
setIsStoreFilterWithAdmin($value)
Definition:
Collection.php:90
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection\$_isStoreFilterWithAdmin
$_isStoreFilterWithAdmin
Definition:
Collection.php:27
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
elseif
elseif(isset( $params[ 'redirect_parent']))
Definition:
iframe.phtml:17
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Definition:
AbstractCollection.php:19
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection
Definition:
Collection.php:11
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection\_construct
_construct()
Definition:
Collection.php:34
Magento\CheckoutAgreements\Model\ResourceModel\Agreement
Definition:
Collection.php:6
$value
$value
Definition:
gender.phtml:16
Magento
Magento\Framework\Data\Collection\setFlag
setFlag($flag, $value=null)
Definition:
Collection.php:865
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection\_init
_init($model, $resourceModel)
Definition:
AbstractCollection.php:401
$store
$store
Definition:
payment_configuration_rollback.php:33
$alias
if(!trim($html)) $alias
Definition:
details.phtml:20
Magento\Framework\Data\Collection\getFlag
getFlag($flag)
Definition:
Collection.php:853
Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Collection\$_map
$_map
Definition:
Collection.php:16
Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection\getSelect
getSelect()
Definition:
AbstractCollection.php:187