Forums / Templates, Stylesheets, Page Layout / How to add a heading between row 1 and 2 on product listing page?

How to add a heading between row 1 and 2 on product listing page?

Locked

Started by rilken27 on 12 Nov 2009, 5:56 PM · Views: 985

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
12 Nov 2009, 5:56 PM
#1
rilken27 avatar

rilken27

New Zenner

Join Date:
Mar 2009
Posts:
43
Plugin Contributions:
0

How to add a heading between row 1 and 2 on product listing page?

I've been searching the forum for days to see if it's possible to cross sell a product to a category. haven't found the answer...so here's an alternative. Within each product listing I want to add a heading that will go directly between row 1 and 2 on the product listing page. It will say "You may also like". How can I achieve this?

12 Nov 2009, 6:58 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How to add a heading between row 1 and 2 on product listing page?

THere are a few cross sell mods in Free Software Add Ons, above. If they won't do the job, you may be able to see how they do what they do and adapt it.

12 Nov 2009, 7:30 PM
#3
rilken27 avatar

rilken27

New Zenner

Join Date:
Mar 2009
Posts:
43
Plugin Contributions:
0

Re: How to add a heading between row 1 and 2 on product listing page?

I have the cross sell mod...but it won't cross sell products to categories as I mentioned in my post. do you know how I can add headings within the product listing page?

12 Nov 2009, 7:51 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to add a heading between row 1 and 2 on product listing page?

Pretty much any modification is possible if you know PHP well enough...

To add a blurb within the product listing, you would edit /includes/modules/your_template/product_listing.php. The largest part of that file is a loop that adds each desired element in the desired order to the listing for a product, then moves to the next product and repeats. It uses $rows as a counter (starting from 0), so you could insert your output code in an appropriate place wrapped in a test for $rows equaling 1 or whatever:

if ($rows == 1){
  //your code
}
12 Nov 2009, 8:05 PM
#5
rilken27 avatar

rilken27

New Zenner

Join Date:
Mar 2009
Posts:
43
Plugin Contributions:
0

Re: How to add a heading between row 1 and 2 on product listing page?

Thanks for your response Glen. Unfortunately PHP is VERY new to me. If I want to add the heading "You may also like" directly between rows 1 and 2...what should my php code look like?

Also, is it possible to have this display for certain categories? And not on others?

P.S. THIS FORUM ROCKS. thank you so much for your help!

12 Nov 2009, 9:04 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to add a heading between row 1 and 2 on product listing page?

By "rows 1 and 2" do you mean the first two products? I can't take time right now to write the code for it.

You can include a test for $cPath equalling the ones for categories you want to use - look at the comments in /includes/templates/template_default/common/tpl_main_page.php for an example using the explode() function.