CB Subs Importer Breaking

12 years 6 months ago - 12 years 6 months ago #181694 by boyjahq
CB Subs Importer Breaking was created by boyjahq
I'm trying to import plans into CB Subs and getting this error:

Fatal error: Call to undefined method stdClass::get() in <span>/</span>home<span>/</span>stub/www/www/stub/components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php on line 186

This isn't for all subscriptions and I'm having a hard time figuring out why the importer is breaking (esp. because the files are encrypted).

The record in the package is an example of one that breaks. The screenshot shows some pertinent jos_users and jos_comprofiler data.

Some points:
  • If I switch the record from A to X it imports fine.
  • Before blowing up, CB Subs initiates an expire event, because I receive an email for this user saying they've expired.
  • Subscription length is for 1 year and this record shouldn't expire until February
  • 27 is a valid plan which other records import fine to.

Any idea what is causing this error?

What is the logic behind importing? What steps does CB Subs take?

Joomla 1.6.6
CB 1.7
CB Subs 1.2.2
PHP 5.2.17
Attachments:

Please Log in to join the conversation.

12 years 6 months ago - 12 years 6 months ago #181758 by krileon
Replied by krileon on topic Re: CB Subs Importer Breaking
This is due to your plan either using CBSubs SQL Actions or CBSubs Fields. It's a known bug fixed for next release. It's due to an improper user object being constructed during the import process. I apologize for the inconvenience.


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.

12 years 6 months ago - 12 years 6 months ago #181792 by boyjahq
Replied by boyjahq on topic Re: CB Subs Importer Breaking
Thanks for that info Kyle.

However, we aren't using SQL actions or fields for any of our plans (they're not installed). We do have CB Subs Promotions, Email, and Tax installed.

Maybe you can help me on another tact:

I originally wrote an importer for AEC. Most of the plans worked fine imported. However, for expired plans, once they were renewed the users weren't added back to the user group they were originally part of. I spent several days scratching my head because the plans looked the same as normal expired plans. The only records I was creating were in the jos_cbsubs_subscriptions table. Is there another table or record that needs to be inserted/updated to make sure that users are re-assigned to their correct group once an account is renewed?

Right now, we're stuck at this point in a site upgrade, and this information will save us weeks of sitting around waiting on another release of CB Subs.

Please Log in to join the conversation.

12 years 6 months ago - 12 years 6 months ago #181803 by krileon
Replied by krileon on topic Re: CB Subs Importer Breaking
There are a few more tables then the _cbsubs_subscriptions table being involved. What integrations exactly is your plan utilizing that you're trying to import into? If not done yet please upgrade to CB 1.7.1 and see if issue is resolved as I can not recall if the problem was in CB directly or CBSubs it self.


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.

12 years 6 months ago - 12 years 6 months ago #182329 by boyjahq
Replied by boyjahq on topic Re: CB Subs Importer Breaking
Hey Kyle,

Unfortunately, upgrading did not help.

The CB Subs plugins being used are just Promotions, Email, and Tax installed.

I think I may have found a viable solution. In the cb.core.php file that was failing, I replaced this:
$value = $user->get( $field->name );

With:
if(!method_exists('get', $user)) {
 $fn = $field->name;
 $value = $user->$fn;
} else {
 $value	= $user->get( $field->name );
}

The importer was passing this file what looked like a database row object and trying to call the get method on it. I used a check to determine when this was happening and tried just handing it whatever field name was asked for.

Questions:
  • The importer runs successfully this way, however every plan is expired when the importer is finished. Why is this occurring?
  • Does it matter whether the user subscription being imported is already in the usergroup a plan assigns them to?
  • If I were going to return to my own script and build the records myself, what tables need to be updated for the subscriptions?

Please Log in to join the conversation.

12 years 6 months ago #182447 by beat
Replied by beat on topic Re: CB Subs Importer Breaking
- Glad you found a solution, and thanks for sharing it. Which $name (s) do need the first variant of the if ? If non-core, what field types are those ?

- You can only import users which are not subcsribed to a plan being imported. Otherwise it will not be imported.

- Which import method do you use ? if you provide dates, make sure to provide well-formed datetime format as documented.

You only need to import to jos_cbsubs_subscriptions table for user subscriptions. However you would need to take care of all integrations (e.g. add to docman groups if you use docman, send emails, and all integrations you would be using).

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.337 seconds

Facebook Twitter LinkedIn