Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

"From" Price In products_list.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-13-2012, 12:19 AM
 
vgh vgh is offline
 

Newbie
  
Join Date: Aug 2012
Posts: 8
 

Default "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
__________________
X-Cart Version 4.50
Reply With Quote
  #2  
Old 09-13-2012, 05:31 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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} 
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 09-13-2012, 05:41 AM
 
vgh vgh is offline
 

Newbie
  
Join Date: Aug 2012
Posts: 8
 

Default 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
__________________
X-Cart Version 4.50
Reply With Quote
  #4  
Old 09-13-2012, 06:06 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:48 AM.

   

 
X-Cart forums © 2001-2020