Russ Warren
Russ Warren

Reputation: 113

How can I change the execute order for Magmi plugins?

I'm working on importing (on a regular basis) about 6,000 items into Magento using Magmi. I've got nearly everything configured the way I need it, but I have one issue.

I need to concatenate 3 columns from my .csv file to create a "category_ids" column. I'm using the Value Replacer plugin with the following value:

{item.departmentid},{item.classid},{item.subclassid}

This works well, however I need to then map this field to another field using the Generic Mapper plugin. Both functions work individually, however I need the Value Replacer to run BEFORE the Generic Mapper. As best as I can tell, it appears the Generic Mapper runs first. Is there a way I can alter the execute order for these two plugins?

Thanks for the help!

Update for Dweeves:

Doh! I totally overlooked that section while trying to figure this out. Now that I've gone through it, I might need a little more help. Right now I've using just the Value Replacer plugin with the following settings:

Replaced attributes: category_ids

New value for category_ids:

{{ ValueRemapper::use_csv('/var/www/magmi/category_ids.csv')->map({item.departmentid},{item.classid},{item.subclassid}) }}

It doesn't seem to be working as I intended it to, but I'm a systems guy and not a PHP programmer. Any help?

2nd Edit I got it working by using the Value Replacer function to first concatenate everything into a new "test" column, then using the Value Replacer Value Mapper function to create the category_ids column with the mapped values. Confusing, but it's working well.

Upvotes: 1

Views: 576

Answers (2)

dweeves
dweeves

Reputation: 5615

You can use the ValueRemapper helper of Value Replacer plugin for this kind of purpose.

See Value Replacer Plugin Documentation (ValueRemapper helper section)

Upvotes: 1

Axel
Axel

Reputation: 10772

To answer your original question (how to define the order the plugins run in).

From my experience, the plugins are loaded in order of their plugin filename.

For example, if you look at magmi/plugins/base/itemprocessors/importlimiter, you will notice that the filename for the plugin is 01_importlimiter.php.

If you look in the genericmapper plugin folder, you'll notice the plugin filename to be 02_genericmapper.php.

With this being said, 01_importlimiter.php will execute before 02_genericmapper.php.

Upvotes: 0

Related Questions