Discussions

Duplicate items when using attributes

Hi Guys,

New here, just dabbed into drupal commerce. My products have multiple attributes, so I followed the FAQ and created multiple copies of the same product with different attribute and linked them to a content product node.

By doing so, every single product of the attribute is showing once on my category page. How do I remove the duplicates?

Thanks,

Wendy

Posted: Oct 24, 2011

Comments

d3vilr3d on October 25, 2011

Never mind,

This has everything to do with Views only. I solved it by altering the views sql pre execute

function nodupe_views_pre_execute(&$view) {

switch($view->name){
case 'catalog':
case 'latest_products':
$view->build_info['query']->groupBy('node_title');
break;
}

Costas on November 1, 2011

Can you please explain it. I mean give us if you can some more information about this.

Thanks

Strutsagget on December 3, 2012

Hi

I would really appreciate if you could explain more.

Is it a custom module? Please explain the variables you use and so on if you have the time.

I really think commerce needs a custom views plugin for this as its something that happens to everyone and there seams to be no clear way to handle it.

joecanti on September 4, 2013

I don't know why this works but it does.

The filter is content:products:delta, and then you add a '0' when prompted for a number. The view is now only showing 1 product / attribute from each product - I need to look into this more to figure out how to choose which attribute to show. EG it would be nice to display 'from £40'

Cheers, Joe