Akeeba Subs: expired subs renewal wrong date
12 years 10 months ago #133085
by cpaschen
Akeeba Subs: expired subs renewal wrong date was created by cpaschen
-- 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
-- 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.
12 years 10 months ago - 12 years 10 months ago #133219
by Xavier
Replied by Xavier on topic Akeeba Subs: expired subs renewal wrong date
Hi,
Indeed I missed it. Thanks to edit the file: plugins\hikashop\akeebasubs\akeebasubs.php
And replace the line:
By:
That should do the job.
Indeed I missed it. Thanks to edit the file: plugins\hikashop\akeebasubs\akeebasubs.php
And replace the line:
Code:
$jDate = new JDate(strtotime($old->publish_down));
$jDown = new JDate(strtotime($old->publish_down) + (86400 * $level_duration * $result->order_product_quantity));
Code:
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));
}
Last edit: 12 years 10 months 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.168 seconds