Commerce Extra module allows site builders to enable extra features or improvements which are missing from Drupal Commerce core. The module is a collection of minimal submodules which some of developer might not consider worth of a full project and therefore are added into this module.

Feature/improvement overview

  1. Improve checkout by prepopulating billing information's addressfield. Needs an address field for user entity. See also Commerce Addressbook for similiar functionality.
  2. Add extra step where user may login, but doesn't require it.
  3. Improve quantity field by wrapping it with decrease/increase button links.

Drupal version: 7
Project page: http://drupal.org/sandbox/iMiksu/1344594
Git clone: git clone --branch master git@git.drupal.org:sandbox/iMiksu/1344594.git

For commit/release workflows you can check my work in Commerce Finnish Payments project.

Comments

chakrapani’s picture

Status: Needs review » Needs work

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

  • README.txt is missing, see the guidelines for in-project documentation.
  • ./modules/commerce_extra_login_page/commerce_extra_login_page.panes.inc: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
        // or incorrectly does a redirect which would leave the old session in place.
    
  • Comments should be on a separate line before the code line, see http://drupal.org/node/1354#inline
    ./modules/commerce_extra_quantity/commerce_extra_quantity.js:8:    if (way == 1) { // increase
    ./modules/commerce_extra_quantity/commerce_extra_quantity.js:11:    else if (way == 2) { // decrease
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./modules/commerce_extra_login_page/commerce_extra_login_page.info ./modules/commerce_extra_quantity/commerce_extra_quantity.module ./modules/commerce_extra_quantity/commerce_extra_quantity.js ./modules/commerce_extra_quantity/commerce_extra_quantity.css ./modules/commerce_extra_billing_information/commerce_extra_billing_information.info ./modules/commerce_extra_billing_information/commerce_extra_billing_information.install ./modules/commerce_extra_billing_information/commerce_extra_billing_information.module ./commerce_extra.module ./commerce_extra.info ./commerce_extra.admin.inc
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

tomimikola’s picture

Code looks high quality. Structure seems to be well thought. Taking care of the comments on #1234: "Mark all as read" in forums. as well as refactoring the bit lengthy commerce_extra_login_page_login_pane_checkout_form_validate function would make this little addon module shine.

imiksu’s picture

Status: Needs work » Needs review

I've created a 7.x-1.x branch.

README.txt file was added.

Comments lines are fixed to respect 80 character limit and separated inline comments into own lines.

I checked all files so that they have one empty line before file end. I'm not quite sure did I understood that standard correctly since some of files you listed already had one empty line. I've checked core modules also to make sure it's consistent.

@TomiMikola, I prefer to have long and consistent function names rather than inconsistent and shorter names. The function you mentioned is a callback function CALLBACK_checkout_form_validate() and I'm using callback pattern of [MODULE NAME]_[PANE ID]_checkout_form_validate().

tomimikola’s picture

Sorry about confusing message but it was about "bit lengthy commerce_extra_login_page_login_pane_checkout_form_validate function" not "function name".

imiksu’s picture

Oh right.. That could be split into different parts just like it is now with the core's login validation. However, I'm still not sure yet is that code going to be final.

rfay’s picture

Status: Needs review » Needs work

IMO this is fantastic, and I'm ready to RTBC it after this one thing.

In _commerce_extra_features() you have

  return array(
    'commerce_extra_billing_information' => array(
      'title' => 'Billing Information',
      'description' => t('Uses user account address field to prepopulate billing information in checkout. After enabling <a href="@url">edit your settings</a> of "Billing information" pane.', array('@url' => url('admin/commerce/config/checkout/form/pane/customer_profile_billing'))),
    ),

And I note that you're using the untranslated title because it goes into the menu title. However, the menu description should also be untranslated at this point; it's handled the same way in the menu system, if I'm not mistaken.

---

This is just a nit, and doesn't need any further attention, but where you have

define('COMMERCE_EXTRA_QUANTITY_INCREASE', 1);
define('COMMERCE_EXTRA_QUANTITY_DECREASE', 2);

I can imagine much easier code if COMMERCE_EXTRA_QUANTITY_DECREASE were defined as -1.

rfay’s picture

Oh one other thing - to avoid confusion in the future, please remove the files in the master branch and replace them with a README.please_use_named_branches.txt that says "Please use 7.x-1.x" or something.

recrit’s picture

All 3 sub modules tested ok and provide some useful tweaks for Commerce.

One suggestion to improve the billing information address populating:

  • commerce_extra_billing_information_field_attach_form: Add an empty check on profile id so if anyone completed the form and then came back, their entered values do not get overridden.
    line 53:   if (isset($entity->type) && empty($entity->profile_id) && $entity->type == 'billing') {
    
imiksu’s picture

Thanks @rfay and @recrit! I've done changes according to your comments and looking forward to get this promoted as a full project!

rfay’s picture

Status: Needs work » Needs review
rfay’s picture

Status: Needs review » Reviewed & tested by the community

OK, looks good to me. Thanks!

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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