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

Select category for discount pricing

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-11-2009, 07:24 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default 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}
&nbsp;<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?
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #2  
Old 09-11-2009, 08:07 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #3  
Old 09-11-2009, 08:27 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default 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.
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #4  
Old 09-11-2009, 08:36 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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"} <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} &nbsp;<span id="save_percent"><font class="closeoutsdiscount">{ $discount }</span>%</font>

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"} <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} &nbsp;<span id="save_percent"><font class="closeoutsdiscount">{ $discount }</span>%</font> {/if}

I take it you have used webmaster mode to check the value of $cat for your closeouts category?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #5  
Old 09-11-2009, 08:57 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default 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.
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #6  
Old 09-11-2009, 09:04 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Select category for discount pricing

have you tried just
Code:
{if $cat eq '78'} ..... {/if}

just to isolate the issue?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #7  
Old 09-11-2009, 12:06 PM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default 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}
&nbsp;<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.
__________________
______________
version 4.1.9 Gold
Reply With Quote
  #8  
Old 09-11-2009, 04:15 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default 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.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #9  
Old 09-11-2009, 10:43 PM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Select category for discount pricing

how about
Code:
{if $cat eq 78}
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote

The following user thanks amy2203 for this useful post:
ChristineP (09-15-2009)
  #10  
Old 09-15-2009, 11:43 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default 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.
__________________
______________
version 4.1.9 Gold
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:23 AM.

   

 
X-Cart forums © 2001-2020