I have a page on my site called shop where I display all products within my shop. If I'm on page 2 let's say (therefore at /shop?page=1) and I click on the "Add to cart" button on one of my products, I get redirected to /shop.

I should be redirected to /shop?page=1

Comments

guillaumev’s picture

Status: Active » Needs review
StatusFileSize
new618 bytes

Here is a patch which fixes the issue...

rszrama’s picture

Status: Needs review » Postponed

If we can get this patch committed, we won't have to fix this in Commerce: #171267: form redirects removes get variables like sort and order

amateescu’s picture

Status: Postponed » Needs review
StatusFileSize
new619 bytes

Waiting for core won't get us very far :)

Anonymous’s picture

StatusFileSize
new767 bytes

The patch from #4 didn't work for me as my site's in a subdirectory. This patch works though.

fp’s picture

Status: Needs review » Reviewed & tested by the community

#5 works well for me. Thanks for the patch.

rszrama’s picture

Assigned: Unassigned » helior
Status: Reviewed & tested by the community » Needs work
Issue tags: +1.3 review

I'm not sure I understand the approach this patch is taking. Is there no simpler way to do this? For example, can we not just set the redirect to the request_path()?

helior’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB
rszrama’s picture

Assigned: helior » Unassigned
Status: Needs review » Fixed

Tested with the following View and committed.


$view = new view;
$view->name = 'catalog';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Catalog';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Catalog';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'product_display' => 'product_display',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'catalog';
$translatables['catalog'] = array(
  t('Master'),
  t('Catalog'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('Page'),
);

Automatically closed -- issue fixed for 2 weeks with no activity.