Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CONTRIBUTION] Product not found but


Guest

Recommended Posts

Ive just had a little play and confirm your right. Pname and Cname together and it works, pname on its own and it doesnt.

HMMMMMMMMMMMMM :blink:

 

 

to confirm, the general structure is this:

 

header

if product not found but still present {

display the other products in the same category

} elseif product not found and not present {

display products with an ID variation out of desperation

} else {

display the normal product info information

}

* now you are calling category browse here

footer

 

Currently you display the category browse bar in all cases but that module requires a category id or it will crash.

 

so move the call to the category browse module into the valid section.

 

header

if product not found but still present {

display the other products in the same category

} elseif product not found and not present {

display products with an ID variation out of desperation

} else {

display the normal product info information

* call to category browse module and all other stuff that you would normally have added to the product info page.

}

footer

Treasurer MFC

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Now, I've this problem:

 

amanda1.JPG

 

Customers who bought this product also purchased.. show me 3 or 4 times the same products....

Why?

this problem show from last modified!

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

  • 3 months later...

Hi Amanda:

 

Thank your for your contribution.

 

I have just implementd it to my site and it works fine, but I want to ask you a little question: I don't know the reason but Google indexed my site by product_id and my actual Data Base do not match id as in the past.

 

So, when customers make a query in google, it points always to a location that it does not exist yet in my site and they go away. Similar id don't works yet because all database was rebuild, but description and product model are still remaining the same. Was it possible to make some changes to look for products using google description or product model in order to seek by product_id?.

 

Thank you in advance for your work.

Link to comment
Share on other sites

Hi Amanda:

 

Thank your for your contribution.

 

I have just implementd it to my site and it works fine, but I want to ask you a little question: I don't know the reason but Google indexed my site by product_id and my actual Data Base do not match id as in the past.

 

So, when customers make a query in google, it points always to a location that it does not exist yet in my site and they go away. Similar id don't works yet because all database was rebuild, but description and product model are still remaining the same. Was it possible to make some changes to look for products using google description or product model in order to seek by product_id?.

 

Thank you in advance for your work.

 

well, basically you can only use the information the page request gives you.

So if they come in with products_id=xxx then that is the only info you can use.

 

If product xxx still exists in your database but is disabled then you can use any of its attributes to display other products like same category, similar model, similar description, even same date added, etc. You just need to fetch that information with the numbern and adjust the query to use those fields.

 

However, if that product never existed or is physically deleted then the number is really all you have.

Treasurer MFC

Link to comment
Share on other sites

  • 4 months later...

Hi, I have installed this great contribution and I read the previous forum questions on having duplicate products:

 

Solution:

"maybe a SELECT DISTINCT would work or do an array_unique on the result array."

 

I tried select distinct - not working. I have no idea how array_unique work.

 

Can someone please help!

 

Ken

Link to comment
Share on other sites

  • 2 weeks later...

Hey,

 

Since most of us seem to have Chemo's Ultimate SEO URL's installed, I have thought of a great way that this contrib can work with the "product not found but" one.

 

Basically, if the product is not found, it should look in the url for key words and then a search according to those key words in the url.

 

The reason is, I have had to dump all of my products out of the database from time to time (it actually happened today for some unknown reason) and then Google obviously has the wrong links because the product ID is incorrect. But, if the site could search the product description in the URL, it could then find the new product instead, or at least find similar ones.

 

Does that make sense?

 

Would it be easily do-able?

 

Cheers,

Chris :)

Link to comment
Share on other sites

Hey,

 

Since most of us seem to have Chemo's Ultimate SEO URL's installed, I have thought of a great way that this contrib can work with the "product not found but" one.

 

Basically, if the product is not found, it should look in the url for key words and then a search according to those key words in the url.

 

The reason is, I have had to dump all of my products out of the database from time to time (it actually happened today for some unknown reason) and then Google obviously has the wrong links because the product ID is incorrect. But, if the site could search the product description in the URL, it could then find the new product instead, or at least find similar ones.

 

Does that make sense?

 

Would it be easily do-able?

 

Cheers,

Chris :)

 

it should not look in the url as that is translated by the rewrite before you can get to it.

you could however use the SEO cache files which link the descriptions with the variables like cpath and product_id and is currently used by tep_href_link to create the seo links.

Treasurer MFC

Link to comment
Share on other sites

  • 4 weeks later...

