bsmither Posted April 9, 2015 Share Posted April 9, 2015 (edited) For those who suffer from massive bogus submission of product reviews and wish a more efficient method of deleting them in bulk, please try this.In /admin/sources/products.reviews.inc.php, make these edits:Near line 37, find: if (!empty($_POST['delete']['ip_address'])) { $delete_array_ip_address = array('ip_address' => $_POST['delete']['ip_address']); $bulk_delete = true; } Add After: /* NEW */ if (isset($_POST['multi-status']) && isset($_POST['go'])) { switch ($_POST['multi-status']) { case 'delete': if (!empty($_POST['delete']['individual'])) { $delete_array_individual = array('id' => array_keys($_POST['delete']['individual'])); $bulk_delete = true; } break; } } /* /NEW */ Two lines after that, find: $delete_array = array_merge($delete_array_email, $delete_array_ip_address); Replace with: /* NEW */ $delete_array = array_merge($delete_array_individual, $delete_array_email, $delete_array_ip_address); // $delete_array = array_merge($delete_array_email, $delete_array_ip_address);In the admin skin template file products.reviews.php, make these edits:Find: {foreach from=$REVIEWS item=review} <div class="note"> <span class="actions"> <input type="hidden" class="toggle" name="approve[{$review.id}]" id="approve_{$review.id}" value="{$review.approved}"> <a href="{$review.edit}" class="edit" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a> <a href="{$review.delete}" class="delete" title="{$LANG.notification.confirm_delete}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a> </span> <div> Add After: {* NEW *}{* Necessary only when using CC6's admin skin. *} <style> .custom-checkbox { background-repeat: no-repeat; background-attachment: scroll; background-position: left 4px; height: 20px; } .custom-checkbox.selected { background-repeat: no-repeat; background-attachment: scroll; background-position: left 4px; height: 20px; } </style> <input type="checkbox" class="all-reviews" id="multi_{$review.id}" name="delete[individual][{$review.id}]" value="" /> {* /NEW *} Then find: <div class="pagination"> <span>{$LANG.common.total}: {$TOTAL_RESULTS}</span>{$PAGINATION} </div> ABOVE that, Add: {* NEW *} <img src="{$SKIN_VARS.admin_folder}/skins/{$SKIN_VARS.skin_folder}/images/select_all.gif" alt=""> <a href="#" class="check-all" rel="all-reviews">{$LANG.form.check_uncheck}</a> {$LANG.orders.with_selected}: <select name="multi-status" class="textbox"> <option value="delete" style="color: red;">Bulk Delete</option> {* <optgroup label="{$LANG.orders.change_order_status}"> {foreach from=$LIST_ORDER_STATUS item=status}<option value="{$status.id}"{$status.selected}>{$status.string}</option>{/foreach} </optgroup> *} </select> <input type="submit" value="{$LANG.common.go}" name="go" class="tiny submit_confirm" title="{$LANG.notification.confirm_delete}"> {* /NEW *}You now should have checkboxes at the left edge of each review, and a 'Check-All' box at the bottom of the table. A separate "Go" button will send all checked list items to be deleted.The drop-down selector currently only has "Bulk Delete", other actions can be added later. Edited April 9, 2015 by bsmither Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted April 10, 2015 Share Posted April 10, 2015 This was added as an issue and has already been added to core code for 6.0.3 release - see https://github.com/cubecart/v6/issues/445Great work Al Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 10, 2015 Author Share Posted April 10, 2015 Should also work for CC5. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.