If I understand your question you want to insert a product into the products table and then, depending on whether it is an accessory or a smart device, also insert into the relevant secondary table.
So your secondary, subclass tables will have a productId column that matches the productId in the products table.
Insert a product into the products table and return the inserted productId. Use that id to do the insert into the secondary table. You now have a link between the two.
You can also add a foreign key constraint from accessories/smart devices to products with on delete cascade to keep your table integrity intact.
is that any help?