Jump to content
NemoPS

[FREE Module] Product Access by customer group

Recommended Posts

Hey everyone!
I think PrestaShop always lacked this feature: allowing products to be restricted like categories, by customer group.
So, I just released this free module you can use to do it.

If you like it, please leave a review on the product page! :)

http://store.nemops.com/free-modules/44-product-access.html#.V9ZgKfr5iUl

Fabio

  • Like 2

Share this post


Link to post
Share on other sites

Hi NemoPS,

 

Thank you for your module. I installed it. But I have 2 problems on my website.

  1. If my customers are between 2 groups. such as, Default and VIP (my own group). The products are displayed repeatedly for 2 times on block new products, block best seller on my homepage.
  2. On the products categories page, I cannot use category filter or any page's control buttons. But If I disabled override/modules/blocklayered. Everything has been worked perfectly.

So, Please tell me, how can I fix it. Thank you! :)

 

P.S. My Prestashop version is 1.6.1.3 and use default-bootstrap for a theme.

Share this post


Link to post
Share on other sites

I guess the issue is that it's not compatible with your override, hard to tell what's wrong

Share this post


Link to post
Share on other sites

Hi Nemo 

Thanks for the module.  I have installed it, I get a white screen when I go into :

 

product>

product acces for groups>

 

Do you know why? 

Also after installing the module there are no products listed on my front office page.

Thanks in advance for your help

kind regards

Len

Share this post


Link to post
Share on other sites

Turn on dev mode, see what the error says (defines.inc.php) :)

  • Like 1

Share this post


Link to post
Share on other sites

Hello !

Thanks for your module !

 

I have the same problem (as iziewon).

Some customers have 2 groups and I have the same product twice in the categories.

 

Maybe we can use the default group if you have 2 groups.

 

Any idea ?

Share this post


Link to post
Share on other sites

There must be something wrong in the query, I probably forgot to group by id_product, that's all that should be necessary.

Is the product count correct? If it is, you just really need to add the group by in the category class override (I can't right away, let me know if it works)

Share this post


Link to post
Share on other sites

Turn on dev mode, see what the error says (defines.inc.php) :)

Hi 

How do I turn on the dev mode in prestashop 1.6? I am stuck  

Thanks Nemo

Share this post


Link to post
Share on other sites

Hi !

