Site admins that want to make use of the "Add to Cart" form without using Views or forcibly typing in the PHP to load it, this module is for you. This module creates a simple "Add to Cart" block which can be re-used anywhere in the site, including in Panels! This would even make it extremely simple to use Context's specialized block reactions to display the "Add to Cart" block where and when you truly want it.

This also includes a separate "Buy it now" block. This particular block allows a simple "add to cart" block with NO attributes displayed. This block even allows administrators to turn off attribute validation so an unconfigured product can be added to the cart. This feature is useful for sites which want to collect what products visitors want for a "Request for Quote" function, particularly when users don't know which options might be necessary.

Sandbox link:
http://drupal.org/sandbox/wjaspers/1145762

Git is driving me crazy, so I've included the code in a ZIP archive here for the moment.
This code works with Ubercart 7.x-3.x.
I plan on backporting this to Ubercart 6.x-2.x as well.

CommentFileSizeAuthor
uc_add_to_cart_block.zip2.6 KBwjaspers

Comments

wjaspers’s picture

Finally got a better Git tool and committed working code to the repository.

sreynen’s picture

Component: new project application » module
Issue tags: +PAReview: Ubercart

Tagging this so Ubercart-focused reviewers can find it.

ralt’s picture

Priority: Normal » Critical

Changing priority according to the new priority guidelines.

davisben’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

You should run this module through Coder with the minor setting. There are some coding standards that should be fixed, but it's mostly minor formatting stuff.

I tested the module, and it seems to work as advertised, but I have a couple comments.

1. Both the Add to Cart block, and the Buy it Now block, have the title "Add to Cart". This could be slightly confusing to users.
2. Your function uc_add_to_cart_block_form_uc_catalog_buy_it_now_form_alter(&$form, &$form_state, $form_id) seems to implement hook_form_FORM_ID_alter(), not hook_form_alter(), as is specified in the comment.

tr’s picture

I tested this module and it works as advertised. I don't see any significant issues. I provided a patch in http://drupal.org/node/1275410 to address many of the coding standards issues, but you should still follow the advice of #4 and install and run Coder.

You create several system variables, so you should implement hook_uninstall() and delete these variables from the database when your module is uninstalled.

When this and #4 are addressed I think this module will be RTBC.

wjaspers’s picture

Status: Needs work » Needs review

Updated, attributed, and pushed.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

sreynen’s picture

Status: Reviewed & tested by the community » Fixed

Hi wjaspers,

Thanks for your contribution and welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects, at your discretion.

Now that you've experienced the full review process, please consider reviewing other projects that are still awaiting review. Anyone can help with reviews, following the guidelines.

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

avpaderno’s picture

Title: UC Add to Cart Block » [D7] UC Add to Cart Block
Issue summary: View changes
Issue tags: -