Process the observer's business logic.

@return void
@see \TechDivision\Import\Product\UrlRewrite\Observers\UrlRewriteObserver::process()
341597
protected function process()
    {

        // process the new URL rewrites first
        parent::process();

        // load the root category
        $rootCategory = $this->getRootCategory();

        // create redirect URL rewrites for the existing URL rewrites
        foreach ($this->existingUrlRewrites as $existingUrlRewrite) {
            // if the URL rewrite has been created manually
            if ((integer) $existingUrlRewrite[MemberNames::IS_AUTOGENERATED] === 0) {
                // do NOTHING, because someone really WANTED to create THIS redirect
                continue;
            }

            // query whether or not 301 redirects have to be created, so don't create redirects
            // if the product is NOT visible or the rewrite history has been deactivated
            if ($this->isVisible() && $this->getSubject()->getCoreConfigData(CoreConfigDataKeys::CATALOG_SEO_SAVE_REWRITES_HISTORY, true)) {
                // if the URL rewrite already IS a redirect
                if ((integer) $existingUrlRewrite[MemberNames::REDIRECT_TYPE] !== 0) {
                    // do NOT create another redirect or update the actual one
                    continue;
                }

                // initialize the data with the URL rewrites new 301 configuration
                $attr = array(MemberNames::REDIRECT_TYPE => 301);

                // initialize the category with the root category
                $category = $rootCategory;

                // load the metadata from the existing URL rewrite
                $metadata = $this->getMetadata($existingUrlRewrite);

                // query whether or not the URL key of the existing URL rewrite has changed
                if (is_array($metadata) && isset($metadata[UrlRewriteObserver::CATEGORY_ID])) {
                    if (isset($this->urlRewrites[$metadata[UrlRewriteObserver::CATEGORY_ID]])) {
                        try {
                            // if yes, try to load the original category and OVERRIDE the default category
                            $category = $this->getCategory($metadata[UrlRewriteObserver::CATEGORY_ID], $this->getValue(ColumnKeys::STORE_VIEW_CODE));
                        } catch (\Exception $e) {
                            // if the old category can NOT be loaded, remove the
                            // category ID from the URL rewrites metadata
                            $attr[MemberNames::METADATA] = null;

                            // finally log a warning that the old category is not available ony more
                            $this->getSubject()
                                 ->getSystemLogger()
                                 ->warning(
                                     sprintf(
                                         'Category with ID "%d" is not longer available for URL rewrite with ID "%d"',
                                         $metadata[UrlRewriteObserver::CATEGORY_ID],
                                         $existingUrlRewrite[MemberNames::URL_REWRITE_ID]
                                     )
                                 );
                        }
                    }
                }

                // load target path/metadata for the actual category
                $targetPath = $this->prepareRequestPath($category);

                // skip update of URL rewrite, if resulting new target path EQUALS old request path
                if ($targetPath === $existingUrlRewrite[MemberNames::REQUEST_PATH]) {
                    // finally log a warning that the old category is not available ony more
                    $this->getSubject()
                         ->getSystemLogger()
                         ->warning(
                             sprintf(
                                 'New target path "%s" eqals request path for URL rewrite with ID "%d"',
                                 $existingUrlRewrite[MemberNames::REQUEST_PATH],
                                 $existingUrlRewrite[MemberNames::URL_REWRITE_ID]
                             )
                         );

                    // stop processing the URL rewrite
                    continue;
                }

                // set the target path
                $attr[MemberNames::TARGET_PATH] = $targetPath;

                // merge and return the prepared URL rewrite
                $existingUrlRewrite = $this->mergeEntity($existingUrlRewrite, $attr);

                // create the URL rewrite
                $this->persistUrlRewrite($existingUrlRewrite);
            } else {
                // query whether or not the URL rewrite has to be removed
                if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_URL_REWRITES) &&
                    $this->getSubject()->getConfiguration()->getParam(ConfigurationKeys::CLEAN_UP_URL_REWRITES)
                ) {
                    // delete the existing URL rewrite
                    $this->deleteUrlRewrite($existingUrlRewrite);

                    // log a message, that old URL rewrites have been cleaned-up
                    $this->getSubject()
                         ->getSystemLogger()
                         ->warning(
                             sprintf(
                                 'Cleaned-up %d URL rewrite "%s" for product with SKU "%s"',
                                 $existingUrlRewrite[MemberNames::REQUEST_PATH],
                                 $this->getValue(ColumnKeys::SKU)
                             )
                         );
                }
            }
        }
    }
