Shamrock Posted September 14, 2009 Share Posted September 14, 2009 how can i hide some products from blockbestsales and new product...we are going to add adult movie and we do not want to show it in these modules because maybe children will enter our site and we don not want to expose them with pornographic images 407 views and no help nice Link to comment Share on other sites More sharing options...
ruilong Posted September 14, 2009 Share Posted September 14, 2009 I would start by looking in the modules and work my way down to the classes involved in getting the product lists. then exclude the category id from the SQL query. Link to comment Share on other sites More sharing options...
Shamrock Posted September 14, 2009 Author Share Posted September 14, 2009 i have tride but i get mysql error :-S need help anyone Link to comment Share on other sites More sharing options...
ruilong Posted September 14, 2009 Share Posted September 14, 2009 you probobly get help faster if you post the sql error and sql code Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 this my query $query = 'SELECT * FROM `ps_category` WHERE NOT (id_category = "10") GROUP BY `item_id` ORDER BY `item_id` DESC LIMIT 3';whats wrong Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 this is the code <!-- MODULE Block best sellers --> {l s='Top sellers' mod='blockbestsellers'} {if $best_sellers|@count > 0} {if $best_sellers|@count > 1}{/if} {$product.name}{$product.description_short|strip_tags|truncate:50} {l s='All best sellers' mod='blockbestsellers'} {else} {l s='No best sellers at this time' mod='blockbestsellers'} {/if} <!-- /MODULE Block best sellers --> and this is my query $query = 'SELECT * FROM `id_category` WHERE NOT (category_id = "10") GROUP BY `item_id` ORDER BY `item_id` DESC LIMIT 3'; Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 any one :long: Link to comment Share on other sites More sharing options...
smeasday Posted September 15, 2009 Share Posted September 15, 2009 I think the code listed above solves your problem - just playing with it to see, but at first glance it does what you want. Link to comment Share on other sites More sharing options...
jhnstcks Posted September 15, 2009 Share Posted September 15, 2009 If I understand you correctly you want to hide some products from "browsers" and only show them to registered customers?If this is correct you could use a combination of a module and customer groups options.You could use this customer registration management module to verify that the customers are over 18, and also create a customer group for over 18's and under 18's. If you add your movies category into the over 18's group then anyone who casually browses your site will not see them, but any customers who are in the over 18's group will be able to browse that category Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 Thanx man nice module but i cant get it to work, the module is installed and working but how do i create the group.. Link to comment Share on other sites More sharing options...
jhnstcks Posted September 15, 2009 Share Posted September 15, 2009 Thats not part of the module its part of prestashop.Take a look at your customers tab in your admin area there is a menu item for groups there near the top.Of course I forgot to say that customer groups is only in prestashop since v1.2 Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 my Version is 1.1.0.5 any other solution pleas Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 i just want to exclude in module block: bestsale, newproduct and Home Featured thats it man i appreciate all help that i can get thanx Link to comment Share on other sites More sharing options...
jhnstcks Posted September 15, 2009 Share Posted September 15, 2009 my Version is 1.1.0.5 any other solution pleas Upgrade to 1.2 Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 we cant upgrade to 1.2 is not stable enough and plus it has lots of bug thax anyway Link to comment Share on other sites More sharing options...
jhnstcks Posted September 15, 2009 Share Posted September 15, 2009 we cant upgrade to 1.2 is not stable enough and plus it has lots of bug thax anyway Your using 1.1 and you think 1.2 has lots of bugs?I have used all the versions of presta so far and 1.2 is by far the most stable for me. Link to comment Share on other sites More sharing options...
Shamrock Posted September 15, 2009 Author Share Posted September 15, 2009 well it works for us wright now thank god + i heard there is some problem with upgrade and we have lots off product and costumer we do not want to jeopardize that Link to comment Share on other sites More sharing options...
ruilong Posted September 15, 2009 Share Posted September 15, 2009 this my query $query = 'SELECT * FROM `ps_category` WHERE NOT (id_category = "10") GROUP BY `item_id` ORDER BY `item_id` DESC LIMIT 3';whats wrong ok, that code selects categories.. what you need is something like thisstarting in modules/blockbestsellers/blockbestsellers.php (as this is the module you want to change)you will find this line$bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5); now by looking at this line, we can see that it uses static class ProductSale and a function called getBestSalesLight to get the products to show in the list.so we check that classclasses/ProductSale.phpthe function looks like this static public function getBestSalesLight($id_lang, $pageNumber = 0, $nbProducts = 10) { global $link, $cookie; if ($pageNumber < 0) $pageNumber = 0; if ($nbProducts < 1) $nbProducts = 10; $result = Db::getInstance()->ExecuteS(' SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, i.`id_image`, il.`legend`, ps.`quantity` AS sales, p.`ean13`, cl.`link_rewrite` AS category FROM `'._DB_PREFIX_.'product_sale` ps LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` 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_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`) INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`) '.($cookie->id_customer ? 'INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`)' : '').' WHERE p.`active` = 1 AND ('.($cookie->id_customer ? 'cg.`id_customer` = '.intval($cookie->id_customer).' OR' : '').' ctg.`id_group` = 1) GROUP BY p.`id_product` ORDER BY sales DESC LIMIT '.intval($pageNumber * $nbProducts).', '.intval($nbProducts)); if (!$result) return $result; foreach ($result AS &$row) { $row['link'] = $link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']); $row['id_image'] = Product::defineProductImage($row); } return $result; } it's in this SQL you should add the "AND id_default_category NOT xx codedo the same trace on new products module and make the appropriate changes. Link to comment Share on other sites More sharing options...
Shamrock Posted September 16, 2009 Author Share Posted September 16, 2009 thanx but one Q. wouldn't this alter best sale on Back Office Statistic????? Link to comment Share on other sites More sharing options...
Shamrock Posted September 17, 2009 Author Share Posted September 17, 2009 no one there to help Link to comment Share on other sites More sharing options...
Recommended Posts