Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Major Fubar


Guest

Recommended Posts

Posted

I have just had to take my new site down, my serach and manufacturers search is all gone to the wall for some reason, I am able to search, and it finds the products I search for, but when I click the Buy button it isnt seeing anything, this is the roll over link for the click to buy button:

http://www.eurorep.net/retail/product_info.php?products_id=

 

same thing for the manufacturers results, wots gone wrong I have restored all search files no joy.

 

Please anyone help with this much appreciated.

Posted

Something goes wrong in your product_listing.php because if you look at the source code, the product_id is in the link of the pictures, but not in the code for the buy_now button.

If you do click on the picture it gives the error:

 

Parse error: parse error, unexpected $ in /var/www/html/retail/product_info.php on line 309

Posted

Sorry JanZ, that was my fault I was playing with product_info.php to see if something was missing, I have replaced the original file and now image works also but buy now doesnt as original post.

Posted

why do you have your quantity defaulting to 0? people will forget to put a qty in there, a drop down is more cumbersome than what it is worth

Posted
why do you have your quantity defaulting to 0?

Where are you commenting on Mibble plz, livefood section using the drop down to select quantity maybe.

I have considered putting in a input box but I just havnt got rd to it yet and do you think it is better to have an input box instead?

 

But back to the problem, if anyone searches site using for example 'habistat' the search brings up results as should do but buy now does not work why?

 

Any pointers on this appreciated.

Posted

I believe that what mibble is commenting on is your product_info.php page. The default for your quantity dropdown is '0', some of your customers will forget to change this value, it is also very cumbersome to change if you order a lot of products.

 

Jud

Posted

Ok Jud thx for that I havemodified this now shows 1 instead of 0, thx for the info, right back to the problem at hand the search.

 

Plz do a search on my site for habistat and click on any of the results buy now button and you get a dead link why? any help here plz.

 

http://www.eurorep.net/retail/index.php

Posted

j0ker,

please post your products_Listing.php page and I will look at it and try to fix your problem. I have had this happen before, but I can't remember what I did to fix it. So just post your products_listing.php page and I will have a look

Posted

Here is the offending beast thx for any help.

 

 

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

 

Master Products - JOHNSON - 05/07/2003 [email protected]

 

Copyright © 2003 Suomedia - Dynamic Content Management

 

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

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;

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

//Master Products

if ($listing['products_master_status'] != '1' && $listing['products_master'] == '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_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

} elseif ($listing['products_master'] != '0') {

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

} else {

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

}

//Master Products EOF

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

I'm speculating here, but I use master_products too (great) and in advance_search_results.php I added something:

 

Around line 205 there is a select:

 

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, 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 ";

 

which I changed because I felt the products_master and products_master_status where missing from the select. Can't remember what triggered me in thinking that.

Anyway I changed it to:

 

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_master, p.products_master_status, 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 ";

 

Now another speculation:

 

if products_master and products_master_status were both missing in the array "listing", I reckon the following code is triggered in product_listing:

 

elseif ($listing['products_master'] != '0') {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

If my line of reasoning is correct that would insert $listing['products_master'] which is NULL and would explain products_id="

Posted

JanZ, I would like to thank you very much great work, the 2nd speculation I havnt tried yet but it works fine without, I will change and see what happens though.

Been nagging me for days that has.

Posted
the 2nd speculation I havnt tried yet but it works fine without, I will change and see what happens though.

Good to hear your problem is solved. No need to do anything further. The "second" speculation is just my reasoning how the incomplete select statement might have lead to the particular problem.

Posted

I have the same issue with the manufacturer product_listing when I select a manufacturer I get all products listed but no buy now again, I will look at what you have done and see if it has the same effect to the manufacturer listing.

 

Thx again.

Posted

I'm continuing to speculate but in product_listing, around line 150 it says:

 

case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
//Master Products
if ($listing['products_master_status'] != '1' && $listing['products_master'] == '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_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

 

now the link is to "basename($PHP_SELF)" which is what you see in your case: advanced_search_results etc. etc.

 

In the other links: tep_href_link(FILENAME_PRODUCT_INFO is used, what my gut feeling says makes more sense (remember I'm only speculating!).

Can you give it a try: changing tep_href_link(basename($PHP_SELF etc. to tep_href_link(FILENAME_PRODUCT_INFO etc... ?

Good luck.

Posted

Done the changes but no change this is what the code looks like now

 

//Master Products

if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') {

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

} elseif ($listing['products_master'] != '0') {

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

} else {

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

}

//Master Products EOF

Posted

Actually, there seems to be a change since it now says for the link: product_info.php?products_id=0

Since you now use:

$listing['products_master_status']

and that is "zero" the problematic part must be this piece of code.

I would say use 'products_id' instead of 'products_master_status' and you would seem to be covered.

However, I'm not certain whether we are mending this part and breaking something else. I should look at the sql-tables to see what status etc. have for values normally.

Giving it a try wouldn't hurt would it ;-)

Posted

Certainly wont harm at all, worth havin a bash.

Posted

Afterburn: something seems to be broken now in the regular product_listing.php.

 

Perhaps you should try:

 

if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 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> ';

instead of:

if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

Posted

Most of what JanZ has already recommended you is what I was gonna say ;-) ... The problem seemed to be that the $listing['products_id'] variable wasn't getting passed into the URL.

Posted

Thx guys great stuff got search working fine manufacturers box still fubar but I can live without the box so I removed it. But great work.

Archived

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

×
×
  • Create New...