Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Article Manager v1.0


RobAnderson

Recommended Posts

Hi Rob and others,

 

I've also installed this ecellent mod and like a lot, so thanks for coding it!

 

I'd like to modify it a bit, and could use some pointers:

 

I want to change the articles.php so that when I click All AArticles link, I get a listing of all articles, sorted out according to their topics. In this manner:

 

Topic 1

Article

Article

Article

 

Topic 2

Article

Article

Article

 

How would you make this, with an additional while loop or something?

Link to comment
Share on other sites

Article Manager v1.2 has just been released and includes a number of minor bug fixes. Please visit http://www.oscommerce.com/community/contributions,1709 to catch up on these.

 

I would like to thank everybody who has posted suggestions for enhancements to this popular contribution (Randy et al ;-). A number of these are planned for Version 2 when I find the time to cobble them together!

 

Suggestions include:

- searching

- ability to contribute articles

- authors' page

- lots of modules, e.g.

- featured author,

- news style listing

- top 10 articles

- topic lists

 

See http://www.oscommerce.com/forums/index.php?sho...ndpost&p=270378 for a discussion on these and more...

 

Please keep the great ideas coming ;-)

 

Regards, Rob

Link to comment
Share on other sites

Hi Juha, in response to your question:

I want to change the articles.php so that when I click All AArticles link, I get a listing of all articles, sorted out according to their topics. In this manner:

 

Topic 1

Article

Article

Article

 

Topic 2

Article

Article

Article

 

How would you make this, with an additional while loop or something?

I think the best way to do this would be to modify the Browse by Categories contribution which is based on Categories/Products and change it to display Topics/Articles (the architecture is essentially the same). This should produce a similar layout to what you are after and could be inserted as a module in place of the default listing produced in the articles.php page.

 

This may well be included in a future release, but sorry I don't have working example for you yet (Randy?).

 

Regards, Rob

Link to comment
Share on other sites

Hi Lonnie, about your search idea ;-)

 

Is this search going to provided via an infobox?  If there is a choice I would vote for having a page with a search box at the top and the article folders below.  Also a back button would be great for the article pages.  I picture something like the image below (search box was taken from Invision Board).  Just an idea.

 

article_manager.jpg

Hmmm, nice idea, a bit like a Yahoo directory and search combined. I was originally thinking of reproducing the default search fucntionality of OSC, i.e. search infobox and advanced search page, but I like your idea better (more functional).

 

The problem is that it might stretch my programming skills a bit more, so if you're not in a hurry...

 

Rob ;-)

Link to comment
Share on other sites

Hi Juha, in response to your question:

 

I think the best way to do this would be to modify the Browse by Categories contribution which is based on Categories/Products and change it to display Topics/Articles (the architecture is essentially the same). This should produce a similar layout to what you are after and could be inserted as a module in place of the default listing produced in the articles.php page.

 

This may well be included in a future release, but sorry I don't have working example for you yet (Randy?).

 

Regards, Rob

hmm, would it that hard to modify articles.php in your mod to do this? I mean, it's quite easy to order the articles by topic and date as it is, just by editing the 'ORDER BY' in the query.

 

After that all I had to do would be to come up with a routine that lists the articles under each topic title. That way I could get rid of the topic name listed for each article on the right side of the page.

 

I might also add that I don't use nested topic categories, just one level of them. Plus in the articles box, I have only All Articles listed.

 

What do you think?

Link to comment
Share on other sites

Rob,

 

The one thing I was thinking about with the article manager was to be able to have articles in specific parts of the web site. I have a ton of extra room at the bottom of my pages and If you could put specific articles under the new products for the month are refferring to the category of product you are looking for. ie: Suspension Articles in the Suspension category. Take a peek at the site to get a better idea.

http://www.sinister-racing.com/catalog/ind...p?cPath=103_100

 

Imagine a few articles underneath the new products for december, say 4.

They would be displayed as:

 

ARTICLE TITLE By: Whoever

blah blah blah.. The article starts

and there is a designated size for the article to fit in

say 200 x 200 area box and at the bottom of

the preview of the article it says

