Jump to content
swguy

[CONTRIBUTION] CMS Page Group Restrictions

Recommended Posts

It's a mess here ! Some anomalies, but I think it's because of my former hack, AND WHAT IT SEEMS TO BE A BUG of prestashop ...

I noticed that if in blockinfo you select nothing (no cms) , then all cms are displayed !!!! you must select at least 1 cms.


In other hand, I would like in fact hide blocks in accordance of groups permissions. Not only contents ... but the block itself (because to see an empty block is not smart ! ).

How ?

Share this post


Link to post
Share on other sites

Did you restore modules/blockinfos/blockinfos.php from the default copy? The old modified copy is no good anymore.

Share this post


Link to post
Share on other sites

That was my mistake, you're right, I made the backup it's ok for that, but I've edited my 1st message in that post, read it again ....

Share this post


Link to post
Share on other sites

I have a problem .... surprising ?

In the BO:

If I create a CMS with NO restriction -> This CMS is displayed in modules/blockinfos settings.

If I create (or modify) a CMS with some restriction -> The CMS IS NOT displayed in modules/blockinfos settings

So impossible to set up the block !

Share this post


Link to post
Share on other sites

I say again, in fact I would prefer to know how to show/hide a block according the customer groups ?!

Share this post


Link to post
Share on other sites

You found a bug. I just fixed it; please download the ZIP again.

Share this post


Link to post
Share on other sites

Humm, now it's the contrary !

Block settings are ok, CMS settings OK as well, but the display of CMS is not working.

No restriction: display ok for all groups.

Restriction: CMS that should appear for authorized group do not display.

Share this post


Link to post
Share on other sites

I can't reproduce this result. Are you sure you've selected the CMS page in the block where you want it to display in the admin?

Share this post


Link to post
Share on other sites

No, I checked again configuration, no doubt.

The only thing is that I didn't update the mysql table, but it seems you made no change on that table.

My last test:

I login in front office as member belonging to an authorized group.
Then in BO I remove all restrictions to a cms.
This cms is visible in FO (normal !)
Then I set restriction to the cms so that my group can see the cms ...
In FO the cms becomes invisible !

Share this post


Link to post
Share on other sites

OK, I know the reason !!!!

When you edit a customer profile to setup the group of this customer, you can check the groups but not defaut ! you cannot uncheck default.

So all customers belong to default, and optionally to another group...

So ... in your system if you restrict default , you restrict all logged customers !!

Share this post


Link to post
Share on other sites

The idea of restricting default is that it will only show up for not logged in customers. That's why I added "guest". This is just how PS works; guess I'll document it more thoroughly.

Share this post


Link to post
Share on other sites

I'll try that evening ... for now I'm at work.

I'm not sure to understand ...

Let's suppose I've created a group "A".

1/ If I check "A" in restriction, and let "Default" unchecked, does it mean that A group won't see CMS and default (and other groups) will see ?

2/ How can I make a CMS visible only for "A" ??? Do I have to let default unchecked ? In that case do you confirm that customers belonging only to default won't see the cms ?

Share this post


Link to post
Share on other sites

The "default" behavior makes this very confusing. I think I will revert to making the checkbox mean "show" rather than "hide."

Share this post


Link to post
Share on other sites

Yes, I think it's much better ! All hidden by default, and chek only who can see !

Share this post


Link to post
Share on other sites
The "default" behavior makes this very confusing. I think I will revert to making the checkbox mean "show" rather than "hide."

Just found this and thought it a good idea.
But it still has checkboxes for hiding.
If I create a new group eg 'retailers' to allow hiding a CMS entry for them, that won't work for new customers until I manually add them to that group, right?

/Mats

Share this post


Link to post
Share on other sites

Hello mister swguy.

I just installed this contribution. It works perfectly and it's very impressive !

Is it possible to make it work with contributions themselves (instead of CMS, or in complement) Or is it too much complicated to handle ?

MrGniarf

Share this post


Link to post
Share on other sites

Hello

For other reasons, I need to create for every customer a “group” which include only one customer.
I also put customers in groups of several customers. So at he end, a customer belong to at least two groups : – One which include only this customer – One which includes this customer and some other.
This could seem fastidious but as everything is automatic, it’s very easy to manage. (Customers can only be created by my CRM, it’s a private shop)

Now I have to deal with an other issue :
Conditions and Terms, Informations and some other CMS stuff need to show only to a certain group ou a specific customer (in fact the custommer group including only this customer). That was what you begin to developped before to change the way to set CMS autorizations/restrictions.

This code has been released; I created a new support thread with the title CONTRIBUTION. The new contribution is intended to “hide” rather than “show” on a per group basis, and works in all areas where CMS functionality is used in the cart (not just in the info block).



I understand you decided to “hide” rather than “show” because it would be fastidious to check every CMS pages when you add a new group. So this was the good way. If not there would have been this issue :
If I create a new group eg 'retailers' to allow hiding a CMS entry for them, that won't work for new customers until I manually add them to that group, right?


In my case,
1)No CMS should be created manually in the backend
2) The CMS pages will automatically be created from CRM : – when I create a group of several customers (2 or 3 CMS pages created) – when I create a group of on client (1 CMS pages created which will contain personal informations and “private messages”)

So it would havec been easier for me to check (automatically ;-) ) the CMS page everytime a new group is created

