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-wishlist
Pricing
ConfiguredPrice
Downloadable.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Wishlist\Pricing\ConfiguredPrice
;
7
8
use
Magento\Catalog\Model\Product\Configuration\Item\ItemInterface
;
9
use
Magento\Catalog\Pricing\Price\ConfiguredPriceInterface
;
10
use
Magento\Catalog\Pricing\Price\FinalPrice
;
11
12
class
Downloadable
extends
FinalPrice
implements
ConfiguredPriceInterface
13
{
17
const
PRICE_CODE
=
'configured_price'
;
18
22
private
$item;
23
27
public
function
getValue
()
28
{
29
return
max(0, parent::getValue() + $this->getLinkPrice());
30
}
31
37
private
function
getLinkPrice()
38
{
39
$result
= 0;
40
if
($this->
getProduct
()->getLinksPurchasedSeparately()) {
42
$customOption
= $this->
getProduct
()->getCustomOption(
'downloadable_link_ids'
);
43
if
(
$customOption
) {
44
$links
= $this->getLinks();
45
$linkIds = explode(
','
,
$customOption
->getValue());
46
foreach
($linkIds as $linkId) {
47
if
(isset(
$links
[$linkId])) {
48
$result
+=
$links
[$linkId]->getPrice();
49
}
50
}
51
}
52
}
53
return
$result
;
54
}
55
59
private
function
getLinks()
60
{
62
$productType = $this->
getProduct
()->getTypeInstance();
63
$links
= $productType->getLinks($this->
getProduct
());
64
return
$links
;
65
}
66
70
public
function
setItem
(
ItemInterface
$item)
71
{
72
$this->item =
$item
;
73
return
$this;
74
}
75
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
$customOption
$customOption
Definition:
products.php:73
Magento\Catalog\Model\Product\Configuration\Item\ItemInterface
Definition:
ItemInterface.php:15
$item
$item
Definition:
partial_invoice.php:27
Magento\Framework\Pricing\Price\AbstractPrice\getProduct
getProduct()
Definition:
AbstractPrice.php:136
Magento\Wishlist\Pricing\ConfiguredPrice\Downloadable
Definition:
Downloadable.php:12
Magento\Wishlist\Pricing\ConfiguredPrice\Downloadable\setItem
setItem(ItemInterface $item)
Definition:
Downloadable.php:70
$links
$links
Definition:
downloadable_product_with_files_and_sample_url.php:39
Magento\Catalog\Pricing\Price\ConfiguredPriceInterface
Definition:
ConfiguredPriceInterface.php:14
Magento\Wishlist\Pricing\ConfiguredPrice\Downloadable\getValue
getValue()
Definition:
Downloadable.php:27
Magento\Catalog\Pricing\Price\FinalPrice
Definition:
FinalPrice.php:15
Magento\Wishlist\Pricing\ConfiguredPrice
Definition:
ConfigurableProduct.php:6
Magento\Wishlist\Pricing\ConfiguredPrice\Downloadable\PRICE_CODE
const PRICE_CODE
Definition:
Downloadable.php:17