我在category.php中实现了以下代码,以显示价格与特价之间的销售价格百分比。它工作正常,但是...当我进行排序时,选择一个过滤器(产品选项过滤)或转到分页的第二页,该百分比消失了!我想我必须在其他地方编写代码或将其添加到分页/过滤器/排序的某个地方。...
if (count($additional_images) > 0) {
$image2 = $this->model_tool_image->resize($additional_images[0]['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));$image = $image .'" id="category_'.$result['product_id'].'"';
}
//sale % mod
$specialSavings = round((($result['price'] - $result['special'])/$result['price'])*100, 0);
if ( $specialSavings >= 23 && $specialSavings <= 27 )
{
$specialSavings = 25;
}
elseif ( $specialSavings > 27)
{
$specialSavings = 30;
}
elseif ( $specialSavings < 23)
{
$specialSavings = 20;
}
else {
$specialSavings = false;
}
//sale % mod
和
data['products'][] = array('specialSavings' => $specialSavings,//sale % mod
任何建议将不胜感激!