Problem

After a fresh commerce install I went to /product/add/default where I can see the following text:

Products can't be created until a store has been added. Add a new store.

"Add a new store" links to "/store/add?destination=/product/add/default". Since however I only have the 'default' store type the "/store/add" page tries to redirect me to "/store/add/default" but it can't because of the destination query. So I end up on the same "/product/add/default" page.

Proposed resolution

Check the number of store entity types and link to "/store/add/[store-entity-type]?destination=/product/add/default" if there's only one.

Comments

czigor created an issue. See original summary.

harings_rob’s picture

Assigned: Unassigned » harings_rob
harings_rob’s picture

PR: https://github.com/drupalcommerce/commerce/pull/350

I have added a helper function as we need this link on multiple places.

Now it will send you to the add_form directly if there is one store type, in other cases it will send you to the add_page.

harings_rob’s picture

Status: Active » Needs review
harings_rob’s picture

Now that I see https://github.com/drupalcommerce/commerce/pull/347, we might want to create a helper class for this sort of functions in commerce_order as wel?

bojanz’s picture

Title: "Add a new store" link on "Add product" page » Broken destinations on product/order "Add store" links

  • bojanz committed b6e2283 on 8.x-2.x
    Issue #2680901 by harings_rob, bojanz: Broken destinations on product/...
bojanz’s picture

Status: Needs review » Fixed

We ended up removing ?destination cause there's no way to make it work well (if you go to add-page to select a bundle, then that link loses ?destination)

Committed, thanks!

EDIT: D'oh, forgot to give commit credit. I'll make up for it in another commit :)

Status: Fixed » Closed (fixed)

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