Jump to content
RobAnderson

Article Manager v1.0

Recommended Posts

A new version has been uploaded with these changes:

  • Compatible with php 7.2.
  • Compatible with BS4. (see note below)
  • Header Tags SEO no longer required. (see note below)
  • Added code to automatically add the title and tags for an article to Page Control in Header Tags SEO (if HTS is installed).
  • Added the date posted on the blog comments page.
  • Added a link to the customers account on the blog comments page, if it exists.
  • Added multi-select option to the Cross Sell page in admin.
  • Added a module to display articles on the home page.
  • Added a module to display articles on the product page.
  • Added the article ID to the article listing page in admin.
  • Added reply to blog in admin.
  • Added IP tracking for blog articles.
  • Added option to require approval for blog posts.
  • Changed the articles infobox to use ssl, if set, to fix a non-secure warning.
  • Changed the articles infobox to only display the articles section if articles exist for those sections.
  • Changed the format of the article listing pages on the shop side.
  • Changed the default setting for an article to non-blog.
  • Changed all of the article listing to use the sort order setting.
  • Fixed code to handle the filter database definition correctly. Reported by member @vmn.
  • Fixed code for the listing description text to prevent problems when html is used. Reported by member @vmn.
  • Fixed Cross Sell code to the blog page.
  • Fixed Cross Sell code to display the images.
  • Fixed article listing page to only show blog or non-blog articles.
  • Fixed code in the articles box to correctly show upcoming articles.
  • Fixed the layout problem in authors section of admin.
  • Fixed coding mistakes on the topics page that caused incorrect links.
  • Fixed coding mistakes on the articles page that caused incorrect links.
  • Fixed coding mistakes in the articles infobox for upcoming article that caused incorrect links.
  • Made many changes on the blog comment page in admin fixes and improvements.
  • Replaced date code with jquery's datepicker. Reported by member @vmn.
  • Replaced all uses of NONSSL with $request_type.
  • Replaced the topics code in the articles infobox with standard oscommerce code.
  • Removed preview from articles creation page.
  • Removed preview code in admin blog comments.
  • Removed unnecessary database code from the articles box.
  • Removed extra files in the new directory for the CE version.
  • Removed redundant functions used by the articles infobox.
  • Removed all filename and table definitions so it now works in CE shops.
  • Rewrote the new articles page to remove html codes.
  • Rewrote the upcoming module to remove html codes.

Notes:

1 - The changes in this update are only for the CE versions. The code for the CE version will probably work in 2.3.4 shops, though I haven't tested it, but not any version before that. There were far too many changes in this version to get them to work with the older versions. It can be done but will take a bit of time.

2 - I included the code for BS4 versions. This was not thoroughly tested but I don't think there are any problems in that version.

3 - The requirement to have Header Tags SEO installed has been removed. This was not thoroughly tested but I don't think there are any problems caused by it. You have to turn the option for Header Tags SEO off in the settings. Please note that if you don't have Header Tags SEO installed, you will not be able to set the title and meta tags from admin. You will need to figure out how to do that manually. Also, the Ultimate SEO url rewriter won't change the url's as expected.

My sincere thanks to @FrediHis help in troubleshooting this saved weeks on the release date. It was invaluable since he pointed out things I probably would not have seen.

Share this post


Link to post
Share on other sites

One of the things left out of the last version was the article reviews code. Mainly because I ran out of time but also because I question if it is ever used. I would be interested to hear what others think of that option. Should there be a way for customers to post reviews for articles?

Share this post


Link to post
Share on other sites

Hello Jack,

After installing this new version on a FROZEN website I get the following errors :

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; cm_footer_articles_manager has a deprecated constructor in /includes/modules/content/footer/cm_footer_articles_manager.php on line 13

Articles


  • Warning: Use of undefined constant ARTICLE_MANAGER_XREF_ARTICLES - assumed 'ARTICLE_MANAGER_XREF_ARTICLES' (this will throw an Error in a future version of PHP) in /includes/modules/content/footer/templates/articles_manager.php on line 11
    1054 - Unknown column 'a.box_id' in 'where clause'

    SELECT a.articles_id, ad.articles_name, a.articles_is_blog from articles a left join articles_description ad on a.articles_id = ad.articles_id where a.articles_status = '1' and a.box_id = '0' and ad.language_id = '1'

Share this post


Link to post
Share on other sites

Sorry Jack,

I had not fully deleted the tables before running the installer so redoing it made the second errors go away.