Your query is :

 

        if ($get_total) {
            if(Module::isInstalled('psproductaccess') && Module::isEnabled('psproductaccess'))
                $sql = 'SELECT COUNT(cp.`id_product`) AS total
                    FROM `'._DB_PREFIX_.'product` p
                    '.Shop::addSqlAssociation('product', 'p').'
                    LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
                    LEFT JOIN `'._DB_PREFIX_.'product_group` pg
                            ON pg.`id_product` = p.`id_product`
                    WHERE cp.`id_category` = '.(int)$this->id.
                    ' AND pg.id_group '.(count($cgroups) ? 'IN ('.implode(',', $cgroups).')' : '= 1').
                ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').
                ($active ? ' AND product_shop.`active` = 1' : '').
                ($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');
            else

...

 

Where I need to add GROUP BY ??

Share this post


Link to post
Share on other sites

Oh that's the count one, I meant the next one down below

Share this post


Link to post
Share on other sites

Nice module! 

Is it possible to have a git repo for this module? The blocklayered override and the duplicate products because of multiple group bug should be fixed.

Share this post


Link to post
Share on other sites

That's a good idea, I will try to set it up at some point, but not before a couple weeks I guess. I will definitely look into it if you remind me :)

Share this post


Link to post
Share on other sites

Hi,

 

First of all thank you for this module, it's awesome.

 

Issues:

 

Products are visible trough the blocklayered filters.

 

Will this be fixed?

 

tks

Share this post


Link to post
Share on other sites

Hello,
I don't think that's possible unless you edit the layered module directly

Share this post


Link to post
Share on other sites

Hello,

I don't think that's possible unless you edit the layered module directly

 

 

tks for the reply.

 

Another issue:

 

we have on the menu:

 

Women

   Top

      Blouses

 

 

If the customer clicks on blouses the products are not visible, but if we click on ->Top or ->Women the products are visible.

 

Is there a way to get around this?

 

 

tks

Share this post


Link to post
Share on other sites

That's odd, how are the settings? I guess products are assigned to that category right?

Share this post


Link to post
Share on other sites

That's odd, how are the settings? I guess products are assigned to that category right?

 

 

The products are assigned to the categories Women, Top and Blouses

Share this post


Link to post
Share on other sites
On 8/31/2017 at 3:39 PM, Rui-PS said:

 

 

The products are assigned to the categories Women, Top and Blouses

 

The products are assigned to the categories Women, Top and Blouses

 

Hello Nemo,
Is there a way to prevent this from happening?

tks

 

Share this post


Link to post
Share on other sites

Oh, sorry I missed the previous answer.
It's definitely odd if they are assigned to that category, but not visible, what if you test with a single product, and see if it works by only assigning it to the blouse category

Share this post


Link to post
Share on other sites
On 11/1/2017 at 1:02 PM, NemoPS said:

Oh, sorry I missed the previous answer.
It's definitely odd if they are assigned to that category, but not visible, what if you test with a single product, and see if it works by only assigning it to the blouse category

 

Hello,

is this module compatible with PS 1.6.16?

We updated our shop and now this module does not work...

tks

 

 

Share this post


Link to post
Share on other sites

Hi there,
There is posibility to hide product from viewing on listings? not only stop access to product page?

Share this post


Link to post
Share on other sites

Hello Nemo,

 

I still have the same issue as the duplicate products everywhere on the store when I'm logged in as the new group. My user is on 2 groups: customer and a VIP one. I added the group by like this:

else
                $sql = 'SELECT COUNT(cp.`id_product`) AS total
                        FROM `'._DB_PREFIX_.'product` p
                        '.Shop::addSqlAssociation('product', 'p').'
                        LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
                        WHERE cp.`id_category` = '.(int)$this->id.
                    ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').
                    ($active ? ' AND product_shop.`active` = 1' : '').
                    ($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '').' GROUP BY cp.`id_product`';

 Can you help me?

 

My goal is that VIP customers see all of the store PLUS extra selected products.

 

Thanks in advance!

 

EDIT: I think I got it!!! It's on the BIG query, the one that selects actual products, not the totals. It ends up like this:

$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity'.(Combination::isFeatureActive() ? ', IFNULL(product_attribute_shop.id_product_attribute, 0) AS id_product_attribute,
                    product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').', pl.`description`, pl.`description_short`, pl.`available_now`,
                    pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image,
                    il.`legend` as legend, m.`name` AS manufacturer_name, cl.`name` AS category_default,
                    DATEDIFF(product_shop.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00",
                    INTERVAL '.(int)$nb_days_new_product.' DAY)) > 0 AS new, product_shop.price AS orderprice
                FROM `'._DB_PREFIX_.'category_product` cp
                LEFT JOIN `'._DB_PREFIX_.'product` p
                    ON p.`id_product` = cp.`id_product`
                '.Shop::addSqlAssociation('product', 'p').
                (Combination::isFeatureActive() ? ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
                ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
                '.Product::sqlStock('p', 0).'
                LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
                    ON (product_shop.`id_category_default` = cl.`id_category`
                    AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
                LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
                    ON (p.`id_product` = pl.`id_product`
                    AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
                LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
                    ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
                LEFT JOIN `'._DB_PREFIX_.'image_lang` il
                    ON (image_shop.`id_image` = il.`id_image`
                    AND il.`id_lang` = '.(int)$id_lang.')
                LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
                    ON m.`id_manufacturer` = p.`id_manufacturer`
                 '.$accessjoin.'
                WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
                    AND cp.`id_category` = '.(int)$this->id
                    .$accesswhere
                    .($active ? ' AND product_shop.`active` = 1' : '')
                    .($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
                    .($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '').' GROUP BY p.`id_product`';

 

Is that right?????

Edited by el_charlie (see edit history)

Share this post


Link to post
Share on other sites

HI Nemo,

 

After installed the module and setup the customers group and add them to the products the main product page get blank with no products. On the botton of the screen it says "exists 10 products" but there are no products on the screen. I am using the 1.6 version.

Can you help please?

 

Thanks

 

Kitos

Share this post


Link to post
Share on other sites

Kitos,

That's odd, are you using an ajax based module to display products or something like that? Custom template? I would say try to disable the layered navigation to start with

Share this post


Link to post
Share on other sites

Hi, it is instal on 1.7, but it have some problem in category list - product don't hide.

Can you give some changes for fix it.

Thenks.

Share this post


Link to post
Share on other sites

Unfortunately not, this was made for 1.6

Share this post


Link to post
Share on other sites
14 hours ago, NemoPS said:

Unfortunately not, this was made for 1.6

Okay Thanks. I'll try myself to customize for 1.7 as i need this module in 1.7 version. :)

Thanks for your support.

Share this post


Link to post
Share on other sites

Hi 

how to control a specific category products discount control in back office?.

Is there any module?

will you please explain?

please help me to do that.

Thank you

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More