public function setSubmenu($dados, $array)
 {
     $submenu = '';
     if (!empty($dados)) {
         foreach ($dados as $key => $value) {
             $replaces = array($array['submenu_item_class'], $array['submenu_item_link_class'], parent::generateUrl($value['nome'], $value['id'], 'categoria'), $value['nome'], '');
             $wrap = $array['submenu_item_wrap'] != "" ? $array['submenu_item_wrap'] : $array['item_wrap'];
             $submenu .= parent::replaceWraper(5, $replaces, $wrap);
         }
     }
     return $submenu;
 }
 public function setSubmenu($dados, $array)
 {
     $submenu = '';
     if (!empty($dados)) {
         if ($array['break_menu']) {
             $quebramenu = array_chunk($dados, $array['break_limit']);
             for ($i = 0; $i < count($quebramenu); $i++) {
                 foreach ($quebramenu[$i] as $key => $value) {
                     $replaces = array($array['submenu_item_class'], $array['submenu_item_link_class'], parent::generateUrl($value['nome'], $value['id'], 'categoria'), $value['nome'], '');
                     $wrap = $array['submenu_item_wrap'] != "" ? $array['submenu_item_wrap'] : $array['item_wrap'];
                     $submenu .= parent::replaceWraper(5, $replaces, $wrap);
                 }
             }
         } else {
             foreach ($dados as $key => $value) {
                 $replaces = array($array['submenu_item_class'], $array['submenu_item_link_class'], parent::generateUrl($value['nome'], $value['id'], 'categoria'), $value['nome'], '');
                 $wrap = $array['submenu_item_wrap'] != "" ? $array['submenu_item_wrap'] : $array['item_wrap'];
                 $submenu .= parent::replaceWraper(5, $replaces, $wrap);
             }
         }
     }
     return $submenu;
 }
 protected function getCores($obj)
 {
     $html = '';
     $index = parent::arrayMultiSearch($this->detalhes, 'label', 'cor');
     if (!is_null($index)) {
         $cores = array_values(array_unique(array_column($obj->detalhes, 'cor')));
         if (count($cores) > 1) {
             foreach ($cores as $key => $value) {
                 $ref = $this->detalhes[$index]['referencia'];
                 $referencia = $ref::findFirst("nome = '{$value}'")->toArray();
                 $url = parent::generateUrl($obj->nome, $obj->_id, 'produto_variacao');
                 $url = $url . '/' . $referencia['nome'] . '/' . $key;
                 $html .= "<a href='{$url}' class='sideColor color-produto-detalhe variacao' style='background-color:{$referencia['hexa']}'></a>";
             }
             $html .= '<br clear="all"/>';
         }
     }
     return $html;
 }
 protected function getCategorias($array)
 {
     $categorias = Categorias::findById($array['categoria_id']);
     $dados = Categorias::getChildrens($categorias);
     $items = '';
     foreach ($dados->subcategorias as $key => $value) {
         $replaces = array($array['item_class'], $array['link_class'], parent::generateUrl($value['nome'], $value['id'], 'categoria'), '', $value['nome'], '');
         $items .= parent::replaceWraper(6, $replaces, $array['item_wrap']);
     }
     return $items;
 }
 protected function getItens($param)
 {
     $html = '';
     $size = 90 / count($this->options['produtos']);
     foreach ($this->options['produtos'] as $key => $value) {
         $html .= '<td style="width:' . $size . '%">';
         if ($param == 'imagem') {
             $imagem = Imagens::findFirst($value['imagens'][0])->url;
             $html .= '<img src="' . $this->url_base . $imagem . '" class="img-responsive" width="150px" />';
         } else {
             if ($param == 'valor' || $param == 'peso' || $param == 'dimensões') {
                 if ($param == 'valor') {
                     $desconto = parent::getDesconto($value);
                     if ($this->ecommerce_options->produto_detalhes == '1') {
                         $html .= 'R$ ' . number_format($value['detalhes'][0][$param] - $desconto, 2, ',', '.');
                         if ($desconto != 0) {
                             $html .= '<span class="preco-desconto">R$ ' . number_format($value['detalhes'][0][$param], 2, ',', '.') . '</span>';
                         }
                     } else {
                         $html .= 'R$ ' . number_format($value[$param] - $desconto, 2, ',', '.');
                         if ($desconto != 0) {
                             $html .= '<span class="preco-desconto">R$ ' . number_format($value[$param], 2, ',', '.') . '</span>';
                         }
                     }
                 } else {
                     if ($param == 'dimensões') {
                         if ($this->ecommerce_options->produto_cubagem_detalhe == '1') {
                             $html .= $value['detalhes'][0]['altura'] . ' / ' . $value['detalhes'][0]['largura'] . ' / ' . $value['detalhes'][0]['comprimento'] . ' CM';
                         } else {
                             $html .= $value['altura'] . ' / ' . $value['largura'] . ' / ' . $value['comprimento'] . ' CM';
                         }
                     } else {
                         if ($param == 'peso') {
                             if ($this->ecommerce_options->produto_cubagem_detalhe == '1') {
                                 $html .= $value['detalhes'][0][$param];
                             } else {
                                 $html .= $value[$param];
                             }
                             $html .= ' KG';
                         } else {
                             $html .= $value['detalhes'][0][$param];
                         }
                     }
                 }
             } else {
                 if ($param == 'avaliação') {
                     $star = Avaliacoes::getStars(Avaliacoes::average(array("produto_id = '{$value['_id']}' and avaliacao_tipo_id = 2 and aprovado = 1", 'column' => 'nota')));
                     if ($star == '') {
                         $html .= 'Produto não foi avaliado';
                     } else {
                         $html .= $star . ' ' . Avaliacoes::count("produto_id = '{$value['_id']}' and avaliacao_tipo_id = 2 and aprovado = 1") . ' -Avaliação(oes)';
                     }
                 } else {
                     if ($param == 'opções') {
                         $html .= '<a href="' . parent::generateUrl($value['nome'], $value['_id'], 'produto') . '" class="btn btn-primary"><i class="fa fa-plus"></i> Mais detalhes</a> ';
                         $html .= '<a href="' . $this->url_base . 'comparacao/delete/' . $value['_id'] . '" class="btn btn-danger"><i class="fa fa-times"></i> Remover</a>';
                     } else {
                         if ($param == 'descrição') {
                             $html .= $value['descricao'];
                         } else {
                             $html .= $value[$param];
                         }
                     }
                 }
             }
         }
         $html .= '</td>';
     }
     return $html;
 }
 protected function getInfoTitle($produto)
 {
     return parent::replaceWraper(3, array(parent::generateUrl($produto['nome'], $produto['_id'], 'produto'), $this->options['info_title_class'], $produto['nome']), $this->options['info_title_wrap']);
 }