Jump to content
RobAnderson

Article Manager v1.0

Recommended Posts

A little simpler and presumably faster solution for $articles_head_desc_tag truncation:

      if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {
        $articles_head_desc_tag = $articles_listing['articles_head_desc_tag'];
        if (strlen($articles_listing['articles_head_desc_tag']) > MAX_ARTICLE_ABSTRACT_LENGTH) {
            $last_tag = strrchr($articles_head_desc_tag,'<');
            $articles_head_desc_tag = substr($articles_head_desc_tag,0, MAX_ARTICLE_ABSTRACT_LENGTH);
            $articles_head_desc_tag .= ' ... ' . $last_tag;
        }
?>
            <div class="main" style="padding-left:15px"><?php echo clean_html_comments($articles_head_desc_tag); ?></div>
<?php
      }

Share this post


Link to post
Share on other sites

This simpler solution may still break the html. I reverted back to my first solution.

Share this post


Link to post
Share on other sites

I haven't looked at a solution for this yet but this page claims to have one, though look at the time it takes. I have a function I use that builds an array of html tags so that I know where they are in the code. I use it for ignoring html when checking search engine position in a program I wrote for that. It works well. I think that would be a simpler solution to the above but I will need to test it.

Other than that, there is an old addon named "embed link" or something like that. The idea is that special characters are inserted in the text and then a function processes them as html. It could probably be adapted for this, though it would require the special characters to be entered into the descriptions.

I'm sure this is possible but whether it is useable, due to the load it adds to the page, may be in question. If I can find a solution that doesn't take too long to process, I will include it in the next version.

Share this post


Link to post
Share on other sites

@jackmc

I think that for a relatively short string like this, my first solution works pretty well.

To be on the safer side, I set MAX_ARTICLE_ABSTRACT_LENGTH=500. The article description should be quite short anyway.

Share this post


Link to post
Share on other sites

More comments:

in admin/articles.php

======================================
replace spiffyCal with datepicker.

-remove the following around line 695:

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
<script language="javascript">
<!--
  var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_article", "articles_date_available","btnDate1","<?php echo $aInfo->articles_date_available; ?>",scBTNMODE_CUSTOMBLUE);
-->
</script>


-find around line 731

          <tr>
            <td class="smallText"><?php echo TEXT_ARTICLES_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>
            <td class="smallText" align="left"><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>
          </tr>

-replace with

          <tr>
            <td class="smallText"><?php echo TEXT_ARTICLES_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>
            <td class="main"><?php echo tep_draw_input_field('articles_date_available', $aInfo->articles_date_available, 'id="articles_date_available"'); ?></td>
          </tr>

-find around line 865

    </table></form>

-replace with

    </table>
<script type="text/javascript">
$('#articles_date_available').datepicker({
  dateFormat: 'yy-mm-dd'
});
</script>    
    </form>

-delete the folder admin/includes/javascript/

======================================

When duplicating an article with "articles_date_available" NULL, the duplcate article's "articles_date_available" will be "0000-00-00 00:00:00".
When you later modify the duplicated article, the "articles_date_added" will be "0000-00-00 00:00:00".

-find around line 357

           tep_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, articles_is_blog, articles_sort_order, authors_id) values (now(), '" . tep_db_input($article['articles_date_available']) . "', '0', '" . (int)$sort_order . "', '" . (int)$article['authors_id'] . "')");

-replace with (this also fixes the missing value of "articles_is_blog" retrieved in the previous SELECT)

            tep_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, articles_is_blog, articles_sort_order, authors_id) values (now(), " . (isset($article['articles_date_available']) ? "'" . tep_db_input($article['articles_date_available']) . "'" : 'DEFAULT') . ",'0','" . tep_db_input($article['articles_is_blog']) . "', '" .(int)$sort_order . "', '" . (int)$article['authors_id'] . "')");
            

 

Share this post


Link to post
Share on other sites

I am using 7.1 and added this to 2.3.4.1

In admin I have Article Manager at both the top and bottom in the left column as well as in configuration.

When I click on configuration everything works with the exception of a few items.

Display abstract in article listing

Display date added in article listing

both are set to true and clicking edit goes back to configuration window.

I rechecked all the file mods only mod in question would be: /catalog/tell_a_friend.php

Quote

/catalog/tell_a_friend.php

FIND (about line 153):

<!-- body_text //-->
<?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo sprintf(HEADING_TITLE, $product_info['products_name']); ?></td>

