1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Display ALL active listings under category list

Discussion in 'Technical Support' started by marketingsolutions, Mar 9, 2009.

Thread Status:
Not open for further replies.
  1. GMaps module v3 installed - next step

    Ok, I have installed the new version of your Google Maps module as you suggested.

    At present, we are not going to upgrade to the later version of 68 as there is a lot of custom coding hidden deep within the core 68 files. I will have to check my versioning history, and see if the changes we made to RC3 can be applyed to RC4.

    As per previous posts, the category.php now displays (paginated) all of the listings underneath the category selection table.

    How might I go about loading the GoogleMap? I am guessing that only initialises when either a category or a listing is selected. Is there a way to get it to load on the category.php page? Or will I have to modify the module and add a function to do that for me?

    Ben
  2. Lhotch curmudgeon

    Did you look at the readme file? It has a section descibing this new functionality and tells you what template changes ned to be made.

    Also not there are additional database configuration fields with the latest version of the module, so it should be uninstalled, new files uploaded and then reinstalled via admin to make sure theese new database changes are made. Just uploading the new files over the old ones wont accomplish a complete upgrade of the module.


    Also, RC 4 was not the latest version of v4.1. It was the last RELEASE CANDIDATE before V4.1 went into regular release so you are actually a couple versions behind. Its generally bad practice to base a production site on a beta product.
  3. Category & Template changes

    We had already made these changes, Google Maps was already displaying when a category had been selected...

    We want the Google Maps to display when just category.php is being viewed - when we are not actually IN a category. Is this possible, or will I have to modify your module to cope with this?

    So, A user clicks into a category. Google Maps was already displaying underneath the category listings. The user then clicks on the 'categories' link in the breadcrumb. This will take them to 'category.php' with no cat selection. We have now got ALL listings, broken into pages, displaying underneath the categories list. But Google maps is NOT present when you are at the top, on category.php (parent, root, whatever you want to call it).

    Is this possible?
  4. Lhotch curmudgeon

    There is actually a check in the code to prevent the map from isplaying in a category that doesnt allow ads or it would just appear as a gray box. Since you are overridding that, go into the module folder and open the file hooks.php.

    Then locate the function called "function google_maps_cat_map()" and a few lines down from the top you should see this line....

    Code:
    if($settings[DisplayGoogle]=="Y" && $settings[DisplayGoogleCatMap]=="Y" && $cat['allowads'] == "Y"){
    
    Remove the variable check on the end so it looks like this....

    Code:
    if($settings[DisplayGoogle]=="Y" && $settings[DisplayGoogleCatMap]=="Y"){
    
  5. Many Thanks

    Thats fantastic! Works exactly like our client was requesting.

    Thank you very much for the time you took to help us out with this, it is very much appreciated.

    I hope that i can return the favour and help you out sometime

    Ben
  6. Lhotch curmudgeon

    Excellent, glad it worked for you/your client.
  7. bowers01 Genius At Work

    Hi,
    I have done this but the listings only show up if you are on the category.php page, is it possible to to show the listings if i was on truckandmachinery.com.au/category.php?cat=buses how can i show all items in buses? as there are deeper categories it just shows the sub cats.
    Cheers,
    Nick
  8. wabugi Customer

    I have the same question as bowers01 (above me).
  9. Eric Barnes Guest

    I just had a look and that would not be an easy change. From what I seen you would have to edit the query in the listings class and some how pass an array of section ids to it.
  10. redking Customer

    Hi! this isn't working for me. I modified category.php, and it only shows all ads when click on browse categories.

    e-Oglasnik » Informatika

    as you can see there are ads in PC Računla (1) PC Komponente (1) but no ads are showin below from those subcategories.

    please help!
  11. wabugi Customer

    Hi redking.

    That's the point. All listings are only displayed when watching the category.php. As soon as you click on sub categories, no ads from their sub categories are being displayed.

    I've read many threads in this forum and always when it comes to this issue anyone says "we can't do it because the server load will be too high".

    Well there are other websites which CAN do it. ebay for example displays all listings from all sub categories. Ok ebay is very big and complex. They have masses of servers and nearly unlimited resources. But for a normal user this kind of displaying listings is logic and understandable.

    Let's forget the server load for a moment. Is it possible to always display all listings from a category including the listings from it's sub categories (and of course again their sub categories)?

    I really would like to be able to do this with my website and I want to see myself how dramatic the increase of the server load is.

    Don't understand me wrong. I don't want to force people to work overtime just to get me a solution ^^
    But this feature requests has been several times on this forum and maybe a more preciser answer or slution would help solving this issue.
  12. rdouglas Customer

    Hi wabugi,

    Did you find a solution to this?



  13. wabugi Customer

    Hi rdouglas,

    no I didn't find a solution yet. My website will go online in maybe 2 weeks from now on (if I have enough time to work on it) and I would really like to have this feature included.

    I already startet a feature request but it seems like this feature is not very popular.
  14. Eric Barnes Guest

    I just looked into this again and I remember now why it is so difficult.

    Here is a test I ran.

    category.php:
    Find: $options['section']=$sec;
    Replace with:
    $arr_childs = array($sec);
    $Categories->get_ids($arr_childs);
    $options['cats'] = $arr_childs;

    includes/classes/kernel/Listings.php
    add:
    $where .= ( empty($options['cats']) ) ? '': " AND p.section In (". implode(', ', $options['cats']) .")";
    inside the getAllListings method.
  15. wabugi Customer

    Hi Eric. I'm very happy that you follow this issue.

    I did what you said. Now my complete listing database is being displayed in every category ^^

    That's where I inserted the code in the listings.php:
    Code:
            function getAllListings($options, $current_row, $max)
            {
                    global $db, $class_tpl, $modules;
                    if(defined('IN_ADMIN')) {
                    $sSQL = 'SELECT * FROM '.PREFIX.'listings as p';
                    }
                    else
                    {
                       $where .= ( empty($options['cats']) ) ? '': " AND p.section In (". implode(', ', $options['cats']) .")";
    
    In Category.php I still have 2 old changes which you suggested some weeks ago. That was:
    To show all listings open category.php and find:
    $showlistings='N';

    Change to:
    $showlistings='Y';

    Find:
    $options['section']=$sec;

    Change to:
    if(isset($sec)) {
    $options['section']=$sec;
    }

    Is it possible that these changes are not compatible with the new changes? Or are these changes still needed?
  16. Eric Barnes Guest

    I knew I would open up a can of worms posting that.
    The best bet is to just start doing some debugging on your own and seeing how it all ties together. With the code I posted above it was added to stock files.
    1 people like this.
  17. wabugi Customer

    What I've done now:

    I updated my installation from v4.13 to 4.14.

    In root/category.php:
    Find: $showlistings='N';
    ChangeTo: $showlistings='Y';

    Find: $options['section']=$sec;
    ChangeTo: if(isset($sec)) {
    $arr_childs = array($sec);
    $Categories->get_ids($arr_childs);
    $options['cats'] = $arr_childs;
    }

    And I added the new code to root/includes/classes/kernel/listings.php like this:
    Code:
    function getAllListings($options, $current_row, $max)
    {
    global $db, $class_tpl, $modules;
    $where .= ( empty($options['cats']) ) ? '': " AND p.section In (". implode(', ', $options['cats']) .")";
    
    That`s a combination of the old solution displaying ALL listings in the root category and your new solution for displaing ALL listings of sub categories in their parent categories.

    This solution now seems to work! Until now I didn't find any errors.

    Thank you again for having another look at this issue. I`m very happy with that solution now ^^

    If I find any malfunctions or errors I will post them here.
  18. rdouglas Customer

    Eric,

    This works for me too. Thanks!

    PS. make sure you have category > allow ads > YES set in the admin panel


  19. pipelin Customer

    Hi,

    I used this code (I had to put category > allow ads > YES set in the admin panel, in every category. I think this code needs some change. it's not right allow ads en every category):


    category.php:
    Find: $options['section']=$sec;
    Replace with:
    $arr_childs = array($sec);
    $Categories->get_ids($arr_childs);
    $options['cats'] = $arr_childs;

    includes/classes/kernel/Listings.php
    add:
    $where .= ( empty($options['cats']) ) ? '': " AND p.section In (". implode(', ', $options['cats']) .")";
    inside the getAllListings method.

    and it works almost perfect, except when I click the menu option "browse", I got this error:

    Notice: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 SQL: SELECT id FROM class_clacategories WHERE parent_id In () in /home/content/r/a/g/ragomez79/html/includes/classes/database/mysql.php on line 143

    Notice: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND p.price BETWEEN 0 AND 99999999999 AND p.expiration > NOW() AND p.display =' at line 1 SQL: SELECT p.id, p.owner, p.title, p.featured, p.section, p.shortDescription, p.description, p.price, p.dateadded, p.expiration, p.display, p.pHighlighted, p.pBold, p.hitcount, p.url, u.username, u.state, u.city, u.country, u.extra, u.extra2, u.extra3 FROM class_clalistings AS p LEFT JOIN class_clausers AS u ON p.owner = u.id WHERE 1=1 AND p.section In () AND p.price BETWEEN 0 AND 99999999999 AND p.expiration > NOW() AND p.display = "Y" GROUP BY p.id, p.owner, p.title, p.featured, p.section, p.description, p.dateadded, p.expiration, u.state, u.city, u.country ORDER BY featured desc in /home/content/r/a/g/ragomez79/html/includes/classes/database/mysql.php on line 143

    Notice: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND p.price BETWEEN 0 AND 99999999999 AND p.expiration > NOW() AND p.display =' at line 1 SQL: SELECT p.id, p.owner, p.title, p.featured, p.section, p.shortDescription, p.description, p.price, p.dateadded, p.expiration, p.display, p.pHighlighted, p.pBold, p.hitcount, p.url, u.username, u.state, u.city, u.country, u.extra, u.extra2, u.extra3 FROM class_clalistings AS p LEFT JOIN class_clausers AS u ON p.owner = u.id WHERE 1=1 AND p.section In () AND p.price BETWEEN 0 AND 99999999999 AND p.expiration > NOW() AND p.display = "Y" GROUP BY p.id, p.owner, p.title, p.featured, p.section, p.description, p.dateadded, p.expiration, u.state, u.city, u.country ORDER BY featured desc LIMIT 0, 10 in /home/content/r/a/g/ragomez79/html/includes/classes/database/mysql.php on line 143

    Can someone help me, please?
  20. Fatih67 Customer

    IS there any solution ?

    I tried all code from forum but I have the same problem with other people.

    also I dont want to accept ads main categories

    this is very very important for me
Thread Status:
Not open for further replies.

Share This Page