Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merged commits from PS1.5 multistore branch:
Browse files Browse the repository at this point in the history
commit 4c8437c
Author: Carlos Escribano Rey <[email protected]>
Date:   Thu Sep 12 13:25:49 2013 +0200

    #1131 - Unify JSON config

    Signed-off-by: Carlos Escribano Rey <[email protected]>

commit 124da74
Author: Carlos Escribano Rey <[email protected]>
Date:   Wed Sep 11 13:53:39 2013 +0200

    #1119 - Multistore feature

    Signed-off-by: Carlos Escribano Rey <[email protected]>

Signed-off-by: Carlos Escribano Rey <[email protected]>
  • Loading branch information
Carlos Escribano Rey committed Sep 12, 2013
1 parent 70b79a1 commit 3a99a9f
Show file tree
Hide file tree
Showing 8 changed files with 409 additions and 664 deletions.
70 changes: 70 additions & 0 deletions QUERY.SQL
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
SELECT
ps.id_product,
ps.id_category_default,

m.name AS manufacturer,

IF(p.ean13, p.ean13, p.upc) AS product_code,
p.supplier_reference,

pl.name AS title,
pl.description,
pl.description_short,
pl.meta_title,
pl.meta_keywords,
pl.meta_description,

cl.link_rewrite,

im.id_image
FROM
(ps_product p
INNER JOIN ps_product_shop ps
ON p.id_product = ps.id_product AND ps.id_shop = 1)
LEFT JOIN ps_product_lang pl
ON p.id_product = pl.id_product AND pl.id_shop = 1 AND pl.id_lang = 1
LEFT JOIN ps_manufacturer m
ON p.id_manufacturer = m.id_manufacturer
LEFT JOIN ps_category_lang cl
ON p.id_category_default = cl.id_category AND cl.id_shop = 1 AND cl.id_lang = 1
LEFT JOIN (ps_image im INNER JOIN ps_image_shop ims ON im.id_image = ims.id_image)
ON p.id_product = im.id_product AND ims.id_shop = 1 AND ims.cover = 1
ORDER BY
p.id_product;

-----

SELECT
c.id_category,
c.id_parent,
c.level_depth,
c.nleft,
c.nright
FROM
ps_category c
INNER JOIN ps_category_product cp
ON (c.id_category = cp.id_category AND cp.id_product = 1)
INNER JOIN ps_category_shop cs
ON (c.id_category = cs.id_category AND cs.id_shop = 1)
WHERE
c.active = 1
ORDER BY
c.nleft DESC,
c.nright ASC;

-----

SELECT
cl.name
FROM
ps_category_lang cl INNER JOIN ps_category parent
ON (parent.id_category = cl.id_category),
ps_category node
WHERE
node.nleft BETWEEN parent.nleft AND parent.nright
AND node.id_category = 14
AND cl.id_shop = 2
AND cl.id_lang = 1
AND parent.level_depth <> 0
AND parent.active = 1
ORDER BY parent.nleft;
28 changes: 18 additions & 10 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@
require_once(dirname(__FILE__) . '/../../init.php');
require_once(dirname(__FILE__) . '/doofinder.php');

$context = Context::getContext();
$baseUrl = dfTools::getModuleLink('feed.php');

header("Content-Type:application/json; charset=utf-8");

$feeds = array();
foreach (Language::getLanguages(true) as $lang)
$languages = array();
$currencies = array_keys(dfTools::getAvailableCurrencies());

foreach (Language::getLanguages(true, $context->shop->id) as $lang)
{
$feeds[] = array(
"id" => $lang['id_lang'],
"code" => $lang['iso_code'],
"url" => dfTools::getFeedURL($lang['iso_code']),
"length" => dfTools::countAvailableProductsForLanguage($lang['id_lang'])
);
$iso_code = strtoupper($lang['iso_code']);
$feeds[$iso_code] = dfTools::getFeedURL($lang['iso_code']);
$languages[] = $iso_code;
}

$cfg = array(
Expand All @@ -57,8 +58,15 @@
"module" => array(
"version" => Doofinder::VERSION,
"feeds" => $feeds,
"fetch_mode" => Doofinder::cfg('DF_FETCH_FEED_MODE', false),
)
"options" => array(
'offset' => 0,
'limit' => 1000,
'language' => $languages,
'currency' => $currencies,
'prices' => (bool) dfTools::cfg($context->shop->id, 'DF_GS_DISPLAY_PRICES', true),
'taxes' => (bool) dfTools::cfg($context->shop->id, 'DF_GS_PRICES_USE_TAX', true),
),
),
);

echo json_encode($cfg);
echo dfTools::json_encode($cfg);
Loading

0 comments on commit 3a99a9f

Please sign in to comment.