Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Duplicate columns in listing of products


doon1947

Recommended Posts

Posted

Hi,

 

2.2 MS2

Have a test site which was working just fine.

It has Option Types 2.13 installed and working.

After I installed Header Tags SEO 3.3 I get a duplicate "Buy Now" column.

see http://always-with-me-test.com/index.php?cPath=22

Can't for the life of me figure where this extra column is generated, or even which file is responsible for its generation:

index.php

product_info.php

includes/modules/product_listing.php

or some other file

Any help appreciated.

Posted

Hi,

 

2.2 MS2

 

duplicate "Buy Now" column.

see http://always-with-me-test.com/index.php?cPath=22

is generated

 

includes/modules/product_listing.php

 

Any help appreciated.

 

Check in your includes/modules/product_listing.php for a duplicate listing.

 

One:

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

$lc_width = '110px';

break;

 

Two:

case 'PRODUCT_LIST_BUY_NOW':

$prod_list_contents .= ' <td align="center" width="100px">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>';

break;

 

Ignore the width entries in my example as I added that to mine.

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Posted

Here's the code from the page, I can't make any sense of it:

 

----------------------------------------

<?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 © 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;

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;

}

 

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

}

 

$list_box_contents[0][] = array('align' => $lc_align,

'params' => 'class="productListing-heading"',

'text' => ' ' . $lc_text . ' ');

}

 

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 = '';

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

$lc_text = ' ' . $listing['products_model'] . ' ';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

 

/*** Begin Header Tags SEO ***/

$lc_add = '';

$hts_listing_query = tep_db_query("select products_head_listing_text, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = " . (int)$listing['products_id'] . " and language_id = " . (int)$languages_id);

if (tep_db_num_rows($hts_listing_query) > 0) {

$hts_listing = tep_db_fetch_array($hts_listing_query);

if (tep_not_null($hts_listing['products_head_listing_text'])) {

$lc_add .= '<div class="hts_listing_text">' . $hts_listing['products_head_listing_text'] . '...<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '"><span style="color:red;">' . TEXT_SEE_MORE . '</span></a></div>';

} else if (HEADER_TAGS_ENABLE_AUTOFILL_LISTING_TEXT == 'true') {

$text = sprintf("%s...%s", substr(stripslashes(strip_tags($hts_listing['products_description'])), 0, 100), '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . (int)$listing['products_id']) . '"><span style="color:red;">' . TEXT_SEE_MORE . '</span></a>');

$lc_add .= '<div class="hts_listing_text">' . $text . '</div>';

}

}

 

 

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>';

$lc_text .= $lc_add;

} else {

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

$lc_text .= $lc_add;

}

/*** End Header Tags SEO ***/

 

 

break;

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) . '</a> ';

}

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$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;

}

 

$list_box_contents[$cur_row][] = array('align' => $lc_align,

'params' => 'class="productListing-data"',

'text' => $lc_text);

}

}

 

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

}

?>

Posted

Hi,

As far as I can tell this is NOT the file where the problem lies, because if I replace this file with a copy of the file as it was before Header Tags contribution was added there is no change in the column display.

Posted

Indeed if I replace

index.php

product_info.php

includes/modules/product_listing.php

with their pre contribution copies I STILL get the duplicate "Buy Now" column

Posted

If I go into Admin/configuration/product listing and set the "Buy Now Column to "0",

then the "Buy Now" Column disappears but there are now two "price" columns

Posted

you forgot the application_top try replacing

To improve is to change; to be perfect is to change often.

 

Posted

you forgot the application_top try replacing

 

If I replace

index.php

product_info.php

includes/modules/product_listing.php

AND application_top.php

I STILL get the duplicate "Buy Now" column

Posted

In the view source of your page is this code:

<td align="center" class="productListing-heading"> Buy Now </td>
   <td align="center" class="productListing-heading"> <a href="http://always-with-me-test.com/index.php?cPath=22&page=1&sort=5a" title="Sort products ascendingly by Buy Now" class="productListing-heading">Buy Now</a> </td>

 

one column is sortable and one not. I am not familiar with the add on you suggest as the culprit, but I do not know why a header tags add on would change the columns in product listing. I am no expert, but it looks like a change was made in product listing or in index.php and not all the original code was removed.

 

Tim

Posted

Hi,

Yes, I just wiped the whole site out and copied it afresh from the live site.

Started to add the modified Header Tags contribution files one by one