As for the first with the deprecated constructor I replaced line 13 in includes/modules/content/footer/cm_footer_articles_manager.php with

    function __construct() {

and it is good to go.

Thanks for your work to get this updated!

Share this post


Link to post
Share on other sites
2 hours ago, artfulweb said:

I had not fully deleted the tables before running the installer so redoing it made the second errors go away.

As for the first with the deprecated constructor I replaced line 13 in includes/modules/content/footer/cm_footer_articles_manager.php with

    function __construct() {

You shouldn't have had to delete the tables. Just selecting the reset option would have brought the database up to this version. It's too late now but others may need to know this.

Also, the line to change is 21. Line 13 is the class name and needs to stay as it is. Thanks for reporting this mistake.

Share this post


Link to post
Share on other sites

I have an issue with the new version

Enable Header Tags SEO is set to false and the db was restored and all previous AM & HTS tables and configuration entries were removed.

Installed the db entries via article_manager_db_handler.php

configuration_group = Article Manager

Have been installed and re-installed five times with no luck.

Same error repeatedly.

 

 

1146 - Table 'bowwowwow.headertags' doesn't exist

select page_title from headertags where page_name like '%articles_id=%' and language_id = '1'

[TEP STOP]

 

Share this post


Link to post
Share on other sites

@Dnj1964You don't mention the version of your shop (please always do that) but I will assume Frozen since that is the only version that setting will work with. I just tried it here and it works as expected so I don't have an answer as to why it would fail. But here's a quick fix. Find this line in admin/articles.php

          $hts_status = (ENABLE_HEADER_TAGS_SEO != 'true' ? 'disabled="disabled" ' : '');
           

and add this below it

          if (false)

.

Share this post


Link to post
Share on other sites

 

Edge BS4 - Current commits to 05-28

Adding the above to admin/articles.php creates a syntax error on the line below.

          <td valign="top" width="50%"><table border="0" cellspacing="0" cellpadding="2" class="BorderedBox">
          <?php
		  $hts_status = (ENABLE_HEADER_TAGS_SEO != 'true' ? 'disabled="disabled" ' : '');
		  	for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
          ?>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_TITLE; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_title[' . $languages[$i]['id'] . ']', GetHeaderTagsTitle($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_DESC; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_desc[' . $languages[$i]['id'] . ']', GetHeaderTagsDescription($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_KWORDS; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_kwords[' . $languages[$i]['id'] . ']', GetHeaderTagsKeywords($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>          
         <?php
             }
         ?>
          </table>

 

3 hours ago, Jack_mcs said:

@Dnj1964You don't mention the version of your shop (please always do that) but I will assume Frozen since that is the only version that setting will work with. I just tried it here and it works as expected so I don't have an answer as to why it would fail. But here's a quick fix. Find this line in admin/articles.php


          $hts_status = (ENABLE_HEADER_TAGS_SEO != 'true' ? 'disabled="disabled" ' : '');
           

and add this below it


          if (false)

.

 

Edited by Dnj1964

Share this post


Link to post
Share on other sites
5 hours ago, Dnj1964 said:

Adding the above to admin/articles.php creates a syntax error on the line below.

Which line would that be? The code you posted doesn't have the change I mentioned so it is unclear where you added it.

Also, the code for BS4 is an afterthought since that is not a finished package. Article Manager should work in it but I don't have a BS4 shop setup that doesn't have Header Tags SEO installed so I can't say for sure. I do have a BS4 shop with Header Tags SEO installed and this addon works correctly in it but that doesn't help in your case.

Share this post


Link to post
Share on other sites
17 minutes ago, Jack_mcs said:

Which line would that be? The code you posted doesn't have the change I mentioned so it is unclear where you added it.

Also, the code for BS4 is an afterthought since that is not a finished package. Article Manager should work in it but I don't have a BS4 shop setup that doesn't have Header Tags SEO installed so I can't say for sure. I do have a BS4 shop with Header Tags SEO installed and this addon works correctly in it but that doesn't help in your case

<td valign="top" width="50%"><table border="0" cellspacing="0" cellpadding="2" class="BorderedBox">
          <?php
		  $hts_status = (ENABLE_HEADER_TAGS_SEO != 'true' ? 'disabled="disabled" ' : '');
		  if (false)
		  	for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
          ?>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_TITLE; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_title[' . $languages[$i]['id'] . ']', GetHeaderTagsTitle($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_DESC; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_desc[' . $languages[$i]['id'] . ']', GetHeaderTagsDescription($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>
            <tr>
              <td class="smallText row-left-seo"><?php echo TEXT_ARTICLES_HTS_KWORDS; ?></td>
              <td class="smallText"><?php echo tep_draw_input_field('articles_hts_kwords[' . $languages[$i]['id'] . ']', GetHeaderTagsKeywords($aInfo->articles_id, $languages[$i]['id']), $hts_status . ' size="35"'); ?></td>
            </tr>          
         <?php
             }
         ?>
          </table>

 

Share this post


Link to post
Share on other sites

Thanks, the code fixes the admin side and can now add an article. 👍

Catalog side clicking article link error: 👎

1146 - Table 'bowwowwow.headertags' doesn't exist

select page_name, page_title from headertags where page_name like 'article_info.php?articles_id=1' and language_id = '1' LIMIT 1

[TEP STOP]

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

PHP 7.1.30
MySQL 5.5.5-10.2.19-MariaDB-log

 

Maybe this an issue that is causing all the problems.

As I said I restored the db which removed all the HTS and AM from the db

All files were deleted from the server.

Yet when adding an article after installing the new version of AM without HTS

When clicking on article Name it drops down and shows a list of article names previously used.

Cleared the browser cache but the names are still showing.

 

Share this post


Link to post
Share on other sites
5 hours ago, Dnj1964 said:

Catalog side clicking article link error:

To fix this, find this line in includes/modules/article_manager.php

  if (isset($_GET['articles_id'])) {

and replace it with

  if (isset($_GET['articles_id']) && ENABLE_HEADER_TAGS_SEO == 'true') {

Just so you know, or anyone else reading this, there's no reason to uninstall existing installations of this addon to install the latest one. There is an update file in the Docs directory that explains what is needed to upgrade.

Share this post


Link to post
Share on other sites

Tried that fix and all I got was a blank page on refresh

1 hour ago, Jack_mcs said:

To fix this, find this line in includes/modules/article_manager.php


  if (isset($_GET['articles_id'])) {

and replace it with


  if (isset($_GET['articles_id']) && ENABLE_HEADER_TAGS_SEO == 'true') {

Just so you know, or anyone else reading this, there's no reason to uninstall existing installations of this addon to install the latest one. There is an update file in the Docs directory that explains what is needed to upgrade.

 

Share this post


Link to post
Share on other sites

A blank page, after a change like this one, is usually due to a mistake in the code being added. Bu I have tried it here and it is working fine. If you can't see a problem with the change, please paste the contents of that file here so I can copy and test it.

Share this post


Link to post
Share on other sites

Jack,

Checked it again, still blank page. Dreaweaver says there is an issue with the replacement code, doesn't say what other than syntax error on that line of code

include('includes/languages/' . $language . '/article_manager.php');
  require('includes/functions/articles.php');

// calculate topic path
  $tPath = '';
  if (isset($_GET['tPath'])) {
      $tPath = $_GET['tPath'];
  } elseif (isset($_GET['articles_id']) && !isset($_GET['authors_id'])) {
      $tPath = tep_get_article_path($_GET['articles_id']);
  }

  $current_topic_id = 0;
  if (tep_not_null($tPath)) {
      $tPath_array = tep_parse_topic_path($tPath);
      $tPath = implode('_', $tPath_array);
      $current_topic_id = $tPath_array[(sizeof($tPath_array)-1)];
  }

//if (isset($_GET['articles_id'])) {
  if (isset($_GET['articles_id']) && ENABLE_HEADER_TAGS_SEO == 'true') {
$articlesPage = 'article_info.php?articles_id=' . $_GET['articles_id'];
      $pageTags_query = tep_db_query("select page_name, page_title from headertags where page_name like '" . tep_db_input($articlesPage) . "' and language_id = '" . (int)$languages_id . "' LIMIT 1");
      if (tep_db_num_rows($pageTags_query) == 1) {
          $pageTags = tep_db_fetch_array($pageTags_query);
          $breadcrumb->add('Articles', tep_href_link('articles.php'));
          $breadcrumb->add($pageTags['page_title'], tep_href_link($articlesPage));
      }
  }

Doug

Share this post


Link to post
Share on other sites

check your code in a clean code editor like notepad++ , If you  are cutting and pasting code from the forum then you can have probems as the code from the form can copy badly.

This is what I see from your pasted code in php sand box. As you can see extra bits have been added. These will give syntex error. With these removes no syntex error given.

http://sandbox.onlinephpfunctions.com/

image.png.6fa5811618f8dcbc591202d701afa4eb.png

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

Unreal....

Copy and paste doesn't even work simply anymore...

Thanks

5 minutes ago, JcMagpie said:

check your code in a clean code editor like notepad++ , If you  are cutting and pasting code from the forum then you can have probems as the code from the form can copy badly.

This is what I see from your pasted code in php sand box. As you can see extra bits have been added. These will give syntex error. With these removes no syntex error given.

http://sandbox.onlinephpfunctions.com/

image.png.6fa5811618f8dcbc591202d701afa4eb.png

 

Share this post


Link to post
Share on other sites

Only other issue is that Clicking through link "All Articles"

Goes to articles.php but doesn't show a list of articles but shows

image.png.07463786c079689800905188c64950e3.png

 

Share this post


Link to post
Share on other sites

@Dnj1964

Dreamweaver has been known to create problems with PHP bases, data-drive websites. As I mentioned to you in another thread, try using a different code editor, such as Notepad++.

M


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

Thanks,

Just went and got Notepad++

1 minute ago, ArtcoInc said:

@Dnj1964

Dreamweaver has been known to create problems with PHP bases, data-drive websites. As I mentioned to you in another thread, try using a different code editor, such as Notepad++.

M

 

Share this post


Link to post
Share on other sites
6 minutes ago, Dnj1964 said:

Goes to articles.php but doesn't show a list of articles but shows

It looks as if the install is bad, I can only guess from the code I see but it looks to be missing the links in the db to the articles. I'm assuming when you add articles it saves in to db the actual artical and a id to find them all. It looks as if you have added articles by copying them over and not copied the links? Not sure just a guess.


 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×