Author Topic: How to show all top categories on home page even if...  (Read 508 times)

Offline mannyb

  • Sr. Member
  • ****
  • Posts: 12
  • Karma: +0/-0
How to show all top categories on home page even if...
« on: September 18, 2019, 07:07:04 AM »
How to show all top category names on homepage even if there is no links in the top categories or subcategories? It looks like it only shows categories and subcategory name only if there is a link.

I only want the top categories to show on home page. All of them even if there is no links in that category.

In the subcategory, I want all subcategory names to show too, even if there is no link in that category.

When people come to site they only see a few categories and move on because they think there is no other category to post in. With all categories out there for them to see they tend to submit there site knowing that there is more than just 5 Categories.

Any help would be appreciated.

Mann




Offline mannyb

  • Sr. Member
  • ****
  • Posts: 12
  • Karma: +0/-0
Re: How to show all top categories on home page even if...
« Reply #1 on: October 19, 2019, 09:46:53 AM »
Anyone know?

Offline azsxsaz13

  • Hero Member
  • *****
  • Posts: 46
  • Karma: +0/-0
Re: How to show all top categories on home page even if...
« Reply #2 on: February 07, 2020, 08:23:13 AM »
Hi, Mann
I also think just like you.
Мaybe Аlexa will think about that in the next version.
Change this to index.php
Code: [Select]
$arecordSet = $conn->Execute('SELECT parent.catid, parent.name, parent.parent, parent.level, parent.catimage,COUNT(digitals.softid) as counter
FROM category AS node,category AS parent,digitals
WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.catid = digitals.idcat
GROUP BY parent.name
ORDER BY node.lft desc');

with this

Code: [Select]
$arecordSet = $conn->Execute('SELECT g.catid, g.name, g.parent, g.level, g.catimage, COUNT(DISTINCT p.softid) as counter
FROM category AS g
LEFT JOIN category AS g2 ON g2.parent = g.catid
LEFT JOIN digitals AS p ON g.catid = p.idcat OR g2.catid = p.idcat
GROUP BY g.catid, g.name
ORDER BY g.lft DESC');

This works, but Alexa knows best how to do it :)
I hope I'm helping.

Offline alexa

  • Administrator
  • Hero Member
  • *****
  • Posts: 511
  • Karma: +8/-2
Re: How to show all top categories on home page even if...
« Reply #3 on: February 08, 2020, 10:45:27 AM »
Hello,

Please try with this code...

Code: [Select]
SELECT
    parent.catid, parent.name, parent.parent, parent.level, parent.catimage, parent.name as parent_name,
    count(softid) as counter
FROM
    category as node
    INNER JOIN category as parent ON
( parent.lft <= node.lft AND parent.rgt >= node.lft )
    LEFT JOIN digitals ON (digitals.idcat = node.catid)
GROUP BY
parent.catid
ORDER BY
parent.name
« Last Edit: February 12, 2020, 02:46:53 PM by alexa »

Offline mannyb

  • Sr. Member
  • ****
  • Posts: 12
  • Karma: +0/-0
Re: How to show all top categories on home page even if...
« Reply #4 on: February 15, 2020, 06:16:42 PM »
Well I tried Alexa's and I got errors. I then tired azsxsaz13 and it seems to work.

Offline alexa

  • Administrator
  • Hero Member
  • *****
  • Posts: 511
  • Karma: +8/-2
Re: How to show all top categories on home page even if...
« Reply #5 on: February 16, 2020, 09:19:47 AM »
Well I tried Alexa's and I got errors. I then tired azsxsaz13 and it seems to work.

What is the exactly error message you get?