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
Gallery
EntryResolver.php
Go to the documentation of this file.
1
<?php
8
namespace
Magento\Catalog\Model\Product\Gallery
;
9
10
use
Magento\Catalog\Model\Product
;
11
12
class
EntryResolver
13
{
21
public
function
getEntryFilePathById
(
Product
$product
, $entryId)
22
{
23
$mediaGalleryData =
$product
->getData(
'media_gallery'
);
24
if
(!isset($mediaGalleryData[
'images'
]) || !is_array($mediaGalleryData[
'images'
])) {
25
return
null
;
26
}
27
28
foreach
($mediaGalleryData[
'images'
] as
$image
) {
29
if
(isset(
$image
[
'value_id'
]) &&
$image
[
'value_id'
] == $entryId) {
30
return
isset(
$image
[
'file'
]) ?
$image
[
'file'
] :
null
;
31
}
32
}
33
return
null
;
34
}
35
43
public
function
getEntryIdByFilePath
(
Product
$product
, $filePath)
44
{
45
$mediaGalleryData =
$product
->getData(
'media_gallery'
);
46
if
(!isset($mediaGalleryData[
'images'
]) || !is_array($mediaGalleryData[
'images'
])) {
47
return
null
;
48
}
49
50
foreach
($mediaGalleryData[
'images'
] as
$image
) {
51
if
(isset(
$image
[
'file'
]) &&
$image
[
'file'
] == $filePath) {
52
return
isset(
$image
[
'value_id'
]) ?
$image
[
'value_id'
] :
null
;
53
}
54
}
55
return
null
;
56
}
57
}
$image
$image
Definition:
product_export_with_images.php:32
Magento\Catalog\Model\Product\Gallery\EntryResolver
Definition:
EntryResolver.php:12
Magento\Catalog\Model\Product\Gallery\EntryResolver\getEntryFilePathById
getEntryFilePathById(Product $product, $entryId)
Definition:
EntryResolver.php:21
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Model\Product\Gallery
Definition:
CreateHandlerTest.php:7
Magento\Catalog\Model\Product\Gallery\EntryResolver\getEntryIdByFilePath
getEntryIdByFilePath(Product $product, $filePath)
Definition:
EntryResolver.php:43