Akeeba Subs: expired subs renewal wrong date

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 1 week ago #133085

-- url of the page with the problem -- : various
-- HikaShop version -- : 2.2.2
-- Joomla version -- : 2.5.16
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : Chrome 30x
-- Error-message(debug-mod must be tuned on) -- : none

Looks like we have one more logic problem on the HS->AkeebaSubs integration.

When a user purchases a subscription the new subscription gets set to start when the last subscription ends; however, that is not proper when the last subscription expired in the past.

Example 1:
Last Existing Subscription End Date: 2013-11-20
HS Order Date: 2013-11-18
New Subscription Date start: 2013-11-20
(correct)

Example 2:
Last Existing Subscription End Date: 2013-10-23
HS Order Date: 2013-11-18
New Subscription Date Start: 2013-10-23
(wrong - user paid for dates not used)

There doesn't appear to be any logic to take into consideration renewing subscriptions with expire dates that have already expired.

Can you please provide the code-fix needed to make this work properly?

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 week ago #133219

Hi,

Indeed I missed it. Thanks to edit the file: plugins\hikashop\akeebasubs\akeebasubs.php

And replace the line:

$jDate = new JDate(strtotime($old->publish_down));
$jDown = new JDate(strtotime($old->publish_down) + (86400 * $level_duration * $result->order_product_quantity));
By:
if(strtotime($old->publish_down) < time()){
	$jDate = new JDate(time());
	$jDown = new JDate(time() + (86400 * $level_duration * $result->order_product_quantity));
}else{
	$jDate = new JDate(strtotime($old->publish_down));
	$jDown = new JDate(strtotime($old->publish_down) + (86400 * $level_duration * $result->order_product_quantity));
}
That should do the job.

Last edit: 11 years 1 week ago by Xavier.
The following user(s) said Thank You: cpaschen

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

Time to create page: 0.048 seconds
Powered by Kunena Forum