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
Catalog
_files
product_with_image.php
Go to the documentation of this file.
1
<?php
7
require
__DIR__
.
'/product_image.php'
;
8
require
__DIR__
.
'/product_simple.php'
;
9
10
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
11
$productRepository
=
$objectManager
->create(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
12
$product
=
$productRepository
->get(
'simple'
);
13
15
$product
->setStoreId(0)
16
->setImage(
'/m/a/magento_image.jpg'
)
17
->setSmallImage(
'/m/a/magento_image.jpg'
)
18
->setThumbnail(
'/m/a/magento_image.jpg'
)
19
->setData(
'media_gallery'
, [
'images'
=> [
20
[
21
'file'
=>
'/m/a/magento_image.jpg'
,
22
'position'
=> 1,
23
'label'
=>
'Image Alt Text'
,
24
'disabled'
=> 0,
25
'media_type'
=>
'image'
26
],
27
]])
28
->setCanSaveCustomOptions(
true
)
29
->save();
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$objectManager
$objectManager
Definition:
product_with_image.php:10
$product
$product
Definition:
product_with_image.php:12
Magento
$productRepository
$productRepository
Definition:
product_with_image.php:11
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125