Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

any comments are welcome


nirvana

Recommended Posts

  • Replies 80
  • Created
  • Last Reply

I cant get it to work either :(

 

I get this error:

1054 - Unknown column '3_15' in 'where clause'



SELECT products.products_id FROM products , products_to_categories WHERE products.products_id = products_to_categories.products_id AND products_to_categories.categories_id = 3_15



[TEP STOP]

 

Any help from anybody would be well appreciated!!

 

Warren

Link to comment
Share on other sites

Hello,

I have the same problem and it looks like the use of cPath variable has been changed in the latest release , it can also contain 1_9.

 

I have added/changed the following:

 

$cPath_old = substr(strrchr($cPath , '_'),1);



$products_ids = tep_db_query("SELECT products.products_id FROM " . TABLE_PRODUCTS . " , " . 

TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products.products_id = products_to_categories.products_id AND products_to_categories.categories_id = '" . $cPath_old ."'");

With kind regards ,

Fred Stuurman

Link to comment
Share on other sites

Hello,

I have the same problem and it looks like the use of cPath variable has been changed in the latest release , it can also contain 1_9.

 

I have added/changed the following:

 

$cPath_old = substr(strrchr($cPath , '_'),1);



$products_ids = tep_db_query("SELECT products.products_id FROM " . TABLE_PRODUCTS . " , " . 

TABLE_PRODUCTS_TO_CATEGORIES . " WHERE products.products_id = products_to_categories.products_id AND products_to_categories.categories_id = '" . $cPath_old ."'");

 

Thanks it works perfectly!!!

 

Warren

Link to comment
Share on other sites

I was running into errors on different category levels.

 

This is what I am using to handle the category and products_status so that this works with various levels deep in the categories.

 

<?php

   // calculate the previous and next

       $products_ids = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_status = '1'  and p.products_id = ptc.products_id and ptc.categories_id = $current_category_id");



   while ($product_row = tep_db_fetch_array($products_ids)) {

  	 $id_array[] = $product_row['products_id'];

   }



   reset ($id_array);

   $counter = 0;

   while (list($key, $value) = each ($id_array)) {

  	 if ($value == $products_id) {

     $position = $counter;

     if ($key == 0)

    	 $previous = -1; // it was the first to be found

     else

    	 $previous = $id_array[$key - 1];



     if ($id_array[$key + 1])

    	 $next_item = $id_array[$key + 1];

     else {

    	 $next_item = $id_array[0];

     }

  	 }

  	 $last = $value;

  	 $counter++;



   }

   if ($previous == -1)

  	 $previous = $last;



   $category_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = $current_category_id AND language_id = $languages_id");

   $category_name_row = tep_db_fetch_array($category_name_query);

?>

Link to comment
Share on other sites

It has a few pluses ... 8)

 

I need to upload it as I have a couple additional changes and so far, regardless of how I get to the product_info.php I do not break any more.

 

Keep your finger's crossed! :D

Link to comment
Share on other sites

I tried all the code changes suggested here! Finally ending up with Linda's one.

 

I don't have those errors people above were getting any more, but now all I have is the text:

 

Product 1/ from

 

It's not clickable even.

 

What have I done wrong?

 

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

I tried all the code changes suggested here! Finally ending up with Linda's one.

 

I don't have those errors people above were getting any more, but now all I have is the text:

 

Product 1/ from

 

 

One thing I did not check on my code is I already had a link for the categories ... and modifed my code to have two image buttons.

 

That peice you may want to go back to the original code for.

 

Mine looks like:

http://www.8thoctave.com/osc_freecall/prod..._id=35&cPath=21

 

My category link includes in the left corner the category image and name and is not a part of this peice of code, but part of another setting I use.

Link to comment
Share on other sites

This is my code section for the links and buttons:

<tr>

 <td>

   <table border="0" align="center">

     <tr>

       <td align="left" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_INFO, "products_id=$previous&cPath=$cPath"); ?>"><?php echo tep_image_button('button_prev.gif', IMAGE_BUTTON_PREVIOUS); ?></a></td>

<!--        <td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . "/" . $counter); ?><br><?php echo (PREV_NEXT_FROM) ?><?php echo ($category_name_row['categories_name']); ?></td> -->

       <td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . "/" . $counter); ?></td>

       <td align="right" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_INFO, "products_id=$next_item&cPath=$cPath"); ?>"><?php echo tep_image_button('button_next.gif', IMAGE_BUTTON_NEXT); ?></a></td>

     </tr>

   </table>

 </td>

</tr>

 

Try switching which row is commented out and see if that doesn't keep everything working but bring back your link.

Link to comment
Share on other sites

Linda

 

Something strange is happening!

 

I worked out how to get the "Prev" and "Next" links in there but there is a problem:

 

eg.

You go to this page:

http://www.redinstead.com.au/product_info..../products_id/55

 

and both the Prev and the Next link try to take you to this page:

http://www.redinstead.com.au/product_info..../cPath/21_25_28

 

And the text still says:

Product 1/

 

Any ideas?

 

 

thanks

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

If I am here:

http://www.redinstead.com.au/product_info....?products_id=55

 

both the next and prev links take me to:

http://www.redinstead.com.au/product_info....&cPath=21_25_28

 

 

 

Jen

 

 

ps Should SE friendly stay turned off? I could never quite decide on the evidence here at the forums

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

SE Friendlies only work on some servers and is not really working properly on many.

 

As to the Previous/Next it looks like the select statement is not grabbing the correct info.

 

If I get time tonight, I will try to package up all my changes, as I have this as an include file now and have updated a few things on it.

 

I think I have most of that posted but I could be missing a peice which is breaking it for you right now.

Link to comment
Share on other sites

Neat useful / necessary feature.

 

The only thing I can add is that if a user/customer performs a search and goes to result 1, he/she will expect next /prev to go through the search results .

 

***Check your site *****

Also I looked at a site using this feature

(Cannot remember which site-it was late last night ).

 

If you hover over the buttons the ALT text comes up as 'reviews'.

 

any thoughts ?

Special Effects / 3d + Flash

Link to comment
Share on other sites

You know ... might be interesting to set a variable like $products_next_prev_list to the current array from Advance Search or New Products ... and when set have it use that array ... and when not set have it use the generated array of the products category.

 

I will have to fool with this idea.

 

Then have between the buttons if there is a $products_next_prev_list it read where it came from so the customer knows what they are being shown.

Link to comment
Share on other sites

hi Linda

 

I just replaced the code in my product_info.php with the one you supplied in your mod above. I am assuming I can just do it that way instead of adding it as an "include".

 

Unfortunately exactly the same thing is happening as before. ie.

 

 

and the text in the middle is still:

Product 1/ from

 

 

I have no idea why! :)

 

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...