This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
urapidflow:v3:customization [2016/11/01 20:23] jamby77 created |
urapidflow:v3:customization [2017/05/19 19:08] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== uRapidFlow Customization ====== | ||
| + | ===== Events ===== | ||
| + | |||
| + | A general way to add observers to the events is: | ||
| + | |||
| + | - Declare an observer in your custom module configuration, | ||
| + | An example: | ||
| + | '' | ||
| + | <file xml MyCustom_Module.xml> | ||
| + | <?xml version=" | ||
| + | <config xmlns: | ||
| + | <event name=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | <file php Observer.php> | ||
| + | <?php | ||
| + | |||
| + | namespace Acme\Module\Observer; | ||
| + | |||
| + | use Magento\Framework\Event\ObserverInterface; | ||
| + | |||
| + | class ProductUrlUpdateObserver implements ObserverInterface | ||
| + | { | ||
| + | /** | ||
| + | * @var \Unirgy\RapidFlow\Helper\Url | ||
| + | */ | ||
| + | protected $helper; | ||
| + | |||
| + | /** | ||
| + | * CategoryUrlUpdateObserver constructor. | ||
| + | * @param \Unirgy\RapidFlow\Helper\Url $helper | ||
| + | */ | ||
| + | public function __construct(\Unirgy\RapidFlow\Helper\Url $helper) | ||
| + | { | ||
| + | $this-> | ||
| + | } | ||
| + | |||
| + | public function execute(\Magento\Framework\Event\Observer $observer) | ||
| + | { | ||
| + | /** @var \Unirgy\RapidFlow\Model\Profile $profile */ | ||
| + | $profile = $observer-> | ||
| + | try { | ||
| + | $this-> | ||
| + | } catch (\Magento\Framework\Exception\AlreadyExistsException $e) { | ||
| + | $profile-> | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | ==== 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 " | ||
| + | |||
| + | '' | ||
| + | <file php WeightUpdateObserver.php > | ||
| + | <?php | ||
| + | |||
| + | class WeightUpdateObserver implements ObserverInterface | ||
| + | { | ||
| + | public function execute(Observer $observer) | ||
| + | { | ||
| + | $vars = $observer-> | ||
| + | foreach ($vars[' | ||
| + | if (strpos($row[' | ||
| + | $row[' | ||
| + | } elseif (strpos($row[' | ||
| + | $row[' | ||
| + | } | ||
| + | } | ||
| + | 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 == | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||