This commit is contained in:
Michael RICOIS 2017-05-29 12:33:38 +02:00
parent 46cfa2b8f3
commit 75c06c7853
3 changed files with 16 additions and 54 deletions

View File

@ -67,49 +67,27 @@ class HTMLTemplateOffredefideliteCore extends HTMLTemplate
// print_r($this->offredefidelite->selecteds);
// die();
}
/**
* Returns the template's HTML content
* @return string HTML content
*/
public function getItemsProducts2()
{
// if(Tools::getValue('id_product'))
// $id_product=Tools::getValue('id_product');
// $id_shop = $this->context->shop->id;
$id_lang = Context::getContext()->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT distinct(p.`id_product`), pl.name, pl.link_rewrite,cl.name as categoryName,c.id_category,p.id_category_default
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_lang = '.(int)$id_lang.' and p.id_product = pl.id_product)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_lang = '.(int)$id_lang.' and p.id_category_default = cl.id_category)
LEFT JOIN '._DB_PREFIX_.'category c ON (cl.id_category = c.id_category)
WHERE c.id_category!=12
and c.id_category!=13
and c.id_category!=14
and c.id_category!=15
and c.id_category!=16
and c.id_category!=17
ORDER BY c.position asc,pl.name asc');
}
public function getItemsProducts()
{
$id_lang = Context::getContext()->language->id;
$sql='
$id_shop = $this->context->shop->id;
$id_lang = $this->context->language->id;
$id_category = Configuration::get('PS_CATEGORY_FIDELITY');
$sql = '
SELECT distinct(p.`id_product`), pl.name, pl.link_rewrite,cl.name as categoryName,c.id_category,p.id_category_default
FROM '._DB_PREFIX_.'category_product cp
LEFT JOIN '._DB_PREFIX_.'category c ON (cp.id_category = c.id_category)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_lang = '.(int)$id_lang.' and c.id_category = cl.id_category)
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = cp.id_product)
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_lang = '.(int)$id_lang.' and p.id_product = pl.id_product)
WHERE cp.id_category=3
or cp.id_category=4
WHERE c.id_category = '.(int)$id_category.'
AND p.active = 1
ORDER BY cl.name desc,cp.position asc,pl.name asc';
$products= Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
// echo $sql;
// print_r($products);
return $products;
}
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
return $products;
}
public function getContent()
{
// $country = new Country((int)$this->order->id_address_invoice);
@ -128,7 +106,7 @@ class HTMLTemplateOffredefideliteCore extends HTMLTemplate
'days' => $days
));
$this->smarty->assign('generationProduits',self::getItemsProducts());
$this->smarty->assign('productFidelity', self::getItemsProducts());
// print_r($this->offredefidelite);
// die();
$this->smarty->assign(

View File

@ -94,23 +94,7 @@ class OffrefideliteControllerCore extends FrontController
($active ? ' AND hss.`active` = 1' : ' ').
' AND hss.`en_avant` = 1
ORDER BY hss.position');
}
public function getItemsProducts2()
{
// if(Tools::getValue('id_product'))
// $id_product=Tools::getValue('id_product');
$id_shop = $this->context->shop->id;
$id_lang = $this->context->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT distinct(p.`id_product`), pl.name, pl.link_rewrite,cl.name as categoryName,c.id_category,p.id_category_default
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_lang = '.(int)$id_lang.' and p.id_product = pl.id_product)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_lang = '.(int)$id_lang.' and p.id_category_default = cl.id_category)
LEFT JOIN '._DB_PREFIX_.'category c ON (cl.id_category = c.id_category)
WHERE c.id_category = 31
AND active = 1
ORDER BY c.position asc,pl.name asc');
}
}
public function getItemsProducts()
{

View File

@ -70,11 +70,11 @@
</table>
<p><br/><br/><strong>{l s='- Cochez votre indice de satisfaction sur les produits que vous avez testés :'}</strong>
<br/>{l s='1 = Très satisfaite, 2 = Satisfaite, 3 = Assez satisfaite, 4 = Pas du tout satisfaite'}</p>
{if $generationProduits|@count>0}
{if $productFidelity|@count>0}
{assign var=idCategory value=0}
<table class="produits">
<tbody>
{foreach from=$generationProduits item=produit}
{foreach from=$productFidelity item=produit}
{if $idCategory!=$produit.id_category}
{assign var=idCategory value=$produit.id_category}
<tr>