X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Featured Products in Categories.... (https://forum.x-cart.com/showthread.php?t=828)

playcentral 11-30-2002 02:15 PM

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! :cry:

ATKOgirl 11-30-2002 08:59 PM

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

playcentral 12-01-2002 05:15 AM

hi,

thanks for letting me know. is their anyway we can override this?

playcentral 12-01-2002 07:43 AM

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 :)

DogTags 12-01-2002 08:24 AM

Hi playcentral

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

Thanks :D

playcentral 12-01-2002 08:50 AM

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!

nfc5382 12-02-2002 04:08 PM

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

Cybro 12-02-2002 04:27 PM

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

playcentral 12-02-2002 05:09 PM

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 :)


All times are GMT -8. The time now is 03:55 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.