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)
-   -   "From" Price In products_list.tpl (https://forum.x-cart.com/showthread.php?t=64835)

vgh 09-13-2012 12:19 AM

"From" Price In products_list.tpl
 
Hi,

We have a range of different products on the site we are building, some have no variants, some have variants where the price is the same and others have variants where the price is different.

We are currently using:

Code:

{if $product.is_variants}From{/if}

To display "From" - however as I mentioned, some products have variants, but the price is the same. Is there anyway around this?

Thanks, Shane

totaltec 09-13-2012 05:31 AM

Re: "From" Price In products_list.tpl
 
Consider this code. I have not tested it but it seems sound.

PHP Code:

{assign var="varcharge" value="N"}
      {if 
$product.is_variants}
        {foreach 
from=$variants item=var}
          {if 
$var.price gt $product.taxed_price}
            {
assign var="varcharge" value="Y"}
          {/if}
        {/foreach}
      {/if}
      {if 
$varcharge eq 'Y'}
          
From:
      {else}
        {
$lng.lbl_our_price}:
      {/if} 


vgh 09-13-2012 05:41 AM

Re: "From" Price In products_list.tpl
 
Thanks for your help Mike, however I don't think the products_list.tpl has access to the $variants array and I can't see any php files where it is being generated in order to give it access to it?

Thanks again for your help.

Cheers, Shane

totaltec 09-13-2012 06:06 AM

Re: "From" Price In products_list.tpl
 
Quote:

Originally Posted by vgh
Thanks for your help Mike, however I don't think the products_list.tpl has access to the $variants array...

You are right, I assumed this would be used on the product page, but I can see now where it makes more sense on the category page. I have written code before to make variants info appear on the category pages, but it can get pretty messy and complicated.

I haven't read through this entire thread: http://forum.x-cart.com/showthread.php?t=52055 but it looks like it should shed some light on what needs to be done.


All times are GMT -8. The time now is 06:55 PM.

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