Multi Categoria K2

  • thiagoiasd
  • Avatar de thiagoiasd Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
13 anos 4 meses atrás #72889 por thiagoiasd
thiagoiasd replied the topic: Re: Multi Categoria K2
sim ja
mas o que eu queria é tipo assim:
Matéria X teria de aparecer nas categorias A e B ao mesmo tempo entendeu?

ja usei o sistema de tags dele é legal e tudo mas o que preciso é de muitcategoria
vc sabe como fazer?

Please Entrar ou Registrar to join the conversation.

  • Marcelo Roberto
  • Avatar de Marcelo Roberto
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
13 anos 4 meses atrás #73521 por Marcelo Roberto
Marcelo Roberto replied the topic: Re: Multi Categoria K2
E ae Thiago... conseguiu alguma coisa? estou tendo o mesmo problema que você <!-- s:x --><img src="{SMILIES_PATH}/icon_mad.gif" alt=":x" title="Furioso" /><!-- s:x -->

[b:3anvu76v][color=#400000:3anvu76v][i:3anvu76v]As horas de loucura são medidas pelo relógio; mas nenhum relógio mede as de sabedoria. (William Blake)[/i:3anvu76v][/color:3anvu76v][/b:3anvu76v]

[b:3anvu76v][color=#400000:3anvu76v]Skype:[/color:3anvu76v][/b:3anvu76v] marcelormoliveira
[b:3anvu76v][color=#400000:3anvu76v]MSN:[/color:3anvu76v][/b:3anvu76v] <!-- e --><a href="Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.">Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.</a><!-- e -->

Please Entrar ou Registrar to join the conversation.

  • thiagoiasd
  • Avatar de thiagoiasd Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
13 anos 3 meses atrás #73600 por thiagoiasd
thiagoiasd replied the topic: Re: Multi Categoria K2
então encontrei um pluginque faz isso tanto no k2 como no proprio joomla
porem ele custa 50 dolares cada um (k2 2 joomla) e estou sem grana no momento
se alguem tiver um plugin semelhante ou algum outro métodoo para isso eu agradeço
segue o link deles
K2: http://extensions.joomla.org/extensions ... ions/17402
Joomla: http://extensions.joomla.org/extensions ... tion/17400

abraços

Please Entrar ou Registrar to join the conversation.

  • thiagoiasd
  • Avatar de thiagoiasd Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
13 anos 3 meses atrás #73601 por thiagoiasd
thiagoiasd replied the topic: Re: Multi Categoria K2
Acabei de encontrar este tópico talves funcione (ainda não tive tempo de testar)
segue a matéria:
Original: http://dvlancer.com/blog/1-blog/23-addi ... ption.html

Caso o link fique off aqui vai ela

Last week we talked about adding Multiple Categories in K2 Items. So lets start by adding an option to save multiple categories for K2 item. First we need a new table where we will store our reference.

--
-- Table structure for table `jos_k2_items_category_ref`
--
CREATE TABLE IF NOT EXISTS `jos_k2_items_category_ref` (
`catid` int(11) NOT NULL,
`itemid` int(11) NOT NULL,
KEY `catid` (`catid`),
KEY `itemid` (`itemid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Now we need to add a new multi-select box so we can display and select multiple categories options. First we add code to generate HTML for multi-select box in administrator\components\com_k2\views\item\view.html.php
//set attributes for multi drop down box
$attribs = 'size="10" multiple="multiple"';
//if item exist then get selected categories
$values = array ();
if($item->id)
{
   $query = "SELECT catid FROM #__k2_items_category_ref WHERE itemid = ".$db->Quote($item->id).";\n";
   $db->setQuery($query);
   $results = $db->loadResultArray();
   if(!empty($results))
   {
    foreach($results AS $key => $val)
    {
     $values&#91;&#93; = $val;
    }
   }
  }
  //add multi select drop down box
  $lists&#91;'categories_mltpl'&#93;
 = JHTML::_('select.genericlist', $categories_options, 'catid_mltpl&#91;&#93;', 
$attribs, 'value', 'text', $values);
add following code to save multiple categories into the database to the administrator\components\com_k2\models\item.php
$catid_mltpl = JRequest::getVar('catid_mltpl', NULL, 'post', 'array');
    if(!empty($catid_mltpl) && is_array($catid_mltpl))
    // Get a database object
    $db =& JFactory::getDBO();
    //delete old cattegiries 
    $query = "DELETE FROM `#__k2_items_category_ref` where itemid = ".$db->Quote($row->id).";\n";
    $db->setQuery($query);
    $result = $db->query();
    //insert new cattegiries
    $query = "INSERT INTO `#__k2_items_category_ref` (`catid`, `itemid`) VALUES\n";
    $count = sizeof($catid_mltpl);
    for ($i = 0; $i < $count; ++$i)
    {
      $catid = $catid_mltpl&#91;$i&#93;;
      if( ($i+1) == $count)
      {
        $query .= "(".$db->Quote($catid).", ".$db->Quote($row->id).");\n";
      } else {
        $query .= "(".$db->Quote($catid).", ".$db->Quote($row->id)."),\n";
      }
    }
    $db->setQuery($query);
    $result = $db->query();
and then we add the box to the template in administrator\components\com_k2\views\item\tmpl\default.php
<tr>
 <td colspan="2">&nbsp;</td>
 <td><label><?php echo JText::_('Multiple Categories'); ?></label></td>
 <td><?php echo $this->lists&#91;'categories_mltpl'&#93;; ?></td>
 </tr>
Now we can add multiple categories to K2 items. That was an easy part. Now we need to do much more figuring out to do to get K2 to work with our multiple categories instead.

Last Updated on Wednesday, 01 February 2012 22:02

me desculpem pela falta de tradução, mas meu inglês não é tão bom assim .

Please Entrar ou Registrar to join the conversation.

  • Marcelo Roberto
  • Avatar de Marcelo Roberto
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
13 anos 3 meses atrás #73614 por Marcelo Roberto
Marcelo Roberto replied the topic: Re: Multi Categoria K2
Show de bola thiagoiasd... eu vou testar e te aviso depois se deu certo... Grande abraço e obrigado por enquanto!

[b:3anvu76v][color=#400000:3anvu76v][i:3anvu76v]As horas de loucura são medidas pelo relógio; mas nenhum relógio mede as de sabedoria. (William Blake)[/i:3anvu76v][/color:3anvu76v][/b:3anvu76v]

[b:3anvu76v][color=#400000:3anvu76v]Skype:[/color:3anvu76v][/b:3anvu76v] marcelormoliveira
[b:3anvu76v][color=#400000:3anvu76v]MSN:[/color:3anvu76v][/b:3anvu76v] <!-- e --><a href="Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.">Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.</a><!-- e -->

Please Entrar ou Registrar to join the conversation.