1
mboyden
Review: Classifieds Module 2.4
  • 2010/4/13 17:33

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


This review on my site (better formatting)

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. This is a review based on implementing the module. You can see this implementation in action.

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.


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 also be removed:
- images/Thumbs.db
- templates/11classifieds_category.html


BUGS/DEFECTS
-------------------

Notes on what I ran into during implementation.

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 address the 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
The _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
lines 82-86, change:
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 j-scripts. 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/j-script" src="lightbox/js/prototype.js"></script>
<script type="text/j-script" src="lightbox/js/scriptaculous.js?load=effects"></script>
<script type="text/j-script" 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" />';
}

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/j-script" src="<{xoImgUrl scripts/jquery/lightbox-0.5.js}>"></script>
<
script type="text/j-script">
<!--
//--><![CDATA[//><!--
$(document).ready(function(){
    $(
".lightbox").lightbox({
        
fitToScreentrue,
    });
});
//--><!]]>
</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. Also note, that I use "j-script" in the code. This needs to be expanded to the real word, but I can't post that here or I get banned.

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/j-script" src="lightbox/js/scriptaculous.js?load=effects"></script>
to
<script type="text/j-script" 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[/b], 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 [i]$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 with Comments/Userinfo
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 some 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. 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.

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.

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. I can, however, appreciate coding solely for the latest version of XOOPS.

Add Listing Submit Error (Blank Page)
In addlisting.php, line 61 change:
xoops_load("xoopscaptcha");
to
xoops_load("captcha");


2
bjuti
Re: Review: Classifieds Module 2.4
  • 2010/4/13 20:16

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Great review!

Have you tried AdsLight?

3
mboyden
Re: Review: Classifieds Module 2.4
  • 2010/4/15 14:59

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


No, wasn't even aware of AdsLight; will have to take a look at it. There is also CatAds 1.53beta out now, too. Will have to look at both and see if they can do a better job. Thanks for the info.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

4
bjuti
Re: Review: Classifieds Module 2.4
  • 2010/4/15 19:16

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


No probz. :)

AFAIK none of them have no option for search by price, type etc... That's important for me.

5
deka87
Re: Review: Classifieds Module 2.4
  • 2010/4/16 6:16

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:

AFAIK none of them have no option for search by price, type etc... That's important for me.


I think you're not totally right. Catads has price search options along with category and city ones.
Mind anchors

6
Peekay
Re: Review: Classifieds Module 2.4
  • 2010/4/16 9:46

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Yes, I updated Catads to v1.53. In the search feature, you can now search for a keyword and restrict the results to a category or region etc. There is a price search field too.

Details and download link here

It is in BETA and there are still a few issues. See the changelog for details.

I do however like Classifieds very much and have recommended it more than once in the forums.
A thread is for life. Not just for Christmas.

7
bjuti
Re: Review: Classifieds Module 2.4
  • 2010/4/16 16:04

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Tnx!

8
jlm69
Re: Review: Classifieds Module 2.4
  • 2010/4/20 12:22

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


mboyden,

First I want to Thank You for taking the time to do this. It is Exactly what I needed, I just wish you did it on a 2.4.4 setup. But I went through it and this is my findings using a 2.4.4 setup.

What are the PHP, MySQL for the server that you used?

If anyone has any of these issues using a 2.4.4 setup please let me know.




1.Search Form Always Shows - I can not reproduce this error. It works fine on my servers.

2. Sort Order in Categories Not Working - Fixed Thanks for pointing that out.

3. View Ad Gives Blank Screen - You wrote:

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.

I have found a lot of little things that should work but don't in 2.4.4


4. Photo Location for Print View - I can not reproduce this on my servers

5. WYSIWYG Incompatibility - I think there are many errors in the Xoops editors in 2.4.4
The suggestions you have do not work with the 'dhtmltextarea' editor in 2.4.4
If I do this:

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

on the viewad.php page everything comes back in one line(this whole post would be on one line)

So I changed it to:

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

which I thought was basically the same as

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

and it works for dhtmltextarea

It was real tough getting the editor to not show br tags and other things throughout all pages
I should not have had the problems, thats why I say there are some issues with the editors.



6. Add Listing with FCKeditor Causes Validation Error
7. Add Listing with FCKeditor Description Has No Caption


Xoops 2.4.4 does not come with FCKeditor it is called CKeditor and the description caption is there, I also took the FCKeditor from the 2.3.3b release and it showed the caption too. But it looked very bad. but still it worked.


8. Add Photos Link in Item View - I don't consider that hard coded, it does have $mydirname, but that still is not hardcoded.
But I did change it by removing $mydirname.


9. Prototype jQuery Conflict - I will not be using j-script, but I will look at this issue.


10. Admin Edit Drop-Downs/Information Consistency - This is now fixed for the next version


11. Add Photos Doesn't Lightbox - I didn't think the submitter needed this. Other users never see this page.


12. Other Template Issues - You wrote, if the advertisement code is turned off, then the last X items doesn't show at all.
I can not reproduce this either.


13. Links Relative - Will look into this and make changes



14. Latest Listings with Photos Block Loses Images - I can't reproduce this either.


15. Blank Screen in Contact Seller for Anonymous Users - I don't see this, where do you see a link for anonymous users to use the contact form? I did see that an anonymous user could access the form directly and I have changed that for the next release. ANONYMOUS USERS are not allowed to use this form.


16. Reply Page Anonymous Submitter Links - I don't see this one either. Anonymous has no access to this page.


There seem to me more reasons I did make this ONLY for Xoops 2.4.4, not just the Captcha. A lot of stupid little things that used to work no longer did with 2.4.4.
One example, I should not have had to use 'if xoopseditor = dhtmltextarea else'

Thanks again to mboyden for his review, I really appreciate it.

Again, if any users have any of these errors with Xoops version 2.4.4 Please let me know.

Thanks,

John

Login

Who's Online

219 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits