View Single Post
  #14  
Old 10-23-2015, 12:06 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Show products with variants with price lowest to highest

This worked for me... (v4.7.x)

In products.php

BEFORE...
Code:
$smarty->assign('cat_products', isset($products) ? $products : array());
INSERT...
Code:
if($products) { foreach($products as $key=> $product) $products[$key]["minprice"] = func_query_first_cell("SELECT min(price) FROM $sql_tbl[pricing] WHERE productid=".$product["productid"]); foreach($products as $key=> $product) $products[$key]["maxprice"] = func_query_first_cell("SELECT max(price) FROM $sql_tbl[pricing] WHERE productid=".$product["productid"]); }

In skin/<SKIN>/customer/main/products_list.tpl AND/OR skin/<SKIN>/customer/main/products_t.tpl

INSERT....

Code:
{if $product.variantid && ($product.minprice != $product.maxprice)} {math assign="min_price" equation="x*y" x=$product.minprice y=1.2}{* tax rate if applicable *} {math assign="max_price" equation="x*y" x=$product.maxprice y=1.2}{* tax rate if applicable *} <p><b>{$lng.lbl_from} {currency value=$min_price} {$lng.lbl_to} {currency value=$max_price}</b></p> {/if}

*Updated*
__________________
xcartmods.co.uk
Reply With Quote