2

we have a multi brand shop with 60K+ of products.

Every brand has it's own way of dimensions. Which results in an attribute list of 500+ entries. Attribute: POS-size

Here is a screenshot of this: enter image description here

But this list is to big to use for a filter on front-end. Thats why we have added an extra attribute for this. To simplify all these sizes. This attribute is: size-frontend

Here is a screenshot: enter image description here

After I have made new products (added via a POS system) I have to manually update the simple product with the size-frontend attribute.

Some examples: Pos-size -> size-frontend 50 -> 50 50/56 -> 50 & 56 56 -> 56 56/62 -> 56 & 62 56-62 -> 56 & 62

This costs a lot of time, and I think think this could be done automatically (through a script or an extension) after making some kind of conversion table. And it should also be able to give an starting product-id, from where it should start.

Does anyone know how to do this? Or know an extension which can do this?

It should be done in the backend, in a special screen like this: enter image description here

Now i have to filter the products on the pos-size, than update these products in bulk to the desired filterable attribute size(s)

It would be nice if i could run this by selecting the desired products and apply this action. WHich could be placed in the actions menu with the products

9
  • I am happy to implement your script.. but after reading the above, that does look cryptic. Hopefully understanding the spec is harder than writing the code.. Are you able to write more info specifically on the process you use to update the simple product? Jun 22, 2020 at 17:37
  • Hi Ronny, would you be able to spread out the 2 lines: Some examples: Pos-size -> size-frontend 50 -> 50 50/56 -> 50 & 56 56 -> 56 56/62 -> 56 & 62 56-62 -> 56 & 62 into something that has more details? Jun 23, 2020 at 15:02
  • i updated the question a little bit. hopefully its more clear now
    – Ronny
    Jun 23, 2020 at 16:32
  • looks like I am even more lost. It is almost as it needs a video to see what you do so that we can realise what is it that is repetitive and can therefore be scripted. But not too worries, no need to put down a video. Jun 24, 2020 at 7:39
  • The extension needs connect the attributes…It would be a big “if > then” updating.Like: IF pos_maat = 50 THEN kledingmaat_zichtbaar = 50 IF pos_maat = 50/56 THEN kledingmaat_zichtbaar = 50 & 56
    – Ronny
    Jun 26, 2020 at 7:50

2 Answers 2

2

This sounds like its fairly easily solvable with a custom module, I don't think there is anything available off the shelf that will relate one set of attributes to another set.

What you could do is build a module that triggers off a product being saved and then updates the customer facing sizes based on a relationship table (maybe written in a csv to make it updatable or an admin grid ui).

That way when a product is saved those frontend sizes are (re)populated with the correct values. For simplicity you could even hardcode those relationships but it makes updating them require dev time.

It's definitely not a 5 min job but not that bad. Custom module with a plugin to trigger on the product before the save function, match the POS sizes to the related frontend sizes, apply them to the product attribute and then allow the product to save as normal.

1
+50

I have updated one of my free modules to cater for your use case. The script has 3 parameters and the first 2 parameter are the attributes to sync.

The script fetches all the products for which theirs values for both attributes differ. In your case, although your catalog is big, the query may return at a time 500 products and at the very most 5k I'd imagine.

But if you have concerns with speed, you can run the scripts by chunks:

For instance, running the below 10 times will go through 100k products in no time php bin/magento mbs:attributes:sync pos_maat kledingmaat_zichtbaar 1000

The module is public and is available at: https://bitbucket.org/magstaging/productattributeupdate/src/master/

Sometimes, I forget to make them public but this one was used once so I believe it is already checked and is indeed public.

Please do backup your database before using the module.

I suggest to run the script on 1 or 2 products first and verify it works for you.. then only roll it out on the full catalog.

I could add an improvement whereby going forward aplugin like the answer below could kick in for every products being changed. But given the script is now optmised, it should be quite easily to just rely on a cron that you may want to setup.

13
  • i will try this this weekend.
    – Ronny
    Jun 26, 2020 at 16:02
  • thanks, will carry on too this weekend. If the script is cumbsersome to run, we have the solution to paginate it and then fallback on using a plugin for further changes in the product catalog Jun 26, 2020 at 16:08
  • I have updated the plugin tonight and also update the answer, you should be now with a shiny plugin that should resolve your issue Jun 26, 2020 at 18:50
  • I have not tested it yet. How and where can i make the relations?
    – Ronny
    Jun 27, 2020 at 9:26
  • The value from the original attribute is replicated to the target attribute. I suggest to test whether the values can be replicated across the full catalog or whether there are queries issues. Then I have missed the translation (indeed your last explanation was much simpler.. so that does explain why I found it doable all of a sudden) Jun 27, 2020 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.