Welcome, Guest
Username: Password: Remember me

TOPIC: Subcategories Mandatory

Subcategories Mandatory 6 months 4 days ago #6629

  • Lisa
  • Lisa's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Hi :-)

I read your instructions how to make subcategories mandatory but it doesn't seem to work for me. Can you advise what I'm doing wrong?

Here's the coding after applying suggestions in old discussions:

public static function ListChildCategories($parent = -1, $selected = -1, $uid = 0) {
$attr .= "class='required validate-list'";
if($parent <= 0 ){
return;
}

$c=0;
$options[] = JHTML::_('select.option', '-1', '- ' . JText::_('SUB_CATEGORIES') . ' -');

if($parent > 0) {
$db = JFactory::getDBO();
$query = 'SELECT * FROM #__jomcl_categories WHERE published=1 ORDER BY ordering';
$db->setQuery( $query );
$mitems = $db->loadObjectList();
$children = array();

if ( $mitems ) {
foreach ( $mitems as $v ) {
$v->name = $v->title;
$v->parent_id = $v->parent;
$pt = $v->parent;
$list = @$children[$pt] ? $children[$pt] : array();
array_push( $list, $v );
$children[$pt] = $list;
}
}
$categories = JHTML::_('menu.treerecurse', $parent, '', array(), $children, 9999, 0, 0);

foreach ( $categories as $item ) {
$item->treename = JString::str_ireplace(' ', '-', $item->treename);
$options[] = JHTML::_('select.option', $item->id, $item->treename );
$c = 1;
}

$attr = 'onchange="ListExtraFields(this.options[this.selectedIndex].value, ' . $uid . ');"';
if($c == 0 ) {
$attr .= ' class="jomcl-hide"';
}
$attr .= "class='required validate-list'";
}

Thank you for your help!
The administrator has disabled public write access.

Subcategories Mandatory 6 months 4 days ago #6631

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

Kindly send your site URL, FTP details and Joomla admin details to This email address is being protected from spambots. You need JavaScript enabled to view it. . So that we will check and update you.

Thanks.
The administrator has disabled public write access.
Time to create page: 0.212 seconds