I am having trouble installing this contrib. When I add all the code, I get the following whenever I try to view a page where the product isn't found:

 

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 ''1order by p.products_price asc' at line 12

select count(p.products_id) as total from products_description pd, categories c, 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 p2c.categories_id = c.categories_id and c.categories_id = 11 and pd.language_id = '1order by p.products_price asc

[TEP STOP]

 

I read earlier the suggestion that it could be something to do with copy & pasting the code - I can't for the life of me figure out what might be causing this.

 

To repro the error (until it's fixed at least :blush: ) you can go here http://cottagepast.com/shop/wooden-marking-guage-p-1274.html

Link to comment
Share on other sites

I am having trouble installing this contrib. When I add all the code, I get the following whenever I try to view a page where the product isn't found:

 

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 ''1order by p.products_price asc' at line 12

select count(p.products_id) as total from products_description pd, categories c, 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 p2c.categories_id = c.categories_id and c.categories_id = 11 and pd.language_id = '1order by p.products_price asc

[TEP STOP]

 

I read earlier the suggestion that it could be something to do with copy & pasting the code - I can't for the life of me figure out what might be causing this.

 

To repro the error (until it's fixed at least :blush: ) you can go here http://cottagepast.com/shop/wooden-marking-guage-p-1274.html

 

This looks like an easy fix.

See where the code says "1order by p.products_price asc"? Well it shouldn't have the '1' in front of 'order'. Just remove it from your code and all should be good.

 

Cheers,

Chris :)

Link to comment
Share on other sites

This looks like an easy fix.

See where the code says "1order by p.products_price asc"? Well it shouldn't have the '1' in front of 'order'. Just remove it from your code and all should be good.

 

Oi! Chris, I think I had been staring at the problem too long. :blink: That was too easy. Huge thanks.

 

Just posting what I did to fix, in the event someone else comes across this problem. I changed every occurrence in catalog/product_info from:

 

pd.language_id = '" . (int)$languages_id . "'"

 

to

 

pd.language_id = '" . (int)$languages_id . "' "

 

(Note the wordspace that I put in after the '). Works beautifully now - thanks for a great contrib, Amanda!

Link to comment
Share on other sites

  • 5 months later...

hi,

I have installed this contribution, and now I get

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products_description pd, categories c, 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 p2c.categories_id = c.categories_id and p.products_id like '%804%' and pd.language_id = '1'

 

[TEP STOP]

 

something to do with PHP5, but I am not sure how to fix. Please help:)

Link to comment
Share on other sites

  • 4 weeks later...

Hi everybody,

 

That's a great contribution. I wonder, is it possible to add it to the advanced_search_result.php, so when the search returns no results, just display some similar products instead. Is that possible? Did anybody tried that?

 

Thanks.

Link to comment
Share on other sites

  • 10 months later...

Its been a long time since someone commented on this contribution but I've noticed something that I think has fallen through the cracks. I've also noticed this same bug on other people's site that also has these contributions running.

 

Here's the bug: (Only happens with Chemo's Ultimate SEO URLs contribution installed and running)

When somebody clicks on a link to an item that is no longer in stock, or available, the site pulls up a recommended list of items as it should. BUT if you click on any of the Buy Now buttons, you will notice it adds the item that they were originally searching for (the one thats out of stock), not the item that is listed on next to that Buy Now button.

 

Product not found...BUT contribution:

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

 

Ultimate SEO URLs contribution:

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

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
maybe a SELECT DISTINCT would work or do an array_unique on the result array.

Hey guys

 

was there a solution found for the duplicate product problem? I have some product in more than one category as well.

 

Would like to get this sorted!

 

Thanks in advance,

 

~Roq

Link to comment
Share on other sites

Hey guys

 

was there a solution found for the duplicate product problem? I have some product in more than one category as well.

 

Would like to get this sorted!

 

Thanks in advance,

 

~Roq

 

Still looking for wise and informed folk to help me sort thru this one.

 

Please help!

 

~Roq

Link to comment
Share on other sites

  • 2 weeks later...
Still looking for wise and informed folk to help me sort thru this one.

 

Please help!

 

~Roq

 

 

Does anyone know how to remove duplicate entries from those listed? It is still pulling the info from every category regardless of whether it is already being displayed or not.

 

Help please :)

Link to comment
Share on other sites

