Skip to Content Skip to Menu

Programmatically generate purchase item

  • sstoks
  • sstoks
  • ONLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
1 hour 30 minutes ago #343096 by sstoks
Replied by sstoks on topic Programmatically generate purchase item
Hi,

I'm not familiar with "CBSubs Options", and I am just looking in the "Plans" pages. I am comparing my "Workshop" plan with the other plans which apparently worked in the past, and I am quite sure that I have everything set up the same way.

Interestingly, if I am logged in to the site, I get this "_getReqParam() on null" error; if I do not log in (I.e., try to order as "guest"), then I get one line further in the script and now end up with "Chosen plans combination is not allowed (you must choose coherent plans selection, e.g. mandatory subscription(s) must be active or mandatory plan(s) must be chosen)." (slightly different from the first error, about the parent subscription).

I agree with your warning that I'm trying to use CBSubs for something it wasn't designed for. Perhaps I should focus my attention on the "webshop" part of the site (HikaShop) and see if I can use that one. There is a relatively simple API available there which lets me create line items for orders.

The drawback here is that I have to configure payment processors for both CBSubs and for this webshop. I can imagine that if people run a "community-site" (with paid subscriptions), then having a simple way to sell the occasional T-shirt or printed mug as support items would be a welcome addition - especially because the invoice and payment processing of CB is so slick.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50068
  • Thanks: 8567
  • Karma: 1467
1 hour 14 minutes ago - 1 hour 10 minutes ago #343097 by krileon
Replied by krileon on topic Programmatically generate purchase item
Normally to sell a T-Shirt in addition to a subscription or independently you'd just use a Merchandise plan. Generating baskets of unknown items with unknown prices is basically invoicing software.

So if whatever you're trying to add to a basket is a static item you can just create plans for them and then it's as simple as redirecting them to a URL that'll build the basket for you. The URL to do this is at the top of each plan (add to basket) and you can have multiple plan ids in that URL to add multiple plans. This basically lets you have whatever UI you want for building baskets, but again requires plans.

So lets say for example I've Plan A with an ID of 1 and Plan B with an ID of 2. My below URL would select both, add them to the basket, then display the basket to me if I'm logged in. If I'm not logged in it'll display registration with both plans selected already.

index.php?option=com_comprofiler&view=pluginclass&plugin=cbpaidsubscriptions&do=addplanstobasket&plans=1-2

CBSubs Options is an integration you'd need to install. It lets you add custom fields to plans basically. Those fields then can modify the price of a plan in many ways. So for example lets say you've a T-Shirt plan and that T-Shirt comes in Red, Blue, Green, and White colors. You could add a dropdown to the plan that lets them select the color. The color can then adjust the price (or not! it doesn't have to!) of the plan. We've a demo of this on our demo site below.

demo.cbdemosites.com/demos/community-builder/registration

The dropdown for Additional Seats in Professional is a CBSubs Option field. The extra pricing options in Developer are also CBSubs Options. Below is my blog posts about CBSubs Options for more examples of what it's capable of.

www.joomlapolis.com/blog/kyle/18983-cbsubs-options
www.joomlapolis.com/blog/kyle/18998-dynamic-plan-pricing
www.joomlapolis.com/blog/kyle/19070-cbsubs-options-new-fields

It's just unclear exactly the usecase you currently have so It's difficult for me to understand your needs exactly. Stuff like variable pricing is done using promotion codes, tax rules, donation plans, and CBSubs Options. All of those let you modify a baskets pricing. Without more information or if possible PM URLs with instructions for a normal user experience I don't really know what more to suggest. I'm still exploring some options API wise to generate baskets with unknown line items, which maybe possible but I can't promise anything there.


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.
Last edit: 1 hour 10 minutes ago by krileon.

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

  • sstoks
  • sstoks
  • ONLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
41 minutes ago - 18 minutes ago #343101 by sstoks
Replied by sstoks on topic Programmatically generate purchase item
Thanks for the explanation about "CBSubs Options". I checked the links you posted. Do I understand correctly that such an "integration" is both a "programmatic" extension (that adds these fields to the various data types) _and_ the accompanying UI part so you can edit those fields without using PHP?

Also, when taking a look at the "Plugin management" page of CB in my Joomla backend, I can't say I've become "less confused" :-) For sure there isn't a "CBSubs Options", but I notice there is both a "CB Paid Subscriptions" plugin (which is at version 4.8.0) and a "CBSubs Paid Subscriptions" which is at version 3.0.0 and which displays a warning saying it's not compatible with my current CB version (which I think is 2.11.0).

If I search for "CBSubs Options" in the "Install CB Plugin" page, then it finds it, shows me a nice description of what it is, along with a "subscribe" button which takes me to the Joomlapolis website about CB Paid Subscriptions - but I _have_ that. I'm afraid I don't "get" it. How does one install such "integrations"?

Sorry about the newbe questions. This is all far less intuitive than I hoped :-)

EDIT: By the way: this "index.php?option=com_comprofiler&view=pluginclass&plugin=cbpaidsubscriptions&do=addplanstobasket&plans=1-2" was a very helpful tip.  I can see that when I enter the ID of my new plan, it gives me a nice error page with "Amount not allowed"; if I fill in the ID of an older plan (which is still "published") then I get exactly what I want to see: a summary of the order, with my billing address already filled in, and links to the payment processors at the bottom.  This will help me debug much more efficiently!
Last edit: 18 minutes ago by sstoks.

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

Moderators: beatnantkrileon
Powered by Kunena Forum