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

Change how products in the product list display in home_main.tpl for one category

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-02-2007, 11:27 PM
 
loopsound loopsound is offline
 

Advanced Member
  
Join Date: Feb 2004
Posts: 85
 

Exclamation Change how products in the product list display in home_main.tpl for one category

I am about to introduce a new product to my website - downloadable cds - and I would like to change how these products in the product list display in home_main.tpl when this one category is selected.

My website does not use the product details page it just lists the products in each category when it selected. This is fine for the products we currently sell as their layout is the same, but now we need a new display for the new category of product.

I know this mod can be done for product.tpl but as I do not use the details page, I think I need a duplicate products.tpl. Does anyone know how to achieve this process? I have literally pulled my hair out changing and guessing code and any help would be greatly appreciated.

I know it has soemthing to do with else/if arguements in home_main.tpl but I do not know enough code to achieve it. I also think I will need duplicated & renamed .tpl's to call but again - not entirely sure.

PLEASE HELP ME!!!!
__________________
xcartgold 4.5.4
xcartgold 4.5.5
Reply With Quote
  #2  
Old 01-03-2007, 12:44 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Change how products in the product list display in home_main.tpl for one category

If you want multiple categories with different layouts using different templates, we create a mod to create different template layouts and apply them to a category via the admin interface, and have a similar mod for product page display. Sample templates are also provided:


Multiple Category (Product Listing) Templates
http://www.websitecm.com/x-cart-mods/multiple-product-listing-templates-for-xcart.html

Multiple Product Page Templates
http://www.websitecm.com/x-cart-mods/multiple-product-templates.html

Package
http://www.websitecm.com/x-cart-mods/multiple-product-templates-package-for-xcart.html

If you need the one category only, then you can edit products.tpl and implement the following change:

FIND:

Code:
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl" products=$products}


Change to:

Code:
{if $current_category.categoryid eq "X"} {include file="customer/main/products_custom.tpl" products=$products} {elseif $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl" products=$products}


Of course substitute your categoryid for X and use the name and location of your custom template. You can download products.tpl, rename it to products_custom.tpl and edit it.
Reply With Quote
  #3  
Old 01-03-2007, 12:53 AM
 
loopsound loopsound is offline
 

Advanced Member
  
Join Date: Feb 2004
Posts: 85
 

Red face Re: Change how products in the product list display in home_main.tpl for one category

Thanks so much for your help. I will have a go at the single category for now but just out of interest are all the template mods you provide 4.1.2 and up compatible? I may wish to buy them if I decide to have multiple category changes.

You have been so helpful. I await your response regarding the mod.

UPDATE:

I have now implemented this mod successfully and would like to know how I could make the search_result.tpl show the in same format as the category listing. I noted that it uses products.tpl as an include - could I add code to search_result.tpl that would use my custom products.tpl aswell?
__________________
xcartgold 4.5.4
xcartgold 4.5.5
Reply With Quote
  #4  
Old 01-03-2007, 08:29 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Change how products in the product list display in home_main.tpl for one category

Yes the mods are 4.1.x compatible.

You can edit your search result template and replace "products.tpl" with your template name.
Reply With Quote
  #5  
Old 01-04-2007, 12:13 AM
 
loopsound loopsound is offline
 

Advanced Member
  
Join Date: Feb 2004
Posts: 85
 

Default Re: Change how products in the product list display in home_main.tpl for one category

Thanks for replying. I think you may have misunderstood what I meant or I have not made it very clear. I would like search_result.tpl to show either products.tpl OR products_cd.tpl (custom tpl). I would like results from my parent category no.158 to display products_cd.tpl and all the other products can display products.tpl. Is this possible?

I am assuming you can use a similiar code as you instructed me to place in products.tpl but I would appreciate if you could help me implement the above.

Again, many thanks Jon
__________________
xcartgold 4.5.4
xcartgold 4.5.5
Reply With Quote
  #6  
Old 01-04-2007, 07:52 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Change how products in the product list display in home_main.tpl for one category

That's a bit more difficult as the search results are not grouped by specific category, so you'd have mixed results. For that purpose you would have to modify the one template for both purposes, to do something like:

{if $products[product].categoryid eq "X"}Show Category Specific Info{else}Show the default{/if}
Reply With Quote
  #7  
Old 01-15-2007, 06:19 AM
 
loopsound loopsound is offline
 

Advanced Member
  
Join Date: Feb 2004
Posts: 85
 

Exclamation Re: Change how products in the product list display in home_main.tpl for one category

Hi

I was just wondering if it was possible to have all subcategories under the main category use the products_cd.tpl not the standard products.tpl. I have only just realised if is displaying incorrectly.

I am still no closer to doing the same with the search_results.tpl either.

Please help - It would be greatly appreciated!!!
__________________
xcartgold 4.5.4
xcartgold 4.5.5
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 12:10 PM.

   

 
X-Cart forums © 2001-2020