Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Listing in Columns v2.0


djmonkey1

Recommended Posts

I have a similar question to Chryses– Does anyone know how to add a phantom (as in empty) row in at the top of the product listing table so that it forces the cells to left align when there are only two products in a row that normally holds four?

 

I have the products listed in rows of 4 columns:

 

X X X X

X X X X

 

But when there are only two items in a category, it spaces them out too far (since it splits it 50%):

 

X_X_

 

If there was an empty row of 4 <th>'s up top (with a with a CSS height:1px or something), a category with only two items would be forced to align left:

 

____

XX

 

I just can't figure out how to add that row in since the table is being dynamically generated by the tablebox() function. I hope this all makes sense. :)

 

Here's the product category page of the site I'm talking about (please delete the two spaces, I just did that to keep the site out of Google searches until it's done):

 

http://en vym eforever.com/index.php?cPath=21

 

Thanks!

 

I'm suffering from the same issue as.

 

I have my column number set to 3 but when I only have 2 products an a row it spaces them out and does not create the empty table. They are still aligning to the left and I also fixed the width of the actual column box(I am also using a modified individual boxes contrib). when I only have 1 item it sits nicely to the left.

 

Anyone got any ideas as to why the function to fill the empty space is not triggering?

 

Help will be greatly appreciated.

Link to comment
Share on other sites

  • Replies 456
  • Created
  • Last Reply

Top Posters In This Topic

I'm suffering from the same issue as.

 

I have my column number set to 3 but when I only have 2 products an a row it spaces them out and does not create the empty table.

I don't see the problem with column number set to 3 and 2 products (changed the no break space as number 160 to & #160; to make it not disappear on the page here):

<table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">
 <tr class="productListing-odd">
<td align="center" valign="top" class="productListing-data" width="33%"> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=8">A Bug's Life</a> <br> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=8"><img src="images/dvd/a_bugs_life.gif" border="0" alt="A Bug's Life" title=" A Bug's Life " width="100" height="80"></a> <br> $35.99 <br>Qty.<input type="text" name="Qty_ProdId_8" value="0" size="4"></td>
<td align="center" valign="top" class="productListing-data" width="33%"> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=12">Die Hard With A Vengeance</a> <br> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=12"><img src="images/dvd/die_hard_3.gif" border="0" alt="Die Hard With A Vengeance" title=" Die Hard With A Vengeance " width="100" height="80"></a> <br> <s>$39.99</s>  <span class="productSpecialPrice">$38.00</span> <br>Qty.<input type="text" name="Qty_ProdId_12" value="0" size="4"></td>
<td align="center" valign="top" class="productListing-data" width="33%">& #160;</td>
 </tr>
</table>

So I guess you also use an old module or another one.

Link to comment
Share on other sites

I don't see the problem with column number set to 3 and 2 products (changed the no break space as number 160 to & #160; to make it not disappear on the page here):

<table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">
 <tr class="productListing-odd">
<td align="center" valign="top" class="productListing-data" width="33%"> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=8">A Bug's Life</a> <br> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=8"><img src="images/dvd/a_bugs_life.gif" border="0" alt="A Bug's Life" title=" A Bug's Life " width="100" height="80"></a> <br> $35.99 <br>Qty.<input type="text" name="Qty_ProdId_8" value="0" size="4"></td>
<td align="center" valign="top" class="productListing-data" width="33%"> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=12">Die Hard With A Vengeance</a> <br> <a href="http://127.0.0.1/cat_sppc_rc1/product_info.php?cPath=3_13&products_id=12"><img src="images/dvd/die_hard_3.gif" border="0" alt="Die Hard With A Vengeance" title=" Die Hard With A Vengeance " width="100" height="80"></a> <br> <s>$39.99</s>  <span class="productSpecialPrice">$38.00</span> <br>Qty.<input type="text" name="Qty_ProdId_12" value="0" size="4"></td>
<td align="center" valign="top" class="productListing-data" width="33%">& #160;</td>
 </tr>
</table>

So I guess you also use an old module or another one.

 

 

Thanks for the reply Jan. I am using Product Listing Columns 2.2a with an extra modification for individual boxes. I tried reverting back to the original without the individual boxes but it still gave me the same problem.

 

Could you tell me what version you are using or possibly pass on the link to the appropriate contribution page?

 

Cheers

Link to comment
Share on other sites

 

 

Thanks heaps, that has fixed the problem.

 

The only issued I had with this new version was getting the Short Product Description feature that I'm using working. For anyone that is using this feature, the modified code below is what I'm using and it seems to be working fine:

 

 

		case 'PRODUCT_LIST_SHORTDESCRIPTIONIB':
			$lc_align = '';
			$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='. $listing[$x]['products_id'];
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 100);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

	$description['products_description'] = ereg_replace("(Array)", "", $description['products_description']);

				$lc_text = '<p align="justify">'. strip_tags($description['products_description']) . '</p>';

			break;

 

