Jump to content
caparuni

[MODULE] Block News CMS

Recommended Posts

Good Job brother!!!

To everybody!! Let's go using for this one!!

Download -> Try it this beutiful module :P

Share this post


Link to post
Share on other sites

is possible to see all news on one page (main)? or how can user see other news if i have about 20-30 news on my web, thanx

Share this post


Link to post
Share on other sites

done... v0.3 is online
now with a view-all-news page (news.php), just put news.php on the root directory
already comes with blog style pagination, previous/next button on the bottom page

try it and give some feedback please

  • Like 1

Share this post


Link to post
Share on other sites

Thanks caparuni, will try your module ;)


ysco..

Share this post


Link to post
Share on other sites

@ysco
please re-download since im kinda mess with the old one, there is a variable ive forgot to delete ;)

Share this post


Link to post
Share on other sites

Hello caparuni,

Thanks for letting me know, will download again.

ysco..

Share this post


Link to post
Share on other sites

Thanks for sharing this module. I will write about it in my future posts.

Share this post


Link to post
Share on other sites
Thanks for sharing this module. I will write about it in my future posts.


ty PrestaShopic... and btw thank you to include sexy bookmarks on your post ;)

Share this post


Link to post
Share on other sites

Thank you caparuni for this contribution.

I can see the previous and next buttons at /news.php BTW. Is it possible to add the pagination like 1, 2, 3, ...., the last page etc etc?

Cheers,

Share this post


Link to post
Share on other sites

@21846657
sure it can be done, but i like to keep it simple just with prev/next button like in blog or wp ;)

Share this post


Link to post
Share on other sites

i have on page news.php 2 batten on uper side .. (newsletter and other one under this – without text) why?

Share this post


Link to post
Share on other sites

@jaffa
could you explain more... since i didnt understand what you mean

Share this post


Link to post
Share on other sites

Thank you ever so much! Great module!!! ;)

Share this post


Link to post
Share on other sites

Hi,

I would like to use this mod, but would like it within the "Homepage content". I have recently moved from CubeCart to Presta so not as familiar with the code, could you help me... I've tried hooking it into the "Homepage content" I would like it to sit to the right of the special block on the following url www.totalurbanwear.co.uk/store.

Share this post


Link to post
Share on other sites

Sorry to bother you all.... I have solved the problem! T'was staring me right in the face!

Share this post


Link to post
Share on other sites

Open the file blockcsm.php

find the code: public function hookLeftColumn ($params)

replace with: public function hookhome($params)

Share this post


Link to post
Share on other sites

