Jump to content
Sign in to follow this  
Illicious

[Contribution] Description in Product Listing MS2 v.2.3

Recommended Posts

I was getting the SQL error also. I found if you are NOT installing the contribution by hand (i.e., using a tool like Beyond Compare), you'll run into a small syntax discrepancy between the install.txt instructions and the included index.php file.

 

Follow the install.txt instructions (below), rather then using a compare tool, to properly install the contribution's sql code into the index.php file.

 

Find:

       case 'PRODUCT_LIST_NAME':

         $select_column_list .= 'pd.products_name, ';

         break;

Below add:

// Products Description Hack begins

       case 'PRODUCT_LIST_DESCRIPTION':

  $select_column_list .= 'pd.products_description, ';

         break;

// Products Description Hack ends

 

The included index.php file omits the ',' (comma) after 'pd.products_description'.

Share this post


Link to post
Share on other sites

Is there a contribution to add manually the description for each product in the product listing? Like using the admin where you add the products..? Or can i use this to do so?


No more outside links here!

Share this post


Link to post
Share on other sites

I get a similar error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' p.products_id, p.manufacturers_id, p.products_price, p.produc

 

select p.products_image, pd.products_name, pd.products_description, , p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '1' order by pd.products_name limit 0, 20

 

[TEP STOP]

 

 

???

Any clue?

Share this post


Link to post
Share on other sites

Ran both SQL queries successfully.

 

Then...

 

I manually installed accordingly to instructions which didn't work - and then I installed zipped files - both times getting the same error message:

 

Fatal error: Cannot redeclare tep_parse_input_field_data() (previously declared in /home/demo3/public_html/testcart/includes/functions/general.php:48) in /home/demo3/public_html/testcart/includes/functions/html_output.php on line 15

 

Any suggestions???

Share this post


Link to post
Share on other sites

i get the

 

1064 - You have an error in your SQL syntax near ' p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, ' at line 1

 

select pd.products_name, pd.products_description, , p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '2' order by pd.products_name limit 0, 20

 

[TEP STOP]

 

error as well :( any tips?

Share this post


Link to post
Share on other sites

Hello,

 

I didn't get any errors like everyone else while installing the contribution, but instead my description is showing up before the product name and part of the listing title box is missing...

 

http://www.beadandcrystalheaven.com.au/index.php?cPath=21_37

 

Any help will be greatly appreciated.

 

Angie

 

 

Opps its ok I worked it out....

Edited by Angie201

Share this post


Link to post
Share on other sites

This is back to haunt me :)

 

I have the product description in product listing added to my site and am instead of using the stylesheet class odd - even for diferentiating my product listing I would like to seperate them with a dashed line.

 

The problem I have is with the product listing description added I end up with a line between the product details and the desciption and a second line seperating the description from the next product. I would like to just have the line seperating the description from the next product.

 

Can anyone provide information on how I would change my css to achieve this or the code I would need to add and to what files? I have tried all kinds of changes to the css but cannot solve my problem

Share this post


Link to post
Share on other sites

I'm running into the same problem.

 

I added this code to TD.productListing-data in catalog/stylesheet.css:

 

  border-bottom: thin solid #ff00cc;
 border-bottom-width: 1px;

 

and I'm now getting a separator between each product, but it's also adding a separator between the title/price and description. For an example, see:

 

http://www.kididdles.com/catalog/index.php?cPath=1_9

 