I am only using English so I'm not sure whether it will work when using multiple languages. I am also playing with creating separate boxes so we'll see how that goes.

Link to comment
Share on other sites

Hi!

I wonder if someone have a qlue how to fix the price color to red in product_listing_col.php and i also have shortdesc installed and i want that text in gray someone have a qlue how to fix this?

 

maybe it can be done by making a class? but i dont know how to fix that....

 

Regards Tony

Link to comment
Share on other sites

  • 2 months later...

I am using a short description contribution myself, and would like to know how to get it working with this contribution. I have modified the new product_listing_col.php with the changes required for the origional product_listing.php but the changes are not making a difference in the display. So I am thinking that the code is obviously being skipped over. Heh.

 

This is the contribution I am using:

Product Description 1.5

http://www.oscommerce.com/community/contributions,1743

 

Here are the changes/steps I needed to make in the origional product_listing.php file, and perhaps someone can tell me where best to put them in the new file.

[ FIND, 85 ]

	$cur_row = sizeof($list_box_contents) - 1;

[ ADD AFTER ]

  $has_description = false;

[ FIND, 100 ]

			$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
		}

[ ADD AFTER ]

			 if (PRODUCT_LIST_DESCRIPTION && $listing['products_description'] && PRODUCT_LIST_DESCRIPTION_MAX_LENGTH)
		$lc_text .= '<br><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="productDesc">' . tep_flatten_product_description($listing['products_description'],  ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . TEXT_MORE . '</a>') . '</td></tr></table>';

Link to comment
Share on other sites

Howdy : )

 

I am in the process of combining the index.php & product_info.php pages with the product listing appearing on the right, and the information from product_info.php appearing in an iframe on the left.

 

With the products appearing in a grid of 3x3 on the right, I would like to be able to throw in an onmouseover event so that when a user mouses over an image on the right, the product_id variable is set correctly.

 

In this contribution, the section I believe the onmouseover event needs to be set in starts roughly at Line 165:

 

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . ">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

}

 

Any ideas of the syntax I should use?

 

Regards,

 

Stuart

A crash reduces your expensive computer to a simple stone.

Link to comment
Share on other sites

The is a problem with the code which causes it to display duplicate items. It appears to just be on RC2 shops. The reason is because there isn't a default case in the switch code. To fix it, in includes/modules/product_listing_col.php, find

break; 
// End Add Multiple mod

and add under it

default: $lc_text='';

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 4 weeks later...
The is a problem with the code which causes it to display duplicate items. It appears to just be on RC2 shops. The reason is because there isn't a default case in the switch code. To fix it, in includes/modules/product_listing_col.php, find
break; 
// End Add Multiple mod

and add under it

default: $lc_text='';

 

Jack

 

I just installed this contribution, however I want the look of the template. There are no instructions on what to do with the template. Do I copy it into the cols page?????

Link to comment
Share on other sites

I just installed this contribution, however I want the look of the template. There are no instructions on what to do with the template. Do I copy it into the cols page?????
Templates vary from one to the other and are not part of oscommerce so no contribution will explain how to install the change into a shop with a template. You have to figure that out on your own or pay someone to do it for you.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

There are no instructions on what to do with the template.

Did you overlook the included file about_product_listing_tpl.html or do you think it doesn't have the information you are looking for?

Link to comment
Share on other sites

Did you overlook the included file about_product_listing_tpl.html or do you think it doesn't have the information you are looking for?

I didn't see that file! *laughing* I am a blonde....

Link to comment
Share on other sites

I apologize if this question has been addressed already. I might have missed it. I am trying to customize the default listing so that the table has a transparent background (kind of like the All Products contribution) instead of the default white background. I can't find where to change it.

 

Also, I would like to add a little bit a space between rows. I found a suggestion for adding .productListing-data {padding: 20px;} in the stylesheet but that seems to also insert space above the Buy Now button, which defeats my intent of clarifying that the Buy Now is below and not above the pictures.

 

Any help is appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

found this contrib recently, installed (Product Listing in Columns 2.2.7 from 23.may 2008), tested and i like it .... but with one exception. I'm using the "Base Price" contrib that shows the base price beside each price but i wasn't able to include it to this contrib. anyone can help please?

 

code of my product_listing.php file (used before adding the contrib)

          case 'PRODUCT_LIST_PRICE':
//Base Price Change
           $lc_align = 'right';
           $lc_text = tep_get_products_display_price($listing['products_id']) . tep_get_products_display_price($listing['products_id'], true) . '<br>';
