/** * @param Shop $shop * @param Configuration $configuration * @return string * @throws \Exception */ private function dumpConfiguration(Shop $shop, Configuration $configuration) { $pathResolver = $this->container->get('theme_path_resolver'); $file = $pathResolver->getCacheDirectory() . '/config_' . $shop->getId() . '.json'; file_put_contents($file, json_encode($configuration, JSON_PRETTY_PRINT)); return $file; }
/** * @param array $basket * @return int */ private function getMaxDeliveryTime($basket) { // get the SwagTrustedShop config $config = $this->tsConfig->getSettings($this->shop->getId()); $deliveryTime = $config['trustedShopsInStockDeliveryTime']; $notInStockDeliveryTime = $config['trustedShopsNotInStockDeliveryTime']; // if trustedShopsNotInStockDeliveryTime is defined check if any // article is not in stock if ($notInStockDeliveryTime > 0) { if ($this->isArticleNotInStock($basket)) { return $notInStockDeliveryTime; } } // if trustedShopsInStockDeliveryTime is defined return it if ($deliveryTime > 0) { return $deliveryTime; } $defaultReturn = 2; if (!$basket) { return $defaultReturn; } $shippingTimes = array_column($basket, 'shippingtime'); if (!$shippingTimes) { return $defaultReturn; } $maxDeliveryTime = (int) max($shippingTimes); if (!$maxDeliveryTime) { return $defaultReturn; } return $maxDeliveryTime; }
/** * Converts a shop doctrine model to a shop struct * @param \Shopware\Models\Shop\Shop $shop * @return Struct\Shop */ public function convertShop(Models\Shop\Shop $shop) { $struct = new Struct\Shop(); $struct->setId($shop->getId()); $struct->setName($shop->getName()); $struct->setHost($shop->getHost()); $struct->setPath($shop->getBasePath()); $struct->setUrl($shop->getBaseUrl()); $struct->setSecure($shop->getSecure()); $struct->setSecureHost($shop->getSecureHost()); $struct->setSecurePath($struct->getSecurePath()); if ($shop->getCategory()) { $struct->setCategory($this->convertCategory($shop->getCategory())); } return $struct; }
public function setLanguageSubShop(\Shopware\Models\Shop\Shop $languageSubShop) { $this->languageSubShop = $languageSubShop; $subShop = $languageSubShop->getMain() ? $languageSubShop->getMain() : $languageSubShop; $this->setShop($subShop); }
/** * Helper function which returns the theme configuration as * key - value array. * * The element name is used as array key, the shop config * as value. If no shop config saved, the value will fallback to * the default value. * * @param \Shopware\Models\Shop\Template $template * @param \Shopware\Models\Shop\Shop $shop * @param bool $lessCompatible * @return array */ private function getShopConfig(Shop\Template $template, Shop\Shop $shop, $lessCompatible = true) { $builder = $this->getShopConfigQuery($template, $lessCompatible); $builder->setParameter('templateId', $template->getId())->setParameter('shopId', $shop->getMain() ? $shop->getMain()->getId() : $shop->getId()); $data = $builder->getQuery()->getArrayResult(); foreach ($data as &$row) { if (!isset($row['value'])) { $row['value'] = $row['defaultValue']; } if ($lessCompatible && $row['type'] === 'theme-media-selection') { $row['value'] = '"' . $row['value'] . '"'; } if ($row['type'] === 'theme-media-selection' && $row['value'] !== $row['defaultValue'] && strpos($row['value'], "media/") !== false) { $row['value'] = $this->mediaService->getUrl($row['value']); } } if (!is_array($data) || empty($data)) { return array(); } //creates a key value array for the configuration. return array_combine(array_column($data, 'name'), array_column($data, 'value')); }
/** * @param ShopwareShop $shop * @param ShopwareConfig $config * @return Context */ public static function createFromShop(ShopwareShop $shop, ShopwareConfig $config) { $self = new self($shop->getHost(), $shop->getBaseUrl(), $shop->getAlwaysSecure() || $shop->getSecure(), []); $self->setShopId($shop->getId()); $self->setUrlToLower($config->get('routerToLower')); $self->setBaseFile($config->get('baseFile')); $self->setAlwaysSecure($shop->getAlwaysSecure()); $self->setRemoveCategory((bool) $config->get('routerRemoveCategory')); return $self; }
public function sCreateSql() { $sql_add_join = array(); $sql_add_select = array(); $sql_add_where = array(); $skipBackend = $this->shop->get('skipbackend'); $isoCode = $this->shop->get('isocode'); if (empty($skipBackend) && !empty($isoCode)) { $sql_isocode = $this->db->quote($isoCode); $sql_add_join[] = "\n LEFT JOIN s_core_translations as ta\n ON ta.objectkey=a.id AND ta.objecttype='article' AND ta.objectlanguage={$sql_isocode}\n\n LEFT JOIN s_core_translations as td\n ON td.objectkey=d.id AND td.objecttype='variant' AND td.objectlanguage={$sql_isocode}\n "; $sql_add_select[] = "ta.objectdata as article_translation"; $sql_add_select[] = "td.objectdata as detail_translation"; //read the fallback for the case the translation is not going to be set $fallbackId = $this->shop->getFallback() ? $this->shop->getFallback()->getId() : null; if (!empty($fallbackId)) { $sqlFallbackLanguageId = $this->db->quote($fallbackId); $sql_add_join[] = "\n LEFT JOIN s_core_translations as taf\n ON taf.objectkey=a.id AND taf.objecttype='article' AND taf.objectlanguage={$sqlFallbackLanguageId}\n\n LEFT JOIN s_core_translations as tdf\n ON tdf.objectkey=d.id AND tdf.objecttype='variant' AND tdf.objectlanguage={$sqlFallbackLanguageId}\n "; $sql_add_select[] = "taf.objectdata as article_translation_fallback"; $sql_add_select[] = "tdf.objectdata as detail_translation_fallback"; } } if (!empty($this->sSettings["categoryID"])) { $sql_add_join[] = "\n INNER JOIN s_articles_categories_ro act\n ON act.articleID = a.id\n AND act.categoryID = {$this->sSettings["categoryID"]}\n INNER JOIN s_categories c\n ON c.id = act.categoryID\n AND c.active = 1\n "; } if (empty($this->sSettings["image_filter"])) { $sql_add_join[] = "\n LEFT JOIN s_articles_img as i\n ON i.articleID = a.id AND i.main=1 AND i.article_detail_id IS NULL\n "; } else { $sql_add_join[] = "\n JOIN s_articles_img as i\n ON i.articleID = a.id AND i.main=1 AND i.article_detail_id IS NULL\n "; } if (!empty($this->sCustomergroup["groupkey"]) && empty($this->sCustomergroup["mode"]) && $this->sCustomergroup["groupkey"] != "EK") { $sql_add_join[] = "\n LEFT JOIN s_articles_prices as p2\n ON p2.articledetailsID = d.id AND p2.`from`=1\n AND p2.pricegroup='{$this->sCustomergroup["groupkey"]}'\n AND p2.price!=0\n "; $pricefield = "IFNULL(p2.price, p.price)"; $pseudoprice = "IFNULL(p2.pseudoprice, p.pseudoprice)"; $baseprice = "IFNULL(p2.baseprice, p.baseprice)"; } else { $pricefield = "p.price"; $pseudoprice = "p.pseudoprice"; $baseprice = "p.baseprice"; } if (empty($this->sSettings["variant_export"]) || $this->sSettings["variant_export"] == 1) { $sql_add_select[] = "IF(COUNT(d.ordernumber) <= 1, '', GROUP_CONCAT(DISTINCT(CONCAT('\"', d.id, ':', REPLACE(d.ordernumber,'\"','\"\"'),'\"')) SEPARATOR ';')) as group_ordernumber"; $sql_add_select[] = "IF(COUNT(d.additionaltext) <= 1, '', GROUP_CONCAT(DISTINCT(CONCAT('\"', d.id, ':', REPLACE(d.additionaltext,'\"','\"\"'),'\"')) SEPARATOR ';')) as group_additionaltext"; $sql_add_select[] = "IF(COUNT({$pricefield})<=1,'',GROUP_CONCAT(ROUND(CAST({$pricefield}*(100-IF(pd.discount,pd.discount,0)-{$this->sCustomergroup["discount"]})/100*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2) SEPARATOR ';')) as group_pricenet"; $sql_add_select[] = "IF(COUNT({$pricefield})<=1,'',GROUP_CONCAT(ROUND(CAST({$pricefield}*(100+t.tax-IF(pd.discount,pd.discount,0)-{$this->sCustomergroup["discount"]})/100*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2) SEPARATOR ';')) as group_price"; $sql_add_select[] = "IF(COUNT(d.active)<=1,'',GROUP_CONCAT(d.active SEPARATOR ';')) as group_active"; $sql_add_select[] = "IF(COUNT(d.instock)<=1,'',GROUP_CONCAT(d.instock SEPARATOR ';')) as group_instock"; $sql_add_group_by = "a.id"; $sql_add_article_detail_join_condition = "AND d.kind=1"; } elseif ($this->sSettings["variant_export"] == 2) { $sql_add_group_by = "d.id"; $sql_add_article_detail_join_condition = ''; } $grouppricefield = "gp.price"; if (empty($this->sSettings["variant_export"]) || $this->sSettings["variant_export"] == 2 || $this->sSettings["variant_export"] == 1) { $sql_add_join[] = "\n JOIN (SELECT NULL as `articleID` , NULL as `valueID` , NULL as `attr1` , NULL as `attr2` , NULL as `attr3` , NULL as `attr4` , NULL as `attr5` , NULL as `attr6` , NULL as `attr7` , NULL as `attr8` , NULL as `attr9` , NULL as `attr10` , NULL as `standard` , NULL as `active` , NULL as `ordernumber` , NULL as `instock`, NULL as `minpurchase`) as v\n "; $sql_add_join[] = "\n JOIN (SELECT NULL as articleID, NULL as valueID, NULL as groupkey, NULL as price, NULL as optionID) as gp\n "; } if (!empty($this->sSettings["active_filter"])) { $sql_add_where[] = "(a.active = 1 AND (v.active=1 OR (v.active IS NULL AND d.active=1)))"; } if (!empty($this->sSettings["stockmin_filter"])) { $sql_add_where[] = "(v.instock>=d.stockmin OR (v.instock IS NULL AND d.instock>=d.stockmin))"; } if (!empty($this->sSettings["instock_filter"])) { $sql_add_where[] = "(v.instock>={$this->sSettings["instock_filter"]} OR (v.instock IS NULL AND d.instock>={$this->sSettings["instock_filter"]}))"; } if (!empty($this->sSettings["price_filter"])) { $sql_add_where[] = "ROUND(CAST(IFNULL({$grouppricefield},{$pricefield})*(100+t.tax-IF(pd.discount IS NULL,0,pd.discount)-{$this->sCustomergroup["discount"]})/100*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2)>=" . $this->sSettings["price_filter"]; } if (!empty($this->sSettings["own_filter"]) && trim($this->sSettings["own_filter"])) { $sql_add_where[] = "(" . $this->sSettings["own_filter"] . ")"; } if ($this->config->offsetGet('hideNoInstock')) { $sql_add_where[] = "(\n (a.laststock * v.instock >= a.laststock * v.minpurchase)\n OR\n (a.laststock * d.instock >= a.laststock * d.minpurchase)\n )"; } $sql_add_join = implode(" ", $sql_add_join); if (!empty($sql_add_select)) { $sql_add_select = ", " . implode(", ", $sql_add_select); } else { $sql_add_select = ""; } if (!empty($sql_add_where)) { $sql_add_where = " AND " . implode(" AND ", $sql_add_where); } else { $sql_add_where = ""; } if (!empty($sql_add_group_by)) { $sql_add_group_by = "GROUP BY ({$sql_add_group_by})"; } else { $sql_add_group_by = ""; } $sql = "\n SELECT\n a.id as `articleID`,\n a.name,\n a.description,\n a.description_long,\n a.main_detail_id,\n d.shippingtime,\n d.shippingfree,\n a.topseller,\n a.keywords,\n d.minpurchase,\n d.purchasesteps,\n d.maxpurchase,\n d.purchaseunit,\n d.referenceunit,\n a.taxID,\n a.filtergroupID,\n a.supplierID,\n d.unitID,\n IF(a.changetime!='0000-00-00 00:00:00',a.changetime,'') as `changed`,\n IF(a.datum!='0000-00-00',a.datum,'') as `added`,\n IF(d.releasedate!='0000-00-00',d.releasedate,'') as `releasedate`,\n a.active as active,\n\n d.id as `articledetailsID`,\n IF(v.ordernumber IS NOT NULL,v.ordernumber,d.ordernumber) as ordernumber,\n\n d.suppliernumber,\n d.ean,\n d.width,\n d.height,\n d.length,\n d.kind,\n IF(v.standard=1||kind=1,1,0) as standard,\n d.additionaltext,\n COALESCE(sai.impressions, 0) as impressions,\n d.sales,\n\n IF(v.active IS NOT NULL,IF(a.active=0,0,v.active),a.active) as active,\n IF(v.instock IS NOT NULL,v.instock,d.instock) as instock,\n (\n SELECT AVG(av.points)\n FROM s_articles_vote as av WHERE active=1\n AND articleID=a.id\n ) as sVoteAverage,\n (\n SELECT COUNT(*)\n FROM s_articles_vote as av WHERE active=1\n AND articleID=a.id\n ) as sVoteCount,\n d.stockmin,\n d.weight,\n d.position,\n\n at.attr1, at.attr2, at.attr3, at.attr4, at.attr5, at.attr6, at.attr7, at.attr8, at.attr9, at.attr10,\n at.attr11, at.attr12, at.attr13, at.attr14, at.attr15, at.attr16, at.attr17, at.attr18, at.attr19, at.attr20,\n\n s.name as supplier,\n u.unit,\n u.description as unit_description,\n t.tax,\n CONCAT(i.img, '.', i.extension) as image,\n\n a.configurator_set_id as configurator,\n\n ROUND(CAST(IFNULL({$grouppricefield}, {$pricefield})*(100-IF(pd.discount,pd.discount,0)-{$this->sCustomergroup["discount"]})/100*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2) as netprice,\n ROUND(CAST(IFNULL({$grouppricefield}, {$pricefield})*(100+t.tax)/100*(100-IF(pd.discount,pd.discount,0)-{$this->sCustomergroup["discount"]})/100*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2) as price,\n pd.discount,\n ROUND(CAST({$pseudoprice}*{$this->sCurrency["factor"]} AS DECIMAL(10,3)),2) as netpseudoprice,\n ROUND(CAST({$pseudoprice}*(100+t.tax)*{$this->sCurrency["factor"]}/100 AS DECIMAL(10,3)),2) as pseudoprice,\n {$baseprice},\n IF(file IS NULL,0,1) as esd\n\n {$sql_add_select}\n\n FROM s_articles a\n INNER JOIN s_articles_details d\n ON d.articleID = a.id\n {$sql_add_article_detail_join_condition}\n LEFT JOIN s_articles_attributes at\n ON d.id = at.articledetailsID\n\n LEFT JOIN `s_core_units` as `u`\n ON d.unitID = u.id\n LEFT JOIN `s_core_tax` as `t`\n ON a.taxID = t.id\n LEFT JOIN `s_articles_supplier` as `s`\n ON a.supplierID = s.id\n\n LEFT JOIN s_core_pricegroups_discounts pd\n ON a.pricegroupActive=1\n AND\ta.pricegroupID=groupID\n AND customergroupID = 1\n AND discountstart=1\n\n LEFT JOIN s_articles_esd e ON e.articledetailsID=d.id\n\n LEFT JOIN (\n SELECT articleID\n FROM\n s_export_categories as ec,\n s_articles_categories_ro as ac\n WHERE feedID={$this->sFeedID}\n AND ec.categoryID=ac.categoryID\n GROUP BY articleID\n ) AS bc\n ON bc.articleID=a.id\n\n LEFT JOIN s_export_suppliers AS bs\n ON (bs.supplierID=s.id AND bs.feedID={$this->sFeedID})\n\n LEFT JOIN s_export_articles AS ba\n ON (ba.articleID=a.id AND ba.feedID={$this->sFeedID})\n\n LEFT JOIN s_articles_prices AS p\n ON p.articledetailsID = d.id\n AND p.`from`=1\n AND p.pricegroup='EK'\n\n LEFT JOIN\n (\n SELECT articleId AS id, SUM(s.impressions) AS impressions\n FROM s_statistics_article_impression s\n GROUP BY articleId\n ) sai ON sai.id = a.id\n\n {$sql_add_join}\n\n WHERE bc.articleID IS NULL\n AND bs.supplierID IS NULL\n AND a.mode = 0\n AND d.kind != 3\n AND ba.articleID IS NULL\n {$sql_add_where}\n\n {$sql_add_group_by}\n "; if (!empty($this->sSettings["count_filter"])) { $sql .= "LIMIT " . $this->sSettings["count_filter"]; } return $sql; }
/** * Helper function which translates associated array data. * * @param array $association * @param Shop $shop * @param $type * @return array */ protected function translateAssociation(array $association, Shop $shop, $type) { foreach ($association as &$item) { $translation = $this->getSingleTranslation($type, $shop->getId(), $item['id']); if (empty($translation)) { continue; } $item = $this->mergeTranslation($item, $translation['data']); } return $association; }
/** * Returns a query which selects the revenue of each referrer. * @param Shop $shop * @param \DateTime $from * @param \DateTime $to * @return DBALQueryBuilder */ protected function createReferrerRevenueBuilder(Shop $shop = null, \DateTime $from = null, \DateTime $to = null) { $builder = $builder = $this->connection->createQueryBuilder(); $builder->select(array('ROUND(orders.invoice_amount / orders.currencyFactor, 2) AS turnover', 'users.id as userID', 'orders.referer AS referrer', 'DATE(users.firstlogin) as firstLogin', 'DATE(orders.ordertime) as orderTime'))->from('s_order', 'orders')->innerJoin('orders', 's_user', 'users', 'orders.userID = users.id')->where('orders.status != 4 AND orders.status != -1')->andWhere("orders.referer LIKE 'http%//%'")->orderBy('turnover'); $this->addDateRangeCondition($builder, $from, $to, 'orders.ordertime'); if ($shop instanceof Shop && $shop->getHost()) { $builder->andWhere("orders.referer NOT LIKE :hostname")->setParameter(':hostname', '%' . $shop->getHost() . '%'); } return $builder; }
/** * @param Shop $shop * @param Criteria $criteria * @return int */ private function getActiveCategoryId(Shop $shop, Criteria $criteria) { /**@var $condition CategoryCondition*/ $category = $shop->getCategory()->getId(); if ($condition = $criteria->getCondition('category')) { $category = $condition->getCategoryIds()[0]; } return $category; }
/** * @param ShopEntity $shop * @return Shop */ public static function createFromShopEntity(ShopEntity $shop) { $struct = new self(); $struct->setId($shop->getId()); $struct->setParentId($shop->getMain() ? $shop->getMain()->getId() : $shop->getId()); $struct->setIsDefault($shop->getDefault()); $struct->setName($shop->getName()); $struct->setHost($shop->getHost()); $struct->setPath($shop->getBasePath()); $struct->setUrl($shop->getBaseUrl()); $struct->setSecure($shop->getSecure()); $struct->setSecureHost($shop->getSecureHost()); $struct->setSecurePath($shop->getSecureBasePath()); if ($shop->getCategory()) { $struct->setCategory(Category::createFromCategoryEntity($shop->getCategory())); } if ($shop->getFallback()) { $struct->setFallbackId($shop->getFallback()->getId()); } return $struct; }
/** * Returns the plugin configuration by the plugin name. If the * plugin has no config, the config is automatically set to an empty array. * * @param string $name * @param Shop $shop * @return Enlight_Config|array */ public function getConfig($name, Shop $shop = null) { if ($shop) { $cacheKey = $name . $shop->getId(); } else { $cacheKey = $name; $shop = $this->shop; } if (!isset($this->configStorage[$cacheKey])) { $sql = "\n SELECT\n ce.name,\n COALESCE(currentShop.value, parentShop.value, fallbackShop.value, ce.value) as value\n\n FROM s_core_plugins p\n\n INNER JOIN s_core_config_forms cf\n ON cf.plugin_id = p.id\n\n INNER JOIN s_core_config_elements ce\n ON ce.form_id = cf.id\n\n LEFT JOIN s_core_config_values currentShop\n ON currentShop.element_id = ce.id\n AND currentShop.shop_id = :currentShopId\n\n LEFT JOIN s_core_config_values parentShop\n ON parentShop.element_id = ce.id\n AND parentShop.shop_id = :parentShopId\n\n LEFT JOIN s_core_config_values fallbackShop\n ON fallbackShop.element_id = ce.id\n AND fallbackShop.shop_id = :fallbackShopId\n\n WHERE p.name=:pluginName\n "; $config = $this->Application()->Db()->fetchPairs($sql, array('fallbackShopId' => 1, 'parentShopId' => $shop !== null && $shop->getMain() !== null ? $shop->getMain()->getId() : 1, 'currentShopId' => $shop !== null ? $shop->getId() : null, 'pluginName' => $name)); foreach ($config as $key => $value) { $config[$key] = unserialize($value); } $this->configStorage[$cacheKey] = new Enlight_Config($config, true); } return $this->configStorage[$cacheKey]; }
/** * @param Request $request * @param Shop $shop * @return bool */ protected function shouldRedirect(Request $request, Shop $shop) { return $request->isGet() && $request->getQuery('__shop') !== null && $request->getQuery('__shop') != $shop->getId() || $request->isPost() && $request->getPost('__shop') !== null && $request->getPost('__redirect') !== null; }
/** * Clear existing theme cache * Removes all assets and timestamp files * * @param \Shopware\Models\Shop\Shop $shop * @param $timestamp */ public function clearThemeCache(Shop\Shop $shop, $timestamp) { if ($shop->getMain()) { $shop = $shop->getMain(); } $files = [$this->pathResolver->buildTimestampName($timestamp, $shop, 'css'), $this->pathResolver->buildTimestampName($timestamp, $shop, 'js')]; $this->clearDirectory($files); }
/** * Set shop instance * * @param \Shopware\Models\Shop\Shop $shop * @return Shopware_Components_Snippet_Manager */ public function setShop(\Shopware\Models\Shop\Shop $shop) { $this->shop = $shop; $this->locale = $shop->getLocale(); $this->namespaces = array(); $this->initExtends(); return $this; }
/** * Helper function to build a unique file name. * @param string $timestamp * @param Shop\Shop $shop * @param string $suffix * @return string */ public function buildTimestampName($timestamp, Shop\Shop $shop, $suffix) { if ($shop->getMain()) { $shop = $shop->getMain(); } $filname = $timestamp . '_' . md5($timestamp . $shop->getTemplate()->getId() . $shop->getId() . \Shopware::REVISION); return $filname . '.' . $suffix; }
/** * This function reads out the nested configuration layout * and translate the element and container snippets. * If a shop instance passed, the function selects additionally the * element values of the passed shop. * * @param Shop\Template $template * @param Shop\Shop $shop * @param null $parentId * @return array */ protected function buildConfigLayout(Shop\Template $template, Shop\Shop $shop = null, $parentId = null) { $builder = $this->entityManager->createQueryBuilder(); $builder->select(array('layout', 'elements'))->from('Shopware\\Models\\Shop\\TemplateConfig\\Layout', 'layout')->leftJoin('layout.elements', 'elements')->where('layout.templateId = :templateId')->orderBy('elements.id')->setParameter('templateId', $template->getId()); if ($shop instanceof Shop\Shop) { $builder->addSelect('values')->leftJoin('elements.values', 'values', 'WITH', 'values.shopId = :shopId')->setParameter('shopId', $shop->getId()); } if ($parentId == null) { $builder->andWhere('layout.parentId IS NULL'); } else { $builder->andWhere('layout.parentId = :parentId')->setParameter('parentId', $parentId); } $layout = $builder->getQuery()->getArrayResult(); foreach ($layout as &$container) { $container['children'] = $this->buildConfigLayout($template, $shop, $container['id']); } return $layout; }
/** * Returns the plugin configuration by the plugin name. If the * plugin has no config, the config is automatically set to an empty array. * * @param string $name * @param Shop $shop * @return Enlight_Config|array */ public function getConfig($name, Shop $shop = null) { if ($shop) { $cacheKey = $name . $shop->getId(); } else { $cacheKey = $name; $shop = $this->shop; } if (!isset($this->configStorage[$cacheKey])) { $sql = "\n SELECT\n ce.name,\n IFNULL(IFNULL(cv.value, cm.value), ce.value) as value\n FROM s_core_plugins p\n JOIN s_core_config_forms cf\n ON cf.plugin_id = p.id\n JOIN s_core_config_elements ce\n ON ce.form_id = cf.id\n LEFT JOIN s_core_config_values cv\n ON cv.element_id = ce.id\n AND cv.shop_id = ?\n LEFT JOIN s_core_config_values cm\n ON cm.element_id = ce.id\n AND cm.shop_id = ?\n WHERE p.name=?\n "; $config = $this->Application()->Db()->fetchPairs($sql, array($shop !== null ? $shop->getId() : null, $shop !== null && $shop->getMain() !== null ? $shop->getMain()->getId() : 1, $name)); foreach ($config as $key => $value) { $config[$key] = unserialize($value); } $this->configStorage[$cacheKey] = new Enlight_Config($config, true); } return $this->configStorage[$cacheKey]; }