The "default" behavior makes this very confusing. I think I will revert to making the checkbox mean "show" rather than "hide."

Has "revert" been made ?
I can't find any contribution this way.
If not I'll try to make the changes my-self baut as I’m a very beginner with Prestashop and Smarty, I’m not sure what I should modify and how.

Is there anyone for help ?

Thanks a lot.

Tibo

Share this post


Link to post
Share on other sites

It's on my list of things to do - haven't gotten to it yet.

Share this post


Link to post
Share on other sites

I've done it

You may check and verufy as it's my first module .... but it seems to work well.

I just made 2 or 3 changes from you CMS group restrictions mod (except calling it group autorizations instead of group restriction). All you original code has been kept, but disabled when needed.
- disabling the "guest part"
- changing a condition from "NOT IN" to "IN"
- changing a "true/false" by a "false/true"


I have not made any thing not logged user or default user can have access to some non specific CMS as I don't need it yet.
(All my custommers are created by my CRM and automatically putted in groups upon creation).

Hopping it can be usefull

tibo

ps_cms_group_autorizations.zip

Share this post


Link to post
Share on other sites

CMS Group Autorizations v0.2

Hello,

Here is the second release of this CMS Group Autorizations mod adding two features :

1) You can now set CMS to show to any registered user (which is automatically put in the default group upon creation from frontend)

2) You can set CMS to show to visitors only. Registerd users can't see it.

I've some trouble with this part : CMS shw in every bock which include CMS even il you try to disable it.
For exemple, if you create the CMS page "Visitors Only" for which one you've only selected the visitor's box
This will always appear in the Info Block and Footer block even if in the module's setting for Info Block, you did not select this CMS page to appear.

Has anyone an idea to fix this ?

When this will be fixed the module will work fine.
The only trick to know will be to dupplicate the CMS if you want to show the same CMS to both visitors and registered user (or some selected groups)

Waiting for your help ...
Tibo

ps_cms_group_autorizations_v0.2.zip

Share this post


Link to post
Share on other sites

Is this possible to do for Product Categories and Subcategories?

It seems no matter what i do with the group permissions in the categoryt editor - all users see all categories (unless default is unchecked)

Share this post


Link to post
Share on other sites

Does anyone know how to do this in prestashop 1.4.1

 

When i use the above files, and go to a page within the cms system, i get this message:

Invalid security token

1. I understand the risks and I really want to display this page

2. Take me out of here

 

When i use option 1, my admin page only shows the menu bar, and not the rest to edit the cms page or set the rights for the page.

 

Maybe I am missing a file?

 

Any1 know how to fix this?

Share this post


Link to post
Share on other sites

I updated my prestashop to 1.4.6.2

Though when i go to the CMS page i still get the same message

 

When chose option the admin page shows now and I can click on a page or click to create a new one.

 

Though then I can save the page and my wysiwyg editor is gone....

 

Any1 knows this?

Share this post


Link to post
Share on other sites

Hi jaspertb, did you manage how to solve the issue of the Invalid Security Token generated by the module? I also need to use this to show a CMS page only to 2 differents groups, but I can't understand how to fix it. I'm new to PrestaShop and... don't know how to move. I tryed to fix the token with a different function, but it isn't working anyways...

Share this post


Link to post
Share on other sites

If you need a solution to hide specific CMS pages and don't want to use a module you can use the {logged in} function and edit the blockinfos.tpl .

 

Current CMS Block Link

 

 

<!-- Block informations module -->
<div id="informations_block_left" class="block">
<h4>{l s='Information' mod='blockinfos'}</h4>
<ul class="block_content">
{foreach from=$cmslinks item=cmslink}
<li><a href="{$cmslink.link}" title="{$cmslink.meta_title|escape:html:'UTF-8'}">{$cmslink.meta_title|escape:html:'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
<!-- /Block informations module -->

 

Updated CMS Block ( Hide all CMS links to Guest )

 

 

<!-- Block informations module -->
{if $logged} 
<div id="informations_block_left" class="block">
<h4>{l s='Information' mod='blockinfos'}</h4>
<ul class="block_content">
{foreach from=$cmslinks item=cmslink}
<li><a href="{$cmslink.link}" title="{$cmslink.meta_title|escape:html:'UTF-8'}">{$cmslink.meta_title|escape:html:'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
{else}
{/if} 
<!-- /Block informations module -->

Share this post


Link to post
Share on other sites

I need this to work on PrestaShop™ 1.5.3.1.

 

I have tried a version modified for PrestaShop 1.4.8.2 as placed on this blog:

 

http://blog.jakobdesign.com/?id=11

 

but can't see the group restriction on CMS...

ps_cms_block_groups.png

 

Any ideas on how to get this to work for PrestaShop™ 1.5.3.1?

 

Cheers

 

Dan

Edited by papagino (see edit history)

Share this post


Link to post
Share on other sites

The idea of restricting default is that it will only show up for not logged in customers. That's why I added "guest". This is just how PS works; guess I'll document it more thoroughly.1.jpg28.jpg3.jpg5.jpg4.jpg29.jpg

Share this post


Link to post
Share on other sites

Replacing core files is very wrong way to distribute new funcionality. Can it be done with override classes? It will be much simplier to update to new versions that way.

 

Or at least can someone post what parts changed in CMS.php and AdminCMS.php for this funcionality?

Edited by hootersam (see edit history)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

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