Jump to Main Content
Content > XOOPS > Classifieds Module for XOOPS
Classifieds Module for XOOPS

The Classifieds module is the only available module that provides a classified ad type of functionality -- somewhat similar to an abbreviated Craigslist and/or BuyItNow on eBay.

Latest Version: 2.4 | Website | Support Forum

I first played with this module in the 1.x version and it did the job then, and it still does the job now. I had need to implement another and started with the 2.0RC2, put it on hold for a long time, and then got back to it in 2.3 and ended up with the 2.4 release (for XOOPS 2.4.4 but implemented on a XOOPS 2.3.3b installation). The module is currently developed by jlmzone who also does the excellent Jobs module and it's his adaptation of the myAds module that has been abandoned which might account for the number of issues I ran into with the module.

Summary

Functionality Includes:

  • User / Admin submission
  • Moderation / Admin approval
  • Inline Advertisements
  • WYSIWYG Editor choice
  • Multiple-layer subcategories, with category permission
  • Cloneable

Overall the module does the job well, and certainly is recommended to those who need the functionality, especially since there really isn't anything else out there that fits the bill. As with any module I put in service, I ran into a a number of issues -- some bugs and the usual struggles implementing the presentation layer due to too much HTML code being passed as data (the solution being either rewrite the functional layer code, or using Smarty code to extract and/or change the data output).

Note that for 2.4, the documentation states that XOOPS 2.4.4+ is required and it is solely due to the change in the XOOPS implementation of Captcha and the calls related. The module is supposedly easy to clone although my notes don't cover that process (see author's notes -- incomplete).

Installation and Upgrade

