BxSnipcartFormEntry.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Snipcart Snipcart
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Create/Edit entry form
  13. */
  14. class BxSnipcartFormEntry extends BxBaseModTextFormEntry
  15. {
  16. public function __construct($aInfo, $oTemplate = false)
  17. {
  18. $this->MODULE = 'bx_snipcart';
  19. parent::__construct($aInfo, $oTemplate);
  20. $CNF = &$this->_oModule->_oConfig->CNF;
  21. if (isset($this->aInputs[$CNF['FIELD_PRICE']])) {
  22. $aSettings = $this->_oModule->getSettings();
  23. $aCurency = $this->_oModule->_oConfig->getCurrency($aSettings);
  24. $this->aInputs[$CNF['FIELD_PRICE']]['info'] = sprintf($this->aInputs[$CNF['FIELD_PRICE']]['info'], $aCurency['code']);
  25. }
  26. }
  27. public function genCustomViewRowValueWeight($aInput)
  28. {
  29. $mixedResult = null;
  30. if(isset($aInput['value']) && $aInput['value'] !== '')
  31. $mixedResult = bx_process_output($aInput['value'], BX_DATA_FLOAT);
  32. if(!empty($mixedResult))
  33. $mixedResult = _t('_bx_snipcart_form_entry_input_weight_value', $mixedResult);
  34. return $mixedResult;
  35. }
  36. }
  37. /** @} */