Post by kartuser » Tue Apr 24, 2012 7:17 am

Does anyone know how to center the featured products?
They appear left aligned.

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by mandamexico » Tue Apr 24, 2012 12:37 pm

Be more specific or attach a screenshot. I dont know what you mean by centered, because its already centered for me.

- Chris

My Extensions

OpenCart Developer (OCD) Tools

Donate - If I ever helped you.


User avatar
Active Member

Posts

Joined
Mon Jun 29, 2009 10:14 am
Location - Los Angeles, CA

Post by kartuser » Wed Apr 25, 2012 9:37 pm

For example you know how you have the become a VIP member section on your website and its probably like the featured section. The products in that section are left aligned. How can I align them to the center.

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by mandamexico » Thu Apr 26, 2012 1:11 am

Ok I see what you mean. But if products span across all the rows and columns it wouldnt appear left aligned. Anyway, try using a align attribute or an html <center></center> code.

Try the catalog/view/theme/default/template/module and open the featured.tpl file. Another place it can be is in the controller file, but the featured.tpl is where the featured module gets its front end display view from. Remember to find the string of code where its pulling both the image and product name text. It will look something like <php echo$ blah blah blah>

Good luck,

Christian

My Extensions

OpenCart Developer (OCD) Tools

Donate - If I ever helped you.


User avatar
Active Member

Posts

Joined
Mon Jun 29, 2009 10:14 am
Location - Los Angeles, CA

Post by kartuser » Thu Apr 26, 2012 1:56 am

Didn't work for me. Tried <center> in different combinations.

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by labeshops » Thu Apr 26, 2012 2:13 am

kartuser wrote:Didn't work for me. Tried <center> in different combinations.
In your stylesheet, look for the division for box products and add text-align: center;

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by max2011 » Thu Apr 26, 2012 5:27 am

i'm no expert but this worked for me

changed stylesheet.css by adding text-align: center;

default line 734

Code: Select all

.box-product .image {
	display: block;
	margin-bottom: 0px;
	text-align: center;
}

Newbie

Posts

Joined
Sat Aug 20, 2011 12:00 am

Post by kartuser » Fri Apr 27, 2012 8:36 am

The text-align: center; still didn't work. I'm no expert by I tried to change to image-align: center; and display: center;

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by grduniam » Fri Apr 27, 2012 2:56 pm

You can do it two ways.

under .box in your Stylesheet (line 680 ish) add:
width:100%;
text-align:center;

This will center featured products but it will also center the text in your account list on account pages/login page etc as well as the headings in these boxes.

So to keep them left aligned but to center the featured products go into your featured.tpl file and add align="center" to the box product div (line 4) as below:

Code: Select all

<div class="box-product" align="center">
Goodluck!

Affiliate Homepage Link and Promote All Products
Hide Empty Shopping Cart
Remove Shipping and Handling from Affiliate Commission
Move Affiliate Info to Top of Orders Page


User avatar
New member

Posts

Joined
Wed Apr 11, 2012 7:26 pm
Location - Tasmania

Post by kartuser » Sat Apr 28, 2012 1:00 am

This didn't work. Maybe I didn't describe correctly. Here is what I'm talking about.
I want these products to center under the yellow featured bar.

I tried to resize the size of the featured products icons but then they run in on each other.

Image

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by grduniam » Sat Apr 28, 2012 2:49 pm

Kartuser, can you post a link to your site so I can have a look at your source code see if I can work it out.

Affiliate Homepage Link and Promote All Products
Hide Empty Shopping Cart
Remove Shipping and Handling from Affiliate Commission
Move Affiliate Info to Top of Orders Page


User avatar
New member

Posts

Joined
Wed Apr 11, 2012 7:26 pm
Location - Tasmania

Post by kartuser » Sun Apr 29, 2012 1:13 am

.
Last edited by kartuser on Wed Jun 13, 2012 11:00 am, edited 1 time in total.

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by labeshops » Sun Apr 29, 2012 2:55 am

labeshops wrote:
kartuser wrote:Didn't work for me. Tried <center> in different combinations.
In your stylesheet, look for the division for box products and add text-align: center;
As I said above, add it to your box product division itself:

Code: Select all

.box-product {
	width: 100%;
	overflow: auto;
       text-align: center;
}

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by kartuser » Sun Apr 29, 2012 4:39 am

Thank you! It works now. It didn't work before.

New member

Posts

Joined
Thu Mar 15, 2012 9:56 am


Post by sunsys » Sat Mar 28, 2015 10:06 pm

labeshops wrote: As I said above, add it to your box product division itself:

Code: Select all

.box-product {
	width: 100%;
	overflow: auto;
       text-align: center;
}
@labeshops, by your method all the text is also center aligned,
In place of "text-align" I have used the padding function

Code: Select all

.box-product {
  width: 100%;
  overflow: auto;
  padding-left: 30px;
}
and everything is perfectly fine also the advantage of padding is that where you have just 2 product they will not come to the center of the product box which looks funny.

Regards,
Sun Systems
Industrial Electronics and Instrumentation


User avatar
Active Member

Posts

Joined
Tue Jan 27, 2015 5:19 am

Post by labeshops » Sun Mar 29, 2015 12:15 am

In my case, I wanted my text aligned center as well, but yeah, padding would also work. Though if you change the size of the image, remember to change the amount of padding.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by sunsys » Sun Mar 29, 2015 1:14 pm

labeshops wrote:In my case, I wanted my text aligned center as well, but yeah, padding would also work. Though if you change the size of the image, remember to change the amount of padding.
@ labeshop, You are right on both counts, thank you for your reply.

Regards,
Sun Systems
Industrial Electronics and Instrumentation


User avatar
Active Member

Posts

Joined
Tue Jan 27, 2015 5:19 am
Who is online

Users browsing this forum: No registered users and 5 guests