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

Implement Reorder Functionality of existing placed order #3132

Closed

Conversation

vishalkushwaha94
Copy link

Hi
This is Vishal Kushwaha from Agra.
I have received an email from Webkul to complete a task of Reorder functionality in bagisto.
I do some changes in code to achieve my goal of reorder functionality so please review my changes.
I have also attache my task pdf that i received in email for reference

Reorder Feature.pdf

@rahulcs0082
Copy link
Contributor

Hello @vishalkushwaha94

We highly appreciate your work and effort but there are some changes that you need to do so that we can review your PR for functional purpose.

First of all, we are using multilanguage for this project so you need to write translation for each language instead of English only.

Kindly follow the PSR-2 coding standard. Please go through the given link and update code according to this standard - https://www.php-fig.org/psr/psr-2/ and https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

@vishalkushwaha94
Copy link
Author

I have translated keywords in all language but there are some languages in which i can't find the exact translation of keyword like "Reorder" so in that case it is in English and also updated my code according to PSR-2 Standard.

While adding translation of keyword in Shop Module language file i find some strange things like there is one keyword which is used as title for cancel button, It is not present in every language file. I find it strange that's why i mention it here.

@shubhwebkul
Copy link
Contributor

Hi Vishal,

  • Please add support for default theme too.
  • design issue.
    issue

@vishalkushwaha94
Copy link
Author

Hi Shubham,
Both issues have been resolved.

$slugOrPath = strtolower(str_replace(" ","-",$item->name));
$product = $this->productRepository->findBySlug($slugOrPath);

if(!$product->isSaleable()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use space after ! operator

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return view($this->_config['view'], compact('order'));
foreach ($order->items as $item) {
$slugOrPath = strtolower(str_replace(" ","-",$item->name));
$product = $this->productRepository->findBySlug($slugOrPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly get product from $item. (Example $item->product)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your tip it help me to reduce no of line in my code.

@@ -61,6 +73,7 @@ public function index()
*/
public function view($id)
{
$can_reorder = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Camel case here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

]);

foreach ($order->items as $item) {
$slugOrPath = strtolower(str_replace(" ","-",$item->name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use space after and before with binary operator

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

foreach ($order->items as $item) {
$slugOrPath = strtolower(str_replace(" ","-",$item->name));
$product = $this->productRepository->findBySlug($slugOrPath);
Cart::addProduct($product->product_id, ['product_id'=>$product->product_id,'quantity'=>$item->qty_ordered]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use space after and before with binary operator

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

)
{
$this->middleware('customer')->only(['moveToWishlist']);
$this->middleware('customer')->only(['moveToWishlist','reorder']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use space after and before with binary operator

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{{ __('shop::app.customer.account.order.view.cancel-btn-title') }}
</a>
</span>
@endif
@if (core()->getConfigData('customer.settings.reorder.product_reorder'))
@if($can_reorder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use space after if and Use camel case for $can_reorder

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@vishalkushwaha94
Copy link
Author

I have tried to resolve all the mentioned issues. Please let me know if there are any remaining.

@vaishaliwebkul
Copy link

@vishalkushwaha94
check reorder functionality with all product type
i.e; getting an exception when trying to reorder a configurable product

Screenshot (33)

@vishalkushwaha94
Copy link
Author

@vaishaliwebkul

I have resolved error in reorder functionality with all product type if there is any one remaining please let me know.

@vaishaliwebkul
Copy link

Hi @vishalkushwaha94
It's now fixed for all product type :)

I am getting the error alert when reordering configurable product two times from the same order id

Screenshot (54)

@vishalkushwaha94
Copy link
Author

@vaishaliwebkul

I have resolved the error please let me know if there are any remaining.

@vaishaliwebkul
Copy link

@vishalkushwaha94
can you please check the reorder for event booking type, as I am getting this error when place reorders for event booking even quantity are available

Screenshot (58)

@vishalkushwaha94
Copy link
Author

@vaishaliwebkul
I hope this time i have resolved all issues, but please let me know if there are any remaining.

@vaishaliwebkul
Copy link

@vishalkushwaha94
Thanks for the efforts, but the last issue is still not resolved, can you please check again.

@vishalkushwaha94
Copy link
Author

vishalkushwaha94 commented Jun 20, 2020

@vaishaliwebkul
I have already solved the last issue, please check again and also share the screenshot of the error message as I am not facing any errors while reorder event booking.

@vaishaliwebkul
Copy link

Hi @vishalkushwaha94
I have updated my code with commit and check multiple times for this issue but always showing the same result.
Hope this will help you https://www.loom.com/share/40190127d6f245e9afc93410c3cd11c3

@vishalkushwaha94
Copy link
Author

Hi @vaishaliwebkul
Thanks for your response, I have resolved the issue, so please check and let me know if there are any issues remaining

@vishalkushwaha94
Copy link
Author

Hi @vaishaliwebkul

If you face any kind of error in reorder functionality please let me know i will resolve it as soon as possible.

@vaishaliwebkul
Copy link

Hi @vishalkushwaha94
you could also fix one more issue, follow the below steps:

  1. place order for the rental booking(daily basis)
  2. reorder this order( working fine)
  3. now edit the same product for an hourly basis and save
  4. reorder the previously order again

Screenshot (74)
Screenshot (75)

@vishalkushwaha94
Copy link
Author

vishalkushwaha94 commented Jun 24, 2020

Hi @vaishaliwebkul
Thanks for your response, but I would like to know that only this issue is left or there are others because if you face any other issues please mention here, this will help me to resolve them once.

@vaishaliwebkul
Copy link

@vishalkushwaha94
I have tested this functionality with the possible cases, all issues have been reported here
Finally, the last one also is resolved :)

Thanks.

@ghermans
Copy link
Contributor

ghermans commented Jul 30, 2020

@vishalkushwaha94 can you please resolve the conflicted file packages/Webkul/Shop/src/Resources/views/customers/account/orders/view.blade.php ?

@otheriz
Copy link

otheriz commented Sep 18, 2020

Just a quick question..

Is this PR already read the availability of the stock?
what will happen if one or some of the 'reorder' items is have no stock?

Any alert or something?

@vishal-webkul
Copy link
Contributor

Reorder option is not available if some of the 'reorder' items is have no stock.

@ghermans
Copy link
Contributor

ghermans commented Feb 5, 2021

I am closing this PR since there has been no activity since 23 Sep 2020.

@ghermans ghermans closed this Feb 5, 2021
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

Successfully merging this pull request may close these issues.

None yet

8 participants