| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Page for products with list price < price | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Page for products with list price < price
I am using 4.7.8 Gold. I've created a new php page that currently displays all products (based on products.php). I just want it to only display products that have a list price (i.e. products on sale).
I've tried many different things but I'm not having any luck. Does anyone have any ideas on how this could be accomplished? Thanks! |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Page for products with list price < price
You would need to include an if statement in the loop in the template:
{if $product.list_price gt 0}
__________________
Paul Dodman e-business & m-commerce consultant w: www.luminointernet.com e: xcart@luminointernet.com Professional X-Cart help, advice, support and services, specialists in Mobile X-Cart. |
|||||||||
#3
|
|||||||
|
|||||||
Re: Page for products with list price < price
Quote:
Well, what is odd, is that the template page is blank and the page still returns all products. This is the first time I've set up a new php page and clearly I've done something wrong. Nothing I add to the tpl file shows up. It's all being generated in the php file. |
|||||||
#4
|
|||||||
|
|||||||
Re: Page for products with list price < price
I should clarify that if I remove the code from the php file that is generating the search results, then anything I type into the tpl file does show up. I'm not sure what code I need in the php file and what in the tpl file.
|
|||||||
#5
|
|||||||
|
|||||||
Re: Page for products with list price < price
Quote:
OK I've got the page itself working, but I can't get the if statement to work correctly. It only returns one product, even though there are multiple products with a list price greater then 0. As far as I can tell, it will only return a product with a list price of greater then 0 that also has no variants. If a product has variants, it won't show even if there is a list price entered. |
|||||||
#6
|
|||||||||
|
|||||||||
Re: Page for products with list price < price
You could try:
{if $product.appearance.market_price_discount gt 0} Worked fine for me on the products listing page.
__________________
Paul Dodman e-business & m-commerce consultant w: www.luminointernet.com e: xcart@luminointernet.com Professional X-Cart help, advice, support and services, specialists in Mobile X-Cart. |
|||||||||
#7
|
|||||||
|
|||||||
Re: Page for products with list price < price
Quote:
Yes, I had tried that yesterday, it doesn't work either. It actually returns no products, whereas the other query does return a product. From reading through the forums, it seems like the list_price is removed from some pages when there are variants with prices. I'm not sure how to get it back. |
|||||||
#8
|
|||||||||
|
|||||||||
Re: Page for products with list price < price
List price is attached to the product and not to variant. As far as I know it is there at all times - as long as there is product array available on the page.
You can do the foreach to list products in smarty with condition however if you do not need these products on the page it is way better and faster to strip them out in php. Either use func_search_products (you can see an example of it in bestsellers module) so you can have the query restrictions set there OR do foreach and unset product after you run the search.php in your scrip (since you said it is based on products.php). I would redo the script and use func_search_products - it is faster and collects just the necessary info which you can add to if you need more after that. Then in the smarty template just do foreach loop and list the products
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|