Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct product-listing/category-row display for 'columns' display #359

Closed
proseLA opened this issue Apr 25, 2024 · 3 comments
Closed

Correct product-listing/category-row display for 'columns' display #359

proseLA opened this issue Apr 25, 2024 · 3 comments
Labels
bug Something isn't working fix provided A correction has been provided
Milestone

Comments

@proseLA
Copy link

proseLA commented Apr 25, 2024

i'm not really sure how people use this template out of the box. maybe i am missing something.

i think i am using this with all of the default settings.

my layout style based on that is now columns.

based on that, i now have a percentage for column width as dictated by this code:

// if in fixed-columns mode, calculate column width
if ($product_listing_layout_style === 'columns') {
$calc_value = $columns_per_row;
if ($num_products_count < $columns_per_row || $columns_per_row == 0) {
$calc_value = $num_products_count;
}
$col_width = floor(100 / $calc_value) - 0.5;
}

given the fact that there are only 3 products in this category, i now have a column width of 32.5; which looks to be a percentage as dictated here:

if ($product_listing_layout_style === 'columns') {
$style = ' style="width:' . $col_width . '%;"';
}

and now, we use that with in-line styling (noooooo!!!!!!) here:

$list_box_contents[$rows][] = [
'params' => 'class="card mb-3 p-3 centerBoxContentsListing text-center h-100 "' . $style,

and then it finally gets output here:

<div class="card mb-3<?= $card_main_class ?>"<?= $card_main_id ?>>
<?php
echo $title;
?>
<div class="card-body text-center"<?= $card_body_id ?>>
<?php
if (is_array($list_box_contents)) {
foreach ($list_box_contents as $row => $cols) {
$r_params = $list_box_contents[$row]['params'] ?? 'class="card-deck text-center"';
?>
<div <?= $r_params ?>>
<?php
foreach ($cols as $col) {
if ($cols === 'params') {

which is already a div within a div within a div. which is fine. except the product display is now 32.5% of the column as opposed to 32.5% of the viewporrt.

see:

image

what might i be missing?

removing the $style on line 396 above seems to resolve the issue. see:

image

again, what might i be missing here?

@lat9
Copy link
Owner

lat9 commented Apr 25, 2024

This configuration setting's directions:
image

Combined with this Wiki article.

@proseLA
Copy link
Author

proseLA commented Apr 25, 2024

this does not explain the problem that i have presented.

you are explicitly stating that you do not recommend using a number other than 0 or 1. but if one chooses to use a non recommended number, the calculation is completely wrong. is that why it is not recommended?

0 or 1 is either fluid or row. so you do not recommend column. the only time this style error occurs is in a non recommended setting, ie column.

so again, given that we are now in a non-recommended setting (which i can only mean non-supported) why is that in-line style width there? it makes no sense to me. and i think it should be removed.

unless you can present a situation where that in-line style would be correct. which i would be more than willing/anxious to hear.

@lat9
Copy link
Owner

lat9 commented Apr 25, 2024

Thanks for sussing that out; same issue applies to the category_row.php module.

@lat9 lat9 added the bug Something isn't working label Apr 25, 2024
@lat9 lat9 added this to the v3.7.0 milestone Apr 25, 2024
@lat9 lat9 changed the title column width seems wrong... Correct product-listing/category-row display for 'columns' display Apr 26, 2024
lat9 added a commit that referenced this issue Apr 26, 2024
- Also includes some reformatting/refactoring for the product_listing.php module.
@lat9 lat9 added the fix provided A correction has been provided label Apr 26, 2024
@lat9 lat9 closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix provided A correction has been provided
Projects
None yet
Development

No branches or pull requests

2 participants