Comments

vasike’s picture

Status: Active » Needs review
StatusFileSize
new3.44 KB

here is patch that propose a solution for this feature request:
- adds a new checkout setting for disabling the cart page
- use hook_menu_alter for a custom callback for redirection
- use hook_form_FORM_ID_alter for hiding the cancel (back to cart) button.

vasike’s picture

StatusFileSize
new3.44 KB

the previous patch seems to have a bug for a module_load_include() call - wrong file name.
there is a new one that should fix it.

dwkitchen’s picture

I was thinking the setting would be on the pane's setting page

admin/commerce/config/checkout/form/pane/cart_contents_form

rather than on the checkout settings page.

vasike’s picture

i didn't use the pane settings as it deals with checkout pages and it "affects" the checkout process.
it doesn't seems "right" to be "hidden" in a Checkout pane setting.

damienmckenna’s picture

Title: Disable the cart page » Option to disable the cart page
StatusFileSize
new3.59 KB

There was a small flaw - when the setting is changed it doesn't trigger the necessary menu rebuild. This patch triggers a menu rebuild if the setting changes, and adds a note to the checkbox explaining that this will happen.

damienmckenna’s picture

StatusFileSize
new4.8 KB

There's a problem with redirecting to the checkout page if there's no cart - the visitor will automatically be redirected to the homepage (or wherever the variable commerce_checkout_empty_redirect defines). So this version adds a new option to control that. It also hides this new option if the main "Disable the cart page" option is disabled.

damienmckenna’s picture

StatusFileSize
new0 bytes

This adds hook_uninstall() for the two new variables.

damienmckenna’s picture

StatusFileSize
new5.67 KB

The last patch missed a change to commerce_cart_form_checkout_pane_cart_view().

This patch adds an option to select a default product which will be added to the cart should it be empty upon arriving at the checkout page; without this option, if someone loads the cart page they will be automatically redirected to the homepage.

I've also added commerce_product and commerce_line_item as dependencies, just because those are specifically used on the cart page callback.

damienmckenna’s picture

StatusFileSize
new9.22 KB

Whoops, the last one was missing some things.

damienmckenna’s picture

Status: Needs review » Fixed

Because this new code is 100% new and doesn't affect the existing module, I decided to spin it off as a separate module:

https://www.drupal.org/project/commerce_auto_checkout

I've also made vasike a co-maintainer.

Marking this fixed.

Status: Fixed » Closed (fixed)

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