PrestaShop Forums: [Module] blockspecials - Affichage pagination - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


[Module] blockspecials - Affichage pagination


[Module] blockspecials - Affichage pagination

#1 Dizin

    PrestaShop Newbie

  • 09 Feb 2010
  • Members
  • Pip
  • 4 posts

Posted 09 February 2010 - 10:50 AM

Bonjour,

J'ai le module blockspecials d'installé sur ma boutique, le petit soucis c'est qu'il m'affiche l'intégralité des produits en promotions, je souhaiterai avoir un pagination pour ce module, malheureusement je n'y arrive pas. Pourriez-vous me donner un coup de main, merci par avance :)
Vous trouverez ci-joint et ci-dessous le code me paraissant utile.

Fonction getRandomSpecials dans classes/Product.php
static public function getRandomSpecials($id_lang, $beginning = false, $ending = false, $nb = 3, $category = 0)
{
global $link, $cookie;
global $isVIP;
$currentDate = date('Y-m-d');

if(intval($category) != 0 ){
$categories = array(intval($category));
/*
$c = new Category(intval($category),$id_lang);
$_childs = $c->getSubCategoriesId($id_lang,$active,true);

$categories = array_merge($categories,$_childs);
*/
}
else{
$categories = null;
}

$query = 'SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`,
i.`id_image`, il.`legend`, t.`rate`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.intval($id_lang).')
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.intval($id_lang).')
LEFT JOIN `'._DB_PREFIX_.'tax` t ON t.`id_tax` = p.`id_tax`
WHERE (price_promo > 0 ' . ($isVIP ? 'OR price_promo_vip > 0' : '') . ') ' //WHERE (`reduction_price` > 0 OR `reduction_percent` > 0 ' . ($isVIP ? 'OR `reduction_price_vip` > 0 OR `reduction_percent_vip` > 0': ''). ')
.((!$beginning AND !$ending) ?
'AND (`reduction_from` = `reduction_to` OR (`reduction_from` <= ''.$currentDate.'' AND `reduction_to` >= ''.$currentDate.''))'
:
($beginning ? 'AND `reduction_from` <= ''.$beginning.''' : '').($ending ? 'AND `reduction_to` >= ''.$ending.''' : '')).
(is_array($categories) ? " AND p.id_category_default IN (" . join(",",$categories) . ") " : "" ) .
'AND p.`active` = 1
ORDER BY RAND() LIMIT 0,' . $nb;

if($result = Db::getInstance()->ExecuteS($query)){


return Product::getProductsProperties($id_lang, $result);
}
//var_dump($retour);
return false;
}

Attached File(s)



#2

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 11 February 2010 - 12:39 PM

J'ai essayé de m'aider des fichiers search, manufacturer, price-drop ou encore category mais je n'y suis pas arrivé. M'étant mis récemment à Prestashop je n'ai pas encore tout compris quand à son fonctionnement.

Personne aurait une piste à me donner? :(





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users