Check out the rest of the story.....

as a hyperlink to the actual full article.

 

Just an Idea but I think many people would realy like it if it had the feature.

 

Thanks,

 

Mike

Link to comment
Share on other sites

Rob,

 

The one thing I was thinking about with the article manager was to be able to have articles in specific parts of the web site. I have a ton of extra room at the bottom of my pages and If you could put specific articles under the new products for the month are refferring to the category of product you are looking for. ie: Suspension Articles in the Suspension category. Take a peek at the site to get a better idea.

http://www.sinister-racing.com/catalog/ind...p?cPath=103_100

 

Imagine a few articles underneath the new products for december, say 4.

They would be displayed as:

 

ARTICLE TITLE By: Whoever

blah blah blah.. The article starts

and there is a designated size for the article to fit in

say 200 x 200 area box and at the bottom of

the preview of the article it says

Check out the rest of the story.....

as a hyperlink to the actual full article.

 

Just an Idea but I think many people would realy like it if it had the feature.

Hi Mike, that's a really good idea. A bit like the cross-sell module but related to topics instead of products. I'll add that to my list!

 

Thanks very much for your suggestion, I'm going to have a lot of great ideas for the next version. I'm only sorry I don't have the time to devote to it right now (with Christmas looming).

 

I hope you understand ;-)

 

Regards, Rob

Link to comment
Share on other sites

Hi Juha, in response to your question:

 

I think the best way to do this would be to modify the Browse by Categories contribution which is based on Categories/Products and change it to display Topics/Articles (the architecture is essentially the same). This should produce a similar layout to what you are after and could be inserted as a module in place of the default listing produced in the articles.php page.

 

This may well be included in a future release, but sorry I don't have working example for you yet (Randy?).

 

Regards, Rob

hmm, would it that hard to modify articles.php in your mod to do this? I mean, it's quite easy to order the articles by topic and date as it is, just by editing the 'ORDER BY' in the query.

 

After that all I had to do would be to come up with a routine that lists the articles under each topic title. That way I could get rid of the topic name listed for each article on the right side of the page.

 

I might also add that I don't use nested topic categories, just one level of them. Plus in the articles box, I have only All Articles listed.

 

What do you think?

Hi Juha, yeah, given that you're only dealing with one level of articles, then your suggestion would be the way to go. I guess I was thinking of multiple levels (and as you've seen from my bug fixes, there are some people out there that want 3+ levels of articles!!!). For my part, like you, I wrote this contribution with only one level in mind (but naturally wanted it to support more).

 

Dang, OSC is so damn flexible, it's hard to cater for everybody ;-)

 

Looking at what you're trying to do then, a simple sort by topics and then article name should do it with a bit of tweaking (removing the topics as you mentioned). The rest is just layout really which is straight HTML stuff.

 

By all means send me some code if you get stuck. I'll try my best ;-)

 

Regards, Rob

 

BTW. How do you have only articles listed in the articles box, yet are using one level of topics. Did I miss something?

Link to comment
Share on other sites

BTW. How do you have only articles listed in the articles box, yet are using one level of topics. Did I miss something?

Rob,

 

I put my 'articles' link in a box which also contains 'news', 'forum', 'FAQ' and 'links' -links. I simply removed all the subcategory stuff and the authors box and added the other links. I made the 'articles' link from 'all articles' link just by changing its name.

 

I also have a 'latest articles' box on my main body. It lists the 5 latest articles (just like in the latest news which I also have.)

 

I wanted to simplify the articles category structure as far as possible.

 

That's why I also would like to have a simple listing of all articles by topics when you click the 'articles' link.

 

About the code, I am thinking that I should divide the sql query in two parts. A bit like this:

 

query first topic

list the topic

query articles under this topic

list the articles

 

query second topic

list the topic

query articles under this topic

list the articles

 

...etc. The article query & list part is there already but I need to figure out how to get the correct topic first before the articles and keep looping this until all topics are covered. That's why I suggested using an additional while loop around the original which would handle the topics.

 

