Created
April 1, 2017 12:35
-
-
Save druman/e7cc0a2bb4a0e24c087f38ae411f90c9 to your computer and use it in GitHub Desktop.
Duplicate comerce variations product in views. Need content:nid field!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_views_pre_execute(). | |
* | |
* Rewrite SQL query to prevent duplicates based on NID | |
*/ | |
function my_module_views_pre_execute(&$view) { | |
if ($view->name == '') { | |
$query = $view->build_info['query']; | |
$count_query = $view->build_info['count_query']; | |
$query->groupBy('nid'); | |
$count_query->groupBy('nid'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment