X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Right border not displaying on subcategory image (https://forum.x-cart.com/showthread.php?t=54588)

Sisom 07-13-2010 11:33 AM

Right border not displaying on subcategory image
 
For some reason, the right border on all of my subcategory images isn't displaying.
I think it's something to do with the code which decides the maximum width of the subcategory image.

I added this style to altskin.css, line 934:



.subcategories img
{
border: 1px solid black;
}


No matter how large I make the border, it won't display the right border! The width of the image, including its border, is always 124px, but I've set it to be 125px in General Settings, Appearance Options.

I then tried setting the width to 124px, and it still displayed at 124px, but still without the right border. Then I tried setting it to 123px, but it still displayed at 123px, but still without the right border. I then tried setting it to 150px, but it displayed at 124px, still without the right border!

I presume it is getting the width from this part of subcategories_t.tpl:


Code:

<a href="home.php?cat={$subcategory.categoryid}"><img src="{$subcategory.icon_url|amp}" alt="{$subcategory.category|escape}" width="{$subcategory.image_x}" height="{$subcategory.image_y}" /></a>


Does anybody have any ideas?


You can view it on the site I am customising:


http://www.mrdtrading.co.uk/store/home.php?shopkey=martin


then go to:


http://www.mrdtrading.co.uk/store/home.php?cat=3

Shamun 07-13-2010 11:41 AM

Re: Right border not displaying on subcategory image
 
Max width is image + effects.

Since your images are 124px and you want a 1px border on both sides, thats 2px so you need a max of 126px.
This can be fixed if you know where to change the subcategories span class.

What it should be:
Code:

<span class="subcategories" style="min-height: 149px; min-width: 124px; width: 126px;">



Edit:
The code will be likely found inside a {foreach} statement which produces each category.

Sisom 07-13-2010 11:58 AM

Re: Right border not displaying on subcategory image
 
Hi Tal, I should have added this piece of code, which is just before the previous piece of code I posted, from subcategories_t.tpl:

Code:


 <span class="subcategories" style="min-width: {$subcat_div_width}px; width: {$subcat_div_width}px; min-height: {$subcat_div_height}px;">


I still don't know what to do to fix it. I tried changing the 'maximum thumbnail width' in General Settings, Appearance Options, to 126px, but still the same problem occurs - and it displays only a 124px wide image, including the left hand border.

Shamun 07-13-2010 12:04 PM

Re: Right border not displaying on subcategory image
 
You can try a temp fix by changing
Code:

width: {$subcat_div_width}px;
to
Code:

width: {$subcat_div_width+2}px;

Sisom 07-13-2010 12:20 PM

Re: Right border not displaying on subcategory image
 
Many thanks Tal, that's fixed it! Much appreciated.
I would still like to find out why it happened in the first place, these things bug me until I work out why they are happening!

Shamun 07-13-2010 12:34 PM

Re: Right border not displaying on subcategory image
 
Quote:

Originally Posted by Sisom
Many thanks Tal, that's fixed it! Much appreciated.
I would still like to find out why it happened in the first place, these things bug me until I work out why they are happening!


Same, which is why I'll be looking more into it soon :-)
The setting for that is somewhere and using hacks like the one I just gave isn't how to go about it. That's just to hold you over until the real issue is found.

gb2world 07-13-2010 12:47 PM

Re: Right border not displaying on subcategory image
 
You might consider it a minor bug if you are harsh? To account for it, QT would need to know that you are going to add a border, and how wide it will be, and account for it. They are resizing the image based on the admin setting, then setting the css for the container based on the same setting, so you can't fix it without another variable. (The administration setting does not know that you are going to add a border, and does not consider it. Might be easier for them to add an option to add a border in the administration, or just add the 2px that you did just in case someone does this.)

Sisom 07-13-2010 01:28 PM

Re: Right border not displaying on subcategory image
 
Thanks for explaining that, gb2world, now I understand it properly.
So, for my situation, Tal's solution is the way to go. It still allows me to change the max width size in Appearance Settings, and have a 1px border.
Thanks guys.

cflsystems 07-13-2010 03:04 PM

Re: Right border not displaying on subcategory image
 
In include/categories.php check this if

if (!empty($subcategories)) {

and then near the bottom

$smarty->assign("subcat_div_width", $subcat_div_width);
$smarty->assign("subcat_div_height", $subcat_div_height + 70);
$smarty->assign("subcat_img_height", $subcat_div_height);
$smarty->assign("subcategories", $subcategories);


I still don't know why QT decided to hard code it like this

Sisom 07-13-2010 03:56 PM

Re: Right border not displaying on subcategory image
 
In the main product page, I can add a border to the style
.product-details img

which is on line 2516 of main.css, and the border displays correctly.

But isn't that element getting its size from 'Maximum product image width' in Appearance Options?
So my question is, why does the problem occur with the thumbnail image, but not the product image?

gb2world 07-13-2010 04:10 PM

Re: Right border not displaying on subcategory image
 
The issue was not with the div that you add the border to, it was with the span that was around the div - it was not big enough to hold the image plus the border you added - it was only big enough to hold the image.

Sisom 07-17-2010 11:03 AM

Re: Right border not displaying on subcategory image
 
But doesn't the product image use the same type of layout as the thumbnail image - i.e. a div to contain the div which contains the image?

gb2world 07-17-2010 11:44 AM

Re: Right border not displaying on subcategory image
 
You would probably have to look at the exact differences to narrow in on the different behavior.

The link you originally published, if I remember correctly, was an image inside an href inside a span, with the span and the image being sized by the same smarty variable, leaving no room for the border you added. If the image you are comparing to is a div inside a div, that is a little different.

Probably - the href is not allowed to expand outside the containing div, so the border does not show. But the div inside the containing div is probably allowed to expand. You'd have to experiment a bit to see if that is the case. This is the kind of css that sometimes has differences across browsers too. Best just to leave room for the border with the containing div. (It might be worth reporting to QT as a minor bug. They probably won't see it as a bug, but at least will be aware of it. I don't think there is any reason to have the spacing so tight and it would be easy just to add a few pixels to avoid any confusion.)


All times are GMT -8. The time now is 10:42 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.