jgudo/ecommerce-react

Size and color select option

rajeev-ops opened this issue · 3 comments

Can anyone help me to add a size or colour select option in product modal

jgudo commented

@rajeev-ops You need to add a new field to every single document on your firestore collection.
To my knowledge, you can't yet do this in your firebase console directly but you can try to execute this in your app. You need to remove this once you have successfully run it.

(async function () {
	const col = await firebase.db.collection('products').get();
	col.forEach((doc) => {
		doc.ref.update({
                        // add new field of your likeness and set default value
			frameSize: {
				eye: 50,
				bridge: 20,
				temple: 142,
				height: 36
			},
			availableColors: ['#000000', '#c500c5', '#840309', '#004d84', '#753600']
		});
	})
})() 

Now you all you have to do is to update the products view page to consume these new fields. And on the admin, you need to add a new color input field to control these new field.

jgudo commented

Please see the latest commit b15e4db
Check the changes and additions for this.

Thankyou so much sir