public static function getPath($id_category, $path = '', $link_on_the_item = false, $category_type = 'products', Context $context = null) { if (ConfigurationCore::get('PST_DISPLAY_LAST_BREADCRUMB') == false) { $path = ''; } return parent::getPath($id_category, $path, $link_on_the_item, $category_type, $context); }
/** * Do whatever you have to before redirecting the customer on the website of your payment processor. */ public function postProcess() { /** * Oops, an error occured. */ if (Tools::getValue('action') == 'error') { return $this->displayError('An error occurred while trying to redirect the customer'); } else { //First solution to know if refreshed page: http://stackoverflow.com/a/6127748 $refreshButtonPressed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0'; $result = $this->module->callToRest('GET', '/orders?mid=' . Context::getContext()->cart->id, null, false); $result['response'] = json_decode($result['response'], true); if ($result['code'] == '200' && isset($result['response']['results'][0]['id']) && !$refreshButtonPressed) { //The cart exists on Aplazame, we try to send with another ID $oldCart = new Cart(Context::getContext()->cart->id); $data = $oldCart->duplicate(); if ($data['success']) { $cart = $data['cart']; Context::getContext()->cart = $cart; CartRule::autoAddToCart(Context::getContext()); Context::getContext()->cookie->id_cart = $cart->id; } else { $this->module->logError('Error: Cannot duplicate cart ' . Context::getContext()->cart->id); } } $this->context->smarty->assign(array('cart_id' => Context::getContext()->cart->id, 'secure_key' => Context::getContext()->customer->secure_key, 'aplazame_order_json' => json_encode($this->module->getCheckoutSerializer(0, Context::getContext()->cart->id), 128), 'aplazame_version' => ConfigurationCore::get('APLAZAME_API_VERSION', null), 'aplazame_url' => Configuration::get('APLAZAME_API_URL', null), 'aplazame_mode' => Configuration::get('APLAZAME_LIVE_MODE', null) ? 'false' : 'true')); return $this->setTemplate('redirect.tpl'); } }
/** * * @param piwikanalyticsjs $module * @return boolean */ function upgrade_module_0_8_3($module) { if ($pksd = Configuration::get('PIWIK_SET_DOMAINS')) { $pksd_ = explode(' ', $pksd); ConfigurationCore::updateValue('PIWIK_SET_DOMAINS', implode(',', $pksd_)); } return true; }
public static function isExpeditorCarrier($id_carrier) { if (!Module::isEnabled('expeditor')) { return false; } foreach (explode(',', ConfigurationCore::get('EXPEDITOR_CARRIER')) as $carrier) { if ($carrier == $id_carrier) { return true; } } return false; }
public function cron($jobname, $params, &$message, &$errorcount) { switch ($jobname) { case 'set_shipping_completed': $this->setOrderShippingCompleted($message, $errorcount); break; case 'cancel_orders': $this->log("cron executed job '" . $jobname . "'", ShopgateLogger::LOGTYPE_DEBUG); $cancellationStatus = ConfigurationCore::get('SG_CANCELLATION_STATUS'); $select = sprintf('SELECT ' . (version_compare(_PS_VERSION_, '1.5.0', '>=') ? ' o.current_state, ' : ' o.id_order, ') . ' so.id_shopgate_order from %sshopgate_order as so JOIN %sorders as o on so.id_order=o.id_order WHERE so.is_cancellation_sent_to_shopgate = 0', _DB_PREFIX_, _DB_PREFIX_); $result = Db::getInstance()->ExecuteS($select); if (empty($result)) { $this->log('no orders to cancel found for shop:' . $this->config->getShopNumber(), ShopgateLogger::LOGTYPE_DEBUG); return; } foreach ($result as $order) { $sgOrder = new ShopgateOrderPrestashop($order['id_shopgate_order']); if (is_string($sgOrder->order_number)) { $sgOrder->order_number = (int) $sgOrder->order_number; } if (version_compare(_PS_VERSION_, '1.5.0', '>=')) { $state = $order['current_state']; } else { $stateObject = OrderHistory::getLastOrderState($order['id_order']); $state = $stateObject->id; } if ($state == $cancellationStatus) { $sgOrder->cancelOrder($message); } else { $sgOrder->cancelOrder($message, true); } } break; default: $this->log("job '" . $jobname . "' not found", ShopgateLogger::LOGTYPE_ERROR); throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_CRON_UNSUPPORTED_JOB, 'Job name: "' . $jobname . '"', true); } }
/** * WARNING: For testing only. Do NOT rely on this method, it may be removed at any time. * @todo Delegate static calls from Configuration to an instance * of a class to be created. */ public static function clearConfigurationCacheForTesting() { self::$_cache = array(); }
/** * Get the day minimum for the delivery * @param DateTime $today * @param int $iDayMin * @param bool $bSaturdayShipping * @param bool $bSundayShipping * @param bool $bShippingHolidays * @param bool $bSaturdayDelivery * @param bool $bSundayDelivery * @param bool $bDeliveryHolidays * @return bool|string */ public static function getDateMinDeliveryTime(DateTime $today, $iDayMin = 0, $bSaturdayShipping = false, $bSundayShipping = false, $bShippingHolidays = false, $bSaturdayDelivery = false, $bSundayDelivery = false, $bDeliveryHolidays = false) { /** * Defined the finish date of the order preparation */ if ($today->format('H') >= (int) ConfigurationCore::get('NOW_DT_HOUR_END_PREP') - (int) ConfigurationCore::get('NOW_DT_HOUR_BEFORE_END_PREP')) { $today->add(new DateInterval('P1D')); } // It's holidays ? $aHolidays = NowHolidays::getHolidaysOnToday($today, true); if (!empty($aHolidays)) { $today->add(new DateInterval('P' . ((int) $aHolidays['dayDiff'] + 1) . 'D')); } if ($iDayMin === 0) { return $today->format('Y-m-d'); } /** * Defined the finish date of the order shipping */ if ($today->format('D') == NowDeliveryTime::SATURDAY) { // The day of today is Saturday ? if (!$bSaturdayShipping) { $today->add(new DateInterval('P2D')); } } elseif ($today->format('D') == NowDeliveryTime::SUNDAY) { // The day of today is Sunday ? if (!$bSundayShipping) { $today->add(new DateInterval('P1D')); } } if ($bShippingHolidays) { // It's holydays ? $aHolidays = NowHolidays::getHolidaysOnToday($today, false, true); if (!empty($aHolidays)) { $today->add(new DateInterval('P' . ((int) $aHolidays['dayDiff'] + 1) . 'D')); } } /** * Defined the finish date of the order delivery */ $today->add(new DateInterval('P' . (int) $iDayMin . 'D')); if ($today->format('D') == NowDeliveryTime::SATURDAY) { // The day of today is Saturday ? if (!$bSaturdayDelivery) { $today->add(new DateInterval('P2D')); } } elseif ($today->format('D') == NowDeliveryTime::SUNDAY) { // The day of today is Sunday ? if (!$bSundayDelivery) { $today->add(new DateInterval('P1D')); } } if ($bDeliveryHolidays) { // It's holydays ? $aHolidays = NowHolidays::getHolidaysOnToday($today, false, false, true); if (!empty($aHolidays)) { $today->add(new DateInterval('P' . ((int) $aHolidays['dayDiff'] + 1) . 'D')); } } return $today->format('Y-m-d'); }
/** * Set values for the inputs. */ protected function getConfigFormValues() { return array('BANDEAUPROMO_TEXTE' => Configuration::get('BANDEAUPROMO_TEXTE'), 'BANDEAUPROMO_LIVE_MODE' => ConfigurationCore::get('BANDEAUPROMO_LIVE_MODE')); }
public function installConfigurationSettings() { $this->setConfigurationSettings(); if (!empty($this->aConfigurationDefaultSettings)) { foreach ($this->aConfigurationDefaultSettings as $name => $value) { if (!ConfigurationCore::get($name)) { ConfigurationCore::updateValue($name, $value); } } } return true; }
public static function loadConfiguration() { /* Configuration */ self::$_CONF = array(); $result = Db::getInstance()->ExecuteS('SELECT `name`, `value` FROM `' . _DB_PREFIX_ . 'configuration`'); if ($result) { foreach ($result as $row) { self::$_CONF[$row['name']] = stripslashes($row['value']); } } /* Multilingual configuration */ self::$_CONF_LANG = array(); $result = Db::getInstance()->ExecuteS(' SELECT c.`name`, cl.`id_lang`, IFNULL(cl.`value`, c.`value`) AS value FROM `' . _DB_PREFIX_ . 'configuration_lang` cl LEFT JOIN `' . _DB_PREFIX_ . 'configuration` c ON c.id_configuration = cl.id_configuration'); if ($result === false) { die(Tools::displayError('Invalid loadConfiguration() SQL query')); } foreach ($result as $row) { self::$_CONF_LANG[(int) $row['id_lang']][$row['name']] = stripslashes($row['value']); } }
public function postProcess() { if (Tools::getValue('submitForm')) { ConfigurationCore::updateValue('LG_CONSULTAS_EMAIL', Tools::getValue('LG_CONSULTAS_EMAIL')); ConfigurationCore::updateValue('LG_CONSULTAS_TAB_CONTENT', Tools::getValue('LG_CONSULTAS_TAB_CONTENT')); ConfigurationCore::updateValue('LG_CONSULTAS_EXTRA_RIGHT', Tools::getValue('LG_CONSULTAS_EXTRA_RIGHT')); ConfigurationCore::updateValue('LG_CONSULTAS_ICON_DISPLAY', Tools::getValue('LG_CONSULTAS_ICON_DISPLAY')); ConfigurationCore::updateValue('LG_CONSULTAS_ICON_COLOR', Tools::getValue('LG_CONSULTAS_ICON_COLOR')); ConfigurationCore::updateValue('LG_CONSULTAS_DEFAULT', Tools::getValue('LG_CONSULTAS_DEFAULT')); ConfigurationCore::updateValue('LG_CONSULTAS_EXTRA', Tools::getValue('LG_CONSULTAS_EXTRA')); ConfigurationCore::updateValue('LG_CONSULTAS_CMS', Tools::getValue('LG_CONSULTAS_CMS')); } }
/** * Delete configuration key from current context. * * @param string $key */ public static function deleteFromContext($key) { if (Shop::getContext() == Shop::CONTEXT_ALL) { return; } $id_shop = null; $id_shop_group = Shop::getContextShopGroupID(true); if (Shop::getContext() == Shop::CONTEXT_SHOP) { $id_shop = Shop::getContextShopID(true); } $id = Configuration::getIdByName($key, $id_shop_group, $id_shop); Db::getInstance()->execute(' DELETE FROM ' . _DB_PREFIX_ . 'configuration WHERE id_configuration = ' . (int) $id); Db::getInstance()->execute(' DELETE FROM ' . _DB_PREFIX_ . 'configuration_lang WHERE id_configuration = ' . (int) $id); self::$_CONF = null; }
public function hookRightColumn($params) { $iso_lang = $iso_cert = Tools::strtoupper(Language::getIsoById($params['cookie']->id_lang)); $tab_id = false; if (isset(TSCommon::$certificates[Tools::strtoupper($iso_cert)]['tsID'])) { $tab_id = TSCommon::$certificates[Tools::strtoupper($iso_cert)]['tsID']; } if (!$tab_id) { return false; } if (isset(TSCommon::$certificates[$iso_cert]['tsID'])) { TSCommon::$smarty->assign('trusted_shops_id', TSCommon::$certificates[$iso_cert]['tsID']); TSCommon::$smarty->assign('variant', isset(TSCommon::$certificates[$iso_cert]['variant']) ? in_array(TSCommon::$certificates[$iso_cert]['variant'], array_keys($this->available_seal_variants)) ? TSCommon::$certificates[$iso_cert]['variant'] : 'default' : 'default'); TSCommon::$smarty->assign('yoffset', TSCommon::$certificates[$iso_cert]['yoffset']); TSCommon::$smarty->assign('jscode', TSCommon::$certificates[$iso_cert]['jscode']); TSCommon::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME')); $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSCommon::$certificates[$iso_cert]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSCommon::$certificate_link[$iso_lang]); TSCommon::$smarty->assign('trusted_shops_url', $url); if (isset(TSCommon::$certificates[$iso_cert])) { $certificate = TSCommon::$certificates[$iso_cert]; if (isset($certificate['tsID']) && ($certificate['typeEnum'] == 'CLASSIC' || $certificate['typeEnum'] == 'UNKNOWN' || $certificate['typeEnum'] == 'EXCELLENCE' && $certificate['user'] != '' && $certificate['password'] != '')) { return TrustedShops::displaySeal(); } } } return ''; }
/** * Set values for the inputs. */ protected function getConfigFormValues() { return array('ALIPAY_LIVE_MODE' => Configuration::get('ALIPAY_LIVE_MODE'), 'ALIPAY_PARTNER_ID' => Configuration::get('ALIPAY_PARTNER_ID'), 'ALIPAY_SECRETE_KEY' => ConfigurationCore::get('ALIPAY_SECRETE_KEY')); }
/** * Generate preview URL * * @param object $product * @param bool $preview * * @return string preview url */ public function getPreviewUrl($product, $preview = true) { $context = \ContextCore::getContext(); $id_lang = \ConfigurationCore::get('PS_LANG_DEFAULT', null, null, $context->shop->id); if (!\ShopUrlCore::getMainShopDomain()) { return false; } $is_rewrite_active = (bool) \ConfigurationCore::get('PS_REWRITING_SETTINGS'); $preview_url = $context->link->getProductLink($product, $product->link_rewrite[$context->language->id], \CategoryCore::getLinkRewrite($product->id_category_default, $context->language->id), null, $id_lang, (int) $context->shop->id, 0, $is_rewrite_active); if (!$product->active && $preview) { $preview_url = $this->getPreviewUrlDeactivate($preview_url); } return $preview_url; }
/** * Get virtual product data * * @return array */ private function getVirtualProductData() { //force virtual product feature \ConfigurationCore::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', '1'); $id_product_download = \ProductDownloadCore::getIdFromIdProduct((int) $this->product->id, false); if ($id_product_download) { $download = new \ProductDownloadCore($id_product_download); $dateValue = $download->date_expiration == '0000-00-00 00:00:00' ? '' : date('Y-m-d', strtotime($download->date_expiration)); $res = ['is_virtual_file' => $download->active, 'name' => $download->display_filename, 'nb_downloadable' => $download->nb_downloadable, 'expiration_date' => $dateValue, 'nb_days' => $download->nb_days_accessible]; if ($download->filename) { $res['filename'] = $download->filename; $res['file_download_link'] = $this->context->getAdminBaseUrl() . $download->getTextLink(true); } return $res; } return ['is_virtual_file' => 0, 'nb_days' => 0]; }
/** * calculate the the quantity to cancel at shopgate * * @param \ShopgateOrder $sgOrder this is the shopgate object which was stored into * the database on addOrder request * @param array $cancelledItems * @param $message * @param \ShopgateLogger $log * * @return array * @throws \ShopgateLibraryException */ private function getCancellationData(ShopgateOrder $sgOrder, $cancelledItems, &$message, ShopgateLogger $log) { if (version_compare(_PS_VERSION_, '1.5.0', '>=')) { $pItems = OrderDetailCore::getList($this->id_order); } else { $pOrder = new OrderCore($this->id_order); $pItems = $pOrder->getProductsDetail(); } if (empty($pItems)) { $errorMessage = "No products found to shopgate order id_order:{$sgOrder->getOrderNumber()}"; $message .= $errorMessage; // changed log type to debug to prevent the creation // of huge log files $log->log($errorMessage, ShopgateLogger::LOGTYPE_DEBUG); return array(); } foreach ($sgOrder->getItems() as $sgItem) { foreach ($pItems as $pItem) { $qty = null; $fromHook = false; $sgItemNumber = $sgItem->getItemNumber(); // generate the item number as we do it for items with attributes if (!empty($pItem['product_attribute_id'])) { $prestaItemNumber = $pItem['product_id'] . '-' . $pItem['product_attribute_id']; } else { $prestaItemNumber = $pItem['product_id']; } if ($sgItemNumber == $prestaItemNumber) { // There is no opportunity to deliver this information to // Shopgate. We need to add a message to the order. $refundPriceData = Tools::getValue('partialRefundProduct'); $refundQtyData = Tools::getValue('partialRefundProductQuantity'); if (!empty($refundPriceData[$pItem['id_order_detail']])) { $currency = new CurrencyCore(ConfigurationCore::get("PS_CURRENCY_DEFAULT")); $noteMsg = "Please note that these information could not be transmitted to Shopgate.\n"; $refundPrice = $refundPriceData[$pItem['id_order_detail']]; $refundPriceMsg = "The price of the Product (id:{$pItem['product_id']}) was refunded({$refundPrice}{$currency->sign}).\n"; if (empty($this->comments)) { $this->comments = array(); } if (is_string($this->comments)) { $data = base64_decode($this->comments); if (method_exists("Tools", "jsonDecode")) { $this->comments = Tools::jsonDecode($data); } else { $this->comments = json_decode($data); } } if (is_array($this->comments)) { $this->comments[] = $noteMsg; $this->comments[] = $refundPriceMsg; } } // if the hook was executed or cancel_order request was sent from // shopgate, we get the right data from version 1.5.0 // for lower versions we got two cases: // * cancel order request, we need to get the cancelled quantity // out of the database (here we need to calculate it as in 1.5.00) // * if the hook was executed from prestashop, we get the actual cancelled // amount in the $_POST array (here there is no need to calculate the cancelled) // value, cause we got it at this point if (empty($refundQtyData[$pItem['id_order_detail']]) && Tools::isSubmit('partialRefundProduct')) { continue; } else { $qty = $refundQtyData[$pItem['id_order_detail']]; } // try to retrieve an $_POST['cancelQuantity'] array $cancelQuantity = Tools::getValue('cancelQuantity', null); if (version_compare(_PS_VERSION_, '1.5.0', '>=') && empty($qty)) { $qty = $sgItem->getQuantity() - $pItem['product_quantity']; } elseif (!empty($cancelQuantity[$pItem['id_order_detail']]) && empty($qty)) { $qty = $cancelQuantity[$pItem['id_order_detail']]; $fromHook = true; } if (empty($qty) && Tools::getValue('action') == "cron") { $qty = $pItem['product_quantity_refunded']; } // nothing to cancel here if (empty($qty) || $qty < 1) { continue; } $cancelledItems[$sgItemNumber]['data']['item_number'] = $pItem['product_id']; // if someone changed the quantity for this item in the past // we stored it in the database if (empty($cancelledItems[$sgItemNumber]['data']['quantity'])) { $oldQty = 0; } else { $oldQty = $cancelledItems[$sgItemNumber]['data']['quantity']; } if (empty($cancelledItems[$sgItemNumber]['data']['quantity'])) { $cancelledItems[$sgItemNumber]['data']['quantity'] = $qty; $cancelledItems[$sgItemNumber]['data']['quantity_to_cancel'] = $qty; } else { // subtract the old quantity if (version_compare(_PS_VERSION_, '1.5.0', '>=') || !$fromHook) { if (Tools::isSubmit('partialRefundProduct')) { $cancelQuantity = $qty; } else { $cancelQuantity = $qty - $oldQty; } } else { $cancelQuantity = $qty; } if ($cancelQuantity < 0) { $cancelQuantity *= -1; } if ($cancelQuantity > 0) { $cancelledItems[$sgItemNumber]['data']['quantity'] += $cancelQuantity; $cancelledItems[$sgItemNumber]['data']['quantity_to_cancel'] = $cancelQuantity; } else { $cancelledItems[$sgItemNumber]['data']['quantity_to_cancel'] = 0; } } if ($cancelQuantity > 0) { $message .= "reducing quantity ({$cancelledItems[$sgItemNumber]['data']['quantity_to_cancel']}) for the item {$sgItemNumber} \n"; } } } } return $cancelledItems; }
public function hookRightColumn($params) { if ((int) Configuration::get('TS_TAB0_DISPLAY_IN_SHOP') !== 1) { return ''; } $iso_code = strtoupper(Language::getIsoById($params['cookie']->id_lang)); if (array_key_exists($iso_code, $this->available_languages) and isset(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'])) { TSBuyerProtection::$smarty->assign('trusted_shops_id', TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID']); TSBuyerProtection::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME')); $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSBuyerProtection::$certificate_link[$iso_code]); TSBuyerProtection::$smarty->assign('trusted_shops_url', $url); if (isset(TSBuyerProtection::$CERTIFICATES[$iso_code])) { $certificate = TSBuyerProtection::$CERTIFICATES[$iso_code]; if (isset($certificate['tsID']) && $certificate['tsID'] !== '' && $certificate['user'] != '') { return $this->display(TSBuyerProtection::$module_name, 'seal_of_approval.tpl'); } } } return ''; }
public static function loadConfiguration() { self::$_CONF = array(); self::$_CONF_LANG = array(); $result = Db::getInstance()->ExecuteS(' SELECT c.`name`, cl.`id_lang`, cl.`value` as cl_value, c.`value` as c_value FROM `' . _DB_PREFIX_ . 'configuration` c LEFT JOIN `' . _DB_PREFIX_ . 'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)'); if (is_array($result)) { foreach ($result as $row) { self::$_CONF[$row['name']] = $row['c_value']; if ($row['id_lang']) { self::$_CONF_LANG[(int) $row['id_lang']][$row['name']] = $row['cl_value']; } } } }
/** * Delete configuration key from current context. * * @param string $key */ public static function deleteFromContext($key) { if (Shop::getContext() == Shop::CONTEXT_ALL) { return; } $idShop = null; $idShopGroup = Shop::getContextShopGroupID(true); if (Shop::getContext() == Shop::CONTEXT_SHOP) { $idShop = Shop::getContextShopID(true); } $id = Configuration::getIdByName($key, $idShopGroup, $idShop); Db::getInstance()->execute(' DELETE FROM `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '` WHERE `' . bqSQL(self::$definition['primary']) . '` = ' . (int) $id); Db::getInstance()->execute(' DELETE FROM `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '_lang` WHERE `' . bqSQL(self::$definition['primary']) . '` = ' . (int) $id); self::$_cache = null; self::$_new_cache_shop = null; self::$_new_cache_group = null; self::$_new_cache_global = null; self::$_initialized = false; }
public function hookRightColumn($params) { $lang = Language::getIsoById($params['cookie']->id_lang); $lang = strtoupper($lang); if (array_key_exists($lang, $this->available_languages) and isset(TSBuyerProtection::$CERTIFICATE[$lang]['tsID'])) { TSBuyerProtection::$smarty->assign('trusted_shops_id', TSBuyerProtection::$CERTIFICATE[$lang]['tsID']); TSBuyerProtection::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME')); $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSBuyerProtection::$CERTIFICATE[$lang]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSBuyerProtection::$certificate_link[$lang]); TSBuyerProtection::$smarty->assign('trusted_shops_url', $url); $displayWidget = false; foreach (TSBuyerProtection::$CERTIFICATE as $lang => $certificate) { $certificate = (array) $certificate; if (isset($certificate['tsID']) && $certificate['tsID'] !== '' && $certificate['user'] != '') { $displayWidget = true; } } if ($displayWidget == false) { return ''; } return $this->display(TSBuyerProtection::$module_name, 'seal_of_approval.tpl'); } }
public function hookRightColumn($params) { $iso_code = strtoupper(Language::getIsoById($params['cookie']->id_lang)); if (array_key_exists($iso_code, $this->available_languages) and isset(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'])) { TSBuyerProtection::$smarty->assign('trusted_shops_id', TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID']); TSBuyerProtection::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME')); $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSBuyerProtection::$certificate_link[$iso_code]); TSBuyerProtection::$smarty->assign('trusted_shops_url', $url); if (isset(TSBuyerProtection::$CERTIFICATES[$iso_code])) { $certificate = TSBuyerProtection::$CERTIFICATES[$iso_code]; if (isset($certificate['tsID']) && ($certificate['typeEnum'] == 'CLASSIC' || $certificate['typeEnum'] == 'EXCELLENCE' && $certificate['user'] != '' && $certificate['password'] != '')) { return TrustedShops::display_seal(); } } } return ''; }
public static function loadConfiguration() { self::$_CONF = array(); self::$_CONF_LANG = array(); self::$_CONF_IDS = array(); $db = Db::getInstance(); $result = $db->ExecuteS(' SELECT c.`id_configuration`, c.`name`, cl.`id_lang`, cl.`value` cl_value, c.`value` c_value FROM `' . _DB_PREFIX_ . 'configuration` c LEFT JOIN `' . _DB_PREFIX_ . 'configuration_lang` cl ON (c.id_configuration = cl.id_configuration)', false); if ($result) { while ($row = $db->nextRow($result)) { self::$_CONF_IDS[$row['name']] = (int) $row['id_configuration']; self::$_CONF[$row['name']] = $row['c_value']; if ($row['id_lang']) { self::$_CONF_LANG[(int) $row['id_lang']][$row['name']] = $row['cl_value']; } } } }
/** * This method is used to render the payment button, * Take care if the button should be displayed or not. */ public function hookPayment($params) { $currency_id = $params['cart']->id_currency; $currency = new Currency((int) $currency_id); if (in_array($currency->iso_code, $this->limited_currencies) == false) { return false; } $this->assignSmartyVars(array('module_dir' => $this->_path)); $this->assignSmartyVars(array('aplazame_enabled_cookies' => true, 'aplazame_version' => ConfigurationCore::get('APLAZAME_API_VERSION', null), 'aplazame_url' => Configuration::get('APLAZAME_API_URL', null), 'aplazame_public_key' => Configuration::get('APLAZAME_PUBLIC_KEY', null), 'aplazame_button_id' => Configuration::get('APLAZAME_BUTTON_ID', null), 'aplazame_mode' => Configuration::get('APLAZAME_LIVE_MODE', null) ? 'false' : 'true', 'aplazame_currency_iso' => $currency->iso_code, 'aplazame_cart_total' => self::formatDecimals($params['cart']->getOrderTotal()), 'aplazame_button_image' => Configuration::get('APLAZAME_BUTTON_IMAGE', null))); return $this->display(__FILE__, 'views/templates/hook/payment.tpl'); }