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

[Solved] Group Functionality for CMS / Info block

28 replies to this topic
#1
Aaron @ Geocachestore

    PrestaShop Newbie

  • Members
  • Pip
  • 23 posts
After much playing around, I'm please to offer Group based CMS functionality for Prestashop 1.12Beta.

There are three files that I had to change to allow the functionality.


* Classes/CMS.php
* admin/tabs/AdminCMS.php
* modules/blockinfos/blockinfos.php


No core functionality change to the CMS, just allowing Groups to be used exactly like they are in Categories.

I've heard a few mutters about this one, and then when I needed it myself, I thought I'd give it a shot. Let me know if there are any issues, I've tested it on my own system and all seems to be working.

Instructions
----------------------------------------------------------------------

Download the zip file
1) Backup your database and all files
2) Rename the above mentioned files to .bak or something (just in case)
3) Upload the contents of the archive to your site (rename the admin directory to whatever you've called it)
4) You'll need to add the following table into your database (replace ps12 with your prefix)

CREATE TABLE `sitefx_store`.`ps12__cms_group` (
`id_category` int( 10 ) unsigned NOT NULL ,
`id_group` int( 10 ) unsigned NOT NULL ,
KEY `category_group_index` ( `id_category` , `id_group` )
)

5) Done.. go into the CMS and assign the default group to all of your entries.

Attached Files


FOR HIRE - Aussie PHP/MySQL Developer - PM me for a quote

Stuff I've worked on
[MOD] Paypal Fees passed on to customer [thread]

[MOD] Added Group Functionality for CMS / Info block [thread]

[MOD] Display Shipping Fees/Carriers prior to Checkout / AJAX [thread]

#2
Aaron @ Geocachestore

    PrestaShop Newbie

  • Members
  • Pip
  • 23 posts
Well, I thought it was useful lol.. ;)
FOR HIRE - Aussie PHP/MySQL Developer - PM me for a quote

Stuff I've worked on
[MOD] Paypal Fees passed on to customer [thread]

[MOD] Added Group Functionality for CMS / Info block [thread]

[MOD] Display Shipping Fees/Carriers prior to Checkout / AJAX [thread]

#3
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
Hey i just noticed this, no one else might have a use for it yet but ill say thank you for your work.

i think ive actually got a use for it.

#4
lotusutol

    PrestaShop Apprentice

  • Members
  • PipPip
  • 30 posts
I actually don't understand what this is for.
Is this module for assigning categories within CMS?
then this is very useful indeed.
I think people aren't taking it up because it was a bit vague what this module was about.

Would this be compatible with v. 1.1?

#5
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
its so only certain groups can see a CMS page, for example wholesale customers will only be able to see certain wholesale pages if its asigned to the group that they are assigned to.

#6
lotusutol

    PrestaShop Apprentice

  • Members
  • PipPip
  • 30 posts
Ah I see :)
I didn't realise that Categories had the group function too.. *goes to check it out*

BTW It's great to see fellow Aussies using PS ;)

#7
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
PS rocks, so easy to build into any format once you understand the schema.

#8
paolo_m

    PrestaShop Apprentice

  • Members
  • PipPip
  • 56 posts
Very interesting ... you upgrade to version 1.2.4?

thanks
Bye
Paolo
RevitLandia

#9
stig

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts
Hi, this is great functionality!

Does this work with 1.2.4?

:-)
Stig

#10
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts
Nice, I was looking for such a feature ! does it work with v1.2.4 ??

And can you tell us how to get the group a website visitor is belonging ?

Thx
signé: LionHell

#11
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts
OK it's working fine with prestashop 1.2.4

However I've modified adminCMS.php so that it can use text editor.
(file jointed below)

Attached Files


signé: LionHell

#12
stig

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts
Hi,

I have a great use for this module - thanks for sharing.

