Skip to Content Skip to Menu

Cbsubs: Apply Promotion such fixed value x CB field

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 8 months ago #240957 by dotcom22
hello

I have a Merchandise and I would like apply a variable price according to the remaining time of current subscription plan (user can not subscribe to more than one plan). For example if a user subscribed to yearly plan and has 150 days left (value present in a specific CB field) before his end, I would like multiply this value per another fixed value such 0.25 cents for determinate the price to pay for my Merchandise (in this case 150 x 0.25 = 37.50).

This could be done by setting a negative promotion, but it seem is not possible to multiply in some manner the value. Using percentage or coupon is not adapted in my case.

Any clue?

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 8 months ago #240996 by krileon
You'll need to use a CB Query Field and do all your calculations in it. Then substitute it in as the promotion price.


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.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 8 months ago #241031 by dotcom22
Excellent I found how to do :silly: B)

If anybody need the same here the correct query to use:
Code:
SELECT DATEDIFF(`expiry_date`,NOW()) * 0.25 AS days FROM `nova_cbsubs_subscriptions` WHERE `user_id` = '[user_id]';


Now unfortunately I can not use it because the discounted price is not displayed on the plan and I forgotten this point. This happen due to the bug I already mentioned in this topic:

www.joomlapolis.com/forum/153-professional-member-support/223130-4298-cbsubs-promotion-not-apply?start=12

So I know you are working on next CB release but here I'm stuck 2 time now and is a bit frustrating :pinch: :( The last release of CBsubs is old of more than 18 months now and it seem I will need to wait again a while.

Could you really not take some minute for investigate a bit ? Maybe is juste code syntax which is wrong I don't know. As I said you don't need to release a new version but just to tell us which file need to be modified.

Any chance please ? :S

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 8 months ago #241065 by krileon

The last release of CBsubs is old of more than 18 months now and it seem I will need to wait again a while.

I know and I'm sorry, but I'm doing the best I can. I just don't have the time to do two major rewrites at once. Most of the API rewrites in CB 2.0 will also affect CBSubs, which also fixes quite a few bugs in CBSubs it self. So once CB 2.0 is done we'll have a better idea what we need to do for CBSubs.

Could you really not take some minute for investigate a bit ? Maybe is juste code syntax which is wrong I don't know. As I said you don't need to release a new version but just to tell us which file need to be modified.

It's not that simple. Price calculations are very complex. There is really no simple fix when it comes to CBSubs. I also do not have the time right now to split my development time between multiple major projects. It takes at least half of my day answering forums as is. That leaves little for programming and even more so if I have to divide it between projects, which is why none of the incubator projects have been updated in awhile as well.

Any chance please ?

No, sorry. It's going to have to wait until we're done with CB 2.0 stable release and can begin working on other projects again. CBSubs has absolute priority after CB 2.0 stable with probably a quick 3.0.1 bug release followed by a 3.1.0 or 4.0.0 feature release.


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.

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 8 months ago #241222 by dotcom22
well I found a inelegant but more or less acceptable solution by playing with display in the plan but now I noticed another point. When a negative promotion is applied, the display in the basket is not well adapted because the "plus" amount is listed after the sub-total such this:

- Your plan PRO: $100
- Sub-total: $100
- With option B (negative promotion): + $35
- Special discount: - $10
- Total = $125

when logically it should be this:

- Your plan PRO: $100
- With option B (negative promotion): + $35
- Sub-total: $135
- Special discount: - $10
- Total = $125

That's normal to display the name/amount of a positive promotion after the sub-total but a negative promotion should be displayed before. I suppose is not possible to change this ?

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 8 months ago #241249 by krileon
Sub total is the sub total of the plans in the basket. So if you have 3 plans being purchased at once it'll sub total those 3. Promotions/Tax usage will show after the sub total. You can change the order a promotion is applied by adjusting "Discount priority:" and changing their ordering.


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