Welcome, Guest
Username: Password: Remember me

TOPIC: Not allow to post ads on first level category

Not allow to post ads on first level category 1 year 8 months ago #5026

Hi,
Is there a way to not allow users to not select a subcategory on Post Ad form? I mean, I don't like users to post ads on the first level categories.

Thanks,

Jackson
The administrator has disabled public write access.

Not allow to post ads on first level category 1 year 8 months ago #5038

  • Super User
  • Super User's Avatar
  • Online
  • Administrator
  • Posts: 2765
  • Thank you received: 292
  • Karma: 40
Dear Customer,

The feature to restrict your users from posting ad to your parent category is not available in Jomclassifieds. But you can achieve this by making your sub-category field as mandatory field.

To make subcategory field mandatory :

Open your html.php file from the below path:
Root -> Components -> com_jomclassifieds -> etc -> html.php

1. Find the below code in the function "ListChildCategories"
$options[] = JHTML::_('select.option', $parent, '- ' . JText::_('SUB_CATEGORIES') . ' -');

And change it as following code
$options[] = JHTML::_('select.option', '-1', '- ' . JText::_('SUB_CATEGORIES') . ' -');

2. Find the below code in the function "ListChildCategories"
$attr .= '';

Add the below code after the above code
$attr .= "class='required validate-list'";

That's it. Now save the file and check your site.

Thanks.
The administrator has disabled public write access.

Not allow to post ads on first level category 1 year 8 months ago #5107

  • ekavet
  • ekavet's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
Ok this will restrict to post an advert to main category.

But what if i have Main category>1Sub Category>2Sub Category>3rd Sub Category or god knows how many there will be more sub category's.

How can i restrict to post in a sub category if there is more sub catorys in it?
The administrator has disabled public write access.
Time to create page: 0.220 seconds