Plugin for Country wise subscription

Hi,

I have successfully developed plugin for EBS payment gateway integration for ojs 2.1.4.8. My client wants me to develop a plugin which allows country wise subscription rates, That means they want to set different subscription rates for different countries.
e.g
if user is from US he’s subscription rate should be 100$ , And if From India rate should be 2000 INR (As set by journal manager).

I want to know if it is possible to do this through a plugin ?
please suggest solution for this…

Hi @chetanshenai9,

Double-check your version number – there is no OJS 2.1.4.8.

I’m not aware of anything that already implements this requirement; you’d likely need to modify the subscription/payment system yourself.

Regards,
Alec Smecher
Public Knowledge Project Team

Sorry, the version is 2.4.8-1. So I will have to modify OJS core ?.

Hi @chetanshenai9,

Yes, you’d need to modify OJS to accomplish that.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks, I want to avoid modifying your code. So, In order to achieve this I am asking them to create multiple subscription types as required for different countries. Then I am trying to create generic plugin that creates table in databases which maps these subscriptions with countries. So my trick is to show only those subscription available to the subscriber’s country when he chooses “Purchase Subscription”.
So I will have to modify the sql query which fetches data into the drop-down(List of available subscriptions).

I can achieve this using a hook that allows me to override the SQL query?

Hi @chetanshenai9,

Off the top of my head:

I think the cleanest option would be to create a subclass of the SubscripionTypeDAO in your plugin, and then use the DAORegistry::registerDAO function to register it as the SubscriptionTypeDAO rather than the built-in one. Then you could selectively override functions as you like without having to monkey with SQL strings (which is also possible but a bit more spaghetti-like).

The only downside to this approach is that other plugins can’t likewise extend the SubscriptionTypeDAO, but I don’t think there’s risk of that.

Regards,
Alec Smecher
Public Knowledge Project Team

Ok. then In order to reference the subclass of SubscripionTypeDAO, I will have to add one line code in core file to reference it?

Hi @chetanshenai9,

You should be able to use DAORegistry::registerDAO from within your plugin; then any code that gets the DAO you registered should get your extended DAO instead of the usual one.

Regards,
Alec Smecher
Public Knowledge Project Team

ok, I got it Thanks…