2

Here's the scenario: There's a store that has both a physical department and a web shop (expresso store). The thing is they both share the same inventory. So when someone buys something in the physical store, the inventory in the web shop doesn't match up anymore.

What I want is to make a frontend interface that lists all products, and have the ability to update the stock by either increasing or decreasing it without having to log into the backend. The reasoning being that it's much more cumbersome to do in the backend, and you have to find the product, open it to edit the stock, then save it.

If it could be done in the frontend, the stock adjustment could be done on the same page as the listing of the products.

Is there any way to accomplish this?

1

Managed to solve this problem with exp:channel:form

Edit

Jeremy: ah yes, sorry, my bad.

Here's what I did.

1) First I used {exp:store:product} to get the product data as per usual

2) Then, I used {exp:channel:form} to access the fields I wanted to edit (i simply inspected the fields in question from within the control panel, and matched the name="" attribute of the fields I wanted to edit. The whole thing looks like this.

    {exp:channel:entries
     channel="produkt"
     category="{cat_id}""
     status="promotert|open"
    }
     {exp:store:product entry_id="{entry_id}"}
      {exp:channel:form
       channel="produkt"
       entry_id="{entry_id}"
       return="varelager"
      }

      <!-- Name of product -->
      <input type="text" name="title" id="title" value="{title}">

      <!-- Stock qty -->
      <input type="number" name="store_product_field[stock][0][stock_level]" id="stock" value="{total_stock}" pattern="[0-9]*">

      <input type="submit" value="Save changes">
    {/exp:channel:form}
  {/exp:store:product}
 {/exp:channel:entries}
  • It'd be great if you could elaborate about how you solved it to help others in the future. – Jeremy Gimbel Jan 24 '14 at 21:11
  • Glad the suggestion helped Stian. For anyone else looking to do something similar you can output the entire Store Product Details field via the Channel form if you want a quick way to edit from the front-end. You just wont have much control over the look and feel. Alternatively you can call out individual fields as in this example. – Ian Jan 26 '14 at 21:56
1

Another option rather than specifying the individual html fields is simply to output the whole Store Product Details field.

Assuming your custom field is named product_details, it would look like this:

{exp:channel:form channel="products" entry_id="{segment_3}"}

    {field:product_details}

{/exp:channel:form}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.