Sometimes we like to show several latest customers testimonals at zen-cart based shopping cart homepage. How to do then? Here are my method, let me share the code with you.
Go go to includes/modules, and open left_column.php, add the following code: <code><? $sql = “select * from pres_testimonials where status = 1 order by id DESC limit 3”; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { echo “<strong>”.$row[name].”</strong>”; echo $row[detail];
} ?> </code>
If you like to show not more than 110 words per testimonal, you can use the folliwing code: <code><? $sql = “select * from pres_testimonials where status = 1 order by id DESC limit 3”; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { echo “<strong>”.$row[name].”</strong>”;
$pos = strpos($row[detail],” “,110); $txt1 = substr($row[detail],0,$pos);
echo $txt1.”<br></br>”;
} ?></code>