Overall, install and update works fine (I started with a 2.0RC2 a couple of months back, but then worked on 2.3 and while I was implementing it, 2.4 came out, so in the end this is pretty much about version 2.4. Install like any XOOPS module. If you are upgrading, run the upgrade script as documented.

I'll note, unfortunately, that a bit of the included documentation doesn't match the published/released version. There are two README files, both out of date. However there is enough info to get you going.

The installation instructions that note which files have been removed (and thus may be deleted on update) missed a couple that also can be removed (from 2.0+ series):

  • listing-p-f.php
  • class/categories.php

Other files that can be removed:

  • images/Thumbs.db
  • templates/11classifieds_category.html

Bugs/Defects

Notes on what I ran into during implementation.

Add Listing Submit Error (Blank Page)

In addlisting.php, line 61 change:

xoops_load("xoopscaptcha");

to

xoops_load("captcha");

Search Form Always Shows

The module search form shows in Index page irrespective of the preference setting. I wanted it to show, so I didn't fix this issue.

Sort Order in Categories Not Working

None of the sort stuff was working for me. To fix, in catview.php, on or about line 40, add this line:

$orderby = !isset($_REQUEST['orderby']) ? NULL : $_REQUEST['orderby'];

View Ad Gives Blank Screen

To fix, in viewad.php, change line 266 from:

$user_profile = XoopsUserUtility::getUnameFromId($usid);

to

$user_profile = XoopsUser::getUnameFromId($usid);

Why this change works, I don't know because reviewing the code I have and know, I would think it should work as is. Not sure if this is a 2.3.x vs. 2.4.x change or not.

Photo Location for Print View

The photo location set in the module preferences isn't working for the Print View.

$friend in Template but No Data

_item.html template uses variable $friend (for send to a friend), but there is no data provided to the template. The link is easily created, though, and belongs in the HTML anyways.

WYSIWYG Incompatibility

There are multiple issues in the code surrounding the adding, displaying, and modifying the listing descriptive information/text. When the listing is added, the code is run through the text sanitizer and it's also run through it again upon pulling it out of the database, and they aren't compatible nor does the module always check to see if the WYSIWYG editor is in use. Realistically, per XOOPS methods, each article should be attributed as to whether or not HTML is used (as well as smilies, images, xcode, etc.). This would make it much easier to get the code to be compatible with whatever DTD is in use, too.

Based on the design, it appears the code wants to "fix" it on the way in (to the database) and then allow everything on the way out (of the database) (except for adding line breaks a 2nd time of course nor images since there is a separate image gallery facility for that). The files that must be dealt with are: addlisting.php, viewad.php, admin/index.php,

addlisting.php

lines 82-86 deal with the descriptive text. I changed:

if ($xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
$desctext = $myts->displayTarea($_POST["desctext"],0,0,0,0,0);
} else {
$desctext = $myts->displayTarea($_POST["desctext"], 1,1,1,1,1);
}

to:

if ($xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') { // (text,html,smiley,xcode,image,br)
$desctext = $myts->displayTarea($_POST["desctext"],0,1,1,0,1);
} else {
$desctext = $myts->displayTarea($_POST["desctext"],1,1,1,0,0);
}

viewad.php

change line 149:

$desctext = $myts->displayTarea($desctext,1,1,1);

to:

$desctext = $myts->displayTarea($desctext,1,1,1,0,0);

sendfriend.php

change line 94 from:

$desctext = $myts->displayTarea($desctext,1,1,1,1,1);

to:

$desctext = $myts->displayTarea($desctext,1,1,1,0,0);

print.php

change line 29 to 1,1,1,0,0

Add Listing with FCKeditor Causes Validation Error

Because of the way the XOOPSform validation j-script works, when using FCKeditor, the user always gets an error on the field filled with the WYSIWYG content. The only fix I currently have is to disable that part of the validation script: change 'true' to 'false' in addlisting.php on line 272.

Add Listing with FCKeditor Description Has No Caption

In include/functions.php, before line 357, add:

$editor_configs["caption"] = $caption;

Add Photos Link in Item View

The Add Photos link (smarty var $add_photos) in the item view page has ../modulename/ in the hard-coded link (with URL and text). I ended up replacing the link overall it since it doesn't do what I wanted from a display point and it's otherwise hard-coded HTML.

Prototype jQuery Conflict

The lightbox implementation of the photo gallery uses Prototype, Scriptaculous and Lightbox javascripts. Unfortunately, it conflicts with the jQuery setup I've been using. There are workarounds to allow both; however, there are lightbox plugins for jQuery, and that is the route I took as it seemed to be the path of least resistance. Found in both view_photos.php and viewad.php.

To deal with the issue, I made the following changes (view_photos.php, lines 176-187, viewad.php lines 279-290) from:

if ($xoopsModuleConfig["".$mydirname."_lightbox"] == 1) {

$header_lightbox = '<script type="text/javascript" src="lightbox/js/prototype.js"></script>
<script type="text/javascript" src="lightbox/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="lightbox/js/lightbox.js"></script>
<link rel="stylesheet" href="include/yogurt.css" type="text/css" media="screen" />
<link rel="stylesheet" href="lightbox/css/lightbox.css" type="text/css" media="screen" />';

} else {

$header_lightbox = '<link rel="stylesheet" href="include/yogurt.css" type="text/css" media="screen" />';
}

to

if ($xoopsModuleConfig["".$mydirname."_lightbox"] == 1) {

$header_lightbox = '<link rel="stylesheet" href="include/yogurt.css" type="text/css" media="screen" />';

} else {

$header_lightbox = '<link rel="stylesheet" href="include/yogurt.css" type="text/css" media="screen" />';
}

In viewad.php, edit lines

Then, add your jQuery into the template itself for these two screens (_view_photo.html and _item.html). What I added:

<link rel="stylesheet" type="text/css" media="screen" href="<{xoImgUrl scripts/jquery/lightbox/css/lightbox.css}>" />
<script type="text/javascript" src="<{xoImgUrl scripts/jquery/lightbox-0.5.js}>"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$(document).ready(function(){
    $(".lightbox").lightbox({
        fitToScreen: true,
    });
});
//--><!]]>
</script>

I guess that one could put this same code into those applications, but I'm against HTML in the functional layer, so I didn't.

Admin Edit Drop-Downs/Information Consistency

The option for Contact by isn't a drop-down so bad information could be edited here. Same for Premium Listing (Y/N). We are admins, though, right?

Add Photos Doesn't Lightbox

The add photos and image gallery section didn't do the lightbox popup. The problem is that the scriptaculous builder wasn't being loaded. To fix, in view_photos.php, change line 179 from:

<script type="text/javascript" src="lightbox/js/scriptaculous.js?load=effects"></script>

to

<script type="text/javascript" src="lightbox/js/scriptaculous.js?load=effects,builder"></script>

Other Template Issues

I found some HTML nesting errors in the templates. Also, the classifieds_index.html and category_index.html uses an if statement for use_extra_code that encapsulates the entire foreach that displays the New Listings on the index page; thus if the advertisement code is turned off, then the last X items doesn't show at all. It should be the reverse of that. Additionally, some of the templates were provided data that wasn't put to use yet could be.

Fixed in 2.4 (from 2.3 release which was what I started implementing with before the release of 2.4)

  • Missing Images: sort-by graphics up_active.gif and down_active.gif (I visited the author's site and saved the from the web browser and uploaded them to my installation).
  • Category Page - Sort Order: The sort order information wasn't being passed to the template and thus none of that was working correctly. Now it works in 2.4.

Links Relative

The links used in this module are often times relative. That can work, but not always. Some even suppose there is no interim directory between the server root and the main XOOPS root or that the preferences setting for photos location is still left in the default location.

Latest Listings with Photos Block Loses Images

If the photos preferences are set to something other than the default, then if the Latest Listings with Photos block is used anywhere but in the module, then the thumbnail images won't show. This is because the URL is hard-coded to the default, so I first changed it to $updir, but that only worked where the module was the same since it was dependent upon the global $xoopsModuleConfig instead of getting the actual configuration info. So, I edited ./blocks/ads_2.php, before line 27, I added:

$module_handler= & xoops_gethandler('module');
$thisModule = $module_handler->getByDirname($blockdirname);
$config_handler =& xoops_gethandler('config');
$thisModuleConfig =& $config_handler->getConfigsByCat(0, $thisModule->mid());

then, I changed every instance of $xoopsModuleConfig (except the global definition) to $thisModuleConfig and I removed $xoopsModuleConfig, $blockdirname, and $block_lang from the globals definition (they are defined in the function as should be).

Blank Screen in Contact Seller for Anonymous Users

In contact.php, change line 78 from:

$r_usid = $xoopsUser->getVar("uid", "E");

to:

$r_usid = (is_object($xoopsUser)) ? $xoopsUser->getVar("uid", "E") : 0;

Reply Page Anonymous Submitter Links

The reply page links the from to the submitting user, and even if the ID is 0 (zero) for the anonymous user. There should be no link if the user is anonymous. To fix, in replies.php, change line 95 from:

$xoopsTpl->assign('submitter', " <a href='".XOOPS_URL."/userinfo.php?uid=$r_usid'>$submitter</a>");

to:

$xoopsTpl->assign('submitter', (($r_usid > 0) ? "<a href='".XOOPS_URL."/userinfo.php?uid=$r_usid'>$submitter</a>" : $submitter));

Enhancement Requests

Of course, I always want more. Most of my requests come from having used eBay and Craigslist and making Classifieds be more aligned with those paradigms that most folks are already familiar with and striving towards a common usability level across the site and all modules.

HTML Out of Functional Layer and Into Presentation Layer

There is still too much HTML in the data passed to the template, but this isn't the only module that does that. Break up more of the HTML into data and pass it to the template, and then code the HTML in the templates per presentation layer tactics (i.e., I have to use smarty replace and regex_replace for too many things to get it to display as desired).

Categories Without Items But With SubCategories With Items Should Display SubCategory Items

I think the title says it all. The last X items should display when any of the current category's subcategories contain items sort of like the main index page does for all categories, but in this case for that category. I guess I sorta understand why not. Maybe it should show (and designate clearly) when the current category has no items, but there are some in the subcategory. There is certainly some logic in this.

Real Name v Login Name

Security-wise, it's always best to have a display name different from the login. This module doesn't offer the choice to use Real Name instead of the user login. I had to edit the code in a couple of places where I couldn't fix it in the templates.

Anonymous Ratings

The system allows anonymous ratings. You can obfuscate them by not linking to them for non-users, but the rating system still works. There is no preference related to such to disallow; at least it checks to only allow one per IP per day although most don't change any more, and realistically with gateways and such for the likes of AOL, there needs to be another method. Personally, I only want registered users to be able to rate/vote.

Self Ratings

Even though it is discouraged, a user may still rate themselves and their item. The system shouldn't allow it IMHO.

Ratings

Ratings need comments and links to who actually made the ratings (thus no anonymous seller ratings even if I can roll with anonymous item ratings)

Send Friend/Contact Seller

Both of these are very similar in nature. Unfortunately, there are a number of issues with these pages/tools.

Use Smarty Templates

These pages (don't even use XOOPSforms and) hard-codes the HTML in the functional layer making it harder to affect a good presentation layout to match the site without tackling the functional layer (not too hard, though). My recommendation is to at least do what is done with the Add Listing page/function (using XOOPSforms and passing that as a single variable). Better yet, pass it all as data and deal with it in the presentation layer (still my favorite for having the total layout control my clients desire).

Send Friend without Variables

If the listing id is missing you can still send to someone something. Maybe. Also, _RETURNGLO constant doesn't exist - the error received when no op variable is passed at all. And anonymous users can use the form (a security vulnerability). Without a valid active listing, it should fail.

XOOPS 2.3.x vs XOOPS 2.4.x+ compatibility

The main issue about compatibility has been using the Captcha system and when using xoops_load() function to specify the older style of "captcha" instead of "xoopscaptcha". XOOPS 2.4.x is backwards compatible with that since the xoops_load function looks for the old method and replaces it with the new method. If you do a search and replace of all these, then you'll likely be fine using this module pre-XOOPS 2.4.x. The module could probably do a quick XOOPS version check and do the load either way if backwards compatibility was desired. Not everyone wants to update/upgrade immediately, especially if you've done any hacking at all to the site and/or if there are module compatibility issues. Either way, you have to test each XOOPS upgrade before deploying to production and that can be time consuming.

Send Friend Doesn't Track IP Address

The Contact Seller tracks and displays IP address and a warning. Send Friend doesn't do that and likely should, especially if/as it can be used by anonymous users.


Other Pages
Previous Page Profile Module xcGallery Next Page
 
Comments are solely the opionion of the author and not to be construed as the opinion of anyone else.
Login
 

 

 

(c) 2006-2007 - Mark Boyden
Privacy - Legal Stuff - Contacts