Just installed the module and added a downpayment feature to a product in our test store.

It would be nice to specify a "number of days" that the full payment must be received by, i.e. whenever a product is ordered by a customer the final payment would be due 60 days from the day they ordered. This should be an option in addition to using a specific date.

Comments

sokrplare’s picture

Assigned: Unassigned » sokrplare

We've toyed with this idea, but can't decide whether it is better to split a "by day" vs. "by date" feature into a separate module. Will need to make an architecture decision in not too long, but for now we want to make sure the date version is stable and working for everyone before we start adding more features. If you'd like to start work on this, I'd be happy to test and commit it!

deslack’s picture

I personally think the by day and by date shouldn't be put into a separate module. The feature is not that significant, and can only be applied to this module only.

JoshOrndorff’s picture

I would love to see this feature too. I'm not taking deposits for events, but for services, and I want to do something like Deposit due now, balance due in 60 days.

I, like Deslack, think that splitting it into a separate module would be overkill. It seems like just a small addition. If code is available for this feature I would be happy to test it, but I won't be able to code anything myself until the more important features of my site are in place. I'll keep following this thread.

Thanks!
-Josh

sokrplare’s picture

Makes sense to me. Just waiting on the module to be approved before kicking off any new feature work. Happy to commit working patches though if you're inspired!

alansch’s picture

Category: feature » task
Status: Active » Needs review
StatusFileSize
new1014 bytes
new6.73 KB

For what it's worth, here is my attempt at implementing a "by number of days" interface for final payments.

I have set it up so the store administrator can decide whether to allow entry by number of days or by cut off date by adding the "number of days" option as a separate product feature (which means that both can be enabled for a product, leaving the choice to the purchaser).

The only remaining implementation quirk at this stage is a default of 30 days when the "number of days" feature is enabled. I have set this up so it can be overridden by a Drupal variable "downpayment_default_days" but I have not implemented an admin interface to create/set this variable. Of course the store administrator can override this to any desired number of days when the feature is enabled for a product.

This patch also includes the fix I posted earlier today (http://drupal.org/node/1281100) for the uc_downpayment_payments record deletion issue.

sokrplare’s picture

Project: » UC Down Payment
Version: » 6.x-1.x-dev

Thanks for the patch - awesome! Will check it out and merge in hopefully!

Also moved this issue over to the live module queue (since we had an issue with promoting the sandbox project http://drupal.org/node/1104470#comment-4901344).

alansch’s picture

Okay, here's a bit of code to provide a configuration interface at admin/store/settings for the uc_downpayment module.

In uc_downpayment.module's hook_menu (uc_downpayment_menu) add the lines...

  $items['admin/store/settings/downpayments'] = array(
    'title' => 'Down Payment Defaults',
    'description' => 'Edit defaults for downpayment module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('uc_downpayment_admin'),
    'access arguments' => array('edit down payments'),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'uc_downpayment.admin.inc',
  );

and in uc_downpayment.admin.inc add the function...

/**
 * Admin Settings page callback.
 */
function uc_downpayment_admin() {
  global $base_url;
  $form = array();

  $form['downpayment_default_days'] = array(
    '#type'          => 'textfield',
    '#title'         => t('Default Days Til Final Payment Due'),
    '#description'   => t('Enter a default value for the number of days from down payment to when the final payment falls due.'),
    '#default_value' => variable_get('downpayment_default_days', 30),
  );

  return system_settings_form($form);
}

This will allow the easy configuration of "downpayment_default_days" and also provides a structure for the addition of any further configuration or default values for the uc_downpayments module.

Note that if the hook or callback function are changed, you will need to clear caches before the changes will become visible. (Derned quirk had me chasing my tail for a few hours *sigh*)

FWIW the Drupal manual reference for this is http://drupal.org/node/206761.

sokrplare’s picture

Status: Needs review » Fixed

Many thanks for all your help. We have included your patch in comment 5 into the most recent dev version, but slightly modified, and taking into account some other changes that have recently been made, unrelated to this issue. Also, we added the interface configuration in comment 7. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.