103454
protected function process()
    {

        // query whether or not, we've found a new SKU => means we've found a new product
        if ($this->hasBeenProcessed($this->getValue(ColumnKeys::SKU))) {
            return;
        }

        // prepare the static entity values
        $product = $this->initializeProduct($this->prepareAttributes());

        // insert the entity and set the entity ID, SKU and attribute set
        $this->setLastRowId($this->persistProduct($product));
        $this->setLastEntityId($product[MemberNames::ENTITY_ID]);
    }
150908
public function process()
	{
		$view = $this->getView();

		try
		{
			parent::process();

			$basketCntl = Controller_Frontend_Factory::createController( $this->_getContext(), 'basket' );

			// Test if addresses are available
			$addresses = $basketCntl->get()->getAddresses();
			if( !isset( $view->standardStepActive ) && count( $addresses ) === 0 )
			{
				$view->standardStepActive = 'address';
				return false;
			}
		}
		catch( Exception $e )
		{
			$this->getView()->standardStepActive = 'address';
			throw $e;
		}

	}
897431
public function process()
    {
        parent::process();

        $flydown = $this->getCompositeWidget('action_flydown');
        $selected_id = $flydown->value;

        if (isset($this->action_items_by_id[$selected_id])) {
            $this->selected = $this->action_items_by_id[$selected_id];

            if ($this->selected->widget !== null) {
                $this->selected->widget->process();
            }
        } else {
            $this->selected = null;
        }
    }
140111
public function process()
	{
		// Get this request's data.
		$this->parseRequest();

		// Perform logic.
		$this->execute();

		// Parse the result of our business logic.
		$this->parseResult();

		// Build the Response utilizing status, type, body, etc.
		$this->buildResponse();

		// Build the broadcasted value.
		$this->buildBroadcast();

		// Broadcast the result to listeners.
		$this->push();

		// Finally, return the Response.
		return $this->respond();
	}
680941
protected function process()
    {

        // query whether or not, we've found a new SKU => means we've found a new product
        if ($this->isLastSku($sku = $this->getValue(ColumnKeys::SKU))) {
            return;
        }

        // FIRST delete the data related with the product with the passed SKU
        $this->deleteStockItem(array(ColumnKeys::SKU => $sku), SqlStatementKeys::DELETE_STOCK_ITEM_BY_SKU);
        $this->deleteProductWebsite(array(ColumnKeys::SKU => $sku), SqlStatementKeys::DELETE_PRODUCT_WEBSITE_BY_SKU);
        $this->deleteCategoryProduct(array(ColumnKeys::SKU => $sku), SqlStatementKeys::DELETE_CATEGORY_PRODUCT_BY_SKU);

        // delete the product with the passed SKU
        $this->deleteProduct(array(ColumnKeys::SKU => $sku));

        // flush the cache to remove the deleted product (which has previously been cached)
        $this->getProductBunchProcessor()->cleanUp();
    }
1010835
protected function process()
    {

        // clean-up the repositories etc. to free memory
        $this->getCustomerAddressBunchProcessor()->cleanUp();

        // temporary persist the last customer address entity ID
        $this->setLastEntityId($this->getValue(ColumnKeys::ENTITY_ID));
    }
