Product.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Model\Rule\Action;
  7. class Product extends \Magento\Rule\Model\Action\AbstractAction
  8. {
  9. /**
  10. * Load attribute options
  11. *
  12. * @return $this
  13. */
  14. public function loadAttributeOptions()
  15. {
  16. $this->setAttributeOption(['rule_price' => __('Special Price')]);
  17. return $this;
  18. }
  19. /**
  20. * Load operator options
  21. *
  22. * @return $this
  23. */
  24. public function loadOperatorOptions()
  25. {
  26. $this->setOperatorOption(
  27. [
  28. 'to_fixed' => __('To Fixed Value'),
  29. 'to_percent' => __('To Percentage'),
  30. 'by_fixed' => __('By Fixed value'),
  31. 'by_percent' => __('By Percentage'),
  32. ]
  33. );
  34. return $this;
  35. }
  36. /**
  37. * Return html
  38. *
  39. * @return string
  40. */
  41. public function asHtml()
  42. {
  43. $html = $this->getTypeElement()->getHtml() . __(
  44. "Update product's %1 %2: %3",
  45. $this->getAttributeElement()->getHtml(),
  46. $this->getOperatorElement()->getHtml(),
  47. $this->getValueElement()->getHtml()
  48. );
  49. $html .= $this->getRemoveLinkHtml();
  50. return $html;
  51. }
  52. }