I presume it's because both <TD>'s are classed as productListing-data. I've scoured the code tonight trying to find where that's being defined, but have had no luck. Is there some way to define the cells separately? (I'd also like to show my price in a different color that the default text, but would need to find its cell to do that, too.)

 

TIA for any help!

 

Terry


Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

OK in the event anyone is using html in the product descriptions the following change to the mod will improve things for you.

 

Find the following line in the product_listing.php

 

 $lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
           

 

and replace it with the following and your html description will work great.

 

// $lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
          
           $lc_text = ' ' . osc_trunc_string(eregi_replace ("<([b|i|u])[^>]*>", "<\\1>",eregi_replace ("<a [^>]*href *= *([^ ]+)[^>]*>", "<a href=\\1>",strip_tags(stripslashes($listing['products_description']),'<b><i><u><a><s><span><strong><em><sub><sup><u>'))), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
           

 

What I had found when I installed it was many problems on differant list pages that was being caused by the html based product descriptions so the above changes cleans it up before the last step is applied to the string/product description.

 

As a FYI you can use the call to convert and data column that stores html content to a html format that can be used without screwing up your page layout.

 

The folowing is code added to the general.php file that will allow you to call a function to get a product desciption any you need it on other pages.

 

// ################### Products Description Hack begins ##############
//
// grabs a length from a string, but goes back to the last space if it cut into
// the middle of a string.  If the string is longer than that, cut, then add '...'
// to the end of the string, if the $more == 1
function osc_trunc_string($str="",$len=150,$more=1)
{
 if ($str=="") return $str;
 if (is_array($str)) return $str;
 $str = trim($str);
 // if it's les than the size given, then return it
 if (strlen($str) <= $len) return $str;
 // else get that size of text
 $str = substr($str,0,$len);
 // backtrack to the end of a word
 if ($str != "") {
	 // check to see if there are any spaces left
	 if (!substr_count($str," ")) {
   if ($more) $str .= "...";
   return $str;
	 }
	 // backtrack
	 while(strlen($str) && ($str[strlen($str)-1] != " ")) {
   $str = substr($str,0,-1);
	 }
	 $str = substr($str,0,-1);
	 if ($more) $str .= "...";
 }
 return $str;
}
// ########### Products Description Hack ends #############

require(DIR_WS_FUNCTIONS . 'articles_general.php');

////
// Return a product's name
// TABLES: products
 function tep_get_products_des($product_id, $language = '') {
   global $languages_id;

   if (empty($language)) $language = $languages_id;

   $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");
   $product = tep_db_fetch_array($product_query);
   
   //$tmp_a = htmlspecialchars($product['products_description']);
   //return $product['products_description'];
   
   $text = stripslashes($product['products_description']); 
 $text = strip_tags($text, '<b><i><u><a><s><span><strong><em><sub><sup><u>'); 
 $text = eregi_replace ("<a [^>]*href *= *([^ ]+)[^>]*>", "<a href=\\1>", $text); 
   $text = eregi_replace ("<([b|i|u])[^>]*>", "<\\1>", $text);
   
   return osc_trunc_string($text, '600');
   
 }

 

just make a call to tep_get_products_des(send the prod ID here )

 

Anyways hope it helps

Share this post


Link to post
Share on other sites

Hi.

 

I got the mod all installed and working, and I really like the way it displays. Is there a set of instructions somewhere for making products_new.php use the same listing?

 

shris

:blink:

Edited by shris

Share this post


Link to post
Share on other sites

Hi all

 

The Description show up correctly under the product name, however my manufacture name show up next to the description instead of under the manufacturer and I have the manufucture cell missing...

 

I checked all the again and again and it seams all correct,

 

where should I look for the problem?

 

I thank you all

 

 

Salvo

 

PS:

 

this is how I would like to show the listing: which I manage to do in older version and I can't do it in ms2

 

<table width="100%" border="2" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

<td>PRODUCTS</td>

<td>Manufacturers</td>

</tr>

<tr>

<td rowspan="2">FOTO</td>

<td>Computer</td>

<td>Dell</td>

</tr>

<tr>

<td colspan="2">DESCRIPTION</td>

</tr>

</table>

Edited by Salvo

Share this post


Link to post
Share on other sites

this is what I have at moment

 

<table width="100%" border="2" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

<td>PRODUCTS</td>

<td>Manufacturers</td>

</tr>

<tr>

<td rowspan="2">FOTO</td>

<td>Computer</td>

<td> </td>

 

</tr>

<tr>

<td colspan="2">DESCRIPTION</td>

<td>Dell</td>

</tr>

</table>

Share this post


Link to post
Share on other sites

hey, i don't know if this mod is still being supported, but i've gotta ask.

 

i mostly have it working. my problem is that my list headings are all messed up. take a look:

 

http://host127.ipowerweb.com/~cafeprod/index.php?cPath=45_60

 

suffice to say, i am confused. i've double check all of the install changes and haven't found any discrepancies. anyone run into a similar problem?


Six jars of Mayonnaise: $12.50

20 feet of rubber tubing: $4.25

Latex-rubber gloves: $3.25/doz.

The look on the cashiers face: Priceless.

 

There are some things money can't buy, for everything else, there's your parent's money.

Share this post


Link to post
Share on other sites

Mod doesn't seem to work with STS_Templates contrib.

 

Doesn't generate any errors, but it doesn't display (new) product description in the product listing...

 

Any thoughts on this and/or help would be greatly appreciated...

 

JP

Edited by jpalbicke

Share this post


Link to post
Share on other sites

does anyone know how to differentiate the styles of the description from the title??? That way we could have a bold product title and a smaller description. Right now it looks to be tied to the productListing-data class, how do you make it separate and what do you have to change?

 

ideas would be great! thanks!

Share this post


Link to post
Share on other sites
does anyone know how to differentiate the styles of the description from the title??? That way we could have a bold product title and a smaller description. Right now it looks to be tied to the productListing-data class, how do you make it separate and what do you have to change?

 

ideas would be great! thanks!

Did you find a way to do what you have described, I have just spent a couple of hours trying to do it without any luck.

 

Thx

Share this post


Link to post
Share on other sites
I'm running into the same problem.

 

I added this code to TD.productListing-data in catalog/stylesheet.css:

 

  border-bottom: thin solid #ff00cc;
 border-bottom-width: 1px;

 

and I'm now getting a separator between each product, but it's also adding a separator between the title/price and description. For an example, see:

 

http://www.kididdles.com/catalog/index.php?cPath=1_9

 

I presume it's because both <TD>'s are classed as productListing-data. I've scoured the code tonight trying to find where that's being defined, but have had no luck. Is there some way to define the cells separately? (I'd also like to show my price in a different color that the default text, but would need to find its cell to do that, too.)

 

TIA for any help!

 

Terry

Hi Terry,

 

I noticed from your site that you manged to figure out the problem of getting that border line out from between the product and product short desc and only appearing inbetween each product.

 

Any way you could help me out with that? Being trying to figure it out for about 2 hours now and its 1.30am....

 

Thanks in advance

 

Damo

Share this post


Link to post
Share on other sites

Hi Damo,

 

Are you using the descriptions in product listing contribution? (It's within that code that I made adjustments, if memory serves me correctly, but there's no point in posting it if you're not using it...)

 

Terry


Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

Sigh... New_Puppy=Late_Nights have left me braindead. Seeing as the topic is the contrib, I guess it's what you're using, yes?

 

If memory serves me correctly, I just had to add a CSS class to every column in the table, but it's been so long I can't remember exactly. Here's my product_listing.php code so you can compare with what you've got. (I have other changes that you may not have, so your mileage may vary... )

 

<?php
/*
?$Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

?osCommerce, Open Source E-Commerce Solutions
?http://www.oscommerce.com

?Copyright (c) 2003 osCommerce

?Released under the GNU General Public License
*/

?$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

?if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="10">
?<tr>
? ?<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
? ?<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
?</tr>
</table>
<?php
?}

?$list_box_contents = array();

?for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
? ?switch ($column_list[$col]) {
? ? ?case 'PRODUCT_LIST_MODEL':
? ? ? ?$lc_text = TABLE_HEADING_MODEL;
? ? ? ?$lc_align = '';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_NAME':
? ? ? ?$lc_text = TABLE_HEADING_PRODUCTS;
? ? ? ?$lc_align = '';
? ? ? ?break;
? ?// Products Description Hack begins
? ? ?case 'PRODUCT_LIST_DESCRIPTION':
? ? ? ?$lc_text = TABLE_LIST_DESCRIPTION;
? ? ? ?break;
? ?// Products Description Hack ends

? ? ?case 'PRODUCT_LIST_MANUFACTURER':
? ? ? ?$lc_text = TABLE_HEADING_MANUFACTURER;
? ? ? ?$lc_align = '';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_PRICE':
? ? ? ?$lc_text = TABLE_HEADING_PRICE;
? ? ? ?$lc_align = 'right';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_QUANTITY':
? ? ? ?$lc_text = TABLE_HEADING_QUANTITY;
? ? ? ?$lc_align = 'right';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_WEIGHT':
? ? ? ?$lc_text = TABLE_HEADING_WEIGHT;
? ? ? ?$lc_align = 'right';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_IMAGE':
? ? ? ?$lc_text = TABLE_HEADING_IMAGE;
? ? ? ?$lc_align = 'center';
? ? ? ?break;
? ? ?case 'PRODUCT_LIST_BUY_NOW':
? ? ? ?$lc_text = TABLE_HEADING_BUY_NOW;
? ? ? ?$lc_align = 'center';
? ? ? ?break;
? ?}

? ?// Products Description Hack begins
? ?if ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW' &&
? ? ? ?$column_list[$col] != 'PRODUCT_LIST_IMAGE' &&
? ? ? ?$column_list[$col] != 'PRODUCT_LIST_DESCRIPTION')
? ? ?$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

? ?if ($column_list[$col] != 'PRODUCT_LIST_DESCRIPTION') {
? ? ?$list_box_contents[0][] = array('align' => $lc_align,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="productListing-heading"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' ?=> " " . $lc_text . " ");
? ?}

?}
? ?// Products Description Hack ends

?if ($listing_split->number_of_rows > 0) {
? ?$rows = 0;
? ?$listing_query = tep_db_query($listing_split->sql_query);
? ?while ($listing = tep_db_fetch_array($listing_query)) {
? ? ?$rows++;

? ? ?if (($rows/2) == floor($rows/2)) {
? ? ? ?$list_box_contents[] = array('params' => 'class="productListing-even"');
? ? ?} else {
? ? ? ?$list_box_contents[] = array('params' => 'class="productListing-odd"');
? ? ?}

? ? ?$cur_row = sizeof($list_box_contents) - 1;

? ? ?for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
? ? ? ?$lc_align = '';
? ? ? ?// Products Description Hack begins
? ? ? ?$lc_params = '';
? ? ? ?// Products Description Hack ends

? ? ? ?switch ($column_list[$col]) {
? ? ? ? ?case 'PRODUCT_LIST_MODEL':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
?	$lc_align = '';
? ? ? ? ? ?$lc_text = ' ' . $listing['products_model'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_NAME':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ? ?$lc_align = '';
? ? ? ? ? ?if (isset($HTTP_GET_VARS['manufacturers_id'])) {
? ? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
? ? ? ? ? ?}
? ? ? ? ? ?break;
? ? ? ? ?// Products Description Hack begins
? ? ? ? ?case 'PRODUCT_LIST_DESCRIPTION':
// $lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';

? ? ? ? ? $lc_text = '' . osc_trunc_string(eregi_replace ("<([b|i|u])[^>]*>", "<\\1>",eregi_replace ("<a [^>]*href *= *([^ ]+)[^>]*>", "<a href=\\1>",strip_tags(stripslashes($listing['products_description']),'<b><i><u><a><s><span><strong><em><sub><sup><u>'))), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';

? ? ? ? ? ?$col_to_span = sizeof($column_list)-1;
? ? ? ? ? ?if (PRODUCT_LIST_IMAGE > 0) {
? ? ? ? ? ? ?$col_to_span -= 1;
? ? ? ? ? ?}
? ? ? ? ? ?$lc_params = 'colspan="' . $col_to_span . '" class="productListing-data"';
? ? ? ? ? ?break;
? ? ? ? ?// Products Description Hack ends

? ? ? ? ?case 'PRODUCT_LIST_MANUFACTURER':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ? ?$lc_align = '';
? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_PRICE':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ? ?$lc_align = 'right';
? ? ? ? ? ?if (tep_not_null($listing['specials_new_products_price'])) {
? ? ? ? ? ? ?$lc_text = ' <s>' . ?$currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = '<b> ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</b>';
? ? ? ? ? ?}
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_QUANTITY':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ? ?$lc_align = 'right';
? ? ? ? ? ?$lc_text = ' ' . $listing['products_quantity'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_WEIGHT':
? ? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ? ?$lc_align = 'right';
? ? ? ? ? ?$lc_text = ' ' . $listing['products_weight'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_IMAGE':
? ? ? ? ? ?$lc_align = 'center';
? ? ? ? ? ?if (isset($HTTP_GET_VARS['manufacturers_id'])) {
? ? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
? ? ? ? ? ?}
? ? ? ? ? ?// Products Description Hack begins
? ? ? ? ? ?if (PRODUCT_LIST_DESCRIPTION > 0) {
? ? ? ? ? ? ?$lc_params = 'rowspan="2" valign="top" class="productListing-data"';
? ? ? ? ? ?}
? ? ? ? ? ?// Products Description Hack ends
? ? ? ? ? ?break;
? ?case 'PRODUCT_LIST_BUY_NOW':
? ? ? ? ?$lc_params = 'class="product" valign="top"';
? ? ? ? ?$lc_align = 'right';

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
? ?$products_attributes = tep_db_fetch_array($products_attributes_query);
? ?if ($products_attributes['total'] > 0) {
? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_more_info.gif', IMAGE_BUTTON_MORE_INFO) . '</a> ';
? ? ? ? ? ?} else {
? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
}
break;
? ? ? ?}

? ? ? ?// Products Description Hack begins
? ? ? ?if ($column_list[$col] == 'PRODUCT_LIST_DESCRIPTION') {
? ? ? ? ?$list_box_contents[$cur_row][] = array('align' => $lc_align,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => $lc_params,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => $lc_text,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'desc_flag' => 'true');
? ? ? ?} else {
? ? ? ? ?$list_box_contents[$cur_row][] = array('align' => $lc_align,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => $lc_params,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' ?=> $lc_text);
? ? ? ?}
? ? ? ?// Products Description Hack ends
? ? ?}
? ?}

? ?new productListingBox($list_box_contents);
?} else {
? ?$list_box_contents = array();

? ?$list_box_contents[0] = array('params' => 'class="productListing-odd"');
? ?$list_box_contents[0][] = array('params' => 'class="productListing-data"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => TEXT_NO_PRODUCTS);

? ?new productListingBox($list_box_contents);
?}

?if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="10">
?<tr>
? ?<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
? ?<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
?</tr>
</table>
<?php
?}
?>

 

HTH,

 

Terry

Edited by TerryK

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Share this post


Link to post
Share on other sites

Hi there hopefully this thread is still active as i need some help!

 

http://cleanskinsonline.com.au/cso/index.php?cPath=21

 

my page is all misaligned and i need some advice how to get it looking right!

 

I want the product name above the description and the headings to move across and the price and the button to be aligned at the top.

 

Please help me!!!!

 

Thanks guys.

 

Enrico.

Share this post


Link to post
Share on other sites

Thought i would show you my product_listing.php code just in case

 

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {
     case 'PRODUCT_LIST_MODEL':
       $lc_text = ' ' . TABLE_HEADING_MODEL . ' ';
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_NAME':
       $lc_text = ' ' . TABLE_HEADING_PRODUCTS . ' ';
       $lc_align = '';
       break;
 // Products Description Hack begins
     case 'PRODUCT_LIST_DESCRIPTION':
       $lc_text = TABLE_LIST_DESCRIPTION;
       break;
   // Products Description Hack ends
     case 'PRODUCT_LIST_MANUFACTURER':
       $lc_text = ' ' . TABLE_HEADING_MANUFACTURER . ' ';
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_PRICE':
       $lc_text = ' ' . TABLE_HEADING_PRICE . ' ';
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $lc_text = ' ' . TABLE_HEADING_QUANTITY . ' ';
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_WEIGHT':
       $lc_text = ' ' . TABLE_HEADING_WEIGHT . ' ';
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $lc_text = ' ' . TABLE_HEADING_IMAGE . ' ';
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_BUY_NOW':
       $lc_text = '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td class="productListing-heading" align="right" width="25%">' . ' ' . TABLE_HEADING_QUANTITY  . ' ' . '</td><td class="productListing-heading" align="center" width="75%" valign="absmiddle">' . ' ' . TABLE_HEADING_BUY_NOW . ' ' . '</td></tr></table>';
       $lc_align = 'right';
       break;
   }

  // Products Description Hack begins
   if ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW' &&
       $column_list[$col] != 'PRODUCT_LIST_IMAGE' &&
       $column_list[$col] != 'PRODUCT_LIST_DESCRIPTION')
     $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

   if ($column_list[$col] != 'PRODUCT_LIST_DESCRIPTION') {
     $list_box_contents[0][] = array('align' => $lc_align,
                                            'params' => 'class="productListing-heading"',
                                            'text'  => " " . $lc_text . " ");
   }

 }
   // Products Description Hack ends

 if ($listing_split->number_of_rows > 0) {
   $rows = 0;
   $listing_query = tep_db_query($listing_split->sql_query);
   while ($listing = tep_db_fetch_array($listing_query)) {
     $rows++;

     if (($rows/2) == floor($rows/2)) {
       $list_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $list_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($list_box_contents) - 1;

     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
       $lc_align = '';
// Products Description Hack begins
       $lc_params = '';
       // Products Description Hack ends
       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = '';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
           }
           break;
	 // Products Description Hack begins
         case 'PRODUCT_LIST_DESCRIPTION':
           $lc_text = '' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u><br>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
           $col_to_span = sizeof($column_list)-1;
           if (PRODUCT_LIST_IMAGE > 0) {
             $col_to_span -= 1;
           }
           break;
         // Products Description Hack ends
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
           break;
         case 'PRODUCT_LIST_PRICE':
           $lc_align = 'right';
           if (tep_not_null($listing['specials_new_products_price'])) {
             $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
           } else {
             $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
           }
           break;
         case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_quantity'] . ' ';
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1') . '</a> ';
           }
	 // Products Description Hack begins
           if (PRODUCT_LIST_DESCRIPTION > 0) {
             $lc_params = 'rowspan="2" ';
           }
           // Products Description Hack ends
           break;
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'right';
           $lc_text = tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=2 maxlength=2') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle') . '</td></tr></table></form>';
           break;
       }

       // Products Description Hack begins
       $lc_params .= 'class="productListing-data"';
       if ($column_list[$col] == 'PRODUCT_LIST_DESCRIPTION') {
         $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                                'params' => $lc_params,
                                                'text' => $lc_text,
                                                'desc_flag' => 'true');
       } else {
         $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                                'params' => $lc_params,
                                                'text'  => $lc_text);
       }
       // Products Description Hack ends
   }
}

   new productListingBox($list_box_contents);
 } 
 else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                  'text' => TEXT_NO_PRODUCTS);

   new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>

 

I cant work out why it is so misaligned ??

 

Thanks again guys

 

Enrico

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×