Post by prototype0104 » Fri May 17, 2019 8:58 pm

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.

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by thekrotek » Fri May 17, 2019 9:38 pm

Why having same products in the store?

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by prototype0104 » Fri May 17, 2019 9:52 pm

I handled a company site that have 200k + products :( .I think they imported bulk products feeds, same item different product_id maybe different category

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by thekrotek » Fri May 17, 2019 10:01 pm

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.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by prototype0104 » 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:

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by straightlight » Fri May 17, 2019 10:44 pm

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?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by prototype0104 » Fri May 17, 2019 10:58 pm

Sorry, 3.0.3.2
I'm not using extensions for search.

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by straightlight » Fri May 17, 2019 11:08 pm

Are you trying to delete those products from your admin - > catalog - > products page?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by thekrotek » Sat May 18, 2019 12:12 am

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.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by paulfeakins » Mon May 20, 2019 5:35 pm

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.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by prototype0104 » Mon May 20, 2019 5:43 pm

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)

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by straightlight » Tue May 21, 2019 2:37 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by prototype0104 » Tue May 21, 2019 3:47 am

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'],

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania
Who is online

Users browsing this forum: kirkhall and 24 guests