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-catalog
Model
Product
Website.php
Go to the documentation of this file.
1
<?php
15
namespace
Magento\Catalog\Model\Product
;
16
17
class
Website
extends
\Magento\Framework\Model\AbstractModel
18
{
24
protected
function
_construct
()
25
{
26
$this->
_init
(\
Magento
\Catalog\Model\
ResourceModel
\
Product
\Website::class);
27
}
28
37
public
function
removeProducts
(
$websiteIds
,
$productIds
)
38
{
39
try
{
40
$this->
_getResource
()->removeProducts(
$websiteIds
,
$productIds
);
41
}
catch
(\
Exception
$e) {
42
throw
new \Magento\Framework\Exception\LocalizedException(
43
__
(
'Something went wrong while removing products from the websites.'
)
44
);
45
}
46
return
$this;
47
}
48
57
public
function
addProducts
(
$websiteIds
,
$productIds
)
58
{
59
try
{
60
$this->
_getResource
()->addProducts(
$websiteIds
,
$productIds
);
61
}
catch
(\
Exception
$e) {
62
throw
new \Magento\Framework\Exception\LocalizedException(
63
__
(
'Something went wrong while adding products to websites.'
)
64
);
65
}
66
return
$this;
67
}
68
76
public
function
getWebsites
(
$productIds
)
77
{
78
return
$this->
_getResource
()->getWebsites(
$productIds
);
79
}
80
}
Magento\Framework\Model\AbstractModel
Definition:
AbstractModel.php:19
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\Catalog\Model\Product\Website\getWebsites
getWebsites($productIds)
Definition:
Website.php:76
$websiteIds
$websiteIds
Definition:
assign_products_to_websites.php:17
__
__()
Definition:
__.php:13
Magento\Catalog\Model\Product\Website\addProducts
addProducts($websiteIds, $productIds)
Definition:
Website.php:57
Magento\Catalog\Model\Product\Exception
Definition:
Exception.php:14
Magento\Catalog\Model\Product\Website\removeProducts
removeProducts($websiteIds, $productIds)
Definition:
Website.php:37
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento\Catalog\Model\Product\Website
Definition:
Website.php:17
Magento\Framework\Model\AbstractModel\_getResource
_getResource()
Definition:
AbstractModel.php:470
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
Magento
$productIds
$productIds
Definition:
product_with_multiple_options.php:11
Magento\Framework\Model\AbstractModel\_init
_init($resourceModel)
Definition:
AbstractModel.php:213
Magento\Catalog\Model\Product\Website\_construct
_construct()
Definition:
Website.php:24