I've created a rule using the "After adding a product to the cart" event to redirect the user to the cart.

https://www.siperfumes.com/collection

If you click on the add to cart button for the first product on this page you'll see that it works. The other buttons on the page look like they are doing some sort of ajax process and add the product to the cart, but the rule is not getting fired.

Any suggestions?

Comments

rszrama’s picture

Status: Active » Closed (cannot reproduce)

Commerce Add to Cart forms don't play well with Views Ajax functionality; can you not just disable that? I don't know why it's working for one on the page and not any others unfortunately.

bluecobalt’s picture

Status: Closed (cannot reproduce) » Active

Ajax is disabled. I don't know why it's doing that Ajax thing. This is extremely frustrating, and the client is not thrilled.

Here's the export of the view. Any idea why this is happening?

$view = new view();
$view->name = 'collection_eaux_de_parfum';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'commerce_product';
$view->human_name = 'collection eaux de parfum - all';
$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['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['disable_sql_rewrite'] = TRUE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['grouping'] = array(
0 => array(
'field' => 'field_product_name',
'rendered' => 1,
'rendered_strip' => 0,
),
);
$handler->display->display_options['style_options']['columns'] = '3';
$handler->display->display_options['row_plugin'] = 'fields';
/* Header: Global: PHP */
$handler->display->display_options['header']['php']['id'] = 'php';
$handler->display->display_options['header']['php']['table'] = 'views';
$handler->display->display_options['header']['php']['field'] = 'php';
$handler->display->display_options['header']['php']['php_output'] = 'EAUX DE PARFUM';
/* Relationship: Commerce Product: Referencing Node */
$handler->display->display_options['relationships']['field_products']['id'] = 'field_products';
$handler->display->display_options['relationships']['field_products']['table'] = 'commerce_product';
$handler->display->display_options['relationships']['field_products']['field'] = 'field_products';
/* Field: Content: Path */
$handler->display->display_options['fields']['path']['id'] = 'path';
$handler->display->display_options['fields']['path']['table'] = 'node';
$handler->display->display_options['fields']['path']['field'] = 'path';
$handler->display->display_options['fields']['path']['relationship'] = 'field_products';
$handler->display->display_options['fields']['path']['label'] = '';
$handler->display->display_options['fields']['path']['exclude'] = TRUE;
$handler->display->display_options['fields']['path']['element_label_colon'] = FALSE;
/* Field: Commerce Product: field_image_cache Image */
$handler->display->display_options['fields']['field_image_cache']['id'] = 'field_image_cache';
$handler->display->display_options['fields']['field_image_cache']['table'] = 'field_data_field_image_cache';
$handler->display->display_options['fields']['field_image_cache']['field'] = 'field_image_cache';
$handler->display->display_options['fields']['field_image_cache']['label'] = '';
$handler->display->display_options['fields']['field_image_cache']['alter']['make_link'] = TRUE;
$handler->display->display_options['fields']['field_image_cache']['alter']['path'] = 'http://www.siperfumes.com[path]';
$handler->display->display_options['fields']['field_image_cache']['alter']['target'] = '_blank';
$handler->display->display_options['fields']['field_image_cache']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_image_cache']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_image_cache']['settings'] = array(
'image_style' => '',
'image_link' => '',
'field_multiple_limit' => '-1',
'field_multiple_limit_offset' => '0',
);
$handler->display->display_options['fields']['field_image_cache']['delta_limit'] = '1';
$handler->display->display_options['fields']['field_image_cache']['delta_offset'] = '1';
/* Field: Commerce Product: Product Name */
$handler->display->display_options['fields']['field_product_name']['id'] = 'field_product_name';
$handler->display->display_options['fields']['field_product_name']['table'] = 'field_data_field_product_name';
$handler->display->display_options['fields']['field_product_name']['field'] = 'field_product_name';
$handler->display->display_options['fields']['field_product_name']['label'] = '';
$handler->display->display_options['fields']['field_product_name']['element_label_colon'] = FALSE;
/* Field: Commerce Product: Options */
$handler->display->display_options['fields']['field_options']['id'] = 'field_options';
$handler->display->display_options['fields']['field_options']['table'] = 'field_data_field_options';
$handler->display->display_options['fields']['field_options']['field'] = 'field_options';
$handler->display->display_options['fields']['field_options']['label'] = '';
$handler->display->display_options['fields']['field_options']['exclude'] = TRUE;
$handler->display->display_options['fields']['field_options']['alter']['text'] = '[field_options-value]';
$handler->display->display_options['fields']['field_options']['element_label_colon'] = FALSE;
/* Field: Commerce Product: Price */
$handler->display->display_options['fields']['commerce_price']['id'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['table'] = 'field_data_commerce_price';
$handler->display->display_options['fields']['commerce_price']['field'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['label'] = '';
$handler->display->display_options['fields']['commerce_price']['exclude'] = TRUE;
$handler->display->display_options['fields']['commerce_price']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['commerce_price']['click_sort_column'] = 'amount';
$handler->display->display_options['fields']['commerce_price']['settings'] = array(
'calculation' => '0',
);
/* Field: Global: PHP */
$handler->display->display_options['fields']['php']['id'] = 'php';
$handler->display->display_options['fields']['php']['table'] = 'views';
$handler->display->display_options['fields']['php']['field'] = 'php';
$handler->display->display_options['fields']['php']['label'] = '';
$handler->display->display_options['fields']['php']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['php']['use_php_setup'] = 0;
$handler->display->display_options['fields']['php']['php_output'] = '

if ($data->field_field_options[0][\'raw\'][\'value\'] == \'Eau de Parfum 1.7 fl. oz.\') {
  print \'50 ml 1.7 fl. oz. \' . $data->field_commerce_price[0][rendered][\'#markup\'];
} else if ($data->field_field_options[0][\'raw\'][\'value\'] == \'Eau de Parfum 3.4 fl. oz.\') {
  print \'100 ml 3.4 fl. oz. \' . $data->field_commerce_price[0][rendered][\'#markup\'];
} else if ($data->field_field_options[0][\'raw\'][\'value\'] == \'Eau de Parfum 0.5 fl. oz.\') {
  print \'15 ml 0.5 fl. oz. \' . $data->field_commerce_price[0][rendered][\'#markup\'];
}

';
$handler->display->display_options['fields']['php']['use_php_click_sortable'] = '0';
$handler->display->display_options['fields']['php']['php_click_sortable'] = '';
/* Field: Commerce Product: Add to Cart form */
$handler->display->display_options['fields']['add_to_cart_form']['id'] = 'add_to_cart_form';
$handler->display->display_options['fields']['add_to_cart_form']['table'] = 'views_entity_commerce_product';
$handler->display->display_options['fields']['add_to_cart_form']['field'] = 'add_to_cart_form';
$handler->display->display_options['fields']['add_to_cart_form']['label'] = '';
$handler->display->display_options['fields']['add_to_cart_form']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['add_to_cart_form']['show_quantity'] = 0;
$handler->display->display_options['fields']['add_to_cart_form']['default_quantity'] = '1';
$handler->display->display_options['fields']['add_to_cart_form']['combine'] = 1;
$handler->display->display_options['fields']['add_to_cart_form']['display_path'] = 1;
$handler->display->display_options['fields']['add_to_cart_form']['line_item_type'] = 0;
/* Field: Commerce Product: Stock */
$handler->display->display_options['fields']['commerce_stock']['id'] = 'commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['table'] = 'field_data_commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['field'] = 'commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['label'] = '';
$handler->display->display_options['fields']['commerce_stock']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['commerce_stock']['type'] = 'commerce_sdf_formatter';
$handler->display->display_options['fields']['commerce_stock']['settings'] = array(
'display' => array(
0 => array(
'seuil' => 0,
'message' => 'Currently Unavailable.',
'classname' => 'currently-unavailable',
),
1 => array(
'seuil' => '99999999',
'message' => '',
'classname' => '',
),
2 => array(
'seuil' => '',
'message' => '',
'classname' => '',
),
3 => array(
'seuil' => '',
'message' => '',
'classname' => '',
),
4 => array(
'seuil' => '',
'message' => '',
'classname' => '',
),
),
);
/* Sort criterion: Commerce Product: Title */
$handler->display->display_options['sorts']['title']['id'] = 'title';
$handler->display->display_options['sorts']['title']['table'] = 'commerce_product';
$handler->display->display_options['sorts']['title']['field'] = 'title';
/* Sort criterion: Commerce Product: Price (commerce_price:amount) */
$handler->display->display_options['sorts']['commerce_price_amount']['id'] = 'commerce_price_amount';
$handler->display->display_options['sorts']['commerce_price_amount']['table'] = 'field_data_commerce_price';
$handler->display->display_options['sorts']['commerce_price_amount']['field'] = 'commerce_price_amount';
/* Filter criterion: Commerce Product: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'commerce_product';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'parfum' => 'parfum',
);
/* Filter criterion: Commerce Product: Options (field_options) */
$handler->display->display_options['filters']['field_options_value']['id'] = 'field_options_value';
$handler->display->display_options['filters']['field_options_value']['table'] = 'field_data_field_options';
$handler->display->display_options['filters']['field_options_value']['field'] = 'field_options_value';
$handler->display->display_options['filters']['field_options_value']['value'] = array(
'Eau de Parfum 1.7 fl. oz.' => 'Eau de Parfum 1.7 fl. oz.',
'Eau de Parfum 3.4 fl. oz.' => 'Eau de Parfum 3.4 fl. oz.',
'Eau de Parfum 0.5 fl. oz.' => 'Eau de Parfum 0.5 fl. oz.',
);

/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1');
$translatables['collection_eaux_de_parfum'] = array(
t('Master'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Node referencing products from field_products'),
t('[field_options-value]'),
t('Content pane'),
t('View panes'),
);

rszrama’s picture

Status: Active » Closed (cannot reproduce)

Sorry, I couldn't tell you. If it isn't in the Views settings, it must be coming from some other module on your site. Stock perhaps? No clue. You'll have to research it further, possibly by cloning the site to a development environment and disabling modules until you find the culprit.