SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1
Topic Adding a new Variation Field Modifier 6069 Views

Adding a new Variation Field Modifier

10 December 2012 at 9:49pm

Just a quick question: how do I create an additional action for Variations, e.g., increasing the shipping weight for a product. As it stands you can affect the price, the rating, etc., but I can't seem to find a list of allowable Characteristic fields to modify.

Graeme

Re: Adding a new Variation Field Modifier

11 December 2012 at 7:28pm Last edited: 11 December 2012 7:28pm

Hi Graeme,

I asked Sascha about your question, since he developed the module.

He was not quite sure at the moment if it's not already possible. But even if not, it should be done with a few lines of code. Because of a deadline we could not look into it further.

Tomorrow the chances are better to find a few minutes to write a quick rundown.

Maybe we'll even extend the module to accomplish this, since we all agreed that this makes sense ;-)

Cheers
Ramon

Re: Adding a new Variation Field Modifier

12 December 2012 at 3:36pm

Hi Graeme,

sorry for the long reply time, lots of project work here :)

In the current version of the variant module it's not possible to add or remove fieldmodifier fields comfortably; there is a dirty way though.

The method "blackListFields()" in "silvercart_product_variants/code/base/SilvercartProductVariantFieldModifier.php" returns all blacklisted SilvercartProduct fields. The last entry of the returned array should be "Weight" - just remove that line and you'll be able to modify the weight with variants.

We'll add a better solution in the next version of the variants module (preferrably something static you can call via your project's _config.php).

All the best,
Sascha

Re: Adding a new Variation Field Modifier

13 December 2012 at 2:34am Last edited: 13 December 2012 2:35am

Hi Sascha,

Thanks for that, I will give it a try.

Graeme