Table of Contents

uRapidFlow Customization

Events

A general way to add observers to the events is:

  1. Declare an observer in your custom module configuration, app/etc/local.xml or app/etc/modules/* (any new file)

An example: app/etc/modules/MyCustom_Module.xml

MyCustom_Module.xml
<?xml version="1.0"?>
<config>
  <global>
    <events>
      <urapidflow_product_import_after_fetch>
        <observers>
          <mycustommodule>
            <type>singleton</type>
            <class>MyCustom_Module_Model_Observer</class>
            <method>urapidflow_product_import_after_fetch</method>
          </mycustommodule>
        </observers>
      </urapidflow_product_import_after_fetch>
    </events>
  </global>
</config>

app/code/local/MyCustom/Module/Model/Observer.php

Observer.php
<?php
 
class MyCustom_Module_Model_Observer
{
    public function urapidflow_product_import_after_fetch($observer)
    {
        $vars = $observer->getEvent()->getVars();
        $oldData = $vars['old_data'];
 
        // custom logic here
    }
}

Product Import Events

There are 5 stages during product import process where a custom logic can be plugged in as an event observer:

The events are fired for each page of data (by default 100 rows), and each stage has more vars available than previous, and including all vars that were available before.

urapidflow_product_import_after_fetch

Vars
Example

This example observer will change weight values of ā€œ2kgā€ and ā€œ470gā€ into correct decimal weight value.

app/code/local/MyCustom/Module/Model/Observer.php

Observer.php
<?php
 
class MyCustom_Module_Model_Observer
{
    public function urapidflow_product_import_after_fetch($observer)
    {
        $vars = $observer->getEvent()->getVars();
        foreach ($vars['new_data'] as &$row) {
            if (strpos($row['weight'], 'kg')!==false) {
                $row['weight'] = intval($row['weight']);
            } elseif (strpos($row['weight'], 'g')!==false) {
                $row['weight'] = intval($row['weight'])/1000;
            }
        }
        unset($row);
    }
}

urapidflow_product_import_after_validate

Vars

urapidflow_product_import_after_diff

Vars

Product Export Events

There are 2 stages during product import process where a custom logic can be plugged in as an event observer:

The events are fired for each page of data (by default 100 rows), and each stage has more vars available than previous, and including all vars that were available before.

urapidflow_catalog_product_export_before_format

Vars

urapidflow_catalog_product_export_before_output

Vars