//Base Price End
           break;

 

this results in:

 

bp_1.jpg

 

note the Price of 21,06 EUR and the Baseprice of 8,49 EUR / m²

 

 

code used in the product_listing_col.php file:

case 'PRODUCT_LIST_PRICE':
			$lc_align = 'right';
			if (tep_not_null($listing[$x]['specials_new_products_price'])) {
				$lc_text = '<br> <s>' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
			} 
			else {
				$lc_text = '<br>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' <br><br>';
			}
			break;

this results in:

 

bp_2.jpg

 

without baseprice.

 

 

I've tried several ways to include that "old" code but all failed. Anyone have a clue what to do to use this contrib with the base price contrib?

Link to comment
Share on other sites

  • 2 months later...

Just a quick question.

 

Can someone tell me where can I find the bit responsible for outputting <tr> tag ?

 

I am using basic version of this contribution so in my code I get a pair of <tr> rows: one for actual products and one for Buy Now links/buttons for these products.

 

Logical for me would be to have one row of products as one html row <tr>, that is to have Buy Now button inside the same <td> together with product name and thumbnail.

 

Which part of code is outputting <tr> ?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 3 weeks later...
  • 1 month later...

Hi all,

 

Happy New Year!

 

First post here for me and I have been trying hard and long to not bother anyone with this question. I have oscommerce-2.2rc2a installed and STSv4.5.8_1_2_1.

 

I really want the site I am setting up to have a two column product listing, and have downloaded the product_listing_columns_2_2_8 contribution to try and achieve this.

 

I have backed up all of the standard files affected by this contribution, and have then copied the supplied files to the correct places on the server. The list_multi.sql ran OK on the database but when I go to the test site, I am presented with the following (I have xxxx sensitive server information):

Fatal error: Call to a member function image() on a non-object in /mounted-storage/xxxxxxx/xxxxxx/xxxxx/www/catalog/includes/functions/html_output.php on line 78

 

Do I also need to carry out the instructions in terms of amending the code in the new_install.txt file supplied, or is all of that covered by copying the catalog files across?

 

I should mention that when I go to the administration section of the online shop (configuration>product listing), the new settings with this contribution are available to use.

 

Thanks in advance!

 

Jonathan

Link to comment
Share on other sites

Fatal error: Call to a member function image() on a non-object in /mounted-storage/xxxxxxx/xxxxxx/xxxxx/www/catalog/includes/functions/html_output.php on line 78

This doesn't sound like something that product listing in columns could have done. I'm not familiar with STS but in regular osC there is not function image and that line doesn't contain any references to objects or image in a standard html_output.php page (actually it is an empty line in the function tep_image).

 

Restart your browser or throw away the cookie of your test site. Then the "new" error will probably be gone (something about navigation?).

Link to comment
Share on other sites

This doesn't sound like something that product listing in columns could have done. I'm not familiar with STS but in regular osC there is not function image and that line doesn't contain any references to objects or image in a standard html_output.php page (actually it is an empty line in the function tep_image).

 

Restart your browser or throw away the cookie of your test site. Then the "new" error will probably be gone (something about navigation?).

Thank you for replying, Jan. Unfortunately it does seem an error within my files, because the same error appears on different Macs. The html_output.php page is one of those that is part of the sts installation, as is application_top.php (both are listed errors at times) so that may be an incompatibility with the contribution and STS, and I probably need to try and compare the original OSC installation files to the STS files, and see where I may need to make changes - (gulp!). Copying the original OSC files in question back to my catalog just then creates another error on the application_top.php file, and now also includes/classes/logger.php

 

It surprises me that it is been so hard to find information on changing the default Product Listing content from a single column to 2 or 3, but this is all so new to me, there has to be a good reason!

 

It is looking ever likely that I may need to purchase a commercial STS template, but I really wanted to see if I could do everything necessary to use my own designs - and this Product Listing is key to that.

 

Thanks again.

 

Jonathan

Link to comment
Share on other sites

There are differences between the two files. The STS installation is as below, with the Line 78 code being $sts->image($src); // Take image from template folder if exists.

 

////

// The HTML image wrapper function

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

 

// START STS v4.4:

global $sts;

$sts->image($src); // Take image from template folder if exists.

// END STS v4.4

 

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

return false;

}

 

Whereas the standard OSC installation has:

 

////

// The HTML image wrapper function

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

 

if (tep_not_null($alt)) {

$image .= ' title=" ' . tep_output_string($alt) . ' "';

}

 

if (tep_not_null($width) && tep_not_null($height)) {

$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';

}

 

if (tep_not_null($parameters)) $image .= ' ' . $parameters;

 

$image .= '>';

 

return $image;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...