有没有简单的方法可以从数据库中检索“产品包”?我想显示不同类别的所有产品包组合。
如果我可以禁用此包以显示在其他类别中,那将会很棒。如果它变得太复杂,我就没有问题了。
当我使用自定义模板时,我将提供一些代码示例,介绍如何在Prestashop 1.6.1.4中显示产品。
<?php
if (isset($_POST['search'])){
$bedrooms= htmlentities(strip_tags($_POST['bedrooms']));
$radius= htmlentities(strip_tags($_POST['radius']));
$type_prop= htmlentities(strip_tags($_POST['type_prop']));
$prop_share= htmlentities(strip_tags($_POST['prop_share']));
$bed_query = mysqli_query($connect, "SELECT * FROM properties WHERE prop_radius='$bedrooms'");
$radius_query = mysqli_query($connect, "SELECT * FROM properties WHERE prop_radius='$radius'");
$type_query = mysqli_query($connect, "SELECT * FROM properties WHERE prop_type='$type_prop'");
$share_query = mysqli_query($connect, "SELECT * FROM properties WHERE prop_share='$prop_share'");
var_dump($bed_query);
echo $radius_query;
echo $type_query;
echo $prop_share;
}else {
echo "This didnt work";
}
?>
<form action="" enctype="multipart/form-data">
<div class="form-group" style="width: 400px; margin-left: 375px; margin-top: 20px; ">
<label for="sel1">Radius (from Aston University):</label>
<select class="form-control" id="sel1" name="radius">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<br>
<label for="sel2">No of bedrooms:</label>
<select class="form-control" id="sel2" name="bedrooms">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
<div class="form-group" style="width: 400px; margin-left: 850px; margin-top: -152px; ">
<label for="sel1">Type of Property:</label>
<select class="form-control" id="sel3" name="type_prop">
<option>Halls</option>
<option>Flat</option>
<option>Terrace Home share</option>
<option>Semi Detactched Home share</option>
</select>
<br>
<label for="sel2">Property share:</label>
<select class="form-control" id="sel4" name="prop_share">
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select>
</div>
<input type="submit" name="search" value="test">
</form>
答案 0 :(得分:0)
关注是sql,您可以通过它从数据库中获取所有包产品
$pack_products = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'product WHERE cache_is_pack = 1');