Hi everybody, please how can i configure this module, set new news, delete, etc..because in the back office, it`s not evident..thank you anywhere for the mod..great work ;)

Share this post


Link to post
Share on other sites

just use ps standart CMS to add/edit/delete the news (Back Office >> Tools >> CMS) ;)

Share this post


Link to post
Share on other sites

Just tried this module, and it works perfect.

But a few things that i need, could you help?
Insert the "button-large" as the "View all news". Just like the bestseller and newproducts module.
The oppertunity to disable the Module on the front office. So i can just link to news.php in the Header.

Share this post


Link to post
Share on other sites
Just tried this module, and it works perfect.

But a few things that i need, could you help?
Insert the "button-large" as the "View all news". Just like the bestseller and newproducts module.
The oppertunity to disable the Module on the front office. So i can just link to news.php in the Header.



go edit blockcms.tpl. add the bottom you will find something like this
view all news



change that to

view all news




to disable the module from FO, just go edit position (Back Office >> Modules >> Positions) and delete the module

Share this post


Link to post
Share on other sites

Great module.

Question:
How can i duplicate this module? Want to hook another one in my right column with different news.
Thanks

Share this post


Link to post
Share on other sites

good day mate! I think the module is great, is it possible to use it in more than one instance? Coz I would like to have one more box using the same system.

Could you tell me if this is possible and how to do it?

Thank you so much

Share this post


Link to post
Share on other sites

This module seems very useful, but I have a serious problem, not me news.php page appears, the cause may be that I use the 1105 version. Please someone help me make it work news.php file.

Greetings from Spain.

Share this post


Link to post
Share on other sites

Hello, is there any hack or modifcation that i can do that will allow me to have a thumbnail image next to each news topic on the "view all" news page?

Thank for any help!

Share this post


Link to post
Share on other sites

Hello!

Noce mod, but if there is some way to syncronize with my Wordpress? Like "read more" leads to WP topic and so... :P
And one more thing. I want this to horizontaly under frontpage editorial picture. Is this possible?

Hope u understand me.

Share this post


Link to post
Share on other sites

@wqest:
sorry this module just to improved default CMS. if you want to do such thing then u must input the link to your wp manualy on CMS

you can try like on #20 replay on this thread if you want to put this module under frontpage editorial picture

Share this post


Link to post
Share on other sites

Thanks mate for this module.
Will try this one and see how it works ;)

Best regards,

ysco..

Share this post


Link to post
Share on other sites

Great contribution, great module !

thanks !

only regret is text format (from tinymce) doesnt seem to make it through the displayed block

But it is still super useful

Share this post


Link to post
Share on other sites

When i activate this module on my site the w3 validator say this:
sorry! this document couldn't be checked or something like this!!!

Share this post


Link to post
Share on other sites

Thanks for this module.

How to set a friendly url? Where can I set it up - in the file. htaccess?

Share this post


Link to post
Share on other sites

A big Thank you, caparuni. Just what I was looking for.

Others have asked this question - how easy is it to duplicate the module to have different blocks?

For example, "blockarticles"; does this just mean changing the word "news" in each file for the word "article" ?
How does this affect the DB ?

If someone can point me in the right direction...

Share this post


Link to post
Share on other sites
Hi,

I use this module and it works well !

I use "url rewriting" on my shop and I don't know if it could be possible to have url rewrited on the page "news.php" like :
http://www.boutique.com/content/1-name-of-my-page
and not : http://www.boutique.com/cms.php?id_cms=1 ( <= that's what I obtain) ?

If urls used are not rewrited, could it penalize SEO ?


first of all thanks to caparuni for module,, it's great,, I use it... and very well..

and about this problem,, I have modified this module,, just to change the news.tpl and blockcms.tpl ,,

here it is..

modified.zip

  • Like 1

Share this post


Link to post
Share on other sites

nice module!

I have one problem here...

I was able to install this module but I can not edit the news?

According what I am reading here I should be able to edit news in Back Office >> Tools >> CMS but the news is not displayed there so I am not able to edit it.

What should I do? Any advice? I would appreciate it!

Thank you

Share this post


Link to post
Share on other sites

PrestaShop Nebie!, have you tried my modified module?

When you create a new cms page it will be show in the News module if you haven't put the number in the exceptions and you can modify it with the cms editor tool.

Share this post


Link to post
Share on other sites

Hey Apprentice,
I did installed your updated module and it is working for me.
...by your explanation I understood how this works.

Good job!!! I like this module!!!

Thanks you very much

Share this post


Link to post
Share on other sites

OK PrestaShop Nebie! but my nick isn't Apprentice, is zantos, HAHAHA.

Share this post


Link to post
Share on other sites

The module does not work with Cyrillic characters ((
How do I fix it?

35811_Eohele9sdHFMfJ1b8fWx_t

Share this post


Link to post
Share on other sites

Decided

In blockcms.php replace trim on mb_strimwidth

Thank you "Sors"

Share this post


Link to post
Share on other sites
Decided

In blockcms.php replace trim on mb_strimwidth

Thank you "Sors"


Hello Fant63,
Could you explain what you mean?
As i understand you talking about specific php code?

Share this post


Link to post
Share on other sites

Rewrote the module. Now he will work with Cyrillic.
Many thanks to the user SORS

What's next?

Next I would like that would be news to appear more interesting - such as manufacturers or suppliers (thanks to user Anton for the idea)

But lack the experience ((

Who can help?

blockcms v0.5.zip

36439_Wn6OtiylsDhr0Vv8VuYD_t

Share this post


Link to post
Share on other sites

Hi
tested the 0.5 version, it works (I don't use cyrillic characters)
It were nice if you add a readme in the zip with explanation :
- How to install the module (extract the zip in the modules directory)
- The news.php file must be at the root of the website
- How to edit the news with the cms tools of prestashop => in the backoffice tools=>cms
...

Thx a lot

Bart

Share this post


Link to post
Share on other sites

The module is open for use and editing
And you can take part in its elaboration - eg write a manual (read me);)

Share this post


Link to post
Share on other sites

It's a little bit strange to provide a module without instructions, and to ask others to write it...

Nervermind here is my contribution :

French translation

README file :

Version 0.5
* Support of Cyrillic characters


===========================
       FRENCH
===========================
DESCRIPTION :
Module permettant d'afficher un bloc d'actualités basé sur la fonctionnalité CMS de prestashop.

INSTALLATION :
Comme tous les modules, dezipper le fichier dans le dossier module de prestashop, copier le fichier news.php à la racine de prestashop

CONFIGURATION :
Dans l'onglet Module du panneau d'administration (back office) cliquer sur Bloc Actualités v0.5 >> Configurer

AJOUT D'ACTUALITES :
Dans le panneau d'administration se rendre dans outils, CMS.
Noter les ID des pages que vous NE VOULEZ PAS afficher comme actualités.
Ajouter les actualités en cliquant sur Nouveau.
Retourner sur la page de configuration du module et saisissez les ID des pages que vous voulez masquer.

===========================
   ENGLISH
===========================
DESCRIPTION :
Modules allowing to display a news block, based on the CMS functionality of prestashop

INSTALLATION :
Install the plug-in normally : unzip the file in the modules directory of prestashop, move the news.php file at the root of prestashop

CONFIGURATION :
In the Module Tab of the backoffice click on Block News CMS v0.5 >> Configure

ADD NEWS :
In the Tools Tab of the back office click on CMS.
Memorize the ID of the page you DON'T WON'T to be displayed as news.
Add a news by clicking on 'add new'.
Go back to the configuration page of the module and enter the IDs of the page you want to hide.



Bart

fr.php

Share this post


Link to post
Share on other sites

ReadMe a little added

[MODULE] Block News CMS
===========================
Version 0.5
* Support of Cyrillic characters
===========================

Creator caparuni
demo: http://www.chenoel.com/

Description of caparuni:
with this module you can turn your static content (CMS) into news block on left/right
nothing fancy in here, im just trying to maximize the used of CMS already provided by presta-team
maybe i can say this is the easiest implementation to have news block look-a-like

WARNING:
this module is a thankyouware so say thank you is a must and send some donation (http://bit.ly/donate-caparuni) is a hope
You can leave a contribution to the development of the module

Special thanks for the development of the module (sorry if I missed someone):
caparuni, SORS, Fant63, zantos, ipz elhakim, Bart95130 and many others.

===========================
   ENGLISH
===========================
DESCRIPTION :
Modules allowing to display a news block, based on the CMS functionality of prestashop

INSTALLATION :
Install the plug-in normally : unzip the file in the modules directory of prestashop, move the news.php file at the root of prestashop

CONFIGURATION :
In the Module Tab of the backoffice click on Block News CMS v0.5 >> Configure

ADD NEWS :
In the Tools Tab of the back office click on CMS.
Memorize the ID of the page you DON'T WON'T to be displayed as news.
Add a news by clicking on 'add new'.
Go back to the configuration page of the module and enter the IDs of the page you want to hide.


===========================
       FRENCH
===========================
DESCRIPTION :
Module permettant d'afficher un bloc d'actualites base sur la fonctionnalite CMS de prestashop.

INSTALLATION :
Comme tous les modules, dezipper le fichier dans le dossier module de prestashop, copier le fichier news.php a la racine de prestashop

CONFIGURATION :
Dans l'onglet Module du panneau d'administration (back office) cliquer sur Bloc Actualites v0.5 >> Configurer

AJOUT D'ACTUALITES :
Dans le panneau d'administration se rendre dans outils, CMS.
Noter les ID des pages que vous NE VOULEZ PAS afficher comme actualites.
Ajouter les actualites en cliquant sur Nouveau.
Retourner sur la page de configuration du module et saisissez les ID des pages que vous voulez masquer.

blockcms v0.5.zip

  • Like 1

Share this post


Link to post
Share on other sites

This is really GREAT! Thank you so much for this very simple but effective module. Works 100% on my page.

Share this post


Link to post
Share on other sites

Great module! Thanks a lot!

Brief length doesn't seem to work for me. When I look in blockcms.tpl on row 10 it looks like this:

{$news.brief|strip_tags:'UTF-8'|truncate:35:'...'} » {l s='read more' mod='blockcms'}



It truncates at 35 characters. I can manually change this to 100 or whatever I like but how can I modify this line to pick the value from Back Office "Brief length"?

Thanks. //trify

Share this post


Link to post
Share on other sites

Through the Back Office is impossible (
Only editing blockcms.tpl
truncate: 35

Share this post


Link to post
Share on other sites

hi
thank you very much
very nice module but dos't work in "Friendly URL Enable" mode or SEO

for example in main dir of your site "WWW.YOURSITE.COM" work well
after view one link for example
www.yoursite.com/music-ipods/2-ipod-shuffle.html

then click one news
you see error

Share this post


Link to post
Share on other sites

dear, i've found error when installing on PS 1.4. since PS.1.4 also had module blockcms by default.
Please advised, when i'm install on it, the blockcms had display "footer", and the footer it self has gone.

Share this post


Link to post
Share on other sites

I am also having issues getting this module working on version 1.4

it seems to install ok but the block does not seem to hav ethe same behaviour has seen in some of the earlier posts.

does it support version 1.4?

Share this post


Link to post
Share on other sites

Great module, thanks!

By the way, if you have problems with unexpected characters (cut characters) at the end of the brief, you can fix this by replacing this code:

'brief' => trim(substr(strip_tags($cms['content']), 0, intval($config['PS_CMS_LENGTH']))),



with this one

'brief' => trim(mb_substr(strip_tags($cms['content']), 0, intval($config['PS_CMS_LENGTH']), 'UTF-8')),



in both blockcms.php and news.php

Share this post


Link to post
Share on other sites

I too am unable to get this to function correctly on the latest version! Is there any plans to make this V1.4.0.17 compatible?!

Share this post


Link to post
Share on other sites

Thanks - I'm trying it out now ... but I have a question:

It displays the existing CMS documents as news articles, but as I create additional CMS documents, it displays the new ones and drops the 'about us', 'our guarantee', and 'terms and conditions of use' ....

Is this right, or should I somehow be creating the CMS news articles somewhere else?

Thanks much!

Share this post


Link to post
Share on other sites

Got it ... It's displaying the news articles fine, but does anyone know where the colors for the links in the CMS news articles is controlled? Mine has reverted to the dreaded blue/purple, and it doesn't look too great with my page.

Thanks again!

Share this post


Link to post
Share on other sites

I think things are looking pretty good with the news block ... but does anyone else have two "Home" links at the bottom of the News page?

Being a novice, I didn't know if the code at the end of the new.tpl page was meant to all go after the 'if' statement or if there should be an else included between the two tags possibly? It looks to me like there are going to be two links, one with an image and one with text. (I've attached that part of the code.)

Thanks

Share this post


Link to post
Share on other sites

I had liked using this module with v1.3.4, but now that I've upgraded to 1.4.4.0, it no longer works. I haven't found if there is a version compatible with the updated versions of PS.

 

Any info about updates that are out there or are on the way?

 

Thanks

Share this post


Link to post
Share on other sites

Hi. Thanks !

 

Fixed the problem with the url in 1.4.4.1 adding {$base_dir} in blockcms.tpl.

Also trying to keep the blockcms working. Some problems remains , preview and ignore categories are not working yet.

 

http://www.megaupload.com/?d=2F00DW4O

 

Thanks again. Apologies for my english.

Share this post


Link to post
Share on other sites
Guest

I am in the need of a "NEWS" page on the top of my shop like: HOME, NEWS, SPECIALS, SITEMAP, CONTACT.

 

However, I'll try this when finding a way to create the NEWS page. Thank you.

  • Like 1

Share this post


Link to post
Share on other sites

Is there a way to install this module like a new module leaving blockcms how it is?

 

I need to mantain the cms structure for a website and add a news module..

 

Thanks in advance! and great job!

Share this post


Link to post
Share on other sites

Hello!

 

After install i have white screen on homepage.

How do you think, where problem?

 

prestashop ver: 1.4.6.2

 

Installation process: copy with replace files on "blockcms" folder in modules folder. Cope news.php in root.

 

BO works

FO get whitescreen

 

If disable module then FO works.

Share this post


Link to post
Share on other sites

After turn on "debug mode"

 

i catch this:

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/path/to/site/modules/blockcms/blockcms.tpl" on line 6 "{foreach from=$news item=news}" item variable 'news' may not be the same variable as at 'from'' in /path/to/site/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:431 Stack trace: #0 /path/to/site/tools/smarty/sysplugins/smarty_internal_compile_foreach.php(40): Smarty_Internal_TemplateCompilerBase->trigger_template_error('item variable '...', 6) #1 /path/to/site/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(284): Smarty_Internal_Compile_Foreach->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #2 /path/to/site/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(123): Smarty_Internal_TemplateCompilerBase->callTagCompiler('foreach', Array, Array) #3 /home/ in /path/to/site/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 431

Share this post


Link to post
Share on other sites

To solve Fatal error:

 

- In BO check use Smarty 2

If after you get "Assign a valid CMS page if you want it to be read" to solve this turn off "term of use".

Share this post


Link to post
Share on other sites

with this module you can turn your static content (CMS) into news block on left/right

nothing fancy in here, im just trying to maximize the used of CMS already provided by presta-team

maybe i can say this is the easiest implementation to have news block look-a-like :)

you can go to chenoel.com to see it in action

 

 

please try it and gimme some report :)

 

 

WARNING:

this module is a thankyouware so say thank you is a must and send some donation is a hope

I use PrestaShop™ 1.4.6.2 . This module is not working on my website. I installed and activate the module, the front page turn white blank. Then I uninstalled your module, my original blockCMS was gone on BO. However, I still see blockCMS on cPanel. Please anyone can help me to restore orginal blockCMS back to BO. Thank you very much in advance

Share this post


Link to post
Share on other sites

I write solution in post #88.

 

To check your problem need more info. Turn on "debug mode" in config files (Show PHP errors).

Share this post


Link to post
Share on other sites

I write solution in

I write solution in post #88.

 

To check your problem need more info. Turn on "debug mode" in config files (Show PHP errors).

 

To check your problem need more info. Turn on "debug mode" in config files (Show PHP errors).

 

Thank you for your response. I am a newbie, I tried to turn debug on

/* Debug only */

@ini_set('display_errors', 'on');

define('_PS_DEBUG_SQL_', true);

 

, but no error info apear. My site is still working, except the blockCMS of header and footer are not working. I really appreciate for your help

  • Like 1

Share this post


Link to post
Share on other sites

awesome module! Thank you bro.

I would like to translate this module. Could you give me a hint which file contains the language parameters and how can i turn it to a rtl-language?

Share this post


Link to post
Share on other sites

Thanks for sharing. Is this module compatitive with PS 1.4.

And the domain of demo site expired on Mar 23 2012.

Then you should renew it :)

  • Like 1

Share this post


Link to post
Share on other sites

Tried this today in 1.4.7 and got message below, uninstalled and realized my original CMS block was gone from front office features lucky for me I keep a backup.

If I need to change other parts of Presta (smarty) to use then for me there is a compatibility issue and will not use.

Good Idea though I would rather add this as an addition to the static CMS block on left and have this on right.

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/hermes/bosweb/web066/b667/ipg.mysite/shop/modules/blockcms/blockcms.tpl" on line 6 "{foreach from=$news item=news}" item variable 'news' may not be the same variable as at 'from'' in /hermes/bosweb/web066/b667/ipg.mysite/shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:431 Stack trace: #0 /hermes/bosweb/web066/b667/ipg.mysite/shop/tools/smarty/sysplugins/smarty_internal_compile_foreach.php(40): Smarty_Internal_TemplateCompilerBase->trigger_template_error('item variable '...', 6) #1 /hermes/bosweb/web066/b667/ipg.mysite/shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(284): Smarty_Internal_Compile_Foreach->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #2 /hermes/bosweb/web066/b667/ipg.mysite/shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(123): Smarty_Intern in/hermes/bosweb/web066/b667/ipg.mysite/shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 431

Share this post


Link to post
Share on other sites

Hi Caparuni, thank you for sharing this module,

 

also for other partisipant in this forum.

 

I've downloaded this module and when i installed, i've got some problem. When i click view all news, page showed error 404. What should i do? you can see the web www.exacorecomputer.com

 

 

 

Thank you for helping me.

Share this post


Link to post
Share on other sites

Hi all

 

I managed to adapt this module to Prestashop version 1.4.7.3

 

If anyone wants to know how, here are the main guidelines (this is based on the blockcms module v 0.5, found previously on this topic):

 

1. Before installing or even copy the module to your shop, change the name of the module folder and files, because prestashop now have a module with the same name. We don't want to override prestashop's module. I changed it to "blockcmsnews":

- change the module folder name to "blockcmsnews"

- open the folder and change the file name "blockcms.php" to "blockcmsnews.php"

- change to file name "blockcms.tpl" to "blockcmsnews.tpl"

 

2. Now open the file "blockcmsnews.php"

- On line 3, change class blockcms extends Module to class blockcmsnews extends Module

- On line 12, change $this->name = 'blockcms'; to $this->name = 'blockcmsnews';

- [optional] On line 14, change $this->tab = '[mod-id]'; to $this->tab = 'front_office_features';

- On line 168, change return $this->display(__FILE__, 'blockcms.tpl'); to return $this->display(__FILE__, 'blockcmsnews.tpl');

Save the file.

 

3. Now open file "blockcmsnews.tpl"

- On line 10, find mod='blockcms' change to mod='blockcmsnews'

Save the file

 

4. Open file "news.php" (is outside the module folder)

- On line 49, change $smarty->display(_PS_MODULE_DIR_.'blockcms/news.tpl'); to $smarty->display(_PS_MODULE_DIR_.'blockcmsnews/news.tpl');

Save the file

 

5. Open file "news.tpl" (is inside the module folder)

- On line 7, find and change mod='blockcms' to mod='blockcmsnews'

- On line 23, find and change mod='blockcms' to mod='blockcmsnews'

Save file

 

This should be enough, but after installing I found additional problems, so, before installing, here are the changes I made to get it running:

 

6. Open again file "blockcmsnews.tpl"

- On line 6, change item=news to item=cmsnews

(for some reason, the smarty compiler returns an error because the from variable and item variable have the same name, so I changed it)

- On line 8, find and replace every instance of the variable $news to $cmsnews

for example, on cms.php?id_cms={$news.id} change to cms.php?id_cms={$cmsnews.id}

- On line 10, do the same replacement.

Save the file

 

7. Open again file "news.tpl"

We have to do the same here.

- On line 4, change {foreach from=$news item=news} to {foreach from=$news item=cmsnews}

- On line 6 and 7, find and replace every instance of the variable $news to $cmsnews

- On line 20, change {foreach from=$news item=news} to {foreach from=$news item=cmsnews}

- On line 22 and 23, find and replace every instance of the variable $news to $cmsnews

Save the file

 

Now you're ready to install the module.

- Copy the now renamed "blockcmsnews" module folder to the "modules" folder of your shop

- Copy the file "news.php" to the root folder of your shop

- Upload to the server

- Open the Modules tab

- Expand the Front Office Features section

- Find the line with the module Block News CMS v0.5 and click Install

Should be up and running

 

Now, I made an additional change (this is for Caparuni to develop it better, if he wants to).

The concept of the module, is to add the IDs of CMS pages we do not want to use. But Prestashop has CMS organized in categories now. So I thought, why not add a CMS subcategory for News, and have this module just find the category ID and all the CMS pages added under that subcategory?

 

Here's what I did:

 

1. On file "blockcmsnews.php"

I will change PS_CMS_IGNORE to PS_CMS_CATEGORY. The idea is, instead of naming the IDs of pages I do not want to show, I want to identify the category (or categories, if you more) I want to display

 

- On line 29, change

OR !Configuration::updateValue('PS_CMS_IGNORE', NULL)

to

OR !Configuration::updateValue('PS_CMS_CATEGORY', NULL

 

- On line 42, change

OR !Configuration::updateValue('PS_CMS_IGNORE', NULL)

to

OR !Configuration::updateValue('PS_CMS_CATEGORY', NULL)

 

- On line 70, change

Configuration::updateValue('PS_CMS_IGNORE', $_POST['cmsignore']);

to

Configuration::updateValue('PS_CMS_CATEGORY', $_POST['cmscategory']);

 

- On line 101, change

<label>'.$this->l('Ignored').'</label>

to

<label>'.$this->l('Category').'</label>

 

- On line 102, change

<div class="margin-form"><input type="text" name="cmsignore" id="cmsignore" value="'.Configuration::get('PS_CMS_IGNORE').'" size="50">

to

<div class="margin-form"><input type="text" name="cmscategory" id="cmscategory" value="'.Configuration::get('PS_CMS_CATEGORY').'" size="50">

 

- On line 103, change

<p class="clear">'.$this->l('ignore list will not shown on the news block/page.<br>insert cms-id and use , (comma) for multiple cms. ex: 1,2,3,4').'</p>

to

<p class="clear">'.$this->l('enter category ID to search that category,<br>you can use multiple categories, (comma separated). ex: 1,2,3,4').'</p>

 

- On line 147, change

$config = Configuration::getMultiple(array('PS_CMS_TITLE', 'PS_CMS_LIMIT', 'PS_CMS_BRIEF', 'PS_CMS_LENGTH', 'PS_CMS_IGNORE'));

to

$config = Configuration::getMultiple(array('PS_CMS_TITLE', 'PS_CMS_LIMIT', 'PS_CMS_BRIEF', 'PS_CMS_LENGTH', 'PS_CMS_CATEGORY'));

 

- On line 153, change

'.(!empty($config['PS_CMS_IGNORE']) ? 'WHERE c.id_cms NOT IN ('.$config['PS_CMS_IGNORE'].')' : '').'

to

'.(!empty($config['PS_CMS_CATEGORY']) ? 'WHERE c.id_cms_category IN ('.$config['PS_CMS_CATEGORY'].')' : '').'

 

Save the file. Upload to server.

 

2. On file "news.php"

- On line 11, change

$config = Configuration::getMultiple(array('PS_CMS_TITLE', 'PS_CMS_LIMIT', 'PS_CMS_BRIEF', 'PS_CMS_LENGTH', 'PS_CMS_IGNORE', 'PS_CMS_PAGE'));

to

$config = Configuration::getMultiple(array('PS_CMS_TITLE', 'PS_CMS_LIMIT', 'PS_CMS_BRIEF', 'PS_CMS_LENGTH', 'PS_CMS_CATEGORY', 'PS_CMS_PAGE'));

 

- On line 13, change

$all_rows = Db::getInstance()->getValue('SELECT count(*) FROM '._DB_PREFIX_.'cms c '.(!empty($config['PS_CMS_IGNORE']) ? 'WHERE c.id_cms NOT IN ('.$config['PS_CMS_IGNORE'].')' : '') );

to

$all_rows = Db::getInstance()->getValue('SELECT count(*) FROM '._DB_PREFIX_.'cms c '.(!empty($config['PS_CMS_CATEGORY']) ? 'WHERE c.id_cms_category IN ('.$config['PS_CMS_CATEGORY'].')' : '') );

 

- On line 23, change

'.(!empty($config['PS_CMS_IGNORE']) ? 'WHERE c.id_cms NOT IN ('.$config['PS_CMS_IGNORE'].')' : '').'

to

'.(!empty($config['PS_CMS_CATEGORY']) ? 'WHERE c.id_cms_category IN ('.$config['PS_CMS_CATEGORY'].')' : '').'

 

Save the file. Upload it to the server.

 

3. Now, on the Shop Administration, go to Tools tab and select CMS

- Add a new subcategory, and name it News

- Add some CMS pages with news

- Memorize or copy the subcategory ID (is on the left column on the CMS list) and go to Modules

- Find the line with the module Block News CMS v0.5 and click Configure

- On the Category field, enter the News subcategory ID

- Save

That's it. You now have a consistent News Module loading CMS pages from a News category.

 

There is a lot more we could do on the module, like date, author, or more. But it is good for now.

 

Nelson G. / Contacto Visual

  • Like 2

Share this post


Link to post
Share on other sites

Hi

Contactovisual, I just did "from A to Z" as you did write on #97. I use PS 1.4.7.

It works 4 me ;)! Thx

 

I found one fault with links:

when I am on main site, links in news are OK, like: /cms.php?id_cms=4

but when I enter to one of the news page (or other CMS page), links are like /content/cms.php?id_cms=4 and click on them shows error.

 

greetings!

Edited by alex2c (see edit history)

Share this post


Link to post
Share on other sites