Fix: Handle global limit 0 to mark packages as out of stock#282
Conversation
|
Hi, thank you for your pull request. Azuriom is a website software for game servers, so could you please clarify the use case for an (out of) stock system, which seems more suited for physical products rather than in-game items? Also there is already a global purchase limit for packages, couldn’t set the limit to 0 (or the number of total purchases), achieve the same behavior? About the code changes themselves:
|
|
Out of Stock is used when developer doing setup of ranks and don't want users able to buy items want only user to see product sorry i forgot to add database migration in pull request and i tried some times to set global purchase limit to 0 but it not working for me |
|
done database migration also added |
|
Great thanks!
Could you please give more information on how to reproduce this issue? As if it’s the case it’s a bug that should be fixed :) |
|
i think i can fix that issue/bug and make a pull request |
|
Yes that would be great, thanks! |
7cce3dc to
081bb84
Compare
081bb84 to
b15c589
Compare
|
done can you now access my pull request after checking changes i made in files |
As @MrMicky-FR said, the "Out of stock" in views cannot be translated in the current implementation. |
Ok instead of making button out of stock what should I do ? |
You actually need it to be translatable, currently, it's hardcoded. |
|
Yes translation key would be needed. Also I’d use a neutral framing such as « Not currently available » to avoid referring to « stock » which might not be suited in the context of virtual items |
This PR addresses an issue where
global_limitcould not be set to0from the admin panel, and updates the storefront to display an 'Out of Stock' button when the limit is reached or set to 0.Changes:
global_limitvalidation rule inPackageRequest.phpfromgt:0tomin:0.getMaxQuantity()inPackage.phpto check!== nullinstead of> 0, ensuring that an explicit limit of0is respected.categories/show.blade.phpandpackages/show.blade.phpto display a disabled 'Out of Stock' button when a package's available quantity falls below 1.