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
magento2-base
dev
tests
integration
testsuite
Magento
Wishlist
_files
wishlist_shared.php
Go to the documentation of this file.
1
<?php
7
require
__DIR__
.
'/../../../Magento/Customer/_files/customer.php'
;
8
require
__DIR__
.
'/../../../Magento/Catalog/_files/product_simple.php'
;
9
11
$simpleProduct
=
$product
->load(
$product
->getId());
12
13
$options
= [];
14
foreach
(
$simpleProduct
->getOptions() as
$option
) {
15
/* @var $option \Magento\Catalog\Model\Product\Option */
16
switch
(
$option
->getType()) {
17
case
'field'
:
18
$options
[
$option
->getId()] =
'1-text'
;
19
break
;
20
case
'date_time'
:
21
$options
[
$option
->getId()] = [
'month'
=> 1,
'day'
=> 1,
'year'
=> 2001,
'hour'
=> 1,
'minute'
=> 1];
22
break
;
23
case
'drop_down'
:
24
$options
[
$option
->getId()] =
'1'
;
25
break
;
26
case
'radio'
:
27
$options
[
$option
->getId()] =
'1'
;
28
break
;
29
}
30
}
31
32
/* @var $wishlist \Magento\Wishlist\Model\Wishlist */
33
$wishlist
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
34
\
Magento
\Wishlist\Model\Wishlist::class
35
);
36
$wishlist
->loadByCustomerId(
$customer
->getId(),
true
);
37
$wishlist
->addNewItem(
$simpleProduct
,
new
\
Magento
\Framework\DataObject([
'options'
=>
$options
]));
38
$wishlist
->setSharingCode(
'fixture_unique_code'
)
39
->setShared(1)
40
->save();
$customer
$customer
Definition:
customers.php:11
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$wishlist
foreach($simpleProduct->getOptions() as $option) $wishlist
Definition:
wishlist_shared.php:33
$options
$options
Definition:
wishlist_shared.php:13
$simpleProduct
$simpleProduct
Definition:
wishlist_shared.php:11
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$option
$option
Definition:
product_configurable_with_single_child.php:38
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125