private function setItem($array)
 {
     $base = new BaseHelper();
     $produto = Produtos::findById($array['produto_id'])->toArray();
     $array['id'] = $array['produto_id'];
     $array['name'] = $produto['nome'];
     $array['quantity'] = $array['quantidade'];
     if (isset($array['detalhe_id']) && $array['detalhe_id'] != '') {
         $desconto = $base->getDesconto($produto, $array['detalhe_id']);
         $chave = $base->arrayMultiSearch($produto['detalhes'], 'detalhe_id', $array['detalhe_id']);
         $array['options']['detalhe_id'] = $array['detalhe_id'];
         $array['price'] = $produto['detalhes'][$chave]['valor'] - $desconto;
         if ($desconto != 0) {
             $array['valor_real'] = $produto['detalhes'][$chave]['valor'];
         }
     } else {
         $desconto = $base->getDesconto($produto);
         $valor = isset($produto['valor']) ? $produto['valor'] : $produto['detalhes'][0]['valor'];
         $array['price'] = $valor - $desconto;
         if ($desconto != 0) {
             $array['valor_real'] = $valor;
         }
     }
     unset($array['produto_id']);
     unset($array['detalhe_id']);
     return $array;
 }
 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;
 }