I am learning PHP slowly but steadily, so I should figure out this eventually but I certainly could use some pointers, and pelase do let me know if my reasoning is faulty here.

 

Cheers!

Link to comment
Share on other sites

Okay... I must admit I have been lurking for the last couple of days... while working on further enhancements for Article Manager, as well as the WishList module.

 

Yes, Rob, your are right, osCommerce is so damn flexible.

 

Here are the feature enhancements I have accomplished so far...

 

1. I have created an Main Articles Page which acts as an entry into the Articles system.

2. Main Article Page contains the following...

  • Full Main Topic / Sub-Topic listing
  • You can choose Text or Image display style for the Main Topic / Sub-Topic listing via setting in Admin
  • Most Popular Articles (how many can be set in Admin)
  • Featured Articles (settings in Admin for which Articles and how many are displayed)
  • Author Showcase displaying info about Author and his/her image
  • All above features are moduler and can be turned on and off in Admin
  • Link to list ALL Articles
  • Search Articles Box

3. Added Image field to Topics

4. Added additional fields to the Author

5. Added character limit to the Articles so it will split the pages if the Article happens to be long. This way, if the Article is long, the page won't also get long. A page link has been added to continue the next page of the Article.

 

We all know how difficult it is as we continue adding infoBoxes to the columns... the page just keeps getting longer and longer and longer. Having a Main Article Page eliminates the need for an additional infoBox to display the Topic and Articles. Now, a single link can be placed anywhere on your site, to direct the user to the Main Articles Page, where they can navigate from there.

 

To answer your question, yes, I have this all working on a Demo "Super-Store" I am working on, but the site is not completed yet and do not want to allow access until it is completely bulletproof and ready. As soon as its ready, I will post a link to the working version. I appreciate your patience and understanding.

 

I'm not telling everyone about this so I can tease you with it. I simply wanted to chime in and let everyone know that all of these enhancement suggestions are being worked on, and in some cases, already completed. I will be working with Rob to package all of these new enhancements into the next major release of Article Manager. Again, I appreciate your patience and understanding.

 

Rob, let me know when you are ready to start work on the next major release.

 

By the way, I like the idea about having an associated articles listing on the products page. I will add this in tonite.

 

-R

Link to comment
Share on other sites

Great Contribution...but I'm still not there.

 

I'm using MS2 and STS (Simple Template System) with Header Tags already installed.

 

Admin works fine

Catalog Side bars infoboxes show fine

 

1. If I click an author in the infobox AUTHORS I get the correct page with text but the page is not wrapped by my theme plus the following error:

Fatal error: Call to undefined function: clean_html_comments() in C:\xampp\htdocs\catalog\includes\modules\article_listing.php on line 66

 

2. Clicking "New Articles" I get this error:

Fatal error: Call to undefined function: clean_html_comments() in C:\xampp\htdocs\catalog\includes\article_header_tags.php on line 134

 

3. Clicking "All Articles" I get the same as number 1 above but with this error:

Fatal error: Call to undefined function: clean_html_comments() in C:\xampp\htdocs\catalog\articles.php on line 350

 

4. Clicking my 1 topics "Practice Tips" I get the same type of page as problem 1 and 3 above but with this error:

Fatal error: Call to undefined function: clean_html_comments() in C:\xampp\htdocs\catalog\includes\modules\article_listing.php on line 66

 

 

I remember a clean_html_comments() error when I had STS and header tags both trying to clean_html_comments. Does that ring a bell?

 

I've uploaded my site to:

http://sirius.mgs.vic.edu.au/~rag/catalog

 

It's a slow upload to my test server so it may take some time until it can be seen Maybe someone could try it out to see in a few hours?

 

Thanks,

Rob

Link to comment
Share on other sites

GOTCHA!

 

If you are using STS 1.8 you and Header Tags may be be experiencing the above problem with the function clean_html_comments() . It produces a vcouple of errors like:

 

 

Fatal error: Cannot redeclare clean_html_comments() (previously declared in C:\xampp\htdocs\catalog\includes\functions\clean_html_comments.php:13) in C:\xampp\htdocs\catalog\includes\functions\clean_html_comments.php on line 13

 

