Access to PrestaShop corporate website
Bonjour, Invité |
| S'inscrire
Se souvenir de moi Mot de passe oublié ?
Site Map Plan du site Contact us Contactez-nous
PrestaShop e-commerce software
  768 Membres en ligne
Forum  >  English Forum  >  Third party modules  >  Fil

4 de 30
4
Répondre
Nouveau sujet
[CONTRIBUTION] News module/mod

offline
Publié : 12 Mars 2010 12:44 AM   [ Ignorer ]   [ # 46 ]
Regular
RankRank

Messages :

  • au total : 78
  • 7 derniers jours : 0
Inscrit: 2009-07-03

You are working on this module for free? Man, actually I am touched.

 
offline
Publié : 12 Mars 2010 11:59 AM   [ Ignorer ]   [ # 47 ]
Club Member
RankRankRank

Messages :

  • au total : 166
  • 7 derniers jours : 14
Inscrit: 2009-11-25

Hi again

Well !! we shall wait

A+

Phil Did

 Signature 

prestashop 1.2.5
prestashop 1.3.0

Les astuces LES ASTUCES
Le WIKI LE WIKI

 
offline
Publié : 13 Mars 2010 10:14 PM   [ Ignorer ]   [ # 48 ]
Club Member
RankRankRank
Avatar

Messages :

  • au total : 149
  • 7 derniers jours : 0
Inscrit: 2008-12-01

Ok, here it is:

Core module


Deprecated, use these

Comments module


Deprecated, use these

Separate sitemap module


Deprecated, use these. (experimental (test and tell if the sitemap it generates is correct, I’m kind of noob here))

These two modules are dependant: install core module first, then install comments module (if you need comments, that is, if you don’t, just install the Core module).

It should work fine, tested it with 1.3.1 and 1.2.5.
The core module features basic functionality:
Meta information *
Short Description
Full description
Rewrite link *

I will create a few more modules to extend it’s functionality.

All those fields are multilingual.

You can also change entry’s status — active/inactive (inactive entries will not be listed in the frontend).
Oh, and post author — you now write on your behalf (but for now it only matters to administrators)

  • — You’ll need to modify your /classes/Tools.php for it to work. The module itself will work without this modification just fine, but the meta description, meta keywords and meta title won’t be loaded.
  • — You’ll need to modify your .htaccess file for it to work.

It’s not yet completely finished, I will be adding features, but you can use it now.
Modifications needed to display meta information:
Open your classes/Tools.php, find:

/* CMS specifics meta tags */
elseif ($id_cms self::getValue('id_cms'))
{
    $row 
Db::getInstance()->getRow('
    SELECT `meta_title`, `meta_description`, `meta_keywords`
    FROM `'
._DB_PREFIX_.'cms_lang`
    WHERE id_lang = '
.intval($id_lang).' AND id_cms = '.intval($id_cms));
    if (
$row)
    
{
        $row[
'meta_title'$row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
        return 
self::completeMetaTags($row$row['meta_title']);
    
}
}

Under these lines add:
elseif ($id_entry self::getValue('id_entry'))
{
    $row 
Db::getInstance()->getRow('
    SELECT `meta_title`, `meta_description`, `meta_keywords`
    FROM `'
._DB_PREFIX_.'news_lang`
    WHERE id_lang = '
.intval($id_lang).' AND id_entry = '.intval($id_entry));
    if (
$row)
    
{
        $row[
'meta_title'$row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
        return 
self::completeMetaTags($row$row['meta_title']);
    
}
}

Save and close.
Modifications needed if you use SEF (Search Engine Friendly URLs):
open your .htaccess file and add two lines:
RewriteRule ^blog/$ /modules/blocknews/news.php [QSA,L,E]
RewriteRule 
^blog/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /modules/blocknews/news.php?id_entry=$1 [QSA,L,E]

A better way is to open yout admin/tabs/AdminGenerator.php, find
$tab['RewriteRule']['comment''# URL rewriting rules';
// Whole bunch of other stuff

And add under it:
$tab['RewriteRule']['content']['^blog/$''/modules/blocknews/news.php [QSA,L,E]';
$tab['RewriteRule']['content']['^blog/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$''/modules/blocknews/news.php?id_entry=$1 [QSA,L,E]';

To those who already installed the previous version: you’re going to have to undo all the changes you’ve made, sorry. Basically, check the instructions in the first post and do the opposite smile

 
offline
Publié : 14 Mars 2010 01:18 AM   [ Ignorer ]   [ # 49 ]
V.I.P.
RankRankRankRank
Avatar

Messages :

  • au total : 656
  • 7 derniers jours : 0
Inscrit: 2009-01-01

To Eihwaz,

You need to take some donation as this module is a hard module to write. Getting a donation does not obligate you to give support. It only means we are appreciated your work. I have given donations to all of the free modules that I am using. I have never received extra support or intend to demand for extra support because of the fund that I have contributed.

I know this module is not an easy module to write. I will not use this module as I am using wordpress and I don’t want o re-set up my blog again. But I am more than willing to make a donation as I will study your codes from top to bottom, and inside and out.

I want to say thank you again for all your help.

 Signature 

Blossomcart

Flowers and Gifts Shop

 
offline
Publié : 14 Mars 2010 01:47 PM   [ Ignorer ]   [ # 50 ]
Club Member
RankRankRank

Messages :

  • au total : 166
  • 7 derniers jours : 14
Inscrit: 2009-11-25

Re,

I will do a reinstall as soon as i can and tell you so

A+

 Signature 

prestashop 1.2.5
prestashop 1.3.0

Les astuces LES ASTUCES
Le WIKI LE WIKI

 
offline
Publié : 14 Mars 2010 03:14 PM   [ Ignorer ]   [ # 51 ]
Apprentice
RankRank

Messages :

  • au total : 22
  • 7 derniers jours : 0
Inscrit: 2009-11-06

Hi Eihwaz,

First, thanks a ton for your module. It’s very useful.
I’ve just installed and met a problem with this module: I cannot add any entry. Pls. see attached file for more details.
It says: It appears all the fields were filled correctly, but the entry still could not be added to your database. Oopsie.
Pls help!

Thanks
venintech from vietnam

Images jointes
Clip.jpg
 
offline
Publié : 14 Mars 2010 03:27 PM   [ Ignorer ]   [ # 52 ]
Club Member
RankRankRank
Avatar

Messages :

  • au total : 149
  • 7 derniers jours : 0
Inscrit: 2008-12-01

Hi, venintech!
This error message occurs when module fails to add entry’s status and your user id to database.
This can also happen if for some reason module’s database tables wasn’t automatically created during installation (check your database to make sure ps_news and ps_news_lang tables exist.).
Also, what version of Prestashop are you using and what other third party modules?
Thank you!

 
offline
Publié : 14 Mars 2010 03:36 PM   [ Ignorer ]   [ # 53 ]
Apprentice
RankRank

Messages :

  • au total : 22
  • 7 derniers jours : 0
Inscrit: 2009-11-06

Hi Eihwaz,

Thanks for your quick support.
I’ve checked database, and it doesn’t has ps_news and ps_news_lang as you mentioned.
Pls. guide me to create them.

Thanks
venintech

 
offline
Publié : 14 Mars 2010 03:42 PM   [ Ignorer ]   [ # 54 ]
Club Member
RankRankRank
Avatar

Messages :

  • au total : 149
  • 7 derniers jours : 0
Inscrit: 2008-12-01

This is strange… Try reinstalling the module, if this doesn’t help, run this query on your database — it will create the necessary tables:

CREATE TABLE `ps_news` (
  `
id_entryint(10unsigned NOT NULL AUTO_INCREMENT,
  `
id_employeeint(10unsigned NOT NULL,
  `
activetinyint(1unsigned NOT NULL DEFAULT '0',
  `
date_adddatetime NOT NULL,
  `
date_upddatetime NOT NULL,
  
PRIMARY KEY (`id_entry`)
ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=;

CREATE TABLE `ps_news_lang` (
  `
id_entryint(10unsigned NOT NULL,
  `
id_langint(10unsigned NOT NULL,
  `
meta_titlevarchar(128NOT NULL,
  `
meta_descriptionvarchar(255) DEFAULT NULL,
  `
meta_keywordsvarchar(255) DEFAULT NULL,
  `
description_shorttext,
  `
contentlongtext,
  `
link_rewritevarchar(128NOT NULL,
  
PRIMARY KEY (`id_entry`,`id_lang`)
ENGINE=MyISAM DEFAULT CHARSET=utf8;

 
offline
Publié : 14 Mars 2010 03:57 PM   [ Ignorer ]   [ # 55 ]
Apprentice
RankRank

Messages :

  • au total : 22
  • 7 derniers jours : 0
Inscrit: 2009-11-06

Hi Eihwaz,

Big thanks again wink It works.
Hope you will write for us more more modules like this wink

Thank you,
venintech

 
offline
Publié : 14 Mars 2010 04:16 PM   [ Ignorer ]   [ # 56 ]
Club Member
RankRankRank
Avatar

Messages :

  • au total : 149
  • 7 derniers jours : 0
Inscrit: 2008-12-01

Thank you! smile One question: did reinstallation help? Or you had to run that query I gave you?

 
offline
Publié : 14 Mars 2010 04:24 PM   [ Ignorer ]   [ # 57 ]
Apprentice
RankRank

Messages :

  • au total : 22
  • 7 derniers jours : 0
Inscrit: 2009-11-06

Hi Eihwaz,

I run your 2 query sql you guided. Not reinstallation.
One question, this module can only hook to right or left? Or it can hook to homepage content?

Thanks,
venintech

 
offline
Publié : 14 Mars 2010 04:34 PM   [ Ignorer ]   [ # 58 ]
Club Member
RankRankRank
Avatar

Messages :

  • au total : 149
  • 7 derniers jours : 0
Inscrit: 2008-12-01

For now, yes, it’s restricted to left or right columns. But you can easily extend it and hook to homepage content:
open modules/blocknews/blocknews.php, find:

public function hookRightColumn($params{
    
return $this->hookLeftColumn($params);
}

Copy this bit, paste it below and change function name:
public function hookHome($params{
    
return $this->hookLeftColumn($params);
}

Save and close. You can now transplant this module to homepage content. It will us the same template, though, which may not be what you want, so I’d suggest to wait for a new version of the module.

 
offline
Publié : 14 Mars 2010 06:22 PM   [ Ignorer ]   [ # 59 ]
Newcomer
Rank

Messages :

  • au total : 3
  • 7 derniers jours : 0
Inscrit: 2009-11-14

Hi Eihwaz,

Thanks alot for this great module! It’s very well written.
If I could just wish for one more feature it would be categories, that would make this the perfect solution!

 
offline
Publié : 14 Mars 2010 06:48 PM   [ Ignorer ]   [ # 60 ]
Regular
RankRank

Messages :

  • au total : 78
  • 7 derniers jours : 0
Inscrit: 2009-07-03

This module is a lot better than commercial modules. Very easy to install, and works great.

I had purchased few commercial modules and they don’t work. And the sellers didn’t care if the modules work as long as I paid for it, no support. You are giving these modules out for free. Star is right, you are more than just great.

Can this news module has twitter feature? What I mean is the posts will upload to twitter automatically? And can this has it’s own sitemap.php so that we can list our posts? And it’s own sitemap.xml so that we can submit it to Google as a blog?

Thanks a zillion

 
 
4 de 30
4
Réponse rapide
Nouveau sujet