You are here:  » i. Header ii. Categories

Support Forum



i. Header ii. Categories

Submitted by jajaj on Sun, 2012-09-23 11:48 in

Hi David

I hope you are well.

Having played around with creating my first website to incorporate Price Tapestry, I completed a second, hoping to apply lessons learned! It has proved much easier the second time around, but I have a couple of questions:

These are regarding the second site, not the one on which you have helped me before.

i. Header

My header shows on my home page, (.png image). As soon as I do a search through brand, category or merchant, it will not display and the properties box shows that it is not available.

If, however, I enter a search into the search box, (e.g. shoes), the header displays fine.

I have spent ages trying to figure out the problem, but to no avail. I am sure I must be missing the obvious: please could you help? Thanks.

ii. Categories

I would like to get rid of the numeric section at the head of the categories, as descriptors such as '87g MEDIUM 216mm' and '133in' are not very helpful.

I looked at the product feed, to see if I could amend it and thus lose the numeric categories, but cannot find anything that matches. A point in the right direction would be much appreciated, Thanks!

Kindest regards

Judie

Submitted by support on Mon, 2012-09-24 08:19

Hi Judie,

Re i. Header;

This sounds like your image is being referenced relatively in the src attribute of your img tag; which means that when browseing into the re-written /category/, /brand/ pages etc. the browser doesn't know where to locate the image.

Easily fixed, in your image tag - assuming your image is in the images/ folder (but it doesn't matter if not as the fix is the same) - let's say you have:

<img src='images/header.png' />

...all you need to do is insert a leading "/" e.g.

<img src='/images/header.png' />

The browser will then always look for the image relative to the top level of your site rather than the current "folder"...

Re: ii. Categories;

Category Mapping would be one way but that would be an ongoing process and there may be too many to manage, so one way to filter out unwanted categories e.g. where they begin with a number would be to make a simple mod to the import record handler in includes/admin.php. Look for the following comment at line 266:

    /* capture original catalogue product name prior to mapping */

...and INSERT the following code just before that line (which is immediately after the category mapping section)

  if (is_numeric(substr($importRecord["category"],0,1))) $importRecord["category"] = "";

(don't forget to re-import affected feeds as changes will only be applied at import time...)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by jajaj on Mon, 2012-09-24 17:40

Hi David

Thanks so much for your help.

Categories sorted - great!

No luck with the header, which is still refusing to show up on brand, category and merchant page searches.

I have checked the up-loaded file and it is OK: (I have had to remove angle brackets start and end of HTML code, as not showing in browser.)

img class="displayed" src="/images/header.png" alt=" "

(CSS) img.displayed {
display: block;
margin-left: auto;
margin-right: auto }

Now having an issue with brands, but I see that someone else has recently asked about this, so I will see if the thread helps before bothering you again!

Kindest regards

Judie

Submitted by support on Mon, 2012-09-24 17:58

Hi Judie,

Just a quick thought on this - links to CSS files also need to be absolute - double check that any CSS links in your header also have a src attribute begining with "/" - however if CSS can't be found then an image would normally display by default (unless there was some overriding CSS that is included correctly that is setting images to be display:none by default!!)

What I would do is open 2 browser windows - FireFox is great as the View > Source function makes all resources clickable to load - one with a top level e.g. search.php?q=something URL where the header image works; and a second with one of your /category/ or /brand/ index pages where the header image does not display. That will enable you to compare the header HTML that is being generated which may give some clue as to why the src attribute isn't corect...

If you're still not sure if you'd lke to post example URLs showing the problem (I'll remove before publishing your reply) I'll check it out for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by jajaj on Mon, 2012-09-24 20:34

Hi David

Thanks for your suggestions, which I have followed. The link to css was fine, so I looked at the source code.

The weird thing is that I can see no slash when viewing img src in the source code for either of the following URLs, but it is most definitely there in the source code for the header that I have up-loaded.

I have no idea where I'm going wrong, but I am sure you will spot it straight away!

Here are the two URLs for you:

{link saved} - image displays OK

{link saved} - no image

No rush: I have burnt out on this tonight and am at work tomorrow, so please don't feel I require your in-put urgently!

Thanks again.

Kindest regards

Judie

Submitted by support on Tue, 2012-09-25 07:52

Hi Judie,

Whilst there is no slash in the image src URL, it will still work at the top level (search.php link) because the images/ folder is in the same folder as that script - that's all it is. On the /merchant/ page, the browser ends up looking for /merchant/images/ - which doesn't exist.

Whilst it should be easily fixed with the leading "/", so in your html/header.php you would have:

<img src="/images/header.png" class="center" >

...you could make this generic by using the variable $config_baseHREF like this:

<img src="<?php print $config_baseHREF?>images/header.png" class="center" >

It does look like there are couple of issue with your html/header.php as it stands - i'm seeing a closing </body> tag immediately after the header image - this should only appear in html/footer.php - although it is gracefully ignored by most browser's it's always best for site optimisation to ensure that the HTML is valid - the View Source tool in Firefox is great for this as validation errors are highlighted in red.

If you're still not sure of course if you'd like to email me your modified files I'll check them out for you right away;

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by jajaj on Tue, 2012-09-25 17:41

Hi David

Thanks!

I've suddenly realised what I have been doing: over-writing the html/header.php file and wiping out your php code.

Sorry!

The header is showing fine now, but not liking something. I have the following error messages:

home page Warning: Cannot modify header information - headers already sent by
(output started at /home/cyclefor/public_html/index.php:10) in /home/cyclefor/public_html/html/header.php on line 29

merchants page Warning: Cannot modify header information - headers already sent by
(output started at /home/cyclefor/public_html/merchants.php:16) in /home/cyclefor/public_html/html/header.php on line 29

category page Warning: Cannot modify header information - headers already sent by
(output started at /home/cyclefor/public_html/categories.php:15) in /home/cyclefor/public_html/html/header.php on line 29

brand page Warning: Cannot modify header information - headers already sent by
(output started at /home/cyclefor/public_html/brands.php:15) in /home/cyclefor/public_html/html/header.php on line 29

I thought that I must be duplicating the 'require' command somewhere, but I have checked and I'm not. The only place I can find two 'require' commands for the header are these, in the html/header php code, but as the code refers to before-php and after-php, I am thinking that this is not the problem?:

<?php
  
if (file_exists("html/user_header_before.php")) require("html/user_header_before.php");
?>

and

<?php
  
if (file_exists("html/user_header_after.php")) require("html/user_header_after.php");
?>

Stumped now!

Thanks, David.

Kindest regards

Judie

Submitted by support on Tue, 2012-09-25 18:40

Hi Judie,

Please could you email me your modified

index.php
brands.php
html/header.php

...and I'll check all the changes out for you...

Cheers,
David.
--
PriceTapestry.com