protected function generatePaymentWidget() { $arrFields = array('purchase_order_id' => array('label' => &$GLOBALS['TL_LANG']['MSC']['purchase_order_id'], 'inputType' => 'text', 'eval' => array('mandatory' => true, 'tableless' => true))); $arrParsed = array(); $blnSubmit = true; $intSelectedPayment = intval(\Input::post('PaymentMethod') ?: $this->objCart->getPaymentMethod()); foreach ($arrFields as $field => $arrData) { $strClass = $GLOBALS['TL_FFL'][$arrData['inputType']]; // Continue if the class is not defined if (!class_exists($strClass)) { continue; } $objWidget = new $strClass($strClass::getAttributesFromDca($arrData, $field)); if ($arrData['value']) { $objWidget->value = $arrData['value']; } $objWidget->tableless = $this->tableless; //Handle form submit if (\Input::post('FORM_SUBMIT') == $this->strFormId && $intSelectedPayment == $this->id) { $objWidget->validate(); if ($objWidget->hasErrors()) { $blnSubmit = false; $objModule->doNotSubmit = true; } } // Give the template plenty of ways to output the fields $strParsed = $objWidget->parse(); $strBuffer .= $strParsed; $arrParsed[$field] = $strParsed; $objTemplate->{'field_' . $field} = $strParsed; } }
/** * Add additional functionality for Billpay to document template * * @param \Template $objTemplate * @param IsotopeProductCollection $objCollection * @param IsotopeDocument $objDocument */ public function addToDocumentTemplate(\Template $objTemplate, IsotopeProductCollection $objCollection, IsotopeDocument $objDocument) { $objTemplate->billpay = false; /** @type Order $objCollection */ if ($objCollection instanceof Order && $objCollection->hasPayment() && $objCollection->getPaymentMethod() instanceof BillpayWithSaferpay) { $arrPayment = deserialize($objCollection->payment_data); if (!empty($arrPayment) && is_array($arrPayment) && is_array($arrPayment['POSTSALE'])) { $doc = new \DOMDocument(); $doc->loadXML(end($arrPayment['POSTSALE'])); $this->objXML = $doc->getElementsByTagName('IDP')->item(0)->attributes; $objTemplate->billpay = true; $objTemplate->billpay_accountholder = $this->getPostValue('POB_ACCOUNTHOLDER'); $objTemplate->billpay_accountnumber = $this->getPostValue('POB_ACCOUNTNUMBER'); $objTemplate->billpay_bankcode = $this->getPostValue('POB_BANKCODE'); $objTemplate->billpay_bankname = $this->getPostValue('POB_BANKNAME'); $objTemplate->billpay_payernote = $this->getPostValue('POB_PAYERNOTE'); } } }
/** * Initialize a new collection and duplicate everything from the source * @param IsotopeProductCollection */ public static function createFromCollection(IsotopeProductCollection $objSource) { global $objPage; $objCollection = new static(); $objConfig = $objSource->getRelated('config_id'); if (null === $objConfig) { $objConfig = Isotope::getConfig(); } $objCollection->uniqid = uniqid(Haste::getInstance()->call('replaceInsertTags', array((string) $objConfig->orderPrefix, false)), true); $objCollection->source_collection_id = (int) $objSource->id; $objCollection->config_id = (int) $objConfig->id; $objCollection->store_id = (int) $objSource->store_id; $objCollection->member = (int) $objSource->member; $objCollection->language = (string) $GLOBALS['TL_LANGUAGE']; $objCollection->currency = (string) $objConfig->currency; $objCollection->pageId = (int) $objPage->id; $objCollection->setShippingMethod($objSource->getShippingMethod()); $objCollection->setPaymentMethod($objSource->getPaymentMethod()); $objCollection->setShippingAddress($objSource->getShippingAddress()); $objCollection->setBillingAddress($objSource->getBillingAddress()); $arrItemIds = $objCollection->copyItemsFrom($objSource); $arrSurchargeIds = $objCollection->copySurchargesFrom($objSource, $arrItemIds); $objCollection->updateDatabase(); // HOOK: order status has been updated if (isset($GLOBALS['ISO_HOOKS']['createFromProductCollection']) && is_array($GLOBALS['ISO_HOOKS']['createFromProductCollection'])) { foreach ($GLOBALS['ISO_HOOKS']['createFromProductCollection'] as $callback) { $objCallback = \System::importStatic($callback[0]); $objCallback->{$callback}[1]($objCollection, $objSource, $arrItemIds, $arrSurchargeIds); } } return $objCollection; }
/** * Initialize a new collection and duplicate everything from the source * * @param IsotopeProductCollection $objSource * * @return static */ public static function createFromCollection(IsotopeProductCollection $objSource) { $objCollection = new static(); $objConfig = $objSource->getRelated('config_id'); if (null === $objConfig) { $objConfig = Isotope::getConfig(); } $objCollection->source_collection_id = (int) $objSource->id; $objCollection->config_id = (int) $objConfig->id; $objCollection->store_id = (int) $objSource->store_id; $objCollection->member = (int) $objSource->member; $objCollection->setShippingMethod($objSource->getShippingMethod()); $objCollection->setPaymentMethod($objSource->getPaymentMethod()); $objCollection->setShippingAddress($objSource->getShippingAddress()); $objCollection->setBillingAddress($objSource->getBillingAddress()); $arrItemIds = $objCollection->copyItemsFrom($objSource); $objCollection->updateDatabase(); // HOOK: order status has been updated if (isset($GLOBALS['ISO_HOOKS']['createFromProductCollection']) && is_array($GLOBALS['ISO_HOOKS']['createFromProductCollection'])) { foreach ($GLOBALS['ISO_HOOKS']['createFromProductCollection'] as $callback) { $objCallback = \System::importStatic($callback[0]); $objCallback->{$callback}[1]($objCollection, $objSource, $arrItemIds); } } return $objCollection; }