![]() |
Display price as "Low as $x.xx" based on wholesale
I originally posted this in the Storefront Design area, but I probably should have posted it here instead. Moderators, please feel free to delete the topic in the Storefront Design area.
Here's my question... Is there a way to display the lowest possible price based on the quantity breaks that are set up in "Wholesale" pricing? I want to be able to show the best (lowest) price on the category and product pages. Here is a thought on how it would work: NOTE: This code is and example and is in no way accurate! Code:
{if $product_wholesale ne ""} The goal would be to pull the lowest price available for the product (and the current member level) and apply it to the "$products[product_low].price" (this variable is not a real existing xcart variable). Just some thoughts. Any suggestions would be great. Surely someone has a thought on how this would work. Boomer, Shan, Funky... any thoughts? Thanks, Piper |
OK, I think I'm on to something here. I found
Code:
$product_wholesale[wi].price I tried putting Code:
{$product_wholesale[3].price} Code:
{$product_wholesale} I'm sure that I'm close to the solution, I'm just not versed enough with Smarty to find the correct syntax. Piper |
It works! Here's what I put into my product.tpl:
Code:
{if $product_wholesale ne ""} Now, that I feel great about that, I'm back to banging my head against the wall because it does not work in the products_t.tpl! Back to the drawing board. Piper |
Getting it into products_t.tpl is flipping difficult.
It is down to the included php files in the products.php being different to those in product.php. But is would be mightily hard to bring them into loops. Best bet is to amend the sql query that search products in products.php to something like: Code:
$products = func_query("select $sql_tbl[products].*, MIN($sql_tbl[pricing].price) as lowestprice, MAX($sql_tbl[pricing].quantity) as quantity from $sql_tbl[products], $sql_tbl[pricing] where $sql_tbl[products].productid=$sql_tbl[pricing].productid AND $sql_tbl[pricing].quantity > 1 AND $sql_tbl[products].categoryid='$cat' AND $sql_tbl[products].forsale='Y' and $avail_condition ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') group by $sql_tbl[products].productid order by orderby"); hope this helps you along the way. |
funkydunk,
Thanks for the code and information. It didn't work, but I appreciate the reply just the same! Here's my thought... products_t.tpl is already pulling price data for each product from the database. It pulls the price from the "xcart_pricing" table based on the product id. How can I define not only the product id, but the quantity column as well? I guess I should have explained that I only have 3 levels of pricing (which eliminates the need to have a script find the lowest price), so the price that is associated with the product id + a quantity of 3 is always what I need. In other words Code:
{include file="currency.tpl" value=$products[product].price} I guess what I need to know (being a mySQL novice) is how do I pull data from a specific space? (in this case it's xcart_pricing+product id+quantity of 3) Thanks again, Piper |
All times are GMT -8. The time now is 08:46 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.