OK, it is hard to believe that nobody sorted the MySQL5 problem yet... The below code is not working as expected and intended but it is not throwing errors. However it is not offering similar or related products, but we'll get there I believe. Anybody?

<?php

// the requested product could not be found. But we do not give up.
// Check if it was disabled and get the category id of that product
$product_check_query = tep_db_query("select pc.categories_id 
									 from " . TABLE_PRODUCTS . " p, 
										  " . TABLE_PRODUCTS_DESCRIPTION . " pd,
										  " . TABLE_PRODUCTS_TO_CATEGORIES . " pc
									 where p.products_status != '1' and 
										   p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and 
										   pd.products_id = p.products_id and 
										   pd.products_id = pc.products_id and 
										   pd.language_id = '" . (int)$languages_id . "'");


if ($product_check = tep_db_fetch_array($product_check_query)) { // product exists but disabled

  // then we do a query of the other products in the same category
  // and we display them below using the product_listing module
  $listing_sql = "select p.products_model, 
						 pd.products_name, 
						 p.products_image, 
						 p.products_quantity, 
						 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 (" . TABLE_PRODUCTS_DESCRIPTION . " pd,
					   " . TABLE_CATEGORIES . " c,
					   " . TABLE_PRODUCTS . " p,
					   " . TABLE_MANUFACTURERS . " m,
					   " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ) left join
					   " . TABLE_SPECIALS . " s on ( p.manufacturers_id = m.manufacturers_id and 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 
						p2c.categories_id = c.categories_id and 
						c.categories_id = " . $product_check['categories_id'] . " and 
						pd.language_id = '" . (int)$languages_id . "'";

} else { // no, the product is totally absent, we are running out of options, so lets do a query anyway with a variation on the product id.

   $wrong_id = $HTTP_GET_VARS['products_id'];
   $size = strlen($wrong_id)-2;
   $wrong_id = substr($wrong_id, 1,$size);
   $listing_sql = "select p.products_model, 
						  pd.products_name, 
						  p.products_image, 
						  p.products_quantity, 
						  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 ( " . TABLE_PRODUCTS_DESCRIPTION . " pd,
						" . TABLE_CATEGORIES . " c,
						" . TABLE_PRODUCTS . " p,
						" . TABLE_MANUFACTURERS . " m,
						" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ) left join
						" . TABLE_SPECIALS . " s on (p.manufacturers_id = m.manufacturers_id and 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 
						 p2c.categories_id = c.categories_id and 
						 p.products_id like '%" . $wrong_id . "%' and 
						 pd.language_id = '" . (int)$languages_id . "'";
}

// create column list
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
					 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
					 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
					 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
					 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
					 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
					 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
					 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

asort($define_list);

$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
  if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
  switch ($column_list[$i]) {
	case 'PRODUCT_LIST_MODEL':
	  $select_column_list .= 'p.products_model, ';
	  break;
	case 'PRODUCT_LIST_NAME':
	  $select_column_list .= 'pd.products_name, ';
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $select_column_list .= 'm.manufacturers_name, ';
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $select_column_list .= 'p.products_quantity, ';
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $select_column_list .= 'p.products_image, ';
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $select_column_list .= 'p.products_weight, ';
	  break;
  }
}


if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'PRODUCT_LIST_MODEL') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by p.products_model";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $listing_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'PRODUCT_LIST_NAME':
	  $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_model";
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_model";
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_model";
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $listing_sql .= "p.products_model";
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_model";
	  break;
	case 'PRODUCT_LIST_PRICE':
	  $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_model";
	  break;
  }
}

?>

Absinthe Original Liquor Store

Link to comment
Share on other sites

  • 4 weeks later...

Mysql5 update

 

Simply change 2 instances of:

 

from " . TABLE_PRODUCTS_DESCRIPTION . " pd, 
					   " . TABLE_CATEGORIES . " c, 
					   " . TABLE_PRODUCTS . " p left join 
					   " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
					   " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join

*****************************
With
*****************************

from ((" . TABLE_PRODUCTS_DESCRIPTION . " pd, 
					   " . TABLE_CATEGORIES . " c, 
					   " . TABLE_PRODUCTS . " p) left join 
					   " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, 
					   " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join

Credit goes to sashaben.

 

Enjoy! :thumbsup:

Absinthe Original Liquor Store

Link to comment
Share on other sites

  • 1 month later...

Archived

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

×
×
  • Create New...