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

Getting Feautured Products to display in all categories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-28-2008, 04:21 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Getting Feautured Products to display in all categories

I want to make use of the Featured Products functionality and have a selection of products featured in each category, not just on the home page, but it seems that as soon as I put products into a category, this stops the Featured Products from displaying.

This seems, to me, a strange way for X Cart to behave - why can I only have Featured Products in a category when there are no products in that category? Surely you only want to have Featured Products when the category actually has some products in it?

I've done a search of the forums and have seen that there are quite a few people asking this same question but of the suggestions that I've seen for fixes, none of the ones I've tried have worked. Is there a (simple enough for a non-coder to undestand) way to get X Cart to display Featured Products even in categories that already contain products?

I'm using version 4.1.9 of X Cart.
Reply With Quote
  #2  
Old 10-28-2008, 04:52 AM
  Verfurt's Avatar 
Verfurt Verfurt is offline
 

X-Cart team
  
Join Date: Jul 2008
Location: Ulyanovsk, Russia
Posts: 13
 

Default Re: Getting Feautured Products to display in all categories

In the skin1/customer/main/subcategories.tpl find the code:

Code:
{if $products eq ""} {if $f_products ne ""} <p /> {include file="customer/main/featured.tpl"} {/if} {/if}

And replace it with:

Code:
{if $f_products ne ""} <p /> {include file="customer/main/featured.tpl"} {/if}

Didn't test it, but it used to work
Reply With Quote
  #3  
Old 10-28-2008, 05:14 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Getting Feautured Products to display in all categories

Quote:
Originally Posted by bionuts
Is there a (simple enough for a non-coder to undestand) way to get X Cart to display Featured Products even in categories that already contain products?

I'm using version 4.1.9 of X Cart.

The short answer is no. Maybe it doesn't make sense to you but it is a either/or situation. Since you can (in theory) have unlimited featured products, and also (in theory) have unlimited products within the category, it becomes a matter of which is most important.

The featured products will be displayed if all of the products listed in the main category are out of stock (provided the don't display products that are out of stock option is checked in admin). Otherwise, the regular products will be displayed

Here are two ways around the situation...
1 You can list the products that you would normally list in the main category in a sub-category instead, and make them featured products of the main category.
2. You can display featured products on the main home page only.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #4  
Old 10-28-2008, 05:55 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

@verfurt
Thanks for that, but it didn't work for me.
__________________
Four sites using X-Cart 5.4.x.x. Oh the joy
Reply With Quote
  #5  
Old 10-28-2008, 06:11 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

Quote:
Originally Posted by JWait
1 You can list the products that you would normally list in the main category in a sub-category instead, and make them featured products of the main category.
Not an ideal solution, in that I don't need to use sub-categories, so don't want to go creating them just so that I can have Featured Products displayed.
Quote:
Originally Posted by JWait
2. You can display featured products on the main home page only.
Which is what I am currently doing, and it works fine for the home page; it would just be nice if it worked for the category pages too.

To me, Featured Products are ones that you want to highlight from within the category. So, if a category has 10 products, you might want to highlight product1 and product3 which have been reciving attention in the media lately. You'd still want them in the list of products in the category as well (not moved to a sub-category), you just want to draw a bit more attention to them. This is why I don't think that Featured Products should be an either / or situation.
Reply With Quote
  #6  
Old 10-28-2008, 06:11 AM
  Ene's Avatar 
Ene Ene is offline
 

X-Cart team
  
Join Date: Aug 2004
Posts: 907
 

Default Re: Getting Feautured Products to display in all categories

You also need to modify the home.php script.

Replace this code

PHP Code:
if (empty($products))
    include 
"./featured_products.php"

with this one:

PHP Code:
include "./featured_products.php"
__________________
Eugene Kaznacheev,
Evangelist/Product Manager at Ecwid: http://www.ecwid.com/ (since Sept 2009)

ex-Head of X-Cart Tech Support Department
ex- X-Cart Hosting Manager - X-Cart hosting
ex-X-Cart Technical Support Engineer


Note: For the official guaranteed tech support services please turn to the Customers HelpDesk.
Reply With Quote
  #7  
Old 10-28-2008, 06:23 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

@Ene
I did that, in conjunction with the change highlighted by Verfurt, but that makes only the Featured Products display - I don't get the rest of the products from the category.
Reply With Quote
  #8  
Old 10-28-2008, 10:34 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

Ok, more reveals slightly more success.

When making Ene's change, it doesn't seem to work unless you place his line of code ahead of this code:
Code:
if (!empty($cat)) include "./products.php";
It would normally come after this code and, left in that position, the change doesn't seem to have any effect.

Then, if you also make Verfurt's change the featured product box does appear on the category page. Further, moving the code up the file moves the featured product box position on the web page. That's all good and a step forward.

The problem is that by making the change that Ene suggests and moving it as I've indicated, for any categories that have more than one page the navigation bar is no longer displayed. So, if we can just solve that issue then all will be hunky dory.
Reply With Quote
  #9  
Old 10-28-2008, 11:18 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

In another thread on the subject (http://forum.x-cart.com/showthread.php?t=40988&highlight=featured+products ) Tbone makes some further changes that (combined with the ones above) do restore the navigation to categories that have more than one page:

Quote:
Originally Posted by TBone
In featured_products.php

add
$searchtype="featured";
just before
include $xcart_dir."/include/search.php";

and comment out
$smarty->clear_assign("products");

In include/search.php

replace
$smarty->assign("products", $products);
with
if (!$searchtype=="featured") {
$smarty->assign("products", $products);
}

In products.php

add
$products = array();
unset($search_data, $products);
Just before
?> at the bottom of the page
These changes mean that the Featured Products box is displayed on the category page, and the navigation for categories with more than one page is maintained. All of this is good and another step forward.

Unfortunately, the navigation is repeated in the Featured Product box and this is wrong. There shouldn't be any navigation in there at all. Anyone know how to stop that?
Reply With Quote
  #10  
Old 10-28-2008, 11:31 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Getting Feautured Products to display in all categories

And the solution to that is to edit featured.tpl in skin1/customer/main and take out the references to customer/main/navigation.tpl.

So there we go; problem solved. Featured Products that display on every category page that has featured products set (the box does not display if there are no products set in the admin panel). Just what I was looking for, but rather more difficult than it needed to be to achieve, I feel.
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 10:12 AM.

   

 
X-Cart forums © 2001-2020