X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Buy more Pay Less feature (https://forum.x-cart.com/showthread.php?t=23999)

Lee 08-10-2006 05:38 AM

Buy more Pay Less feature
 
Afternoon all,

We have a 5plus price feature on our site, which currently only displays on the actual product detail page. As we are expanding our 5plus price to cover all our products I want to display this feature on the products.tpl listing.

Currently on product.tpl I have
{if $variants eq ''}
{include file="customer/main/product_prices.tpl"}
{/if}

This file contains the following loop within a {if $product_wholesale ne ""}

Pay only <FONT CLASS="buymore">{section name=wi loop=$product_wholesale}{include file="currency.tpl" value=$product_wholesale[wi].price}{/section}</FONT> each when you buy <FONT CLASS="buymore">{section name=wi loop=$product_wholesale}{$product_wholesale[wi].quantity}{if $smarty.section.wi.last}{else}-{$product_wholesale[wi].next_quantity}{/if}{/section}</FONT> or more!

Within the products tpl page I have a call to a duplicated version of product_prices.tpl (with a _des in the title). I cannot get this to display unless I remove the if statement, and then when it does display I get no prices. What should I be looking to change, either the initial if statement or the Pay only loop above??

Thanks in advance!

jdiehl 08-10-2006 02:18 PM

You are calling templates that deal with 1 product on a page that deals with several products. That isn't going to work without more mods. Ideally you should edit the php file to pull that data so that you can just display it any time you want without have to call additional template files.

Additional template files are handy if you only do something once and awhile and you don't want to clutter your code. But if you are doing it every time just pull the variables and display them

carlisleglass 08-10-2006 11:31 PM

Here's the coding I use ... Its a modified version of what I found on these forums about 6 months ago.

It works in v4.1.x but should work in v4.0.x as well.

Insert this where you want the text to appear.

Code:


{* get wholesale wholesale pricing data for product *}
{php}
$prodid=$this->_tpl_vars['pid'];

$results = func_query("SELECT min(price) as price, max(quantity) as quantity FROM xcart_pricing WHERE productid='$prodid' AND quantity > 1 ORDER BY quantity");
$this->assign("sv_val",$results);
$wsprice=$this->_tpl_vars['sv_val'][0]['price'] ;
$wsqty=$this->_tpl_vars['sv_val'][0]['quantity'] ;
if ($wsqty > 1) {
echo "
<font style='color: #ff9900; font-size: 7pt; font-style: italic'>";
echo "... as low as бё" .  $wsprice . " when purchasing more than " . $wsqty . " items.";
echo "</font>";
}
{/php}



All times are GMT -8. The time now is 07:04 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.