Hallo,
wird im Katalog-Ajaxrating irgendwo die Anzahl der Bewertungen festgehalten?
MfG,
typoburns
Hallo,
wird im Katalog-Ajaxrating irgendwo die Anzahl der Bewertungen festgehalten?
MfG,
typoburns
Kann mir keiner helfen?
Würde gerne ne Zählung der Bewertungen erreichen und diese auch ausgeben lassen, damit die Bewertungen auch eine Gewichtung erhalten.
Habe folgendes Teil in der CatalogAjaxRatingField.php gefunden.
Vielleicht kann ja mal ein PHP-Spezi drüber schauen, ob da bereits was passendes drin steht!
PHP-Code:
if (($this->Input->get('q') == 'rating') && ($objCatalog->pid==$this->Input->get('ratecat')) && ($objCatalog->id==$this->Input->get('rateitem')))
{
if (!$hasVoted)
{
$this->Database->prepare("INSERT INTO tl_catalog_rating (cat_id, item_id, value, ip, time) VALUES (?, ?, ?, ?, ?)")
->execute($objCatalog->pid, $objCatalog->id, $this->Input->get('value'), $_SERVER['REMOTE_ADDR'], time());
// Would love to use $this->Environment->ip here but this is the internal IP of an network if behind NAT, therefore useless.
$votecount++;
$votesum+=$this->Input->get('value');
$value=$this->calculate($votesum, $votecount);
// now we are pretty dirty in here, we have to update ourselves "on the fly".
$table=$this->Database->prepare("SELECT tableName FROM tl_catalog_types WHERE id=?")
->execute($objCatalog->pid);
if($table->next()) {
$this->Database->prepare("UPDATE ".$table->tableName." SET ".$k."=? WHERE id=?")
->execute($this->calculate($votesum, $votecount), $objCatalog->id);
}
}
if ($this->Input->get('isAjax') == '1')
{
$objVotes=$this->Database->prepare("SELECT *, COUNT(*) AS totalVotes, SUM(value) AS sumValue FROM tl_catalog_rating WHERE cat_id=? AND item_id=? GROUP BY cat_id, item_id")
->execute($objCatalog->pid, $objCatalog->id);
$objVotes->next();
echo round($objVotes->sumValue/$objVotes->totalVotes, 2);
exit;
}
else
{
$this->redirect(preg_replace('@(\?|&)q=[^&]*&ratecat=[^&]*&rateitem=[^&]*&value=[^&]*@', '', $this->Environment->request));
}
}
$objWidth=$this->Database->prepare("SELECT ajaxratingfield FROM tl_catalog_fields WHERE pid=? AND colName=?")
->execute($objCatalog->pid, $k);
$ajaxWidget = new CatalogAjaxRatingWidget(array
(
'value'=>$value,
'size' => 5,
'strId' => (($objCatalogInstance instanceof ModuleCatalogReader) ? $objCatalog->pid . '_' . $objCatalog->id : ''),
'catId' => $objCatalog->pid,
'itemId' => $objCatalog->id,
'voted' => $hasVoted,
'tableless' => true,
'intRatingUnitWidth' => $objWidth->ajaxratingfield,
));
$html = $ajaxWidget->parse();
return array
(
'items' => array($html),
'values' => false,
'html' => $html,
);
}
}
Hallo typoburns,
das wird aktuell zwar erfasst, aber noch nicht ausgegeben.
Mach dazu bitte ein Ticket bei Google.
Viele Grüße
Contao Pool | C-C-A | MetaModels | [Internetseite -> Mediendepot Ruhr]
[Arbeitet bei -> Paus Design & Medien]
"I can EXPLAIN it to you, but I can't UNDERSTAND it for you."
Gibt es dazu irgendwelche Neuigkeiten bzw. Ideen, wie ich die Anzahl der Bewertungen ausgeben kann? Bräuchte diese Zahl auch für mein Richsnippet-Problem...
Danke!
sonja
wäre wichtig, gibts dazu schon einen Ticket-Link/ eine Lösung?
Danke.
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
Lesezeichen