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
Implement Reorder Functionality of existing placed order #3132
Conversation
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 |
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. |
Hi Shubham, |
$slugOrPath = strtolower(str_replace(" ","-",$item->name)); | ||
$product = $this->productRepository->findBySlug($slugOrPath); | ||
|
||
if(!$product->isSaleable()){ |
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.
use space after ! operator
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.
done
return view($this->_config['view'], compact('order')); | ||
foreach ($order->items as $item) { | ||
$slugOrPath = strtolower(str_replace(" ","-",$item->name)); | ||
$product = $this->productRepository->findBySlug($slugOrPath); |
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.
You can directly get product from $item. (Example $item->product)
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.
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; |
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.
Please Camel case here
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.
done
]); | ||
|
||
foreach ($order->items as $item) { | ||
$slugOrPath = strtolower(str_replace(" ","-",$item->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.
Use space after and before with binary operator
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.
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]); |
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.
Use space after and before with binary operator
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.
done
) | ||
{ | ||
$this->middleware('customer')->only(['moveToWishlist']); | ||
$this->middleware('customer')->only(['moveToWishlist','reorder']); |
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.
Use space after and before with binary operator
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.
done
{{ __('shop::app.customer.account.order.view.cancel-btn-title') }} | ||
</a> | ||
</span> | ||
@endif | ||
@if (core()->getConfigData('customer.settings.reorder.product_reorder')) | ||
@if($can_reorder) |
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.
Use space after if and Use camel case for $can_reorder
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.
done
I have tried to resolve all the mentioned issues. Please let me know if there are any remaining. |
@vishalkushwaha94 |
I have resolved error in reorder functionality with all product type if there is any one remaining please let me know. |
Hi @vishalkushwaha94 I am getting the error alert when reordering configurable product two times from the same order id |
I have resolved the error please let me know if there are any remaining. |
@vishalkushwaha94 |
@vaishaliwebkul |
@vishalkushwaha94 |
@vaishaliwebkul |
Hi @vishalkushwaha94 |
Hi @vaishaliwebkul |
If you face any kind of error in reorder functionality please let me know i will resolve it as soon as possible. |
Hi @vishalkushwaha94
|
Hi @vaishaliwebkul |
@vishalkushwaha94 Thanks. |
@vishalkushwaha94 can you please resolve the conflicted file packages/Webkul/Shop/src/Resources/views/customers/account/orders/view.blade.php ? |
Just a quick question.. Is this PR already read the availability of the stock? Any alert or something? |
Reorder option is not available if some of the 'reorder' items is have no stock. |
I am closing this PR since there has been no activity since 23 Sep 2020. |
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