1021006
protected function process()
    {

        // query whether or not, the image changed
        if ($this->isParentImage($this->getValue(ColumnKeys::IMAGE_PATH))) {
            return;
        }

        // try to load the product SKU and map it the entity ID
        $this->parentId = $this->getValue(ColumnKeys::IMAGE_PARENT_SKU, null, array($this, 'mapParentSku'));

        // reset the position counter for the product media gallery value
        $this->resetPositionCounter();

        // initialize and persist the product media gallery
        $productMediaGallery = $this->initializeProductMediaGallery($this->prepareProductMediaGalleryAttributes());
        $this->valueId = $this->persistProductMediaGallery($productMediaGallery);

        // persist the product media gallery to entity data
        if ($productMediaGalleryValueToEntity = $this->initializeProductMediaGalleryValueToEntity($this->prepareProductMediaGalleryValueToEntityAttributes())) {
            $this->persistProductMediaGalleryValueToEntity($productMediaGalleryValueToEntity);
        }

        // temporarily persist parent/value ID
        $this->setParentId($this->parentId);
        $this->setParentValueId($this->valueId);
    }
733548
public function process()
	{
		$view = $this->getView();
		$session = $this->_getContext()->getSession();

		if( ( $languageId = $view->param( 'loc-languageid' ) ) !== null ) {
			$session->set( 'arcavias/locale/languageid', $languageId );
		}

		if( ( $currencyId = $view->param( 'loc-currencyid' ) ) !== null ) {
			$session->set( 'arcavias/locale/currencyId', $currencyId );
		}

		parent::process();
	}
1095285
public function process()
	{
		$view = $this->getView();

		try
		{
			// only start if there's something to do
			if( ( $option = $view->param( 'cs-order', null ) ) === null
				|| $view->get( 'standardStepActive' ) !== null
			) {
				return;
			}

			$context = $this->_getContext();
			$orderBaseManager = MShop_Factory::createManager( $context, 'order/base' );

			$basket = $orderBaseManager->getSession();
			$basket->setCustomerId( $context->getUserId() );
			$basket->finish();

			$cntl = Controller_Frontend_Factory::createController( $context, 'order' );
			$orderItem = $cntl->store( $basket );
			$cntl->block( $orderItem );

			$context->getSession()->set( 'arcavias/orderid', $orderItem->getId() );

			$view->orderItem = $orderItem;
			$view->orderBasket = $basket;

			parent::process();

			// save again after sub-clients modified it's state
			MShop_Factory::createManager( $context, 'order' )->saveItem( $orderItem );
		}
		catch( Exception $e )
		{
			$view->standardStepActive = 'order';
			throw $e;
		}
	}
