Trying To Understand Grids And Spans - V.4.1.5

Hi Folks,



While trying to adapt a layout to match a given design, we encounter an strange grid-span behaviour that we don't know how to face, or what causes it. I attach a screenshot with annotations.



The fact is that we need to nest some grids. The main design is 12 column width. The first grid is of 12 columns, and span 12. The next level has two grids, one of 2 columns, and one of 10 columns, both of them having the same span (span 2 and span 10). BUT then, when we create two grids inside the 10 column grids, they span above the total size of the container, and thus we have a grid-7 that spans 8, and a grid 3 that spans 4.



This is causing us some headaches when implementing the design, as we can't rely on the columns widths for the content inside those grids.



Does anybody know where is the trick or what do we do bad? Any comment or guidance would be highly appreciated.



Thanks in advance,

strange-grid-span-behaviour.png

Have not confirmed your info, but if you have a grid width of 7 columns, the span within it should be span7. Where is the code being generated that is using the class=“span9”? It could be there's a defect that you should report via bugtracker if you can provide details on how they can reproduce it.

Hi tbirnseth,


[quote name='tbirnseth' timestamp='1406578310' post='188371']

Have not confirmed your info, but if you have a grid width of 7 columns, the span within it should be span7. Where is the code being generated that is using the class=“span9”? It could be there's a defect that you should report via bugtracker if you can provide details on how they can reproduce it.

[/quote]



Many thanks for your interest on the subject, I appreciate your help in tons and tons of posts.



We've been dealing with that issue for some days, and really we don't know if we are doing something bad, or if it's an issue with our design, or a bug.



Certainly, maybe we are being too cautious and it's time to post it on the bug tracker, as you suggest. We'd be thankful if you or anyone else could confirm such behaviour on another cs-cart installation (v.4.1.5).



Any further comment on the topic would help us narrowing the causes and make for a better case on the bug tracker.



Thanks in advance,

You'd have to post a link to the page to look. But I'm guessing it's simply a typo in the templates somewhere… Can you provide more specifics?

Hi Tbirnseth,


[quote name='tbirnseth' timestamp='1406599199' post='188383']

You'd have to post a link to the page to look. But I'm guessing it's simply a typo in the templates somewhere… Can you provide more specifics?

[/quote]



Sorry for the delay in the follow up of that matter, I was out for a few days.



We posted the same question to Cs-cart support team and that's their answer:


[quote]

The span value in question indicates the relation of the current grid width to the parent one. This value is shown only for the Full width and Fluid width layouts. Please let me explain how it is generated. If the layout type is not Fixed and the layout width for the fluid layout is more than 0, the block manager demonstrates you the relation of the grid width to the parent one. fn_get_grid_fluid_width calculates the value according to the following algorithm:


function fn_get_grid_fluid_width($width_schema, $parent_width, $grid_width)
{
$relation = 0;
if (empty($parent_width)) {
$relation = $grid_width;
} else {
$relation = $width_schema * (($grid_width * 100 / $parent_width) / 100);
}
return round($relation);
}


As a result, depending on the variables values sent to the function, the span value can be different from the grid one. I hope this explains the situation. Please feel free to contact us if you have any further questions.

[/quote]



So it seems from their explanation that the span value must be understood as a ratio (in relation to its parent grid) and not as an absolute value. In our case (following the screenshot from our first post n this thread), I understand that this should be read as: “the grid 7 will span-occupy 8/(8+4)=75% of the parent grid, which is a 10 column grid”.



Are we interpreting this correctly?



All in all, the problem for us was that we used the span in the html generated to customize the site styles, and the resulting html was giving us a “span 8” and “span 4” labels where we expected “span 7” and “span 3” labels. This was a nightmare when editing CSS, as we expected that each label would indicate the number of the columns…



I enclose a screenshot of this page: http://af.webdeprova…&category_id=21 that I've setup in order to illustrate the issue. Using firebug, the html rendered labels each div with the “relative” span number, instead of the grid number.



Any comment or further discussion will be appreciated!



Thanks in advance,



P.S.: I've updated the link in order to show also a block in the grid10 container.

strange-grid-span-behaviour-html.png

Wow, you must have sent a pack of cookies to the helpdesk. Rarely have I ever seen a description that was technical and complete from the helpdesk…