PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

[Module] blockspecials - Affichage pagination

1 reply to this topic
#1
Dizin

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
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 Files



#2
Dizin

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
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? :(