PrestaShop Forums: [Solved] Group Functionality for CMS / Info block - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


[Solved] Group Functionality for CMS / Info block


[Solved] Group Functionality for CMS / Info block

#1 Aaron @ Geocachestore

    PrestaShop Newbie

  • 03 Jun 2009
  • Members
  • Pip
  • 23 posts

Posted 19 June 2009 - 09:34 AM

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 File(s)


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

  • 03 Jun 2009
  • Members
  • Pip
  • 23 posts

Posted 26 June 2009 - 06:20 AM

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

  • 22 Jan 2009
  • Members
  • PipPip
  • 326 posts
  • Location:Melbourne Australia

Posted 04 July 2009 - 04:39 AM

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

  • 29 Jun 2009
  • Members
  • PipPip
  • 30 posts

Posted 07 July 2009 - 01:46 AM

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

  • 22 Jan 2009
  • Members
  • PipPip
  • 326 posts
  • Location:Melbourne Australia

Posted 07 July 2009 - 10:22 AM

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

  • 29 Jun 2009
  • Members
  • PipPip
  • 30 posts

Posted 07 July 2009 - 01:47 PM

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

  • 22 Jan 2009
  • Members
  • PipPip
  • 326 posts
  • Location:Melbourne Australia

Posted 07 July 2009 - 08:59 PM

PS rocks, so easy to build into any format once you understand the schema.

#8 paolo_m

    PrestaShop Apprentice

  • 14 Apr 2009
  • Members
  • PipPip
  • 56 posts
  • Location:Treviso

Posted 03 October 2009 - 08:37 AM

Very interesting ... you upgrade to version 1.2.4?

thanks
Bye
Paolo
RevitLandia

#9 stig

    PrestaShop Newbie

  • 22 Sep 2009
  • Members
  • Pip
  • 20 posts

Posted 05 October 2009 - 08:45 AM

Hi, this is great functionality!

Does this work with 1.2.4?

:-)
Stig

#10 lionhell

    PrestaShop Apprentice

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 11 October 2009 - 07:55 PM

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

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 14 October 2009 - 08:04 AM

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 File(s)


signé: LionHell

#12 stig

    PrestaShop Newbie

  • 22 Sep 2009
  • Members
  • Pip
  • 20 posts

Posted 14 October 2009 - 09:48 AM

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 File(s)

  • Attached File  table.jpg (73bytes)
    Number of downloads: 1393

Stig

#13 stig

    PrestaShop Newbie

  • 22 Sep 2009
  • Members
  • Pip
  • 20 posts

Posted 14 October 2009 - 10:01 AM

LionHell, did you make any other changes to get this to work with 1.2.4?
Stig

#14 lionhell

    PrestaShop Apprentice

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 14 October 2009 - 10:58 AM

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

  • 22 Sep 2009
  • Members
  • Pip
  • 20 posts

Posted 14 October 2009 - 11:24 AM

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

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 14 October 2009 - 11:39 AM

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

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 14 October 2009 - 11:41 AM

Ha ha ok I see !!!!

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

#18 stig

    PrestaShop Newbie

  • 22 Sep 2009
  • Members
  • Pip
  • 20 posts

Posted 14 October 2009 - 12:44 PM

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

  • 09 May 2009
  • Members
  • PipPip
  • 95 posts
  • Location:Tampa, Florida

Posted 15 October 2009 - 11:07 AM

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

  • 04 Oct 2009
  • Members
  • PipPip
  • 111 posts

Posted 15 October 2009 - 11:47 AM

Very good news ! THX
signé: LionHell





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users