product_listing.php is the culprit. Hope my php skills are up to finding a fix

Thanks for your input.

Will report back

 

Al.

Posted

Well if you are testing and rebuilding I can only ask why with an outdated shop with security holes

 

The new 2.3 version is better nicer a lot more fun to work with so why not do properly and start afresh personally think it your time is wasted on an outdated model.

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Posted

Well if you are testing and rebuilding I can only ask why with an outdated shop with security holes

 

The new 2.3 version is better nicer a lot more fun to work with so why not do properly and start afresh personally think it your time is wasted on an outdated model.

 

Regards

Joli

 

I understand your comment. However the main OSC feature of my site is a large number of "product options" see for example:

http://always-with-me-test.com/product_info.php?cPath=21&products_id=1006

These options are built using a contribution Options Type 2.3 which does not run on any newer version than 2.2ms2

so I am stuck unless you know any other way to provide about 230 different options leading to alout 14,500 possible produt-option combinations

Posted

I have found the problem now, I had copied code incorrectly in product_listing.php

 

Al.

Posted

I understand your comment. However the main OSC feature of my site is a large number of "product options" see for example:

http://always-with-me-test.com/product_info.php?cPath=21&products_id=1006

These options are built using a contribution Options Type 2.3 which does not run on any newer version than 2.2ms2

so I am stuck unless you know any other way to provide about 230 different options leading to alout 14,500 possible produt-option combinations

 

http://addons.oscommerce.com/info/8193

 

The install is bit fiddly recommend the one from dun web there are a few minor mistakes especially with the includes/class shopping cart.

I used the original one from the rc2 install

 

http://addons.oscommerce.com/info/6818

 

But the tweaks are all in the forum .

 

I must say I used this on a 2.31 version so not sure about 2.3.4 but pretty sure would not take much to fix

 

as regards getting the product attributes in the database that would be the easy bit :)

just a few insert sql queries in phpmyadmin

 

This is also well explained on the forums database upgrade to 2.3 sometimes the images can be a bit tricky

 

you may get easy done in a day if you concentrate some experienced guys would do in an hour I know one who would maybe do in it in 10 minutes (w00t)

 

So something to think about remember you want the cart to work for 5 - 10 years .

 

So method would be obviously complete back up to computer of database and site .

 

Then install your test site in a directory I would in your case use the 2.3.3 version as the 2.3.4 did break a few contributions and I honestly can not say about that addon they are still being reported and fixed so will take a while ( you can do the upgrades later to 2.3.4 )

 

Set up your test database I personally copy my original so I can leave it ***ALONE** And work between copy and test export / import

 

well can be done as I say the least of your worries are the options

 

So have a go at the 2.3 option addon and check the forums for small mistakes all documented and use the original includes/classe/shopping cart

 

You should be good to go.

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Posted

Are there good reasons for my to migrate from 2.2ms2 to 2.31

I have 3 big contributions added to 2.2 plus a good number of modifications I have written myself

I don't mean to offend but "The new 2.3 version is better nicer a lot more fun to work" does not strike me as a valid reason to upgrade, better security maybe, but I don't consider that a big factor either.

I have a live store which is the mainstay of a profitable 18 month old business, I am loath to mess with an upgrade.

I am more concerned with the profitable business than pretty coding or "enhancements". More sales is what I am after hence the addition of Header Tags in an attempt to improve search engine positioning.

However I am open to being persuaded to upgrade if anyone is willing to explain the benefit or benefits.

Posted

Well sure you will get plenty of answers on that one.

 

Maybe I should have just put it a bit more bluntly it is not a question of why you should upgrade but a question of when you must upgrade simple as that

.

Doing it now you will not face waking up one morning with a non working store because of server upgrades hacks or whatever and then be forced to get a rushed expensive probably professional upgrade done quick..

getting that profitable business back online.

 

You have the choice of doing now properly at your own pace or.... (w00t)

 

Regards

Joli

 

PS: Yes I have just seen you do have a bit of heavy custom work done so I do understand your hesitance well wait simply for a few other opinions that is why we have a forums

 

By the way there is another header tags module out there

 

http://www.oscommerce.com/forums/topic/394978-seo-header-tags-reloaded-support/

 

Going to try myself this weeks instead Header Tags Seo.

The guy who wrote it is a great coder so definitely worth a look at

To improve is to change; to be perfect is to change often.

 

Archived

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

×
×
  • Create New...