Ejemplo n.º 1
0
 /**
  * Get fingerprint difference
  *
  * @params array $old Old fingerprint
  * @params array $new New fingerprint
  *
  * @return array
  */
 protected function getCartFingerprintDifference(array $old, array $new)
 {
     $diff = parent::getCartFingerprintDifference($old, $new);
     $cellKeys = array('capostOfficeId', 'capostShippingZipCode');
     foreach ($cellKeys as $name) {
         if ($old[$name] != $new[$name]) {
             $diff[$name] = $new[$name];
         }
     }
     return $diff;
 }
Ejemplo n.º 2
0
 /**
  * Get fingerprint difference
  *
  * @param array $old Old fingerprint
  * @param array $new New fingerprint
  *
  * @return array
  */
 protected function getCartFingerprintDifference(array $old, array $new)
 {
     $diff = parent::getCartFingerprintDifference($old, $new);
     if (count($old['coupons']) !== count($new['coupons']) || count($old['coupons']) !== count(array_intersect($old['coupons'], $new['coupons']))) {
         $diff['coupons'] = array();
         foreach (array_diff($new['coupons'], $old['coupons']) as $id) {
             $diff['coupons'][] = array('id' => $id, 'state' => 'added');
         }
         foreach (array_diff($old['coupons'], $new['coupons']) as $id) {
             $diff['coupons'][] = array('id' => $id, 'state' => 'removed');
         }
     }
     return $diff;
 }