Projet

Général

Profil

Paste
Télécharger (1,94 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / commerce / modules / cart / commerce_cart.install @ b858700c

1
<?php
2

    
3
/**
4
 * Make all fields that were previously eligible for attribute selection on the
5
 * Add to Cart form continue to use the attribute selection widget.
6
 */
7
function commerce_cart_update_7100() {
8
  // Loop over all the field instances on product bundles.
9
  foreach (field_info_instances('commerce_product') as $bundle_name => $instances) {
10
    foreach ($instances as $instance) {
11
      $field = field_info_field_by_id($instance['field_id']);
12

    
13
      // If the field meets attribute eligibility, it should continue to use the
14
      // select widget as an attribute field on the Add to Cart form.
15
      if ($field['cardinality'] == 1 && function_exists($field['module'] . '_options_list')) {
16
        $instance['commerce_cart_settings'] = array(
17
          'attribute_field' => TRUE,
18
          'attribute_widget' => 'select',
19
        );
20
      }
21

    
22
      // Save the updated field instance.
23
      field_update_instance($instance);
24
    }
25
  }
26

    
27
  return t('All eligible product attribute fields have been updated to continue using the attribute selection widget.');
28
}
29

    
30
/**
31
 * Disable the new local action to apply pricing rules to an order.
32
 */
33
function commerce_cart_update_7101() {
34
  variable_set('commerce_order_apply_pricing_rules_link', FALSE);
35
  return t('A new local action link on order edit forms for applying pricing rules to an order has been disabled by default; enable it on the order settings form if desired.');
36
}
37

    
38
/**
39
 * Adjust the new shopping cart refresh frequency to occur continuously to match
40
 * the long-standing behavior of the process.
41
 */
42
function commerce_cart_update_7102() {
43
  variable_set('commerce_cart_refresh_frequency', 0);
44
  return t('New order settings have been added to let you reduce the frequency of the shopping cart refresh. This update set it to occur continuously as it has been, but we recommend you implement some delay unless you have a unique product pricing situation that demands pricing updates every time a shopping cart is loaded.');
45
}