Untouched 2.3.4.1 tell_a_friend and there is no code as above.

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  if (!tep_session_is_registered('customer_id') && (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }

  $valid_product = false;
  if (isset($HTTP_GET_VARS['products_id'])) {
    $product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
    if (tep_db_num_rows($product_info_query)) {
      $valid_product = true;

      $product_info = tep_db_fetch_array($product_info_query);
    }
  }

  if ($valid_product == false) {
    tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id']));
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND);

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
    $error = false;

    $to_email_address = tep_db_prepare_input($HTTP_POST_VARS['to_email_address']);
    $to_name = tep_db_prepare_input($HTTP_POST_VARS['to_name']);
    $from_email_address = tep_db_prepare_input($HTTP_POST_VARS['from_email_address']);
    $from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
    $message = tep_db_prepare_input($HTTP_POST_VARS['message']);

    if (empty($from_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_NAME);
    }

    if (!tep_validate_email($from_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_ADDRESS);
    }

    if (empty($to_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_NAME);
    }

    if (!tep_validate_email($to_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_ADDRESS);
    }

    $actionRecorder = new actionRecorder('ar_tell_a_friend', (tep_session_is_registered('customer_id') ? $customer_id : null), $from_name);
    if (!$actionRecorder->canPerform()) {
      $error = true;

      $actionRecorder->record(false);

      $messageStack->add('friend', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES : 15)));
    }

    if ($error == false) {
      $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
      $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], STORE_NAME) . "\n\n";

      if (tep_not_null($message)) {
        $email_body .= $message . "\n\n";
      }

      $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id'], 'NONSSL', false)) . "\n\n" .
                     sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");

      tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);

      $actionRecorder->record();

      $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');

      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id']));
    }
  } elseif (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
    $account = tep_db_fetch_array($account_query);

    $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $from_email_address = $account['customers_email_address'];
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . (int)$HTTP_GET_VARS['products_id']));

  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<h1><?php echo sprintf(HEADING_TITLE, $product_info['products_name']); ?></h1>

<?php
  if ($messageStack->size('friend') > 0) {
    echo $messageStack->output('friend');
  }
?>

<?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . (int)$HTTP_GET_VARS['products_id']), 'post', '', true); ?>

<div class="contentContainer">
  <div>
    <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
    <h2><?php echo FORM_TITLE_CUSTOMER_DETAILS; ?></h2>
  </div>

  <div class="contentText">
    <table border="0" cellspacing="2" cellpadding="2" width="100%">
      <tr>
        <td class="fieldKey"><?php echo FORM_FIELD_CUSTOMER_NAME; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('from_name'); ?></td>
      </tr>
      <tr>
        <td class="fieldKey"><?php echo FORM_FIELD_CUSTOMER_EMAIL; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('from_email_address'); ?></td>
      </tr>
    </table>
  </div>

  <h2><?php echo FORM_TITLE_FRIEND_DETAILS; ?></h2>

  <div class="contentText">
    <table border="0" cellspacing="2" cellpadding="2" width="100%">
      <tr>
        <td class="fieldKey"><?php echo FORM_FIELD_FRIEND_NAME; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('to_name') . '&nbsp;<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>'; ?></td>
      </tr>
      <tr>
        <td class="fieldKey"><?php echo FORM_FIELD_FRIEND_EMAIL; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('to_email_address') . '&nbsp;<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>'; ?></td>
      </tr>
    </table>
  </div>

  <h2><?php echo FORM_TITLE_FRIEND_MESSAGE; ?></h2>

  <div class="contentText">
    <table border="0" cellspacing="2" cellpadding="2" width="100%">
      <tr>
        <td class="fieldValue"><?php echo tep_draw_textarea_field('message', 'soft', 40, 8); ?></td>
      </tr>
    </table>
  </div>

  <div class="buttonSet">
    <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>

    <?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'triangle-1-w', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id'])); ?>
  </div>
</div>

</form>

<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Closest code is:

<?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . (int)$HTTP_GET_VARS['products_id']), 'post', '', true); ?>

but no table attributes all <div>

Other code not found as well.

Any help or ideas would be greatly appreciated

Share this post


Link to post
Share on other sites

@Dnj1964You don't mention what version of this addon you are using or if you are using the official or CE version of oscommerce so I'm limited in helping you. But the fact that you have two sections in admin means there is an installation mistake. That needs to be fixed before anything else is done.

 

Share this post


Link to post
Share on other sites
10 hours ago, Jack_mcs said:

@Dnj1964You don't mention what version of this addon you are using or if you are using the official or CE version of oscommerce so I'm limited in helping you. But the fact that you have two sections in admin means there is an installation mistake. That needs to be fixed before anything else is done.

 

I am using the official version downloaded from the oscommerce site.

And installed Articles Manager 1.57_8

 

Share this post


Link to post
Share on other sites
1 hour ago, Dnj1964 said:

I am using the official version downloaded from the oscommerce site.

And installed Articles Manager 1.57_8 

 

As to why I can't set had a look at the database install file and in both Display Abstract and Display Date the configuration is only set to true no option to set to false.

Should now just be a simple database change.

 

      $lines[] = "INSERT INTO configuration (" . $fields       . ") VALUES ('Display Topic in Article Listing', 'DISPLAY_TOPIC_ARTICLE_LISTING', 'true', 'Display the Topic in the Article Listing?', '" . $configuration_group_id . "', '" . ($sortID++). "', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL)";
      $lines[] = "INSERT INTO configuration (" . $fields       . ") VALUES ('Display Abstract in Article Listing', 'DISPLAY_ABSTRACT_ARTICLE_LISTING', 'true', 'Display the Abstract in the Article Listing?', '" . $configuration_group_id . "', '" . ($sortID++). "', 'tep_cfg_select_option(array(\'true\', ', now(), NULL)";

      $lines[] = "INSERT INTO configuration (" . $fields       . ") VALUES ('Display Date Added in Article Listing', 'DISPLAY_DATE_ADDED_ARTICLE_LISTING', 'true', 'Display the Date Added in the Article Listing?', '" . $configuration_group_id . "', '" . ($sortID++). "', 'tep_cfg_select_option(array(\'true\', ', now(), NULL)";

      $lines[] = "INSERT INTO configuration (" . $fields       . ") VALUES ('Display Topic/Author Filter', 'ARTICLE_LIST_FILTER', 'true', 'Do you want to display the Topic/Author Filter?', '" . $configuration_group_id . "', '" . ($sortID++). "', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL)";

 

