Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SpecialPrice.php
Go to the documentation of this file.
1 <?php
8 
10 
15 {
19  protected $percent;
20 
26  public function getDiscountPercent()
27  {
28  if ($this->percent === null) {
29  $this->percent = parent::getValue();
30  }
31  return $this->percent;
32  }
33 
39  public function getValue()
40  {
41  if ($this->value !== null) {
42  return $this->value;
43  }
44 
45  $specialPrice = $this->getDiscountPercent();
46  if ($specialPrice) {
47  $regularPrice = $this->getRegularPrice();
48  $this->value = $regularPrice * ($specialPrice / 100);
49  } else {
50  $this->value = false;
51  }
52  return $this->value;
53  }
54 
60  protected function getRegularPrice()
61  {
62  return $this->priceInfo->getPrice(RegularPrice::PRICE_CODE)->getValue();
63  }
64 
68  public function isPercentageDiscount()
69  {
70  return true;
71  }
72 }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9