I have managed to get it working by amending the code and some of the lines, the updated working code is below
- Code: Select all
<cms:php>
$sql = "SELECT oc_product.product_id, image, name, price FROM oc_product JOIN oc_product_description ON oc_product_description.product_id=oc_product.product_id WHERE oc_product.product_id='<cms:show product_id_1 />' OR oc_product.product_id='<cms:show product_id_2 />' OR oc_product.product_id='<cms:show product_id_3 />' OR oc_product.product_id='<cms:show product_id_4 />' ORDER BY Name DESC LIMIT 4";
//echo $sql;
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<div class='gallery-item foods'>";
echo "<div class='item'>";
echo "<div class='product'>";
echo "<div class='product-thumb'>";
echo "<img src='book-now/image/" . $row["image"] . "' alt='' style='object-fit: cover;width: 100%;height: 250px;' />";
echo "<div class='overlay'>";
echo "<div class='btn-product-view-details'>";
echo "<a class='btn btn-default btn-theme-colored btn-sm btn-flat pl-20 pr-20 btn-add-to-cart text-uppercase font-weight-700' href='book-now/index.php?route=product/product&path=-1&product_id=" . $row["product_id"] . "' target='_blank'>View details</a>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='product-details text-center'>";
echo "<a href='book-now/index.php?route=product/product&path=-1&product_id=" . $row["product_id"] . "'><h5 class='product-title'>" . $row['name'] . "</h5></a>";
echo "<div class='price'><ins><span class='amount'>£ " . number_format($row['price'],2) . "</span></ins></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
}
$conn->close();
</cms:php>