751001
protected function process()
    {

        // query whether or not the media gallery has to be cleaned up
        if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_MEDIA_GALLERY) &&
            $this->getSubject()->getConfiguration()->getParam(ConfigurationKeys::CLEAN_UP_MEDIA_GALLERY)
        ) {
            // initialize the array for the actual images
            $actualImageNames = array();

            // iterate over the available image fields
            foreach (array_keys($this->getImageTypes()) as $imageColumnName) {
                if ($this->hasValue($imageColumnName) && !in_array($imageName = $this->getValue($imageColumnName), $actualImageNames)) {
                    $actualImageNames[] = $imageName;
                }
            }

            // query whether or not, we've additional images
            if ($additionalImages = $this->getValue(ColumnKeys::ADDITIONAL_IMAGES, null, array($this, 'explode'))) {
                foreach ($additionalImages as $additionalImageName) {
                    // do nothing if the image has already been added, e. g. it is the base image
                    if (in_array($additionalImageName, $actualImageNames)) {
                        continue;
                    }

                    // else, add the image to the array
                    $actualImageNames[] = $additionalImageName;
                }
            }

            // load the existing media gallery entities for the produdct with the given SKU
            $existingProductMediaGalleries = $this->getProductMediaProcessor()
                                                  ->getProductMediaGalleriesBySku($sku = $this->getValue(ColumnKeys::SKU));

            // remove the images that are NOT longer available in the CSV file
            foreach ($existingProductMediaGalleries as $existingProductMediaGallery) {
                // do nothing if the file still exists
                if (in_array($existingImageName = $existingProductMediaGallery[MemberNames::VALUE], $actualImageNames)) {
                    continue;
                }

                try {
                    // remove the old image from the database
                    $this->getProductMediaProcessor()
                         ->deleteProductMediaGallery(array(MemberNames::VALUE_ID => $existingProductMediaGallery[MemberNames::VALUE_ID]));

                    // log a debug message that the image has been removed
                    $this->getSubject()
                         ->getSystemLogger()
                         ->warning(
                             $this->getSubject()->appendExceptionSuffix(
                                 sprintf(
                                     'Successfully removed image "%s" from media gallery for product with SKU "%s"',
                                     $existingImageName,
                                     $sku
                                 )
                             )
                         );
                } catch (\Exception $e) {
                    // log a warning if debug mode has been enabled and the file is NOT available
                    if ($this->getSubject()->isDebugMode()) {
                        $this->getSubject()
                             ->getSystemLogger()
                             ->warning($this->getSubject()->appendExceptionSuffix($e->getMessage()));
                    } else {
                        throw $e;
                    }
                }
            }

            // log a message that the images has been cleaned-up
            $this->getSubject()
                 ->getSystemLogger()
                 ->debug(
                     $this->getSubject()->appendExceptionSuffix(
                         sprintf(
                             'Successfully cleaned-up media gallery for product with SKU "%s"',
                             $sku
                         )
                     )
                 );
        }
    }
1169870
protected function process()
    {

        // initialize the array for the artefacts
        $this->artefacts = array();

        // process the images/additional images
        $this->processImages();
        $this->processAdditionalImages();

        // append the artefacts that has to be exported to the subject
        $this->addArtefacts($this->artefacts);
    }
370517
protected function process()
    {

        // query whether or not, we've found a new path => means we've found a new category
        if ($this->hasBeenProcessed($path = $this->getValue(ColumnKeys::PATH))) {
            return;
        }

        // process the parent instance
        parent::process();

        // remove the path => row ID mapping from the subject
        $this->removePathRowIdMapping($path);
    }
196097
public function process()
    {
        $this->getVisitor();
        $this->saveVisitor();

        if (!$this->visitor->hasUserId() && !Yii::$app->user->isGuest) {
            $this->visitor->setUserId(Yii::$app->user->identity->getId());
        }

        if ($this->detectFirstVisitSource) {

        }

        if ($this->detectAllVisitsSources) {

        }

        if ($this->storeLastActivity) {
            $this->visitor->save();
        }

        if ($this->storeVisitedPages) {

        }
    }
1234482
public function process()
    {
        switch ($this->inputs['action']) {
            case 'login':
                $this->webLogin();
                break;
            case 'logout':
                $this->webLogout();
                exit($this->showWebLoginForm());
                break;
            case 'getContacts':
                $this->getContacts();
                break;
            case 'updateStatus':
                $this->updateStatus();
                break;
            case 'sendMessage':
                $this->sendMessage();
                break;
            case 'sendBroadcast':
                $this->sendBroadcast();
                break;
            default:
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
                    exit($this->showWebForm());
                }
                exit($this->showWebLoginForm());
                break;
        }
    }
684118
protected function process()
    {

        // load the entity ID
        ;

        // query whether or not, we've found a new entity ID => means we've found a new customer address
        if ($this->isLastEntityId($entityId = $this->getValue(ColumnKeys::ENTITY_ID))) {
            return;
        }

        // delete the customer address with the passed entity ID
        $this->deleteCustomerAddress(array(MemberNames::ENTITY_ID => $entityId));

        // flush the cache to remove the deleted customer address (which has previously been cached)
        $this->getCustomerAddressBunchProcessor()->cleanUp();
    }
778085
protected function _process()
    {
        $name = $this->config('field');
        $this->value = $this->_registry->data($name);
        $this->_processed = true;
    }