/** * Add our own encoder to the internal encoder collection * * @param Enlight_Event_EventArgs $args * @return array|mixed */ public function onAddEncoder(Enlight_Event_EventArgs $args) { $this->registerMyComponents(); $hashes = $args->getReturn(); $hashes[] = new \Shopware\SwagMd5Reversed\Md5ReversedEncoder(); return $hashes; }
/** * Plugin event method * * @param Enlight_Event_EventArgs $args * @return mixed */ public function onFilterRender(Enlight_Event_EventArgs $args) { $request = $args->getSubject()->Action()->Request(); /** @var $response Enlight_Controller_Response_ResponseHttp */ $response = $args->getSubject()->Action()->Response(); $headers = $response->getHeaders(); foreach($headers as $header) { if($header['name'] == 'Content-Type' && strpos($header['value'], 'application/javascript') === 0) { $source = $args->getReturn(); $source = str_replace(array("\r\n", "\r"), "\n", $source); $expressions = array( // Remove comments '#/\*.*?\*/#ms' => '', '#^\s*//.*$#m' => '', //'#\n\s+#ms' => '', '#^\s+#ms' => '', //'#\s+$#ms' => '', ); $source = preg_replace(array_keys($expressions), array_values($expressions), $source); return $source; } } if ($request->getModuleName() !== 'frontend' && $request->getModuleName() !== 'widgets') { return $args->getReturn(); } return $this->filterSource($args->getReturn()); }
public function onFilterSql(Enlight_Event_EventArgs $args) { $sql = $args->getReturn(); $newSql = 'attr20,'; for ($i = 21; $i <= 40; $i++) { $newSql .= 'swag_attr' . $i . ','; } $sql = str_replace('attr20,', $newSql, $sql); return $sql; }
/** * @param \Enlight_Event_EventArgs $args * @return mixed */ public function onBenchmarkEvent(\Enlight_Event_EventArgs $args) { $event = $args->getName(); if (!isset($this->results[$event])) { $this->results[$event] = array(0 => true, 1 => 0, 2 => 0, 3 => microtime(true)); } if (empty($this->results[$event][0])) { $this->results[$event][0] = true; $this->results[$event][1] -= memory_get_peak_usage(true); $this->results[$event][2] -= microtime(true); } else { $this->results[$event][0] = false; $this->results[$event][1] += memory_get_peak_usage(true); $this->results[$event][2] += microtime(true); } return $args->getReturn(); }
/** * Provide the store data for the current store. * * @param \Enlight_Event_EventArgs $args * @return array|mixed */ public function handleElement(\Enlight_Event_EventArgs $args) { /** @var $controller \Enlight_Controller_Action */ $controller = $args->get('subject'); /** @var CustomComponents $customComponents */ $customComponents = $controller->get('swag_dynamic_emotion.custom_components'); $element = $args->get('element'); $data = $args->getReturn(); $storeId = $controller->Request()->getParam('currentStore'); // just modify our own components if (!$customComponents->isCustomComponents($element['component']['cls'])) { return $data; } // if no $storeId is available (e.g. shopping world preview), get a fallback $storeId = isset($storeId) ? $storeId : Shopware()->Db()->fetchOne('SELECT id FROM swag_store LIMIT 1'); // if still not available (e.g. no stores) - return if (!$storeId) { return $data; } /** @var ModelRepository $storeRepo */ $storeRepo = Shopware()->Models()->getRepository('Shopware\\CustomModels\\SwagDynamicEmotion\\Store'); return array_merge($data, ['store' => $storeRepo->find($storeId)]); }
/** * Complements the generated urls with scheme, host and basePath, if required. * * @param Enlight_Event_EventArgs $args * @return string */ public function onFilterUrl(Enlight_Event_EventArgs $args) { /** @var $userParams array */ $userParams = $args->get('userParams'); /** @var $request Enlight_Controller_Request_RequestHttp */ $request = $args->get('subject')->Front()->Request(); /** @var $url string */ $url = $args->getReturn(); if (!empty($url) && ($url[0] === '/' || preg_match('|^[a-z]+://|', $url))) { return $url; } $forceSecure = !empty($this->Config()->forceSecure) || !empty($userParams['forceSecure']); $forceSecure = $forceSecure && !empty($this->Config()->enableSecure); $forceAbsolute = !empty($this->Config()->forceAbsolute) || !empty($userParams['forceAbsolute']); if ($forceAbsolute || $forceSecure) { $prepend = $forceSecure ? 'https://' : 'http://'; if ($forceSecure) { $prepend .= $this->Config()->get('secureHttpHost', $request->getHttpHost()); $prepend .= $this->Config()->get('secureBaseUrl', $request->getBaseUrl()); } else { $prepend .= $this->Config()->get('httpHost', $request->getHttpHost()); $prepend .= $this->Config()->get('baseUrl', $request->getBaseUrl()); } $url = $prepend . '/' . $url; } return $url; }
/** * Adds an Attribte to s_order for sepa * * @param Enlight_Event_EventArgs $args * @return string */ public function insertOrderAttribute(Enlight_Event_EventArgs $args) { $subject = $args->getSubject(); if ($subject->sUserData['additional']['payment']['name'] === "paymilldebit") { $sepaDays = (int) $this->Config()->get('paymillSepaDate'); if ($sepaDays < 0) { $sepaDays = 0; } $timeStamp = strtotime("+" . $sepaDays . " DAYS"); $attributeSql = preg_replace('/attribute6/', 'attribute6, paymill_sepa_date', $args->getReturn()); $attributeSql = preg_replace('/\\)$/', ",{$timeStamp} )", $attributeSql); $args->setReturn($attributeSql); } }
/** * This method registers shopware's generic payment method handler * and the debit payment method handler * * @param Enlight_Event_EventArgs $args * @return array */ public function addPaymentClass(\Enlight_Event_EventArgs $args) { $dirs = $args->getReturn(); $this->Application()->Loader()->registerNamespace('ShopwarePlugin\\PaymentMethods\\Components', __DIR__ . '/Components/'); $dirs['debit'] = 'ShopwarePlugin\\PaymentMethods\\Components\\DebitPaymentMethod'; $dirs['sepa'] = 'ShopwarePlugin\\PaymentMethods\\Components\\SepaPaymentMethod'; $dirs['default'] = 'ShopwarePlugin\\PaymentMethods\\Components\\GenericPaymentMethod'; return $dirs; }
public static function onpaymentAction(Enlight_Event_EventArgs $args) { self::registerNamespace(); $caller = $args->getSubject(); $request = $args->getSubject()->Request(); if ($request->sViewport == 'checkout' && ($request->sAction == 'confirm' || $request->sAction == 'index' || $request->success == 'payment' || $request->sAction == 'payment')) { // hier die extrabehandlung bei neuanmeldungen ... if ($caller->View()->sRegisterFinished) { $caller->View()->sFormData = array(); } else { return; } // nothing to do here } if (!$caller->View()->sFormData) $caller->View()->sFormData = array (); if (isset($_SESSION['addresscheck']) && $_SESSION['addresscheck'] != "VALID") self::checkCustomerAddress($request); // boni check if ( !$_SESSION['boni_proved']) $cScore = self::checkConsumerScore($request); else $cScore = $_SESSION['boni_proved']; $allowedScores = array ("G" => array ("G", "Y", "R"), "Y" => array ("Y", "R"), "R" => array ("R")); $ret = $args->getReturn(); $formData['payone_payId'] = self::getPaymentId(); // paypal if (self::checkPaymentScore('paypal', $cScore, $allowedScores)) $formData['paypal'] = true; // online pay foreach (Shopware_Controllers_Backend_BuiswPaymentPayone::$directdebits as $creditcard) { if (self::checkPaymentScore($creditcard['key'], $cScore, $allowedScores)) { $formData['onlinepay'][] = $creditcard; } } $formData['eps_values'] = Shopware_Controllers_Backend_BuiswPaymentPayone::$eps_values; $formData['idl_values'] = Shopware_Controllers_Backend_BuiswPaymentPayone::$idl_values; // invoice if (self::checkPaymentScore("rechnung", $cScore, $allowedScores)) $formData['rechnung'] = true; // direct debit if (self::checkPaymentScore("lastschrift", $cScore, $allowedScores)) $formData['lastschrift'] = true; // credit card foreach (Shopware_Controllers_Backend_BuiswPaymentPayone::$creditcards as $creditcard) if (self::checkPaymentScore($creditcard['key'], $cScore, $allowedScores)) $formData['creditcards'][] = $creditcard; for ($month = 1; $month <= 12; $month++) $formData['months'][str_pad($month, 2, '0', STR_PAD_LEFT)] = str_pad($month, 2, '0', STR_PAD_LEFT); for ($i = 0; $i <= 10; $i++) $formData['years'][(int) (date("Y") + $i) - 2000] = (int) date("Y") + $i; // cash on delivery if (self::checkPaymentScore('nachnahme', $cScore, $allowedScores)) $formData['nachnahme'] = true; // prepayment if (self::checkPaymentScore("vorkasse", $cScore, $allowedScores)) $formData['vorkasse'] = true; $caller->View()->sFormData += $formData; $caller->View()->sFormData += self::getUserSetting(); $tmp = array ('payone_radio_classes' => ($request->sViewport == 'checkout' || ($request->sViewport == 'register' && $request->sAction == 'saveRegister') ? 'auto_submit' : '')); $caller->View()->sFormData += $tmp; if ($_GET['PAYONEERROR']) { $caller->View()->sErrorFlag = array (self::NAME); $caller->View()->sErrorMessages = 'Fehler: ' . $_GET['PAYONEERROR']; } $view = $caller->View(); $view->addTemplateDir(dirname(__FILE__) . '/Views/'); $radioReplacement = '<input type="hidden" name="register[payment]" value="' . self::getPaymentId() . '">'; $pm = $view->sPaymentMeans ? $view->sPaymentMeans : $view->sPayments; $payonePayment = self::multi_array_key_search(self::getPaymentId(), $pm, 'id'); // throws every other payment means out $view->sPaymentMeans = array ($payonePayment); if ($view->sPayments) { $view->sPayments = array ($payonePayment); $view->extendsBlock('frontend_checkout_payment_fieldset_input_radio', $radioReplacement); } else $view->extendsBlock('frontend_register_payment_fieldset_input_radio', $radioReplacement); return true; }
/** * Filters the shown Payments * RatePAY-payments will be hidden, if one of the following requirement is not given * - Delivery Address is not allowed to be not the same as billing address * - The Customer must be over 18 years old * - The Country must be germany or austria * - The Currency must be EUR * * @param Enlight_Event_EventArgs $arguments * * @return array */ public function filterPayments(Enlight_Event_EventArgs $arguments) { $return = $arguments->getReturn(); $currency = Shopware()->Config()->get('currency'); $userId = Shopware()->Session()->sUserId; if (empty($userId) || empty($currency)) { return; } $user = Shopware()->Models()->find('Shopware\\Models\\Customer\\Customer', Shopware()->Session()->sUserId); //get country of order if (Shopware()->Session()->checkoutBillingAddressId > 0) { // From Shopware 5.2 find current address information in default billing address $addressModel = Shopware()->Models()->getRepository('Shopware\\Models\\Customer\\Address'); $customerAddressBilling = $addressModel->findOneBy(array('id' => Shopware()->Session()->checkoutBillingAddressId)); $countryBilling = $customerAddressBilling->getCountry(); if (Shopware()->Session()->checkoutShippingAddressId > 0 && Shopware()->Session()->checkoutShippingAddressId != Shopware()->Session()->checkoutBillingAddressId) { $customerAddressShipping = $addressModel->findOneBy(array('id' => Shopware()->Session()->checkoutShippingAddressId)); $countryDelivery = $customerAddressShipping->getCountry(); } else { $countryDelivery = $countryBilling; } } else { $countryBilling = Shopware()->Models()->find('Shopware\\Models\\Country\\Country', $user->getBilling()->getCountryId()); if (!is_null($user->getShipping()) && $user->getBilling()->getCountryId() != $user->getShipping()->getCountryId()) { $countryDelivery = Shopware()->Models()->find('Shopware\\Models\\Country\\Country', $user->getShipping()->getCountryId()); } else { $countryDelivery = $countryBilling; } } //get current shopId $shopId = Shopware()->Shop()->getId(); $config = $this->getRatePayPluginConfigByCountry($shopId, $countryBilling); $showRate = $config['rateStatus'] == 2 ? true : false; $showDebit = $config['debitStatus'] == 2 ? true : false; $showInvoice = $config['invoiceStatus'] == 2 ? true : false; $validation = new Shopware_Plugins_Frontend_RpayRatePay_Component_Validation($config); $validation->setAllowedCurrencies($config['currency']); $validation->setAllowedCountriesBilling($config['country-code-billing']); $validation->setAllowedCountriesDelivery($config['country-code-delivery']); //check if payments are hidden by session (not in sandbox mode) if ($validation->isRatepayHidden()) { $showRate = false; $showDebit = false; $showInvoice = false; } //check if the country is allowed if (!$validation->isCurrencyValid($currency)) { $showRate = false; $showDebit = false; $showInvoice = false; } //check if the billing country is allowed if (!$validation->isBillingCountryValid($countryBilling)) { $showRate = false; $showDebit = false; $showInvoice = false; } //check if the delivery country is allowed if (!$validation->isDeliveryCountryValid($countryDelivery)) { $showRate = false; $showDebit = false; $showInvoice = false; } $limitInvoiceMin = $config['limit-invoice-min']; $limitDebitMin = $config['limit-debit-min']; $limitRateMin = $config['limit-rate-min']; //check if it is a b2b transaction if ($validation->isCompanyNameSet() || $validation->isUSTSet()) { $showRate = $config['b2b-rate'] == 'yes' && $showRate ? true : false; $showDebit = $config['b2b-debit'] == 'yes' && $showDebit ? true : false; $showInvoice = $config['b2b-invoice'] == 'yes' && $showInvoice ? true : false; $limitInvoiceMax = $config['limit-invoice-max-b2b'] > 0 ? $config['limit-invoice-max-b2b'] : $config['limit-invoice-max']; $limitDebitMax = $config['limit-debit-max-b2b'] > 0 ? $config['limit-debit-max-b2b'] : $config['limit-debit-max']; $limitRateMax = $config['limit-rate-max-b2b'] > 0 ? $config['limit-rate-max-b2b'] : $config['limit-rate-max']; } else { $limitInvoiceMax = $config['limit-invoice-max']; $limitDebitMax = $config['limit-debit-max']; $limitRateMax = $config['limit-rate-max']; } //check if there is an alternate delivery address if (!$validation->isBillingAddressSameLikeShippingAddress()) { $showRate = $config['address-rate'] == 'yes' && $showRate ? true : false; $showDebit = $config['address-debit'] == 'yes' && $showDebit ? true : false; $showInvoice = $config['address-invoice'] == 'yes' && $showInvoice ? true : false; } //check the limits if (Shopware()->Modules()->Basket()) { $basket = Shopware()->Modules()->Basket()->sGetAmount(); $basket = $basket['totalAmount']; Shopware()->Pluginlogger()->info('BasketAmount: ' . $basket); if ($basket < $limitInvoiceMin || $basket > $limitInvoiceMax) { $showInvoice = false; } if ($basket < $limitDebitMin || $basket > $limitDebitMax) { $showDebit = false; } if ($basket < $limitRateMin || $basket > $limitRateMax) { $showRate = false; } } $paymentModel = Shopware()->Models()->find('Shopware\\Models\\Payment\\Payment', $user->getPaymentId()); $setToDefaultPayment = false; $payments = array(); foreach ($return as $payment) { if ($payment['name'] === 'rpayratepayinvoice' && !$showInvoice) { Shopware()->Pluginlogger()->info('RatePAY: Filter RatePAY-Invoice'); $setToDefaultPayment = $paymentModel->getName() === "rpayratepayinvoice" ?: $setToDefaultPayment; continue; } if ($payment['name'] === 'rpayratepaydebit' && !$showDebit) { Shopware()->Pluginlogger()->info('RatePAY: Filter RatePAY-Debit'); $setToDefaultPayment = $paymentModel->getName() === "rpayratepaydebit" ?: $setToDefaultPayment; continue; } if ($payment['name'] === 'rpayratepayrate' && !$showRate) { Shopware()->Pluginlogger()->info('RatePAY: Filter RatePAY-Rate'); $setToDefaultPayment = $paymentModel->getName() === "rpayratepayrate" ?: $setToDefaultPayment; continue; } $payments[] = $payment; } if ($setToDefaultPayment) { Shopware()->Pluginlogger()->info($user->getPaymentId()); $user->setPaymentId(Shopware()->Config()->get('paymentdefault')); Shopware()->Models()->persist($user); Shopware()->Models()->flush(); Shopware()->Models()->refresh($user); Shopware()->Pluginlogger()->info($user->getPaymentId()); } return $payments; }
/** * Filter event for the banner elements of the Digital Publishing module. * Enables you to manipulate the banner data before it gets passed to the frontend. * * @param \Enlight_Event_EventArgs $args * @return mixed */ public function onContentBannerFilter(\Enlight_Event_EventArgs $args) { $banner = $args->getReturn(); // Do some magic data manipulation return $banner; }
/** * @param \Enlight_Event_EventArgs $args * @return array * @throws \Exception */ public function convertMedia(\Enlight_Event_EventArgs $args) { $data = $args->getReturn(); if (!$this->isLegacyTemplate()) { return $data; } $data['src'] = array_column($data['thumbnails'], 'source'); $data['src']['original'] = $data['source']; return $data; }
/** * Plugin event listener function which fired after the * top seller data selected. * This function is used in case that the shop owner configured the * live refresh of the article data. * The listener function registers an additional listener on the * after_send_response event. * * @param Enlight_Event_EventArgs $arguments * @return mixed */ public function afterTopSellerSelected(Enlight_Event_EventArgs $arguments) { if (Shopware()->Session()->Bot) { return $arguments->getReturn(); } $strategy = $this->Application()->Config()->get('topSellerRefreshStrategy', self::AGGREGATE_STRATEGY_LIVE); if ($strategy !== self::AGGREGATE_STRATEGY_LIVE || !$this->isTopSellerActivated()) { return $arguments->getReturn(); } if (Shopware()->Front()->returnResponse()) { $this->TopSeller()->updateElapsedTopSeller(50); } else { $event = new Enlight_Event_EventHandler('Enlight_Controller_Front_AfterSendResponse', array($this, 'afterSendResponseOnTopSeller')); Shopware()->Events()->registerListener($event); } return $arguments->getReturn(); }
/** * This method registers shopware's default hash algorithm * @param Enlight_Event_EventArgs $args * @return array */ public function onAddEncoder(\Enlight_Event_EventArgs $args) { $hashes = $args->getReturn(); $hashes[] = new Shopware\Components\Password\Encoder\Bcrypt($this->getBcryptOptions()); $hashes[] = new Shopware\Components\Password\Encoder\Sha256($this->getSha256Options()); $hashes[] = new Shopware\Components\Password\Encoder\LegacyBackendMd5(); $hashes[] = new Shopware\Components\Password\Encoder\Md5(); $hashes[] = new Shopware\Components\Password\Encoder\PreHashed(); return $hashes; }
/** * Remove html-comments / whitespaces * * @param Enlight_Event_EventArgs $args * @return mixed|string */ public function onFilterRender(Enlight_Event_EventArgs $args) { $source = $args->getReturn(); if (strpos($source, '<html') === false) { return $source; } $config = Shopware()->Config(); // Remove comments if (!empty($config['sSEOREMOVECOMMENTS'])) { $source = str_replace(array("\r\n", "\r"), "\n", $source); $expressions = array('#(<(?:script|pre|textarea)[^>]*?>.*?</(?:script|pre|textarea)>)|(<style[^>]*?>.*?</style>)|(<!--\\[.*?\\]-->)|(<!--\\s*\\#\\s*include virtual.*?-->)|<!--.*?-->#msiS' => '$1$2$3$4', '#(([a-z0-9]\\s*=\\s*(["\'])[^\\3]*?\\3)|<[a-z0-9_]+)\\s+([a-z/>])#is' => '\\1 \\4', '#^\\s+#ms' => '', '#\\s+$#ms' => ''); $source = preg_replace(array_keys($expressions), array_values($expressions), $source); } return $source; }
/** * add purchase tracking * @param Enlight_Event_EventArgs $arguments * @return boolean */ public function purchase(Enlight_Event_EventArgs $arguments) { if ($this->Config()->get('boxalino_tracking_enabled')) { $products = array(); foreach ($arguments->getDetails() as $detail) { $products[] = array('product' => $detail['articleDetailId'], 'quantity' => $detail['quantity'], 'price' => $detail['priceNumeric']); } Shopware_Plugins_Frontend_Boxalino_EventReporter::reportPurchase($products, $arguments->getSubject()->sOrderNumber, $arguments->getSubject()->sAmount, Shopware()->Shop()->getCurrency()); } return $arguments->getReturn(); }
/** * Remove html-comments / whitespaces * * @param Enlight_Event_EventArgs $args * @return mixed|string */ public function onFilterRender(Enlight_Event_EventArgs $args) { $source = $args->getReturn(); if (strpos($source, '<html') === false) { return $source; } $config = Shopware()->Config(); // Remove comments // && empty($template->_tpl_vars['debug_output'] todo@all property tpl_vars seems to not exist in smarty 3.1 if (!empty($config['sSEOREMOVECOMMENTS'])) { $source = str_replace(array("\r\n", "\r"), "\n", $source); $expressions = array( // Remove comments '#(<(?:script|pre|textarea)[^>]*?>.*?</(?:script|pre|textarea)>)|(<style[^>]*?>.*?</style>)|(<!--\[.*?\]-->)|<!--.*?-->#msiS' => '$1$2$3', // remove spaces between attributes (but not in attribute values!) '#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4', // note: for some very weird reason trim() seems to remove spaces inside attributes. // maybe a \0 byte or something is interfering? '#^\s+#ms' => '', '#\s+$#ms' => '', ); $source = preg_replace(array_keys($expressions), array_values($expressions), $source); } // Trim whitespace // $template = Shopware()->Template(); // if(!empty($config['sSEOREMOVEWHITESPACES'])&&empty($template->_tpl_vars['debug_output'])) { // require_once(SMARTY_DIR.'plugins/outputfilter.trimwhitespace.php'); // $source = smarty_outputfilter_trimwhitespace($source, $template); // } return $source; }
/** * Plugin event listener function which fired after the * top seller data selected. * This function is used in case that the shop owner configured the * live refresh of the article data. * The listener function registers an additional listener on the * after_send_response event. * * @param Enlight_Event_EventArgs $arguments * @return mixed */ public function afterTopSellerSelected(Enlight_Event_EventArgs $arguments) { if (Shopware()->Session()->Bot) { return $arguments->getReturn(); } $strategy = $this->Application()->Config()->get('topSellerRefreshStrategy', self::AGGREGATE_STRATEGY_LIVE); if ($strategy !== self::AGGREGATE_STRATEGY_LIVE || !$this->isTopSellerActivated()) { return $arguments->getReturn(); } $this->TopSeller()->updateElapsedTopSeller(50); return $arguments->getReturn(); }
/** * Callback function to register our password encoders * * @param Enlight_Event_EventArgs $args * @return array */ public function onAddPasswordEncoder(\Enlight_Event_EventArgs $args) { $this->get('loader')->registerNamespace('Shopware_Components', dirname(__FILE__) . '/Components/'); $hashes = $args->getReturn(); $hashes[] = new Shopware_Components_Migration_PasswordEncoder_Md5Reversed(); return $hashes; }
/** * transfer attribute data from temp order to new finalized order, shopware doesn't do it automatically * the temp order contains already the pushed transaction status data * * @param \Enlight_Event_EventArgs $args * @return string */ public function event_Shopware_Modules_Order_SaveOrderAttributes_FilterSQL(\Enlight_Event_EventArgs $args) { $sql = $args->getReturn(); $sOrder = $args->getSubject(); $db = $sOrder->sSYSTEM->sDB_CONNECTION; $helper = $this->Application()->PayoneMain()->getHelper(); //temporaryId $tempId = $sOrder->sSYSTEM->sSESSION_ID; $tempOrder = Shopware()->Models()->getRepository('Shopware\\Models\\Order\\Order')->findOneBy(array('temporaryId' => $tempId)); if (!$tempOrder) { return; } $attributes = $helper->getOrCreateAttribute($tempOrder); //inject insert SQL $sql = str_replace("INSERT INTO s_order_attributes (", "INSERT INTO s_order_attributes " . "(mopt_payone_txid, mopt_payone_status, mopt_payone_sequencenumber, " . "mopt_payone_is_authorized, mopt_payone_is_finally_captured, mopt_payone_clearing_data, ", $sql); $sql = str_replace(" VALUES (", " VALUES (" . $db->quote($attributes->getMoptPayoneTxid()) . ', ' . $db->quote($attributes->getMoptPayoneStatus()) . ', ' . $db->quote($attributes->getMoptPayoneSequencenumber()) . ', ' . $db->quote($attributes->getMoptPayoneIsAuthorized()) . ', ' . $db->quote($attributes->getMoptPayoneIsFinallyCaptured()) . ', ' . $db->quote($attributes->getMoptPayoneClearingData()) . ', ', $sql); $args->setReturn($sql); }
/** * Internal listener function of each fired event in shopware. * * @param Enlight_Event_EventArgs $args * @return mixed */ public function onEvent(Enlight_Event_EventArgs $args) { if ($this->preventEventLog) { return $args->getReturn(); } $event = $args->getName(); $this->events[$event]['returns'][] = $args->getReturn(); $this->events[$event]['time'][] = microtime(true); return $args->getReturn(); }
/** * Modifies the onGetArticlesByCategoryFilterSql to filter Articles based on the selected options * * 1. determine if is active * 2. extend base query * * @param \Enlight_Event_EventArgs $args * @return string */ public function onGetArticlesByCategoryFilterSql(\Enlight_Event_EventArgs $args) { /** @var int $categoryId */ $categoryId = Shopware()->Front()->Request()->sCategory; $baseQuery = $args->getReturn(); if (!$this->requestHelper->hasVariantIds()) { return $baseQuery; } $filterItems = Shopware()->Container()->get('SwagVariantLegacyFilter')->getFilterConditions($categoryId, $this->requestHelper->getRequestedVariantIds()); /** @var LegacyResponseExtender $legacyResponseExtender */ $legacyResponseExtender = Shopware()->Container()->get('SwagVariantLegacyResponseExtender'); return $legacyResponseExtender->fromFilterGroups($filterItems)->extendQuery($baseQuery); }
public function onFilterCollectors(\Enlight_Event_EventArgs $arguments) { $collectors = $arguments->getReturn(); $utils = $arguments->get('utils'); foreach ($collectors as $key => $collector) { if ($collector instanceof EventCollector) { $collectors[$key] = new ClockworkEventCollector($arguments->get('eventManager'), $utils); } elseif ($collector instanceof TemplateCollector) { $collectors[$key] = new ClockworkTemplateCollector($this->container->get('template'), $utils, $this->container->get('kernel')->getRootDir()); } } return $collectors; }