Skip to Content Skip to Menu

Is it possible to have a maximum number of a specific merchandise?

  • andor
  • andor
  • OFFLINE
  • Posts: 38
  • Thanks: 3
  • Karma: 1
11 years 5 months ago #229050 by andor
...and even let it count down when it's ordered and paid?

Joomla 2.5.13
CB 1.9.1
CBSubs 3.0.0

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
11 years 5 months ago #229114 by krileon
No, there is no quantity parameter or usage for merchandise (or any plan type for that matter). Subscriptions can have a number of renewals per user, but no usage limit. Best you could do is use CBSubs SQL Actions to count the number of merchandise purchases and if is equal to or greater than the quantity you want then you'd disable new purchases for the plan. Example query as follows for this (note this is untested and is just an example).
Code:
UPDATE `#__cbsubs_plans` AS a SET a.`allow_newsubscriptions` = 0 WHERE a.`id` = '[plan_id]' AND ( SELECT COUNT(*) FROM `#__cbsubs_merchandises` AS b WHERE b.`plan_id` = a.`id` ) >= QUANTITY_HERE

In the above you'd replace QUANTITY_HERE with 5 for example to limit the number of purchases to the plan to no more than 5. It dynamically fills in plan id via substitution so you can basically copy paste, set QUANTITY_HERE, and should be good to go ideally.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • poml
  • poml
  • OFFLINE
  • Posts: 111
  • Thanks: 1
  • Karma: 0
7 years 9 months ago #291788 by poml
Sorry to dig this out, but I have a similar question. I see now that CBSubs does count, on top of a plan I can see two lines
Merchandise records with this plan 3
Completed merchandise with this plan 3
Can I use this number somehow to automatically switch the config of this plan to
Allow new subscriptions = No
? Maybe using an auto action? Something like, on cPayUserStateChange if number XY = 20 then set Allow new subscriptions = No?

Second question: I guess there is no option for a "Sold Out" display?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
7 years 9 months ago #291810 by krileon
That's just counting the rows. You'd need to write a query that counts the rows then toggles off new subscriptions. The update query above does this for you already.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum