Post by antmagn » Fri Aug 02, 2024 2:08 pm

Hello everyone, is there any way to make the product page more on the center of the page, I mean the separation between the image and the tittle on the right? I'm using the default theme, I have also added the full page width extension. I've tried change the image size at the options and it only change the image size inside the white box, it does not move anything.
Thank you in advance,
Tonia

Attachments

Screenshot 2024-07-30 9.22.02 AM.png

Screenshot 2024-07-30 9.22.02 AM.png (157.06 KiB) Viewed 1179 times

Last edited by antmagn on Tue Aug 06, 2024 8:03 pm, edited 1 time in total.

New member

Posts

Joined
Fri Jul 23, 2021 8:38 pm

Post by SohBH » Fri Aug 02, 2024 6:42 pm

Apply css to image link.

Code: Select all

display: flex;
align-items: center;
justify-content: center;

View all extensions | Request custom work | Pricing | Contact Me


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia

Post by softmonke » Sun Aug 04, 2024 6:17 am

SohBH wrote:
Fri Aug 02, 2024 6:42 pm
Apply css to image link.

Code: Select all

display: flex;
align-items: center;
justify-content: center;
Hmm in OpenCart's default theme (which seems like what @antmagn is using albeit with a few changes to the colours of the theme), the product image is already centered using margin-left auto and margin-right auto - so I don't think this is necessary.

Correct me if I'm wrong but I think what @antmagn was trying to say is that they want the product image section and the product information section to each take up 50% of the page space rather than the current set up, where the product image section is taking up more space than the product information section. If that's the case, you have to understand that in Bootstrap (the CSS library that the default OpenCart theme is using), each row takes up 12 columns, and in the OpenCart's theme, the product image section in the product page takes up 8 columns, and the product information section takes up 4 columns.

If you take a look at the "product.twig" template file, you will see something like below:

Code: Select all

       {% if column_left or column_right %}
        {% set class = 'col-sm-6' %}
        {% else %}
        {% set class = 'col-sm-8' %}
        {% endif %}
That's for setting the column size of the product image, while taking into consideration modules that might have been added to the product page layout. So if you want it only take up 50% of the space, you should change "col-sm-8" to "col-sm-6". And then, on the other hand, for the product information section, look for the following:

Code: Select all

        {% if column_left or column_right %}
        {% set class = 'col-sm-6' %}
        {% else %}
        {% set class = 'col-sm-4' %}
        {% endif %}
And change "col-sm-4" to "col-sm-6". You can play around with the numbers to achieve your desired layout but just make sure that the numbers add up to 12 for a single row. You might want to check out Bootstrap's documentation here: https://getbootstrap.com/docs/3.4/css/#grid for a better, more detailed explanation on the grid system in Bootstrap.

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by antmagn » Tue Aug 06, 2024 2:20 pm

softmonke wrote:
Sun Aug 04, 2024 6:17 am
SohBH wrote:
Fri Aug 02, 2024 6:42 pm
Apply css to image link.

Code: Select all

display: flex;
align-items: center;
justify-content: center;
Hmm in OpenCart's default theme (which seems like what @antmagn is using albeit with a few changes to the colours of the theme), the product image is already centered using margin-left auto and margin-right auto - so I don't think this is necessary.

Correct me if I'm wrong but I think what @antmagn was trying to say is that they want the product image section and the product information section to each take up 50% of the page space rather than the current set up, where the product image section is taking up more space than the product information section. If that's the case, you have to understand that in Bootstrap (the CSS library that the default OpenCart theme is using), each row takes up 12 columns, and in the OpenCart's theme, the product image section in the product page takes up 8 columns, and the product information section takes up 4 columns.

If you take a look at the "product.twig" template file, you will see something like below:

Code: Select all

       {% if column_left or column_right %}
        {% set class = 'col-sm-6' %}
        {% else %}
        {% set class = 'col-sm-8' %}
        {% endif %}
That's for setting the column size of the product image, while taking into consideration modules that might have been added to the product page layout. So if you want it only take up 50% of the space, you should change "col-sm-8" to "col-sm-6". And then, on the other hand, for the product information section, look for the following:

Code: Select all

        {% if column_left or column_right %}
        {% set class = 'col-sm-6' %}
        {% else %}
        {% set class = 'col-sm-4' %}
        {% endif %}
And change "col-sm-4" to "col-sm-6". You can play around with the numbers to achieve your desired layout but just make sure that the numbers add up to 12 for a single row. You might want to check out Bootstrap's documentation here: https://getbootstrap.com/docs/3.4/css/#grid for a better, more detailed explanation on the grid system in Bootstrap.
Thank you very much, that was exactly what I meant! It looks much better now, although it does not fit to widow width, but still much better.

Attachments

Screenshot 2024-08-06 9.19.22 AM.png

Screenshot 2024-08-06 9.19.22 AM.png (120.58 KiB) Viewed 781 times


New member

Posts

Joined
Fri Jul 23, 2021 8:38 pm

Post by softmonke » Tue Aug 06, 2024 3:47 pm

No problem! If you want it to fit the entire window's width, you can just change the "container" class to "container-fluid" instead for the "<div>" with id "product-product".

Anyway, since this is resolved, do add [SOLVED] to the title of your post :)

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am

Who is online

Users browsing this forum: No registered users and 20 guests