/** * Generate the checkout step * @return string */ public function generate() { // Make sure field data is available \Controller::loadDataContainer('tl_iso_product_collection'); \System::loadLanguageFile('tl_iso_product_collection'); $objTemplate = new Template($this->strTemplate); $varValue = null; $objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this)); $objWidget->storeValues = true; if (\Input::post('FORM_SUBMIT') == $this->strFormId) { $objWidget->validate(); $varValue = $objWidget->value; // Do not submit the field if there are errors if ($objWidget->hasErrors()) { $doNotSubmit = true; } elseif ($objWidget->submitInput()) { $objOrder = Isotope::getCart()->getDraftOrder(); // Store the form data $_SESSION['FORM_DATA'][$this->strField] = $varValue; // Set the correct empty value (see #6284, #6373) if ($varValue === '') { $varValue = $objWidget->getEmptyValue(); } // Set the new value if ($varValue !== $objOrder->{$this->strField}) { $objOrder->{$this->strField}; } } } $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0]; $objTemplate->customerNotes = $objWidget->parse(); return $objTemplate->parse(); }
/** * Generate the checkout step * @return string */ public function generate() { $objTemplate = new Template($this->strTemplate); $arrAttributes = ['dateDirection' => 'gtToday', 'inputType' => 'calendar', 'eval' => ['required' => true, 'rgxp' => 'date', 'datepicker' => true]]; $varValue = null; $objWidget = new FormCalendarField(FormCalendarField::getAttributesFromDca($arrAttributes, $this->strField, $varValue, $this->strField, $this->strTable, $this)); $objWidget->storeValues = true; if (\Input::post('FORM_SUBMIT') == $this->strFormId) { $objWidget->validate(); $varValue = $objWidget->value; $rgxp = $arrAttributes['eval']['rgxp']; // Convert date formats into timestamps (check the eval setting first -> #3063) if ($varValue != '' && in_array($rgxp, array('date', 'time', 'datim'))) { try { $objDate = new \Date($varValue, \Date::getFormatFromRgxp($rgxp)); $varValue = $objDate->tstamp; } catch (\OutOfBoundsException $e) { $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varValue)); } } // Do not submit the field if there are errors if ($objWidget->hasErrors()) { $doNotSubmit = true; } elseif ($objWidget->submitInput()) { $objOrder = Isotope::getCart()->getDraftOrder(); // Store the form data $_SESSION['FORM_DATA'][$this->strField] = $varValue; // Set the correct empty value (see #6284, #6373) if ($varValue === '') { $varValue = $objWidget->getEmptyValue(); } // Set the new value if ($varValue !== $objOrder->{$this->strField}) { $objOrder->{$this->strField}; } } } $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable]['date_picker'][0]; $objTemplate->datePicker = $objWidget->parse(); return $objTemplate->parse(); }
/** * @param string $attribute * @param string $queryType * @param string $countType * @param bool $showClear * * @return array|null */ protected function generateAttribute($attribute, $queryType, $countType, &$showClear) { $isActive = false; $label = $attribute; // Will be updated by getOptionsForAttribute() $options = $this->getOptionsForAttribute($attribute, $label); // Must have options to apply the filter if (empty($options)) { return null; } $arrItems = $this->generateOptions($attribute, $options, $queryType, $countType, $isActive); // Hide fields with just one option (if enabled) if (empty($arrItems) || $this->iso_filterHideSingle && count($arrItems) < 2) { return null; } $objClass = RowClass::withKey('class')->addFirstLast(); if ($isActive) { $objClass->addCustom('sibling'); $showClear = true; } $objClass->applyTo($arrItems); /** @var Template|object $objTemplate */ $objTemplate = new Template($this->navigationTpl); $objTemplate->level = 'level_2'; $objTemplate->items = $arrItems; $class = $attribute . ' query_' . strtolower($queryType) . ' count_' . $countType; if ($this->isMultiple($attribute)) { $class .= ' multiple'; } if ($isActive) { $class .= ' trail'; } return array('label' => $label, 'subitems' => $objTemplate->parse(), 'isActive' => $isActive, 'class' => $class); }
/** * Return the payment form. * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { global $objPage; $objTemplate = new Template('iso_payment_sparkasse'); $objTemplate->amount = number_format($objOrder->getTotal(), 2, ',', ''); $objTemplate->basketid = $objOrder->source_collection_id; $objTemplate->currency = $objOrder->currency; $objTemplate->locale = $objOrder->language; $objTemplate->orderid = $objOrder->id; $objTemplate->sessionid = $objPage->id; $objTemplate->transactiontype = $this->trans_type == 'auth' ? 'preauthorization' : 'authorization'; $objTemplate->merchantref = ''; if ($this->sparkasse_merchantref != '') { $objTemplate->merchantref = substr($this->replaceInsertTags($this->sparkasse_merchantref), 0, 30); } $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][0]; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][1]; $objTemplate->link = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][2]; // Unfortunately we can't use the class method for this // @todo change when PHP 5.4 is compulsory $objTemplate->calculateHash = function ($arrData) { ksort($arrData); return hash_hmac('sha1', implode('', $arrData), $this->sparkasse_sslpassword); }; return $objTemplate->parse(); }
/** * Generate main image and return it as HTML string * * @return string */ public function generateMainImage() { $hasImages = $this->hasImages(); if (!$hasImages && !$this->hasPlaceholderImage()) { return ''; } /** @var Template|object $objTemplate */ $objTemplate = new Template($this->strTemplate); $this->addImageToTemplate($objTemplate, 'main', $hasImages ? $this->arrFiles[0] : $this->getPlaceholderImage(), $hasImages); $objTemplate->javascript = ''; if (\Environment::get('isAjaxRequest')) { $strScripts = ''; $arrTemplates = deserialize($this->lightbox_template, true); if (!empty($arrTemplates)) { foreach ($arrTemplates as $strTemplate) { $objScript = new Template($strTemplate); $strScripts .= $objScript->parse(); } } $objTemplate->javascript = $strScripts; } return $objTemplate->parse(); }