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

Featured Products in Categories....

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-30-2002, 02:15 PM
 
playcentral playcentral is offline
 

Member
  
Join Date: Nov 2002
Posts: 25
 

Default Featured Products in Categories....

Hi,

For some reason we cannot display featured products in our category pages.

On the main page we can show featured products but we can't shows them in the categories. We have subcategories of the main categories but don't want to display feature products in them. IS anybody else experiencing this problem?

It lists all items within the category, we used the debud console and it is not even bringing up the featured.tpl so it makes me think think that theis is a if command line problem or something in one the main templates. Hope you follow.

Please help!
Reply With Quote
  #2  
Old 11-30-2002, 08:59 PM
 
ATKOgirl ATKOgirl is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 448
 

Default

Hi,

Featured products can only be used in categories that do not contain products. They are meant for the root categories to feature products from the sub categories below.

Hope that helps,
ATKOgirl
__________________
X-Cart Versions: 4.1.10 and 4.2.0
Reply With Quote
  #3  
Old 12-01-2002, 05:15 AM
 
playcentral playcentral is offline
 

Member
  
Join Date: Nov 2002
Posts: 25
 

Default

hi,

thanks for letting me know. is their anyway we can override this?
Reply With Quote
  #4  
Old 12-01-2002, 07:43 AM
 
playcentral playcentral is offline
 

Member
  
Join Date: Nov 2002
Posts: 25
 

Default

ok, we have now figured this out. If anybody wants the code, then let me know, it's quite extensive and you have to create new templates, but it works
Reply With Quote
  #5  
Old 12-01-2002, 08:24 AM
 
DogTags DogTags is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 96
 

Default

Hi playcentral

Yes, it would be great if you could post your code.

Thanks
Reply With Quote
  #6  
Old 12-01-2002, 08:50 AM
 
playcentral playcentral is offline
 

Member
  
Join Date: Nov 2002
Posts: 25
 

Default

ok...

First of all you need to edit : /customer/home_main.tpl

near the bottom you should have :

Code:
{elseif $main eq "catalog" and $current_category.category ne ""} {include file="customer/main/welcome.tpl"}


or something like that...then change it to this, and add another elseif line( just copy and paste this over the above line:


Code:
{elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcome.tpl"} {elseif $main eq "catalog" and $current_category.category ne ""} {include file="customer/main/subcategories2.tpl" f_products=$f_products}


Then create a .tpl file called subcategories2.tpl in /customer/main this should have the following in it...


Code:
{* $Id: subcategories.tpl,v 1.21.2.3 2002/11/11 14:04:39 andrew Exp $ *} { include file="location.tpl" } {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} {capture name=dialog} {if $f_products ne ""} {include file="customer/main/products.tpl" products=$f_products} {else} {include file="customer/main/subcategories3.tpl"} {/if} {/capture} {include file="dialog.tpl" title=$current_category.category|regex_replace:"/.*\//":"" content=$smarty.capture.dialog extra="width=100%"}


You should then create another file in /customer/main called subcategories3.tpl this should have this in it:

Code:
{* $Id: subcategories.tpl,v 1.21.2.3 2002/11/11 14:04:39 andrew Exp $ *} { include file="customer/main/navigation.tpl" } {if ($page eq "")||($page eq "1")}{$current_category.description|regex_replace:"/[\n]/":" "} {/if} {include file="customer/main/products.tpl"}


Finally edit the featured products template found in /customer/main called featured.tpl, this should have this in it:

Code:
{* $Id: featured.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *} {capture name=dialog} {if $f_products ne ""} {include file="customer/main/products.tpl" products=$f_products} {else} {include file="customer/main/products.tpl"} {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_featured_products content=$smarty.capture.dialog extra="width=100%"}



The only thing wrong with all of this is that the page numbers/navigation ends up inside the capture box, but we actually prefer it like that. By all means please back up all your templates before doing this as I don't want people mucking up their cart if anything goes wrong.

Hope this helps people!
Reply With Quote
  #7  
Old 12-02-2002, 04:08 PM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 480
 

Default

umm thats a little complicated... try this 3 line solution:

bottom of File: /customer/main/subcategories.tpl

Code:
{if $products eq ""} {if $f_products ne ""} {/if} {/if} { include file="customer/main/navigation.tpl" }

to

Code:
{if empty($products)} {if $f_products ne ""} {include file="customer/main/featured.tpl"} {/if} {/if} { include file="customer/main/navigation.tpl" }

apparently an empty array does not evaluate to "".


this works fine now, and displays featured products if there are no products in the current category and there are featured products., If you alwasy want featured products to show then remove the conditional if's
Reply With Quote
  #8  
Old 12-02-2002, 04:27 PM
 
Cybro Cybro is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: UK
Posts: 30
 

Default

Great!!! Thanks playcentral and nfc5382, Just what I've been looking for.
Although I did favour the 3 line solution
__________________
Regards

Graham

Site in Progress...
(Version 3.2.2 Gold)
Reply With Quote
  #9  
Old 12-02-2002, 05:09 PM
 
playcentral playcentral is offline
 

Member
  
Join Date: Nov 2002
Posts: 25
 

Default

alright smart arse! :P

my code was just hacked together to do the purpose, and I've only been using xcart about a week so don't really know what I'm doing

Thanks for the new code though
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 03:49 PM.

   

 
X-Cart forums © 2001-2020