HABTM complex table join

Hi! Maybe (very probably) for many here is not so complex … but I’m beating myself a few days on this issue.
I have a table products in mysql where it is HABTM the table colors, which in turn also has the table numbering (sizes), and table photos related to that product. The problem is that the color of each shoe will define which numbers are available in that color as well as load the respective photos of that color. Even difficult to explain. Let me give you an example.

Boot Firenze in brown color has size 36, 37 and 38.
The same boot Firenze only that in black color has size 40, 41 and 42.

And each one has to have their respective photos.

I have two doubts:

1 - How to properly model these tables? I made the table products be HABTM colors which in turn is HABTM numbering and the color is HasMany pictures but I do not know if it’s right.
2 - And I’m very difficult in this table format to join them in hr to register, because HABTM is right, but how to associate the color with the numbering in the same product register?

Can someone help me? I’m using Cakephp 2.x if it helps in something. Thank you so much guys