Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

another article manager modification


muskokee

Recommended Posts

Hi everyone,

 

I am once again working on an article manager addition. The last one was HERE. All the code and fixes are within that thread--it adds another date option to indicate when the article was written as opposed to the date it was added or the date it is available.

 

My next mod involves showing a random article on the index page, default section (but could be placed anywhere really). I wrote the mod myself, but could not get it to behave properly..so I re-wrote this CONTRIB to work with the article table rather than the product table.

 

Problem: this behaves exactly the same way my hand coded mod does

 

What happens:

The article is randomly chosen and displayed BUT the description or short description does not get displayed each and everytime the page is loaded. The name, and link work fine...just an empty description. VERY VERY FRUSTRATING.

 

I cannot see what the problem is.

 

Anyone else?

 

<?php
  //SET THE QUERYS
$sql_query = tep_db_query("select distinct a.articles_id, ad.articles_name, ad.articles_description from " . TABLE_ARTICLES_DESCRIPTION . " ad left join " . TABLE_ARTICLES . " a on a.articles_id = ad.articles_id where a.articles_status = '1' and a.articles_protected = '1' order by rand() limit " . MAX_DISPLAY_RANDOM_ARTICLES);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_ARTICLES));

 new contentBoxHeading($info_box_contents);

  $info_box_contents = array();
 $row = 0;
 $col = 0;
 $info_box_contents = array();

 while ($new_articles = tep_db_fetch_array($sql_query))
 {
	$new_articles['articles_name'] = tep_get_articles_name($new_articles['articles_id']);
	$info_box_contents[$row][$col] = array('align' => 'center',
										   'params' => 'class="smallText" width="33%" valign="top"',
										   'text' => '<a href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $new_articles['articles_id']) . '">' . $new_articles['articles_name'] . '</a><br>'.$new_articles['articles_description'] );

	$col ++;
	if ($col > 2) 
	{
		  $col = 0;
		  $row ++;
	}
 }

 new contentBox($info_box_contents);
?>

 

Any help appreciated. :)

 

Sheri

PS - I have article manager 1.2 installed. I don't want to update the version as it is working just fine.

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...