Projet

Général

Profil

Révision 9d13637e

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.module
363 363
  $form['cart_refresh'] = array(
364 364
    '#type' => 'fieldset',
365 365
    '#title' => t('Shopping cart refresh'),
366
    '#description' => t('Shopping cart orders comprise orders in shopping cart and some checkout related order statuses. These settings let you control the shopping cart orders are refreshed, the process during which product prices are recalculated, to improve site performance in the case of excessive refreshes on sites with less dynamic pricing needs.'),
366
    '#description' => t('Shopping cart orders comprise orders in shopping cart and some checkout related order statuses. These settings let you control how the shopping cart orders are refreshed, the process during which product prices are recalculated, to improve site performance in the case of excessive refreshes on sites with less dynamic pricing needs.'),
367 367
    '#weight' => 40,
368 368
  );
369 369
  $form['cart_refresh']['commerce_cart_refresh_mode'] = array(
......
2236 2236
  // form with form IDs based on the $product_ids.
2237 2237
  $form['#validate'][] = 'commerce_cart_add_to_cart_form_validate';
2238 2238
  $form['#submit'][] = 'commerce_cart_add_to_cart_form_submit';
2239
  $form['#after_build'][] = 'commerce_cart_add_to_cart_form_after_build';
2239 2240

  
2240 2241
  return $form;
2241 2242
}
......
2287 2288
  // Then render and return the various product fields that might need to be
2288 2289
  // updated on the page.
2289 2290
  if (!empty($form_state['context'])) {
2290
    $product = $form_state['default_product'];
2291
    $product = commerce_product_load($form_state['default_product_id']);
2292
    $form_state['default_product'] = $product;
2291 2293
    $product->display_context = $form_state['context'];
2292 2294

  
2293 2295
    // First render the actual fields attached to the referenced product.
......
2423 2425
  }
2424 2426
}
2425 2427

  
2428
/**
2429
 * After build callback for the Add to Cart form.
2430
 */
2431
function commerce_cart_add_to_cart_form_after_build(&$form, &$form_state) {
2432
  // Remove the default_product entity to mitigate cache_form bloat and performance issues.
2433
  if (isset($form_state['default_product'])) {
2434
    $form_state['default_product_id'] = $form_state['default_product']->product_id;
2435
    unset($form_state['default_product']);
2436
  }
2437
  return $form;
2438
}
2439

  
2426 2440
/**
2427 2441
 * Implements hook_field_info_alter().
2428 2442
 */

Formats disponibles : Unified diff