Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing column widths in shopping_cart.php


WoodsWalker

Recommended Posts

Greetings!

 

I am trying to change the column widths in shopping_cart.php, specifically to make the first column with the "Remove" checkbox narrower (it now spans about 30% of the table), so that there is more room for my products' pics & names in the second column.

 

Tried adding a "width" parameter in various positions and with various syntax, but nothing I come up with works. I am a PHP newbie.

 

I am assuming that I can add something to define the column width to the following code in shopping_cart.php around lines 66-81...

<?php
$info_box_contents = array();
$info_box_contents[0][] = array('align' => 'center',											  
								'params' => 'class="productListing-heading"',
								'text' => TABLE_HEADING_REMOVE);

$info_box_contents[0][] = array('params' => 'class="productListing-heading"',
								'text' => TABLE_HEADING_PRODUCTS);

$info_box_contents[0][] = array('align' => 'center',
								'params' => 'class="productListing-heading"',
								'text' => TABLE_HEADING_QUANTITY);

$info_box_contents[0][] = array('align' => 'right',
								'params' => 'class="productListing-heading"',
								'text' => TABLE_HEADING_TOTAL);

 

Can anyone tell me what I should add, exactly?

 

Thanks,

Wendy

Link to comment
Share on other sites

This worked for me:

 

In this code:

 

	$info_box_contents[0][] = array('align' => 'center',											  
								'params' => 'class="productListing-heading"',
								'text' => TABLE_HEADING_REMOVE);

I changed the second line to this:

 

									'params' => 'class="productListing-heading" width="5%"',

You may want to use a different width value, I was just seeing if I could change it.

:lol:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Stand by...

 

I made the change, and nothing happened...

 

I added the width % value to the remaining three columns (so it totalled 100%) and it worked, but a bunch of formatting disappeared....

 

So, I removed my changes, but the formatting was still screwed up... rats!

 

But... I had a backup!!! :D :D :D (Wonder whom I got that idea from?)

 

So I'm starting again... this looks promising, obviously. ;)

Link to comment
Share on other sites

The way I work things like this is using Firefox with the Webdeveloper add-on.

 

It lets you edit the HTML "on the fly".

 

So I get the desired results, then I go back and figure out what to change in the PHP page to get what I need (or think I need).

 

Sometimes this approach fails because of browser differences.

 

This change works on my PC using IE7 or Firefox in this instance.

 

If you post (or PM me) your URL I may be able to help further to see why it doesn't work for you but does for me.

 

Sometimes you have to clear your browser cache, or hold the <Ctrl> key dowm while doing a page refresh to see the changes.That forces the browser to reload the page contents from the site (IE and Firefox anyway).

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Well, this is weird...

 

I've tried to replicate my results above (but without the formatting going bazoo), but now my changes have no effect at all (and, yes, I do refresh my browser page every time).

 

Here's the code I have now:

 

<?php
$info_box_contents = array();
$info_box_contents[0][] = array('align' => 'center',
								'params' => 'class="productListing-heading" width="10%"',
								'text' => TABLE_HEADING_REMOVE);

$info_box_contents[0][] = array('params' => 'class="productListing-heading" width="70%"',
								'text' => TABLE_HEADING_PRODUCTS);

$info_box_contents[0][] = array('align' => 'center',
								'params' => 'class="productListing-heading" width="10%"',
								'text' => TABLE_HEADING_QUANTITY);

$info_box_contents[0][] = array('align' => 'right',
								'params' => 'class="productListing-heading" width="10%"',
								'text' => TABLE_HEADING_TOTAL);

 

...but the first column still takes up 30% of the table width.

 

Any ideas?

 

~Wendy

Link to comment
Share on other sites

Hi Jim,

 

You posted at the same instant I did. :P

 

Before I say anything else, I just want to say that I've been bouncing around on the forum for the last few days getting useful information ... and a lot of it has come from your posts. So THANK YOU!!! :)

 

I use Firefox ... that Webdeveloper add-on sounds great!

 

Any ideas about my post above? It's weird that I got it to work, at the expense of my formatting (so I thought I was on my way) , and now that I've begun again I can't get it to work at all. Refresh isn't usually a problem with my browser, but I'll gun it a little more with your suggestions.

 

~Wendy

Link to comment
Share on other sites

I'd have to have your URL to help any further.

 

There could be something in your CSS that might be throwing a wrench in the works.

 

That's all I can think of off hand that could affect what you're trying to achieve.

 

Before I say anything else, I just want to say that I've been bouncing around on the forum for the last few days getting useful information ... and a lot of it has come from your posts. So THANK YOU!!!

:blush:

 

Gee.. I just try to help where I can.

 

You're most welcome.

:rolleyes:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Web Developer 1.1.5

 

In case you're interested in adding that to your Firefox.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

OK, I decided to try to replicate exactly what I did the last time, like a forensic detective.

 

This seemed unrelated, but I work in Dreamweaver, and when I save a file locally, it always asks me "Update Links?" and I say "No". Except that, on my semi-successful attempt to implement your "width" suggestion, where it worked but I lost my font formatting over the whole page, I repled "Yes" by mistake.

 

I've never been quite sure what this "Update Links" command does, which is why I usually answer "No".

 

But anyway, just a minute ago, after I made the width changes again, I answered "Yes" on purpose, since that's what I did the time before. As before, my Dreamweaver window did who-knows-what, and I was left with the code for WHOLE TABLE that we've been working on highlighted.

 

Then I saved to my remote copy (on the server) as I normally do, and BEHOLD - the column widths are right, but the fonts are all unformatted.

 

Yes, of course I still have a backup. :D Maybe when Dreamweaver "Updates Links", it does something to the whole table - or, actually, what it really looks like to me is as if whatever changes it has made has caused the page to lose track of the stylesheet.

 

Hmm, I may need to have another Coke.

 

~Wendy

Link to comment
Share on other sites

I could be wrong, but using Dreamweaver to edit a PHP web page might not get you what you want.

:blush:

 

I'd just use a text editor like Notepad.

 

My favorite (what I really use) is Crimson Editor.

 

It's free, just Google it.

 

Hmm, I may need to have another Coke.

Besides a good cup of Java, or Iced tea, that's my beverage of choice...

:thumbsup:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Yes indeedy, I was right, at least about one thing: Dreamweaver's "Update Links" option had changed the link to the stylesheet in a weird way, don't ask me why ... but I changed it back - just that, and ... the font formatting came back (yay), but the table also reverted to its previous proportions (doh).

 

Does this spark any deep insights?

Link to comment
Share on other sites

Without seeing the HTML source for your page - I'm out of ideas.

crying.gif

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Well, that Coke must have worked, because given the evidence I had amassed throughout the steps above, I now suspected that there was something in stylesheet.css that was throwing a monkeywrench into things (since when I accidentally disabled the Stylesheet, the table proportions worked correctly).

 

And... BINGO!

 

Here was the culprit in the stylesheet:

 

TD.productListing-data {
 font-family: Verdana, Arial, sans-serif;
 font-size: 11px;
 font-weight: bold;
 width: 50%;

 

I deleted the line designating the width, and now all is well! :P

 

I'll just have to peek at all my other pages to see if this has affected anything in a way I don't want.

 

Thanks again, Jim, this worked great, and was a learning experience to boot!

 

~Wendy

p.s. I am going to get that FireFox add-on.

Link to comment
Share on other sites

Glad you figured it out Ma'am.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...