protected function saveDefaultAddressByType($type)
    {

        // load email and website ID
        $email     = $this->getValue(ColumnKeys::EMAIL);
        $websiteId = $this->getSubject()->getStoreWebsiteIdByCode($this->getValue(ColumnKeys::WEBSITE));

        // try to load the customer with the given email + website ID
        if ($customer = $this->getCustomerBunchProcessor()->loadCustomerByEmailAndWebsiteId($email, $websiteId)) {
            // initialize an empty address ID
            $addressId = null;

            // query whether or not we've a default shipping/billing address
            if ((integer) $this->getValue($type) === 1) {
                $addressId = $this->getSubject()->getLastEntityId();
            }

            // finally update the customer
            $this->getCustomerBunchProcessor()->persistCustomer(
                $this->mergeEntity(
                    $customer,
                    array(
                        $this->mapColumName($type) => $addressId,
                        MemberNames::UPDATED_AT    => $this->formatDate(date('Y-m-d H:i:s'))
                    )
                )
            );
        }
    }
protected function saveDefaultAddressByType($type)
    {

        // load email and website ID
        $email     = $this->getValue(ColumnKeys::EMAIL);
        $websiteId = $this->getSubject()->getStoreWebsiteIdByCode($this->getValue(ColumnKeys::WEBSITE));

        // try to load the customer with the given email + website ID
        if ($customer = $this->getCustomerBunchProcessor()->loadCustomerByEmailAndWebsiteId($email, $websiteId)) {
            // initialize an empty address ID
            $addressId = null;

            // query whether or not we've a default shipping/billing address
            if ((integer) $this->getValue($type) === 1) {
                $addressId = $this->getSubject()->getLastEntityId();
            }

            // finally update the customer
            $this->getCustomerBunchProcessor()->persistCustomer(
                $this->mergeEntity(
                    $customer,
                    array(
                        $this->mapColumName($type) => $addressId,
                        MemberNames::UPDATED_AT    => $this->formatDate(date('Y-m-d H:i:s'))
                    )
                )
            );
        }
    }
protected function saveDefaultAddressByType ( $ type ) { // load email and website ID $ email = $ this -> getValue ( ColumnKeys :: EMAIL ) ; $ websiteId = $ this -> getSubject ( ) -> getStoreWebsiteIdByCode ( $ this -> getValue ( ColumnKeys :: WEBSITE ) ) ; // try to load the customer with the given email + website ID if ( $ customer = $ this -> getCustomerBunchProcessor ( ) -> loadCustomerByEmailAndWebsiteId ( $ email , $ websiteId ) ) { // initialize an empty address ID $ addressId = null ; // query whether or not we've a default shipping/billing address if ( ( integer ) $ this -> getValue ( $ type ) === 1 ) { $ addressId = $ this -> getSubject ( ) -> getLastEntityId ( ) ; } // finally update the customer $ this -> getCustomerBunchProcessor ( ) -> persistCustomer ( $ this -> mergeEntity ( $ customer , array ( $ this -> mapColumName ( $ type ) => $ addressId , MemberNames :: UPDATED_AT => $ this -> formatDate ( date ( 'Y-m-d H:i:s' ) ) ) ) ) ; } }
Save default address by type.

@param string $type The address type to save

@return void
Save default address by type .