New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video-50-Create-Seller-Page #52
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div className="price">${product.price}</div> | ||
<div> | ||
<Link to={`/seller/${product.seller._id}`}> | ||
{product.seller.seller.name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me only works if I use {product.seller.name}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also happened to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well actually name will not display with {product.seller.name}, but original code wont run neither
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any idea how to solve it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are stuck in this part maybe you need to delete mongodb database and recreate it, that solved my problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anvoluther @Royal6969 I have the same error: "TypeError: Cannot read property '_id' of undefined". I tried following what you said but I do not understand. Can you please explain what changes I needed to make exactly in productModel.js and orderModel.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi gannau, in product model and order model - seller is added with below line:
seller: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
It's hard to tell what went wrong on your part since I don't have your codes but this error started showing up with the change to multi-vendor but if you assigned each of the product with a seller id which in this case is Admin, there shouldn't be a problem. The other option is to delete old products and create a new one either in frontend or with /seed in backend but make sure to update the seller name and it doesn't have to be just admin this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gannau
you have to delete all your products and create again IN THE PAGE throw admin view and seller view for example
use delete and create product button that you had done before
In my case, one day, doing this lesson,
I found my users deleted and had to create it with login screen and admin view for privileges (seller or admin) and I checked the data in Moongose too
After that, I delete and create again all product
For the admin, his product first
and for sellers their products too
for separate
both are new user , remember??
And later with the Basir's code, all began to work perfectly
PD: In some cases, ObjectId in MongoDB gave me issues and it got me crazy but with moongose view (compass) is easy manage the data but it's mmmmm ...
Also, check your ObjectId in sellers!!
you have to be same ObjectId for group of product in common
Also if you experiment the same issue you are showing me in past email,
but instead with ._id , you have the same issue with name
it mean that you would had previously filled the fields for each seller in their seller views in the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gannau
you have to delete all your products and create again IN THE PAGE throw admin view and seller view for example
use delete and create product button that you had done beforeIn my case, one day, doing this lesson,
I found my users deleted and had to create it with login screen and admin view for privileges (seller or admin) and I checked the data in Moongose tooAfter that, I delete and create again all product
For the admin, his product first
and for sellers their products too
for separate
both are new user , remember??And later with the Basir's code, all began to work perfectly
PD: In some cases, ObjectId in MongoDB gave me issues and it got me crazy but with moongose view (compass) is easy manage the data but it's mmmmm ...
Also, check your ObjectId in sellers!!
you have to be same ObjectId for group of product in common
Also if you experiment the same issue you are showing me in past email,
but instead with ._id , you have the same issue with name
it mean that you would had previously filled the fields for each seller in their seller views in the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that at models the ObjectId was written like this: ObjectID... and it should be ObjectId. When I changed that, it worked perfect :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont delete the entire database..just delete the new product you created from database.. you can delete that specific product from np sqlbooster...or you code go to localhost3000/profile and create a seller name..that is the issue all u have to do is delete the new product u created..and go to profile and add the seller name..it worked for me
<div className="price">${product.price}</div> | ||
<div> | ||
<Link to={`/seller/${product.seller._id}`}> | ||
{product.seller.seller.name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how make make the database
<div className="price">${product.price}</div> | ||
<div> | ||
<Link to={`/seller/${product.seller._id}`}> | ||
{product.seller.seller.name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make like the normal way
|
Thank you Jomin I appreciate your prompt response but I already deleted everything from mongodb atlas :( I just wonder why my website would crash if you don't assign a seller to all products. To my recall, Basir only assigned one product with a seller id and the website seems to be working still. Did you manage to finish the end of this course? |
Yea..but some modules didnot respond quite well due to node js version..otherwise all went well |
No description provided.