A detailed description

The module was designed for Drupal Commerce. It allows to use a product image preview to represent the color/size (options) instead of the dropdown-list of the "add-to-cart-form". It converts select list to attached to product images. The product's info (SKU, price) reloads on image clicks as usual.
The module has configuration page to set image style for previews and select the field from commerce_product entity.
Screenshot

A link to the project page

Module link: https://www.drupal.org/project/commerce_options_as_images

A git clone command:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/petu/2301343.git commerce_options_as_images
cd commerce_options_as_images

I'm sure my module is not a duplication. I've spent a lot of time to find solution for my issue. Here are related questions:

Comments

petu’s picture

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

howto’s picture

You should change your git clone command because it's a personal git clone command.

petu’s picture

Issue summary: View changes
petu’s picture

Thank you, howto!

Fixed.

howto’s picture

Manually review

Line 9, file file commerce_options_as_images.module, function commerce_options_as_images_form_alter(&$form, &$form_state, $form_id)

You should use hook_form_commerce_cart_add_to_cart_form_alter() to alter form add to cart
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_FORM_ID_alter/7

Line 16, file commerce_options_as_images.module, function commerce_options_as_images_form_alter()

$form['#attached']['css']=array(....)

This will overwrite all css attached to form, this will be better:

$form['#attached']['css'][]=.....

Line 42, file commerce_options_as_images.moodule, function commerce_options_as_images_product_image_id_options().

drupal_set_message(t('Visit settings page before to set settings.'), 'error');
You should use function l() to render a link.
This link should be a placeholder in function t().

Line 25, file commerce_options_as_images_ui.admin, function commerce_options_as_images_settings_form().

Missing argument in this function. It should be:

function commerce_options_as_images_settings_form($form, $form_state){}
howto’s picture

Status: Needs review » Needs work

Change issue status.

petu’s picture

Status: Needs work » Needs review

howto,

thanks a lot for reasonable comments!!

I've fixed all the notices you commented.
All the changes were committed to git.

gwprod’s picture

Status: Needs review » Needs work

Your code still fails automated review:
http://pareview.sh/pareview/httpgitdrupalorgsandboxpetu2301343git

In commerce_options_as_images.module
On line 15:

I do not believe this is correct.

$form['#attached']['css'][] = array(
        drupal_add_css(drupal_get_path('module', 'commerce_options_as_images') . '/css/commerce_options_as_images.css',
          array(
            'group' => CSS_DEFAULT,
            'every_page' => TRUE,
          )),
      );

If you want to attach this CSS when the form is on the page, It should be

$form['#attached']['css'][] = drupal_get_path('module', 'commerce_options_as_images') . '/css/commerce_options_as_images.css';

If you want it to be on every page on your site, don't use #attached.

On line 36, use theme_image if possible (it should be).

On line 56, is it appropriate for this to be a MENU_LOCAL_TASK? I don't know.

You do not implement hook_uninstall to remove the variables you are setting in commerce_options_as_images_ui.admin.inc

petu’s picture

Status: Needs work » Needs review

Derek,

thank you for your review!

All the automated review errors were corrected.
I replaced #attached to your line of code (without loading on every page).

On line 56, is it appropriate for this to be a MENU_LOCAL_TASK? I don't know.

I replaced MENU_LOCAL_TASK to MENU_NORMAL_ITEM.

On line 36, use theme_image if possible (it should be).

I used theme() instead of manual image creation.

You do not implement hook_uninstall to remove the variables you are setting in commerce_options_as_images_ui.admin.inc

Implemented hook_uninstall().

Corrected admin message link ("Visit settings page before to set settings").

PA robot’s picture

Status: Needs review » Closed (duplicate)
Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2012412

Project 2: https://www.drupal.org/node/2301411

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

petu’s picture

Status: Closed (duplicate) » Needs review
stefank’s picture

Status: Needs review » Needs work

Hi petu,

I like the idea of the module.

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. http://pareview.sh/pareview/httpgitdrupalorgsandboxpetu2301343git reported number of issues that need to be address. Still some outstanding issues.

README.txt/README.md
(*) No: Follows the guidelines for in-project documentation and the README Template. It is not clear from this file, how this module works and how user will configure this with content type.

Also hook_help() is missing.

Can you address the issues, and maybe help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)

Thanks

petu’s picture

Status: Needs work » Needs review

Stefan,

thank you for review! I corrected the issues from automated system.

(*) No: Follows the guidelines for in-project documentation and the README Template. It is not clear from this file, how this module works and how user will configure this with content type.

The module doesn't support tuning depending on several content types yet. Could you please describe your idea in particular?

stefank’s picture

Petu,

That was supposed to be mentioned somewhere else (about the content type). The point is that the README file should follow the guildelines and templete.

Thanks

petu’s picture

Got your idea Stefan!

Thank you for the advice!

I've corrected the README.txt as you mentioned.

duozersk’s picture

Status: Needs review » Reviewed & tested by the community

I have reviewed the code and it is definitely ready to go. I have created an issue for the things to improve - #2354193: Use drupal_get_form() and system_settings_form() - but it is not a show stopper.

Thanks
AndyB

petu’s picture

Thank you, Andrey!

The patch from #2354193: Use drupal_get_form() and system_settings_form() has been applied.

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

Non-blocking issues:

  • commerce_options_as_images_form_commerce_cart_add_to_cart_form_alter is actually an implementation of hook_form_FORM_ID_alter()
  • Also in that function, I dont think you need both #attached css and drupal_add_css(). I think the #attached method is preferred.
  • In commerce_options_as_images_product_image_id_options() use single quotes for your array keys, its slightly faster and Drupal code standard

No other issues found.

Thanks for your contribution, petu!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

petu’s picture

Karl,

thank you for your time and for approving my account/module!

  • commerce_options_as_images_form_commerce_cart_add_to_cart_form_alter is actually an implementation of hook_form_FORM_ID_alter()
  • Also in that function, I dont think you need both #attached css and drupal_add_css(). I think the #attached method is preferred.
  • In commerce_options_as_images_product_image_id_options() use single quotes for your array keys, its slightly faster and Drupal code standard

The issues are fixed now.

petu’s picture

Issue summary: View changes
petu’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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