Skip to content
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

Feature Implement #1

Closed
AstroProjection opened this issue Apr 28, 2021 · 109 comments
Closed

Feature Implement #1

AstroProjection opened this issue Apr 28, 2021 · 109 comments

Comments

@AstroProjection
Copy link
Contributor

Fixing the issue of Delete Product Review as discussed on bradtraversy/proshop_mern#141

Please update your 'master' branch to your latest changes and push it to origin

@talmax1124
Copy link
Collaborator

I don't see the PR

@AstroProjection
Copy link
Contributor Author

Will do it, but I wanted to latest version of your main branch so that I can work off of that

@talmax1124
Copy link
Collaborator

talmax1124 commented Apr 28, 2021

Ok, just commited my latest changes

@AstroProjection
Copy link
Contributor Author

I don't have access to push to your repository

@talmax1124
Copy link
Collaborator

Let me do that then

@talmax1124
Copy link
Collaborator

Try now

@AstroProjection
Copy link
Contributor Author

#2

Verify and let me know.

@talmax1124
Copy link
Collaborator

talmax1124 commented Apr 28, 2021

It does nothing: [0] DELETE /api/products/6089626dcc7322a7134fa879/reviews 201 323.964 ms - 28

Once I click, the error does not show, but it does not delete. The thing above is the response from the terminal in VSCODE

@AstroProjection

@talmax1124
Copy link
Collaborator

Screen Shot 2021-04-28 at 10 21 37 AM

@AstroProjection
Copy link
Contributor Author

Could you send a pic of the payload that's being sent on the delete request as well as the headers which are being sent

@talmax1124
Copy link
Collaborator

Screen Shot 2021-04-28 at 10 33 21 AM

Screen Shot 2021-04-28 at 10 33 40 AM

Screen Shot 2021-04-28 at 10 33 59 AM

![Uploading Screen Shot 2021-04-28 at 10.34.12 AM.png…]()

@AstroProjection
Copy link
Contributor Author

Could you you send an screenshot of the payload, it should be the review data that we're sending from the frontend to the back

@talmax1124
Copy link
Collaborator

Where do I find the payload?

@talmax1124
Copy link
Collaborator

Screen.Recording.2021-04-28.at.11.25.41.AM.mov

@talmax1124
Copy link
Collaborator

talmax1124 commented Apr 28, 2021

Does this help? @AstroProjection
Do you think we will have time to complete it today?

@talmax1124
Copy link
Collaborator

@AstroProjection Once we finish this, the next thing I want to integrate is Options. I created a issue about this in the proshop repo as well

@AstroProjection
Copy link
Contributor Author

#3 - this PR should resolve the issues

@talmax1124
Copy link
Collaborator

Yes it is working now

@talmax1124
Copy link
Collaborator

Ok, I implemented coupons. I think this may be a stupid fix, but when I do multiplication by 0.3 which is supposed to be 30% gives me a bunch of numbers after it. You know for example 3.2993448 when I have .toFixed(2). Any fixes you can think of?

@talmax1124
Copy link
Collaborator

talmax1124 commented Apr 29, 2021

You want me to explain where and what I did?

@AstroProjection
Copy link
Contributor Author

I'm not sure I understand the question, the float.toFixed(2) isn't working?

@talmax1124
Copy link
Collaborator

Exactly. Ok, so I am using the files cartAction:
export const addCoupon = (coupon) => (dispatch) => {
let couponDiscount = 0;

// TODO: Get couponDiscount value from db

if (coupon.toLowerCase() === "familydiscount") {
couponDiscount = 3;
}

if (coupon.toLowerCase() === "militarydiscount") {
couponDiscount = 2;
}

if (coupon.toLowerCase() === "sacoleiraspecialty") {
couponDiscount = 4;
}

dispatch({
type: CART_ADD_COUPON,
payload: { coupon, couponDiscount },
});

localStorage.setItem("coupon", JSON.stringify(coupon));
localStorage.setItem("couponDiscount", JSON.stringify(couponDiscount));
};

I added a coupon constant in the cart constant: export const CART_ADD_COUPON = "CART_ADD_COUPON";

Added to reducer:
case CART_ADD_COUPON:
return {
...state,
coupon: action.payload.coupon,
couponDiscount: action.payload.couponDiscount,
};

and in placeorderscreen is:

if (cart.couponDiscount) {
cart.totalPrice *= Number(cart.couponDiscount).toFixed(2);
}

@talmax1124
Copy link
Collaborator

The major component is in placeorderscreen. So I have the product price for example $7. Then the fee which is like $3.30. Then I get the value from the action and multiply by the cart total. When I add .toFixed(2) or even without toFixes(2) it does nothing. Doesn't constrain to two variables

@AstroProjection
Copy link
Contributor Author

Add toFixed to the final cart.totalPrice

@talmax1124
Copy link
Collaborator

talmax1124 commented Apr 29, 2021

I did this:
if (cart.couponDiscount) {
cart.totalPrice.toFixed(2) *= Number(cart.couponDiscount).toFixed(2);
}
and in terminal got: SyntaxError: /Users/carlitos/shop/frontend/src/screens/PlaceOrderScreen.js: Invalid left-hand side in assignment expression (75:4)

