Stock.php 735 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\ProductAlert\Block\Product\View;
  7. /**
  8. * Recurring payment view stock
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Stock extends \Magento\ProductAlert\Block\Product\View
  14. {
  15. /**
  16. * Prepare stock info
  17. *
  18. * @param string $template
  19. * @return $this
  20. */
  21. public function setTemplate($template)
  22. {
  23. if (!$this->_helper->isStockAlertAllowed() || !$this->getProduct() || $this->getProduct()->isAvailable()) {
  24. $template = '';
  25. } else {
  26. $this->setSignupUrl($this->_helper->getSaveUrl('stock'));
  27. }
  28. return parent::setTemplate($template);
  29. }
  30. }