protected function prepareList(array $addresses, array $data)
    {
        $countries = $this->country->getList();

        $list = array();
        foreach ($addresses as $address_id => $address) {

            $list[$address_id] = $address;

            if (empty($data['status'])) {
                continue; // Do not check enabled country, state and city
            }

            if (empty($countries)) {
                continue; // No countries defined in the system
            }

            if ($address['country'] !== '' && $address['country_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            if (!empty($address['state_id']) && $address['state_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            // City ID can also be not numeric (user input)
            if (is_numeric($address['city_id']) && $address['city_status'] == 0) {
                unset($list[$address_id]);
            }
        }

        return $list;
    }
protected function prepareList(array $addresses, array $data)
    {
        $countries = $this->country->getList();

        $list = array();
        foreach ($addresses as $address_id => $address) {

            $list[$address_id] = $address;

            if (empty($data['status'])) {
                continue; // Do not check enabled country, state and city
            }

            if (empty($countries)) {
                continue; // No countries defined in the system
            }

            if ($address['country'] !== '' && $address['country_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            if (!empty($address['state_id']) && $address['state_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            // City ID can also be not numeric (user input)
            if (is_numeric($address['city_id']) && $address['city_status'] == 0) {
                unset($list[$address_id]);
            }
        }

        return $list;
    }
protected function prepareList ( array $ addresses , array $ data ) { $ countries = $ this -> country -> getList ( ) ; $ list = array ( ) ; foreach ( $ addresses as $ address_id => $ address ) { $ list [ $ address_id ] = $ address ; if ( empty ( $ data [ 'status' ] ) ) { continue ; // Do not check enabled country, state and city } if ( empty ( $ countries ) ) { continue ; // No countries defined in the system } if ( $ address [ 'country' ] !== '' && $ address [ 'country_status' ] == 0 ) { unset ( $ list [ $ address_id ] ) ; continue ; } if ( ! empty ( $ address [ 'state_id' ] ) && $ address [ 'state_status' ] == 0 ) { unset ( $ list [ $ address_id ] ) ; continue ; } // City ID can also be not numeric (user input) if ( is_numeric ( $ address [ 'city_id' ] ) && $ address [ 'city_status' ] == 0 ) { unset ( $ list [ $ address_id ] ) ; } } return $ list ; }
Returns an array of filtered addresses
@param array $addresses
@param array $data
@return array
Returns an array of filtered addresses