Jump to content

[solved] adult section we need ASAP help


Recommended Posts

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

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

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

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 this
starting 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 class
classes/ProductSale.php

the 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 code

do the same trace on new products module and make the appropriate changes.

Link to comment
Share on other sites

×
×
  • Create New...