@talmax1124
Copy link
Collaborator

I don't understand why this is doing it because everything is using .toFixed(2) in terms of the totalPrice and all that

@AstroProjection
Copy link
Contributor Author

if (cart.couponDiscount) {
cart.totalPrice *= Number(cart.couponDiscount).toFixed(2);
cart.totalPrice = cart.totalPrice.toFixed(2);
}

You are multiplying the previous totalPrice with a new float value which will make it behave like that again

@talmax1124
Copy link
Collaborator

Yay, it is working! Thanks. You have been so helpful

@talmax1124
Copy link
Collaborator

I hate to keep bothering you but can we work on a vscode live share session. I started this feature but I was having multiple inputs and it was not passing to cartScreen. It's options

@talmax1124
Copy link
Collaborator

I really appreciate everything you have done for me. I have been trying to get help from other people and all I gotten is I can't help you or I'm busy. So I appreciate you for helping me. It means alot. I know words may not mean a-lot, I would pay you if I had money. Honestly. As a 16 year old, I got into programming last year, and it has been a journey. A great one.

@talmax1124
Copy link
Collaborator

Hey @AstroProjection I tried doing the tutorial and refining it a bit, and I can't get it to work. Can you check my latest code commit. Thnaks.

@talmax1124 talmax1124 reopened this Jun 9, 2021
@AstroProjection
Copy link
Contributor Author

You haven't pushed anything up

@talmax1124
Copy link
Collaborator

talmax1124 commented Jun 9, 2021 via email

@talmax1124
Copy link
Collaborator

I forgot. I did it on another repo of mine: https://github.com/talmax1124/cdshop @AstroProjection

@AstroProjection
Copy link
Contributor Author

Last changes were a month ago?

@talmax1124
Copy link
Collaborator

@talmax1124
Copy link
Collaborator

This is the actual one, the one I last sent. Sorry. @AstroProjection

@AstroProjection
Copy link
Contributor Author

Can't seem to access the page

@talmax1124
Copy link
Collaborator

Look at my profile talmax1124 and look for repo: creativeduoshopping-master

@talmax1124
Copy link
Collaborator

talmax1124 commented Jun 10, 2021

Or try checking the link again @AstroProjection

@talmax1124
Copy link
Collaborator

I got it working! @AstroProjection . This may sound stupid but I almost had paypal for the place-order screen instead of the order screen. Is there a way you can help me changing it? Thanks and have a great day or evening!

@talmax1124
Copy link
Collaborator

i've tried it again right now and something is not right. Can you help me in this? @AstroProjection

@talmax1124
Copy link
Collaborator

Nevermind got it working too! i just need help implementing stripe like this https://github.com/stripe-samples/checkout-one-time-payments or https://checkout.stripe.dev/preview @AstroProjection

@AstroProjection
Copy link
Contributor Author

Awesome! see as you keep solving these issues it all starts to fall into place a little better :)

@AstroProjection
Copy link
Contributor Author

i'll look into the stripe implementation and see if I can help you out with it

@talmax1124
Copy link
Collaborator

Ok. Thanks Alot @AstroProjection !

@talmax1124
Copy link
Collaborator

Do you know by when you can have it ready? @AstroProjection

@talmax1124
Copy link
Collaborator

Did you figure out how to do the stripe thing @AstroProjection

@AstroProjection
Copy link
Contributor Author

Sorry, I've been preoccupied with work, couldn't find the time for it, I'll look at it over the weekend

@talmax1124
Copy link
Collaborator

It's all good! I have been trying to add the payment before the order screen but I had to revert it because It was sending to sandbox URL. If you ever find a fix, I will appreciate it if you could teach me what I did wrong @AstroProjection

@talmax1124
Copy link
Collaborator

Hello @AstroProjection I just wanted to see if you had time to accomplish the stripe thing?

@talmax1124
Copy link
Collaborator

talmax1124 commented Jul 12, 2021

Also I found a bug when deleting the reviews. It deletes the rating but not how many review there was. For Example, the photo is after i deleted a review, it stays like there was a review made. @AstroProjection

image'

Update like 2 minutes after:
I fixed it, just made an equation to remove it by 1 since that is how many 1 comment is. In terms of review.

@AstroProjection
Copy link
Contributor Author

Nice! sorry I've been swamped with work this last month, haven't had time to do my own thing, how did the stripe thing go?

@talmax1124
Copy link
Collaborator

No Luck! I have been working on other things and work as well. I have done major improvements, just the stripe thing is the only thing I couldn't do. I don't know what to do. That's the reason I asked you. @AstroProjection

@talmax1124
Copy link
Collaborator

@AstroProjection Could you finish the stripe thing?

@talmax1124
Copy link
Collaborator

@AstroProjection or if you could help me implement Auth0 into the sign in. Or if you can help me implement payment buttons like Apple Pay or Google Pay. I really don't know how to any of these because I'm implementing some stuff. Thanks for the help!

@talmax1124
Copy link
Collaborator

@AstroProjection Are you currently busy? Could you help me out in my other repository adding edit review but that only that user can edit it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants