List view instead of grid view

Open to all! Ask other shopowners for help.
amaische
Member
Posts: 13
Joined: Wed Aug 18, 2021 7:10 am
Phoenix Version: v1.0.9.7
Been thanked: 1 time

List view instead of grid view

Post by amaische »

Hello,
I have installed Phoenix 1.0.7.7 and I want the product listing to be shown in list view, not in grid view.
The user of the shop should not be able to choose between list or grid, the admin should make the adjustment.
Is there an addon or have i overlooked something in the standard phoenix ?
Thank you in advance, best regards amaische


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: List view instead of grid view

Post by heatherbell »

amaische wrote: Wed Aug 18, 2021 7:15 amwant the product listing to be shown in list view,
Change the settings in Admin>Configuration>Product Listing>Products per Row
You can change it so only 1 product per row will show, that is a list view.
amaische
Member
Posts: 13
Joined: Wed Aug 18, 2021 7:10 am
Phoenix Version: v1.0.9.7
Been thanked: 1 time

Re: List view instead of grid view

Post by amaische »

Hello,
thank you for the fast reply. If I do so, the image is really large (card-img=100%). If I change it to e.g. 50% it is better, but the text (containing products_model, products_name, products_price,etc) is still beneath the image and not besides the image in the same row.
How can I change this ?
best regards amaische
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: List view instead of grid view

Post by ecartz »

There is an example with the product listing as a list in app.php/addons/supporters_code/s05e06_t ... ,_theming/

I forget how old that example is; it may or may not work with 1.0.7.7 without changes. It would work in 1.0.8.0.
amaische
Member
Posts: 13
Joined: Wed Aug 18, 2021 7:10 am
Phoenix Version: v1.0.9.7
Been thanked: 1 time

Re: List view instead of grid view

Post by amaische »

Unfortunately in the addon is no example how the list looks like.
Therefore I have found a solution
1. As mentioned above change the setting in admin: products-per-row=row row-cols-1 row-cols-sm-1 row-cols-md-1
2. Change product_listing.php (templates-default-includes-components) (the following changes are hard coded):

find:

Code: Select all

 "$prod_list_contents .= '<div class="card h-100 is-product" data-is-special="' . (int)$listing['is_special'] . '" data-product-price="' . $currencies->display_raw($listing['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '" data-product-manufacturer="' . max(0, (int)$listing['manufacturers_id']) . '" >' . PHP_EOL;"

Code: Select all

    $prod_list_contents .= '<div class="card h-100 is-product" data-is-special="' . (int)$listing['is_special'] . '" data-product-price="' . $currencies->display_raw($listing['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '" data-product-manufacturer="' . max(0, (int)$listing['manufacturers_id']) . '" style="border:none;-ms-flex-direction: row;flex-direction: row;">' . PHP_EOL;
find:

Code: Select all

          $prod_list_contents .= '<a href="' . tep_href_link('product_info.php', 'manufacturers_id=' . (int)$_GET['manufacturers_id'] . '&products_id=' . (int)$listing['products_id']) . '">' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', true, 'card-img-top') . '</a>' . PHP_EOL;
and add after the </a> an </span>
Do the same two lines beneath.

find:

Code: Select all

         $prod_list_contents .= '<h5 class="card-title">';
and change it to

Code: Select all

 $prod_list_contents .= '<span style="display: inline-block; width: 70%;"><h5 class="card-title">';
find:

Code: Select all

$prod_list_contents .= '</div>' . PHP_EOL;
(the first one at the end of the while-loop) and change it to

Code: Select all

 $prod_list_contents .= '</span></div>' . PHP_EOL;

find:

Code: Select all

 $prod_list_contents .= '</div>' . PHP_EOL;
(the last one in the while-loop) and change it to

Code: Select all

  $prod_list_contents .= '</div><hr>' . PHP_EOL;
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: List view instead of grid view

Post by Kofod95 »

Please copy that file into templates/override/includes/components - then it's a no-core change

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: List view instead of grid view

Post by Omar_one »

check this add-on by @zipurman
app.php/addons/paid_addon/zipur_product_manager/
its included a hook for Product List Columns 1,2,4,6..
it's not just that , there is a lot.. its product manager for back-end and front-end
ArtcoInc
Contributor
Posts: 119
Joined: Fri Oct 25, 2019 4:19 pm
Phoenix Version: v1.0.3.0
Has thanked: 86 times
Been thanked: 17 times

Re: List view instead of grid view

Post by ArtcoInc »

(reviving an old thread)

I, too, need to know how to display in list view, not grid view.

1) Phoenix, v 1.0.3.0 (please don't judge)
2) There is no Product Listing > Product Per Row option in 1.0.3.0
3) The edits posted by the OP are not applicable in v 1.0.3.0
4) Zipurman's add-on is no longer available

I am not adverse to editing 'core' files (again, please don't judge). I did this on a site I built years ago on Phoenix 1.0.1.4 (and in pre-frozen versions of oSC-CE), but those changes aren't applicable to 1.0.3.0.

TIA

Malcolm
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: List view instead of grid view

Post by burt »

I -think- old versions included a header tag module for grid/list.
Does your have such a module ? If yes, paste the contents here, in code tags.
I am not here to build for you.
I am here to build with you. Let's help each other.
ArtcoInc
Contributor
Posts: 119
Joined: Fri Oct 25, 2019 4:19 pm
Phoenix Version: v1.0.3.0
Has thanked: 86 times
Been thanked: 17 times

Re: List view instead of grid view

Post by ArtcoInc »

@burt I'm sorry, but I don't see that header tag ...

Malcolm


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply