I found few solutions, but obviously none of them were working, so had to find it out by myself. So where to start – lets suppose we have our $post_id somewhere (I’m pretty sure there are lot of tutorials how to get post from database), so in first step we need to modify some base product settings:

So what happens here? In first line we are changing our product type to variants (you can do it also in product edit page in woocommerce), next line adds all possible colors we need (this can be any attribute like size, model or everything you want), $availableColors is just plain php array. Next step is:

Code above adds our color attribute to base product also with all possible values. Which is important here – is_visible should be set to 0 and is_variation should be set to 1. Then:

The last part is to insert or update your variation for each defined color. The variable $post_name can be anything you want, just should be same schema for all variants as we are using it to check if such variant already exists and should be only updated, or not exists and should be created. But you can use also SKU or GUID for this.

Maybe someone will find it usefull:

 

It is a bit different then method showed in previous post – this time its not transactional email sent at demand, but we will catch event fired after invoice is generated. So (I suppose you have your module already) in etc/config.xml add:

Then create your class at app/code/local/YourVendor/YourModule/Model/Observer.php (or use existing one) and add new method:

And invoice will be attached to email defined at:

Zrzut ekranu 2015-01-14 o 19.12.17

Seems to be complex, but its not that bad:

About $vars variable – in this one you can put everything which is set inside email template as variables.

If you are using MAMP and trying to execute doctrine:schema:create or anything db related you may encounter that error, solution is simple – you need to create symlink to mysql.sock:

Its not that bad, all you have to do is get Stock Object, update quantity and save again along with product:

 

Probably you are using git. And probably a day when you will add another repo is close. But standard git behavior is to use key located at ~/.ssh/id_rsa. And you just generated ~/.ssh/mynewkey and want to using for your gitserver.com host. So what to do? Just edit your ~/.ssh/config (if you don’t have it yes, create empty) and put:

And this is it, git clone should use mynewkey instead of id_rsa

The quick and dirty way is:

but of course you can use also:

You need to wait for the callback to ensure that the buffer is written to disk. It’s not buffered.

All data must be stored at the same time; you cannot perform sequential writes.

Creates a WriteStream, which is convenient because you don’t need to wait for a callback. But again, it’s not buffered.