As for why Article shows top and bottom and in Configuration as well, that is a mystery, have rechecked the coding 3 times.

Only file that has any code mis-match is /catalog/tell_a_friend

The difference are mostly $HTTP_GET_VARS['products_id'] in the Article Manager and (int)$HTTP_GET_VARS['products_id'] in the OSC file

 

 

 

Share this post


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

I am using the official version downloaded from the oscommerce site

That's too bad for a number of reasons. But as far as this addon is concerned, you probably should use the BS version for the installation. The  2.3 version is for an older version of the official version (there are too many versions to have files for all of them).

For the database, if you run the article_manager_update_configure.php file it should correct the database settings.

For the tell-a-friend changes, unless your file has been altered, it is best just to replace it with the one in the BS directory.

Unfortunately, there are a number of things that may cause the installation to fail due to the addon not being updated in a while. I do apologize for that. I have a new version here that addresses those problems but it is not ready for release. I will get it finished and uploaded but it won't be son, I'm sorry to say.

Share this post


Link to post
Share on other sites

Jack_mcs

I am using Edge BS4 - was looking at Articles Manager v1.57_8 in the BS folder.

Was this updated for a BS version prior to BS4

 

Thanks

Doug

 

Share this post


Link to post
Share on other sites

The last released version still uses defined names so it won't work in the CE versions.

Share this post


Link to post
Share on other sites

To those that interested, there is a planned update, probably within the next few weeks.

Share this post


Link to post
Share on other sites

Thanks Jack.
I look forward to the update with impatience.
I have been using this addon for many years and have long been looking forward to adapting it to the community version.


Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.

Best regards,

Fredi

Share this post


Link to post
Share on other sites

@FrediIt is mostly done. I just need to find the time to do some testing and update the instructions. Hopefully it won't be too much longer.

Share this post


Link to post
Share on other sites

Hi Jack!
If this helps you, I will be happy to do the testing.

 


Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.

Best regards,

Fredi

Share this post


Link to post
Share on other sites

Thank you for the offer but at this stage that would probably slow things down.

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks Jack!

After the upgrade is complete, I will test it and let you know the results.

An important option is to save the blog format and the correct blog editing page.
Adding articles to the user, this is my opinion can be deleted.
It is advisable to make it possible to update after editing without preview, as you have done on the information pages. The option to select a visual editor can also be excluded. The editor can be added by simply adjusting the Text field.

 

Edited by Fredi

Support forum for osCommerce in russian language - from Ashkelon. Support since 2002.

Best regards,

Fredi

Share this post


Link to post
Share on other sites
23 hours ago, Fredi said:

An important option is to save the blog format and the correct blog editing page.
Adding articles to the user, this is my opinion can be deleted.

Please explain these in mode detail. I'm not sure I understand.

Also, please see the PM I sent you.

Share this post


Link to post
Share on other sites

Hello everyone


I looking for an article manager or blog addon that is compatible with v2.3.4.1 BS4.

Should be compatible with this https://apps.oscommerce.com/wXxA8&google-xml-sitemap-seo&v=23
and with this too
https://apps.oscommerce.com/36rDo&ultimate-seo-urls (I know this is for 2.2 but I could only integrate this)

so i need an article manager to v2.3.4.1 BS4.

Thx.

Share this post


Link to post
Share on other sites

@accesidA new version of this addon will be available soon. It has been most completed but there are some problems that need to be ironed out first. But, just so you know, this addon required Header Tags SEO to be installed. if you don't have that addon and don't plan to install it, this addon won't work for you,

Share this post


Link to post
Share on other sites

Thanks for the reply (I understand it... I will try first to install the Header Tag SEO)
Can you tell me if I use (https://apps.oscommerce.com/36rDo&ultimate-seo-urls) addon is the new article manager that will be redy soon, what url structure will it appear to me?
I'd like to publish articles before your addon will be redy and I'll put them in the article manager later. But now I want to upload manually edited articles in html format but in finaly format (structure) off url.

Share this post


Link to post
Share on other sites

The format is

Quote

article-name-a-ID.html

Here is an example from my site for the article with the name of "Discount Coupon versus Gift Vouchers":

https://www.oscommerce-solution.com/discount-coupons-versus-gift-vouchers-oscommerce-a-14.html

Note that the version of Article Manager on my site has changes not in the current released version but not all of the changes that will be in the next version.

Share this post


Link to post
Share on other sites

Thank you for your response.
I'm looking forward to your article manager.

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

×