Course on Sell by Default

More
15 years 7 months ago #11 by Antonio Durán
Replied by Antonio Durán on topic Re: Course on Sell by Default
Ok, I will try, although I am sure I will miss some things:

- First, we need a new table for storing categories mappings
- A new view in admin side, that would manage them (similar to the mappings one)
- Then, just a simple change to sell_courses_* function, so instead of using the configured one we had in Joomdle config, it uses the mapping to know in which category it has to put the product.

Also, a fix would need to be made in Tienda plugin (I can do that myself when you do the rest), as now it uses the category info to determine which products are courses.
In VM this is done through product types, so there is no problem there.

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

  • shekar
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 years 7 months ago #12 by shekar
Replied by shekar on topic Re: Course on Sell by Default
what I am thinking is, when we create a new course in MOODLE X Category, if X category is not exists in VM it has to create a new X category in VM and publish the course in that category, without any mappings in JOOMDLE.

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

  • shekar
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 years 7 months ago #13 by shekar
Replied by shekar on topic Re: Course on Sell by Default
When I update the COST for existing Course in Moodle, its not updating the same in VM.

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

More
15 years 7 months ago #14 by Antonio Durán
Replied by Antonio Durán on topic Re: Course on Sell by Default
What you suggest is another approach, yes.
I guess that could be done using an event for category creation (if it exists, I don't remember).
It would call a new service in joomla that creates a new category in shop.


As you say, cost is not auto-updated. You need to to "reload from moodle".
To make that work, a new event would be used in moodle, course_updated.

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

  • shekar
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 years 7 months ago - 15 years 7 months ago #15 by shekar
Replied by shekar on topic Re: Course on Sell by Default
I have created new event "course_updated" like "auto_sell",

MOODLE
Code:
auth_plugin_joomdle::call_method ("updateCourse", $cid);
and calling function

JOOMLA
Code:
return JoomdleHelperShop::reload_courses ($courseid);

But no use... am I missing something?
Last edit: 15 years 7 months ago by shekar.

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

More
15 years 7 months ago #16 by Antonio Durán
Replied by Antonio Durán on topic Re: Course on Sell by Default
You will need to add the handler for the new event to the database.

This is done in save_config function (or whatever it is called) in auth.php.

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

  • shekar
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 years 7 months ago #17 by shekar
Replied by shekar on topic Re: Course on Sell by Default
This is what you are saying?
Code:
if (!record_exists ('events_handlers', 'eventname', 'course_updated', 'handlermodule', 'auth/joomdle')) { $event = 'course_updated'; $handler->eventname = $event; $handler->handlermodule = 'auth/joomdle'; $handler->handlerfile = '/auth/joomdle/auth.php'; $handler->handlerfunction = serialize ('joomdle_'.$event); $handler->schedule = 'instant'; $handler->status = 0; insert_record ('events_handlers', $handler); }


Code:
function joomdle_course_updated ($course) { $autosell = get_config('auth/joomdle', 'auto_sell'); if ($autosell) $cid['courseid'] = $course->id; auth_plugin_joomdle::call_method ("updateCourse", $cid); return true; }

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

More
15 years 7 months ago #18 by Antonio Durán
Replied by Antonio Durán on topic Re: Course on Sell by Default
Yes, that is what I meant.

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

  • shekar
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 years 7 months ago - 15 years 7 months ago #19 by shekar
Replied by shekar on topic Re: Course on Sell by Default
I made everything like what I have done for auto_sell. Course is automatically creating in VM, But when I update the course in moodle its not updating the same in VM.

How can I check whether "joomdle_course_updated" function is calling or not, when moodle triggered "course_updated" function.
Last edit: 15 years 7 months ago by shekar.

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

More
15 years 7 months ago #20 by Antonio Durán
Replied by Antonio Durán on topic Re: Course on Sell by Default
You can put debug code inside the function (exit) to know if it is being called.

Also, there are some tables in moodle db (event*) that control this. You can check there if everything seems in place (comparing with the working events)

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