or

 

Fatal error: Call to undefined function: clean_html_comments() in C:\xampp\htdocs\catalog\includes\modules\article_listing.php on line 66

 

Here is how I fixed it. First of all I searched the whole site for "clean_html_comments" and found it in several files but in 2 files is was actually being included like this:

require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

 

catalog/includes/application_top.php

catalog/includes/sts_display_output.php

 

in order for this contribution (article manage) to work it needs to look for the function in application_top.php

 

THE FIX:

open catalog/includes/sts_display_output.php

comment out:

require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

 

Hope I'm making sense? It's pretty late.

 

Cheers,

Rob

:D

Link to comment
Share on other sites

Hi all...

 

I have created an addition to the articles manager.

articles tabs . from the contribution categories_tab.

to show the top topics

ied: TOPIC_1 TOPC_2 TOPIC_3 and so on...

 

I WILL CONTRIBUTE IT SO CAN BE ADDED TO ARTICLES MANAGER if you all like the idea.

 

However it would be a nice to expand it futher. such as:

 

TOPIC_1 TOPC_2 TOPIC_3 and so on...

Sub-Topic-1

 

To show the sub topic if there are any, but I am not able to added under.

 

Someone interest would like to take it further?

 

Thanks

Link to comment
Share on other sites

Rob,

 

continuing with my idea, I made a short bit of code:

 

<html>
<head>
</head>
<body>
<table>
<?php 

require('includes/application_top.php');
$lauseke=mysql_query("select topics_id, topics_name from topics_description where language_id = '1'");
while ($listaa=mysql_fetch_row($lauseke)) {
$tulos=$listaa[1];
echo "<tr><td>" . $tulos . "</td></tr>";

$klause=mysql_query("select ad.articles_id, ad.articles_name, ad.articles_head_desc_tag , a2t.topics_id from articles_description ad, articles_to_topics a2t where ad.articles_id=a2t.articles_id and a2t.topics_id='" . $listaa[0] . "' and ad.language_id='1'");
while ($artikkelit=mysql_fetch_row($klause)) {
echo "<tr><td><b>".$artikkelit[1] . "</b></td></tr>";
echo "<tr><td>".$artikkelit[2]."<br></td></tr>";
}
}
?>
</table>
</body>
</html>

 

This seems to do what I want to accomplish but in a very simplified way and using non-OSC code, so to speak.

 

I have made a few feeble attempts to integrate this into OSC but the OSC structure if a bit too complex for me. Could you guys lend a hand here, please? I am having especially hard time making correct mysql queries, I always end up with an error. Obviously there's something about the functions I don't understand.

 

As you said, Rob, the finished code should go in place of 'default page' but am I right in assuming that I can also remove most of the main page code before that?

Link to comment
Share on other sites

  • 4 weeks later...

Hi, I?m new to this and not too familiar with the complex php that is going on in oscommerce. So I wonder what exactely I have to when the install instruction says:

 

Open catalog/includes/languages/english/article_header_tags.php

IF YOU DO have the Header Tags Controller contribution installed:

- Replicate the global details from header_tags.php into the indented section at the top of the page, e.g. site e-mail address, title, keywords and description.

IF YOU DO NOT have the Header Tags Controller contribution installed:

- Complete the global details in the indented section at the top of the page, e.g. site e-mail address, title, keywords and description.

 

Can anybody teach me?

 

And - not being an English-speaker - what are "cross-sell articles"?

 

Thank you in advance,

Robert

Link to comment
Share on other sites

Hi, wonderfull contribution! Just one thing: I found the code to display the latest newsitems but I can't seem to get the code working on the frontpage. I want to show the latest 5 or 10 articles entered on the frontpaga of my store, between the welcome text and the new products. Can someone please help me out (so I can finally throw away postnuke... B) )???

 

Thanks for this great contribution!

Link to comment
Share on other sites

Something to get you going:

 

New file (new_articles.php) in modules:

 