I'm using 1.24 and have it installed fine. But I do have a small problem that when I tick the group name boxes in CMS admin the Save function doesn't save to the new table. So in the shop the information block is blank.

I attached a quick screenshot from php MyAdmin showing the table has been added ok.

Any help greatly appreciated......

Thanks

Stig

Attached Files


Stig

#13
stig

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts
LionHell, did you make any other changes to get this to work with 1.2.4?
Stig

#14
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts
You must create a new table in your DB whose name is yourprefix_cms_group .

If you forgot to do that , the interface will work, but nothing will be save !!!

In brief:

- Create new table in DB (prefix_cms_group).

- Replace the 3 files (/tabs/adminCMS.php, classes/CMS.php, modules/blockinfos/blockinfos.php).

- Edit all your cms to check the group(s) authorized to watch them.


That's all ...


PS: If you create a CMS that only 1 particular group can see, dont forget to login on your site with an account belonging to that group !
signé: LionHell

#15
stig

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts

From 1255514293:

You must create a new table in your DB whose name is yourprefix_cms_group .

If you forgot to do that , the interface will work, but nothing will be save !!!

In brief:

- Create new table in DB (prefix_cms_group).

- Replace the 3 files (/tabs/adminCMS.php, classes/CMS.php, modules/blockinfos/blockinfos.php).

- Edit all your cms to check the group(s) authorized to watch them.


That's all ...


PS: If you create a CMS that only 1 particular group can see, dont forget to login on your site with an account belonging to that group !


Hi LionHell,

Yes, I have the new table and I replaced the three files. I tried the original and also your new version of AdminCMS.php. The interface works, but the ticks in the group boxes aren't saved. Other changes to the page content are saved. I can see the table ps_cms_group in phpMyAdmin is empty.

Maybe there is something wrong with the table? Here is the SQL statement I used:

Quote

CREATE TABLE `web113-pshop`.`ps_cms_group` (

`id_category` int( 10 ) unsigned NOT NULL ,

`id_group` int( 10 ) unsigned NOT NULL ,

KEY `category_group_index` ( `id_category` , `id_group` )

)


The table was created fine.

Your help is appreciated.
Stig

#16
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts

Quote


-- Serveur: localhost
-- Généré le : Mar 13 Octobre 2009 à 15:59
-- Version du serveur: 5.1.37
-- Version de PHP: 5.3.0

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de données: `name_of_your_DB`
--

-- --------------------------------------------------------

--
-- Structure de la table `your-prefix_cms_group`
--

CREATE TABLE IF NOT EXISTS `your-prefix_cms_group` (
`id_cms` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL,
KEY `cms_group_index` (`id_cms`,`id_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


Here is a dump of my cms_group table ...
Try to import it in your DB (change prefix to use yours).
signé: LionHell

#17
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts
Ha ha ok I see !!!!

Remplace all "category" by "cms" in your table definition ...
signé: LionHell

#18
stig

    PrestaShop Newbie

  • Members
  • Pip
  • 20 posts
Hi LionHell,

;-P


That did the trick! I now have the module working correctly. Thank you for your help!

Now that it's working, I need to make sure group members can only access the information they are allowed to see when the visit sitemap.php - any ideas on that one?

Cheers
Stig

#19
swguy

    PrestaShop Apprentice

  • Members
  • PipPip
  • 95 posts
The original author hasn't been on the forum for a couple of months. I will go ahead and make the sitemap change stig requested, do the 1.2.4 merges, update the documentation, etc. I should be able to post it this weekend.

Scott
That Software Guy - http://www.thatsoftwareguy.com
My Mods: Better Together, Boilerplate Description, Sort order in CMS
http://www.thatsoftw...prestashop.html

Please support my feature request for a generalized fee/discount framework in PrestaShop: http://www.prestasho...cker/view/3044/

#20
lionhell

    PrestaShop Apprentice

  • Members
  • PipPip
  • 122 posts
Very good news ! THX
signé: LionHell