Skip to content

Fix: Handle global limit 0 to mark packages as out of stock#282

Open
fordmc wants to merge 1 commit into
Azuriom:masterfrom
fordmc:feat-out-of-stock
Open

Fix: Handle global limit 0 to mark packages as out of stock#282
fordmc wants to merge 1 commit into
Azuriom:masterfrom
fordmc:feat-out-of-stock

Conversation

@fordmc

@fordmc fordmc commented Jun 16, 2026

Copy link
Copy Markdown

This PR addresses an issue where global_limit could not be set to 0 from the admin panel, and updates the storefront to display an 'Out of Stock' button when the limit is reached or set to 0.

Changes:

  • Modified global_limit validation rule in PackageRequest.php from gt:0 to min:0.
  • Updated getMaxQuantity() in Package.php to check !== null instead of > 0, ensuring that an explicit limit of 0 is respected.
  • Updated categories/show.blade.php and packages/show.blade.php to display a disabled 'Out of Stock' button when a package's available quantity falls below 1.

@MrMicky-FR

Copy link
Copy Markdown
Member

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:

  • I don’t understand why the database migration is not included, as right now the column is_out_of_stock does not exist as it’s added by this pull request
  • The "Out of stock" in views cannot be translated in the current implementation

@fordmc

fordmc commented Jun 16, 2026

Copy link
Copy Markdown
Author

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

@fordmc

fordmc commented Jun 16, 2026

Copy link
Copy Markdown
Author

done database migration also added

@MrMicky-FR

Copy link
Copy Markdown
Member

Great thanks!

and i tried some times to set global purchase limit to 0 but it not working for me

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 :)

@fordmc

fordmc commented Jun 16, 2026

Copy link
Copy Markdown
Author

i think i can fix that issue/bug and make a pull request
because i know whats the issue in that :)

@MrMicky-FR

Copy link
Copy Markdown
Member

Yes that would be great, thanks!

@fordmc fordmc changed the title Feat: Add "Out of Stock" feature for packages Fix: Allow global purchase limit to be 0 to mark packages out of stock Jun 16, 2026
@fordmc fordmc force-pushed the feat-out-of-stock branch from 7cce3dc to 081bb84 Compare June 16, 2026 15:08
@fordmc fordmc force-pushed the feat-out-of-stock branch from 081bb84 to b15c589 Compare June 16, 2026 15:13
@fordmc fordmc changed the title Fix: Allow global purchase limit to be 0 to mark packages out of stock Fix: Handle global limit 0 to mark packages as out of stock Jun 16, 2026
@fordmc

fordmc commented Jun 16, 2026

Copy link
Copy Markdown
Author

done can you now access my pull request after checking changes i made in files

@Koora7334

Copy link
Copy Markdown
Contributor

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.
Nice idea btw

@fordmc

fordmc commented Jun 16, 2026

Copy link
Copy Markdown
Author

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.
Nice idea btw

Ok instead of making button out of stock what should I do ?
Can I make button show in red and can't be clicked when global purchase was set to 0 ?

@Koora7334

Copy link
Copy Markdown
Contributor

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.
Nice idea btw

Ok instead of making button out of stock what should I do ? Can I make button show in red and can't be clicked when global purchase was set to 0 ?

You actually need it to be translatable, currently, it's hardcoded.

@MrMicky-FR

Copy link
Copy Markdown
Member

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

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.

3 participants