You are here:  » CSS Format for Related Products


CSS Format for Related Products

Submitted by ChrisNBC on Wed, 2013-06-19 10:09 in

Hi David,

Hope all is going well.

I would like to apply css settings to the related products results. Currently the result rows are displayed with pink and blue backgrounds...I have hunted for the css code in default.css but can't see where this formatting is set?

Would be grateful if you could tell me how I can alter the formatting for the 'related' results.

Thanks in advance.

Regards

Chris

Submitted by support on Wed, 2013-06-19 13:05

Hi Chris,

Related products are actually displayed by the search results HTML module html/searchresults.php (included by html/related.php).

So if you're happy with the same styling for search results and related products then you can simply edit the .searchresults style definitions in default.css

However, if you wanted them styled differently, first create a copy of html/searchresults.php and save it as html/relatedresults.php. In the new file, look for the following code at line 4:

  <div class='searchresults'>

...and REPLACE with:

  <div class='relatedresults'>

Next, edit html/related.php and look for the following code at line 3:

  require("html/searchresults.php");

...and REPLACE with:

  require("html/relatedresults.php");

Finally, in default.css, copy all the .searchresults related styles and create new .relatedresults styles are required...

Don't forget to do a hard-refresh in your browser (normally CTRL+F5) after editing CSS to ensure that it is reloaded)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Thu, 2013-06-20 14:13

Hi David,

Thanks as always for your quick response. I want to style the related results independently, so I made the changes you suggest. However, when I checked the site, no related results are displayed at all for most products except one where no price comparison results are displayed. I wonder if the fact that I'm applying this change to a niche site which uses a 'synthetic' data feed to ensure Amazon matches are exact is impacting the related results in some way?

Would be grateful if you could let me know what you think.

Thanks in advance.

Regards
Chris

Submitted by support on Thu, 2013-06-20 14:37

Hi Chris,

That actually sounds like Related Products aren't enabled - the setting is overridden on "old" product pages so that the Related Products results can help visitors find alternatives. To enable for all pages, make sure that $config_useRelated is set to TRUE at line 10 as follows:

  $config_useRelated = TRUE;

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Fri, 2013-06-21 20:03

Hi David,

Thanks for your response.

I double checked the config when I couldn't get 'related' to work and it is set to TRUE.

The odd thing is that I for most of the pages such as the one below, there are no related results

{link saved}

but for another page (which has no comparison results), the related items display perfectly:

{link saved}

I'm wondering if the problem maybe relates to the way Amazon results are matched using the synthetic feed file?

Thanks in advance.

Regards
Chris

Submitted by support on Sun, 2013-06-23 09:54

Hello Chris,

What's actually happening is, I think due to the very niche nature of the site, is that the query used to return related products is not returning any results due to the fact that the only result for a keyword search of the exact name is the product itself (which is excluded from Related Products of course!)

In this instance it's probably necessary to "losen" up the related product query logic - if you could please email me your current products.php so that I can see the version of code currently in place I'll implement something for you to try that should help..

Cheers,
David.
--
PriceTapestry.com