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

10 years 9 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 to join the conversation.

10 years 9 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).
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 to join the conversation.

7 years 1 month 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 to join the conversation.

7 years 1 month 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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.213 seconds

Facebook Twitter LinkedIn