_element, $name); $translate = $this->getTranslate(); $baseUrl = Front::getInstance()->getRequest()->getBaseUrl(); $settings = Front::getInstance()->getBootstrap()->getResource('settings'); $this->_currency = $settings['currency']; $this->setHeaderCode('') ->setBodyCode('') ->setBodyCode( ""); $this->setBodyCode( ""); } /** * * get chzn elements multi options * * @return array */ public function getChznMultiOptions() { return $this->_chznMultiOptions; } /** * * set chzn elements multi options * * @param array $chznMultiOptions * * @return $this */ public function setChznMultiOptions($chznMultiOptions) { $this->_chznMultiOptions = (array)$chznMultiOptions; return $this; } /** * * render the form element * * @return string */ public function render() { $output = null; $counter = 0; $values = $this->getValue(); foreach ((array)$values[self::FIELD_NAME] as $id => $key) { if (!empty($key)) { $output .= $this->_renderRow(false, $key, $values[self::FIELD_LOCATIONS][$id], $values[self::FIELD_FIRST][$id], $values[self::FIELD_ADDL][$id], $counter++); } } $output .= $this->_renderRow(true, null, null, null, null, $counter); return $output; } /** * * render a single row of the element * * @param bool $new * @param string $key * @param string $locations * @param string $firstPrice * @param string $addlPrice * @param int $counter * * @return string */ protected function _renderRow($new = true, $key = null, $locations = null, $firstPrice = null, $addlPrice = null, $counter = null) { $translate = $this->getTranslate(); $brackets = ''; if ($counter !== null) { $brackets = '[' . $counter . ']'; } $chznSelect = new ChznSelect($this->_name . '[' . self::FIELD_LOCATIONS . ']' . $brackets, false); $chznSelect->setAttributes(array( 'data-placeholder' => $translate->_('Choose Locations...'), )) ->setMultiOptions( $this->getChznMultiOptions()) ->setMultiple() ->setValue($locations); $localizedFirstPrice = LocaleFormat::getInstance()->numericToLocalized($firstPrice, true); $localizedAddlPrice = LocaleFormat::getInstance()->numericToLocalized($addlPrice, true); return '