Page 1 of 1

Duplicates products in search

Posted: Fri May 17, 2019 8:58 pm
by prototype0104
Hi guys I have some problem!
SORRY FOR VERY BAD ENGLISH
I have some products that are the same but I don't want to delete anything. If I have 3 products with name " Battery", when I search by name ("battery") , site shows me all 3 products that basically is 1. I want to make a condition that hide me duplicates.
I tried to put this condition:

Code: Select all

  
 {% set first = 1 %}
{% for product in products %}
  {% if model != product.model or first== 1%}
	{% set first= 2 %}
	.....
	{% set model= product.model%}
  {% endif %}
{% endfor %}
	
This work only if duplicate products are successive.

Re: Duplicates products in search

Posted: Fri May 17, 2019 9:38 pm
by thekrotek
Why having same products in the store?

Re: Duplicates products in search

Posted: Fri May 17, 2019 9:52 pm
by prototype0104
I handled a company site that have 200k + products :( .I think they imported bulk products feeds, same item different product_id maybe different category

Re: Duplicates products in search

Posted: Fri May 17, 2019 10:01 pm
by thekrotek
prototype0104 wrote:
Fri May 17, 2019 9:52 pm
Same item different product_id maybe different category
Still not clear, if it's the same product or not.

Re: Duplicates products in search

Posted: Fri May 17, 2019 10:10 pm
by prototype0104
It's same, have the same model (sku) code, but have different product_id, maybe different attributes.
Exemple:
I have a part for some vehicle
This part is compatible with Vehicle X and Vehicle Y (compatibility attribute)
For any vehicle they created new product but basically the same.. They don't want to delete :hammer:

Re: Duplicates products in search

Posted: Fri May 17, 2019 10:44 pm
by straightlight
prototype0104 wrote:
Fri May 17, 2019 10:10 pm
It's same, have the same model (sku) code, but have different product_id, maybe different attributes.
Exemple:
I have a part for some vehicle
This part is compatible with Vehicle X and Vehicle Y (compatibility attribute)
For any vehicle they created new product but basically the same.. They don't want to delete :hammer:
No OC version posted. Using any extensions?

Re: Duplicates products in search

Posted: Fri May 17, 2019 10:58 pm
by prototype0104
Sorry, 3.0.3.2
I'm not using extensions for search.

Re: Duplicates products in search

Posted: Fri May 17, 2019 11:08 pm
by straightlight
Are you trying to delete those products from your admin - > catalog - > products page?

Re: Duplicates products in search

Posted: Sat May 18, 2019 12:12 am
by thekrotek
prototype0104 wrote:
Fri May 17, 2019 10:10 pm
It's same, have the same model (sku) code, but have different product_id, maybe different attributes.
Exemple:
I have a part for some vehicle
This part is compatible with Vehicle X and Vehicle Y (compatibility attribute)
For any vehicle they created new product but basically the same.. They don't want to delete :hammer:
Then these are different products and should be displayed in search results, not hidden. Problem solved.

Re: Duplicates products in search

Posted: Mon May 20, 2019 5:35 pm
by paulfeakins
prototype0104 wrote:
Fri May 17, 2019 10:10 pm
For any vehicle they created new product but basically the same.. They don't want to delete :hammer:
Why did they do it that way?

It sounds like they should not have duplicated the products.

Re: Duplicates products in search

Posted: Mon May 20, 2019 5:43 pm
by prototype0104
My mistake.. Basically is not the same product. Every product have a product number for identify from an image. Now I want to do something, if there are more products with same code, show name, image and the links with every product. ( I don't want to have same name and same image in product list)

Re: Duplicates products in search

Posted: Tue May 21, 2019 2:37 am
by straightlight
What the OP is looking for is to regroup the product model and sku and to show them all on the product detail page. This has been requested before a few times on the forum. However, it is not suggested to use an extension for this since it will affect your SEO links. Regrouping detailed data into one page reduces the Marketing Management's assets but also reduces the Product Management levels based on its reputation that is being announced from the store.

Re: Duplicates products in search

Posted: Tue May 21, 2019 3:47 am
by prototype0104
In the end I did product list to be like, every product title : Category : Product name
Category = last subcategory - 1 (ex: CAR->BMW->320D) Category = BMW

Code: Select all

public function getcatID($category_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category WHERE category_id = '" . (int)$category_id . "'");
		return (int)$query->row['parent_id'];
	}
	

Code: Select all

$categories = $this->model_catalog_product->getCategories($result['product_id']);
				$catid= $this->model_catalog_category->getcatID($categories[0]['category_id']);
				$category_data = $this->model_catalog_category->getCategory($catid); 
				$category_name = $category_data['name'];

Code: Select all

'name'        => $category_name . ': ' . $result['name'],