<?php
 $articles_new_array = array();
 $articles_new_query_raw = "select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td on a2t.topics_id = td.topics_id left join " . TABLE_AUTHORS . " au on a.authors_id = au.authors_id, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name";

 $articles_new_split = new splitPageResults($articles_new_query_raw, MAX_NEW_ARTICLES_PER_PAGE);
?>
<?php
 if ($articles_new_split->number_of_rows > 0) {
   $articles_new_query = tep_db_query($articles_new_split->sql_query);
?>
<div class="cbox" id="newa">
<h2><?php echo TEXT_NEW_ARTICLES; ?></h2>
<table class="listing">
<?php
   while ($articles_new = tep_db_fetch_array($articles_new_query)) {
?>
<tr>
<td><?php echo '<a href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'name=' . tep_spider_name($articles_new['articles_name']) .'&' . 'articles_id=' . $articles_new['articles_id']) . '">' . $articles_new['articles_name']. '</a>' ?></td>
<td class="c"><?php echo '<a href="' . tep_href_link(FILENAME_ARTICLES,  . 'tPath=' . $articles_new['topics_id']) . '">' . $articles_new['topics_name'] . '</a>'; ?></td>
<td class="r"><?php echo tep_date_long($articles_new['articles_date_added']); ?></td>
</tr>
<?php
 } // End of listing loop
echo '</table></div>';   
} else {
?>
<?php
 }
?>

 

In index.php:

 

<?php require(DIR_WS_MODULES . 'new_articles.php');?>

 

Has some of my own html since I hate the bloat OSC generates.

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

Mazza, thanks for the tip... I created the file new_articles.php and put it in includes/modules. After that I added the code in the index.php just before:

 

// needed for the new products module shown below
   $new_products_category_id = $current_category_id;
?>
             </tr>
           </table></td>
         </tr>

 

But I get the following error.

 

Parse error: parse error in /home/immersio/public_html/shop/index.php on line 115

 

Hope you can help. My knowledge about php is very very limited...

Link to comment
Share on other sites

Does anybody have any idea how to solve my problem? (And probably someone else his problem too...)

 

If anyone is interested in the dutch translation files for this contrib... I've made them. Maybe Rob want to include them in his contrib?

Link to comment
Share on other sites

Corrected new_articles.php:

 

<?php
$articles_new_array = array();
$articles_new_query_raw = "select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td on a2t.topics_id = td.topics_id left join " . TABLE_AUTHORS . " au on a.authors_id = au.authors_id, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name";

$articles_new_split = new splitPageResults($articles_new_query_raw, MAX_NEW_ARTICLES_PER_PAGE);
?>
<?php
if ($articles_new_split->number_of_rows > 0) {
  $articles_new_query = tep_db_query($articles_new_split->sql_query);
?>
<div class="cbox" id="newa">
<h2><?php echo TEXT_NEW_ARTICLES; ?></h2>
<table class="listing">
<?php
  while ($articles_new = tep_db_fetch_array($articles_new_query)) {
?>
<tr>
<td><?php echo '<a href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $articles_new['articles_id']) . '">' . $articles_new['articles_name']. '</a>' ?></td>
<td class="c"><?php echo '<a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $articles_new['topics_id']) . '">' . $articles_new['topics_name'] . '</a>'; ?></td>
<td class="r"><?php echo tep_date_long($articles_new['articles_date_added']); ?></td>
</tr>
<?php
} // End of listing loop
echo '</table></div>';  
} else {
?>
<?php
}
?>

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

First I don't have this file sts_display_output.php, so this fix won't work for me. Any other thoughts?

 

 

in order for this contribution (article manage) to work it needs to look for the function in application_top.php

 

THE FIX:

open catalog/includes/sts_display_output.php

comment out:

require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

Link to comment
Share on other sites

Great Contribution! Easy to install..great instructions!!! Thanks

 

I do however need some assistance, please.

 

My site is at http://www.nudephotostore.com/store/

 

My Article box shows up like this:

 

BOX_HEADING_ARTICLES

 

BOX_NEW_ARTICLES (0)

BOX_ALL_ARTICLES (0)

 

 

Any idea what Ive done wrong & how I can fix it?

 

thanks

tammy

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...