OpenCart Problem with Table in Description

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sully210
Forum Newbie
Posts: 17
Joined: Sat Sep 11, 2010 4:09 pm

OpenCart Problem with Table in Description

Post by sully210 »

Hello all :oops: I am really doing my best to learn this but I am having a problem I cannot find an answer for. I posted a thread on the OpenCart forum and the only solution offered made my problem worse. I have a table that spans most of the description area on the back end for the cigars on this shopping cart :

http://store.villagecigaremporium.com/i ... duct_id=67

Notice that it appears larger than the description area on the front end. I was told to edit the source code and add a <p> tag before and after the table and it made the table appear larger than the one shown above and automatically added more code. Is there a way to get the table to appear according to the size of the description area in the front end without going in and changing all 446 tables manually.

I can paste the three different sets of code here if necessary but here is the link to the post I have there that no one cares to answer further:

http://forum.opencart.com/viewtopic.php?f=20&t=19903

I thank you for any help you can provide and look forward to getting smart enough to help someone else some day.

:?

Best-

Sully
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: OpenCart Problem with Table in Description

Post by buckit »

your table is specifying a width.
replace: width: 645px;
with: width: 100%;
stuartr
Forum Newbie
Posts: 13
Joined: Sun Sep 12, 2010 11:11 am

Re: OpenCart Problem with Table in Description

Post by stuartr »

As mentioned the width specified in the table definition is teh cause of the problem, changing it to 100% as suggested will then set it to be 100% of the parent container.

Personally I would also look at swapping the orientation of the table so the descriptions run down and the comments appear along side the descriptions. This will allow you to cope better with the large number of fields that you are having to cope with.

So instead of

Code: Select all

<table border="1" cellpadding="4" cellspacing="2" style="width: 645px; height: 73px;">
	<tbody>
		<tr>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Class<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Ring<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Length<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Sing.<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Origin</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Wrapper</span></strong><strong><span style="color: rgb(139, 69, 19);"><br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Binder<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Filler<br />
				</span></strong></td>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Strength<br />
				</span></strong></td>
		</tr>
		<tr>
			<td style="text-align: center;">
				VSG</td>
			<td style="text-align: center;">
				49</td>
			<td style="text-align: center;">
				7in</td>
			<td style="text-align: center;">
				1</td>
			<td style="text-align: center;">
				Dominican</td>
			<td style="text-align: center;">
				Ecuador</td>
			<td style="text-align: center;">
				Dominican</td>
			<td style="text-align: center;">
				Dominican</td>
			<td style="text-align: center;">
				Full</td>
		</tr>
	</tbody>
</table>
I would use

Code: Select all

<table border="1" cellpadding="4" cellspacing="2" style="width: 645px; height: 73px;">
	<tbody>
		<tr>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Class<br />
				</span></strong></td>
                                                <td style="text-align: center;">
				VSG</td>
		</tr>
		<tr>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Ring<br />
				</span></strong></td>
			<td style="text-align: center;">
				49</td>
		</tr>
		<tr>
			<td style="text-align: center;">
				<strong><span style="color: rgb(139, 69, 19);">Length<br />
				</span></strong></td>
			<td style="text-align: center;">
				7in</td>
		</tr>
	</tbody>
</table>
sully210
Forum Newbie
Posts: 17
Joined: Sat Sep 11, 2010 4:09 pm

Re: OpenCart Problem with Table in Description

Post by sully210 »

Thank you all!!! You guys are awesome and I really appreciate the help! I am trying :?
sully210
Forum Newbie
Posts: 17
Joined: Sat Sep 11, 2010 4:09 pm

Re: OpenCart Problem with Table in Description

Post by sully210 »

What should my height be set to if I decide to leave it horizontal??? :?
sully210
Forum Newbie
Posts: 17
Joined: Sat Sep 11, 2010 4:09 pm

Re: OpenCart Problem with Table in Description

Post by sully210 »

I changed the width to 100% and this is what happened : http://store.villagecigaremporium.com/i ... uct_id=401 Now what???
sully210
Forum Newbie
Posts: 17
Joined: Sat Sep 11, 2010 4:09 pm

Re: OpenCart Problem with Table in Description

Post by sully210 »

This one seems to have worked. Yeah!! Should I set the height to auto or some other value???? Or just leave it the way it is???

Thank you so much once again! :D

You guys are genius' :wink:
stuartr
Forum Newbie
Posts: 13
Joined: Sun Sep 12, 2010 11:11 am

Re: OpenCart Problem with Table in Description

Post by stuartr »

Just followed the link and its still showing me the 900px width description :?

But as a general rule I tend to not set attributes unless I know I need them, so I personally wouldn't bother setting height unless I know I am likely to have a problem with it defaulting (which in the case of height is "auto")

Setting unnecessary atrributes will eventually lead to you needing to change a whole load of them as they are over-riding the cascade.
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: OpenCart Problem with Table in Description

Post by buckit »

its showing 900px in chrome and is spanning the entire screen :)

what program are you using to edit this? for some reason its not actually setting to 100%
Post Reply