![]() |
Select category for discount pricing
I have a closeouts (root category) and I need the correct variable to select the root category for my closeouts and display the Market price discount for any product in that category in the product.tpl.
I tried {if $product.price ne 0 && $cat="78"} <font class="MarketPrice">{$lng.lbl_market_price}:{math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%3.0f" assign=discount} <span id="save_percent"><font class="closeoutsdiscount">{ $discount }</span>%</font> What variable would I use for the root category to select in my product.tpl? |
Re: Select category for discount pricing
sorry, I don't understand what you're trying to do?
only display the market price if it's in the closeouts category? but display it in the other categories? |
Re: Select category for discount pricing
The first part of your answer is desired... to only display the market price for the closeouts category. Currently I do not use a discount price and have only membership levels for each product. For this, I do not apply a list price, and the market price is just a dummy price that doesn't show on our products.
|
Re: Select category for discount pricing
OK, so you want a different price display for your closeouts category than the rest. OK
you tried this: Code:
{if $product.price ne 0 && $cat="78"} and it didn't work. It looks about right to me, but you haven't got and end if Code:
{if $product.price ne 0 && $cat="78"} I take it you have used webmaster mode to check the value of $cat for your closeouts category? |
Re: Select category for discount pricing
Yes, I have used webmaster mode and I also checked in the cpanel to make sure of the correct placement value. The end if was proper in my product.tpl, though I did not select all the lines for copy/paste here. I also tried {if $product.price ne 0 && $cat eq "78"} and {if $product.price ne 0 && $category.categoryid eq "78"}, but still no cigar.
|
Re: Select category for discount pricing
have you tried just
Code:
{if $cat eq '78'} just to isolate the issue? |
Re: Select category for discount pricing
I've tried to isolate the category, but using $cat eq '78' doesn't display the market price.
{if $cat eq '78'} <font class="MarketPrice">{$lng.lbl_market_price}:{math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%3.0f" assign=discount} <span id="save_percent"><font class="closeoutsdiscount">{ $discount }</span>%</font> {/if} Is it missing something else like a {foreach from=$categories or {if $main... I'll try any suggestions. |
Re: Select category for discount pricing
Hi Christine,
When you say "root category" do you mean another category you have put the product in that is not defined as the main category? Check the breadcrumb on the product page - those are the categories that you defined as the main category for the product. If you do not see the closeout category in that path - I do not believe the default queries for product.php capture that category. (In other words - a product can be in multi categories and for some shops, a query to capture all the category information for every product page load could be a lot of extra overhead, if it were not used.) You may want to take a look at the $current_category array, you will see the categories XCART has about your product: $current_category.categoryid, $current_category.parentid, etc. I think the category_location array is also there that is used to make the breadcrumb. If you don't see your closeout category - you may have to add a query to product.php to check to see if a product is in that category - and then set a flag you can use in the template. |
Re: Select category for discount pricing
how about
Code:
{if $cat eq 78} |
Re: Select category for discount pricing
Thanks for your help. Still no cigar with trying to use the root category. I have a work-around now with using an extra field, this isn't the best solution, but I've tried many combination's for the root category and can't get it to work.
|
All times are GMT -8. The time now is 04:06 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.