Jump to content

Editable List


Zeka
 Share

Recommended Posts

Hi. I am quite new to processwire and want to use it as an alternative to Joomla with seblod. I need some advise how i can implement editable list of items ( articles ). For example we have 20 products with different fields and prices field one of them.

How can I display an editable list of the products displaying only some field from them.

Here some screenshot:Editable%20List.png

Link to comment
Share on other sites

@Zeka,

There would be several ways to do what you want and it will depend on some factors.

I would guess that the majority of PW sites that configure products would be using pages to store the products (1 product per page);

Your product template would contain these fields:

  • product_name
  • qty_per_unit
  • unit_price

You could either use the ProFields lister to make your list as above, or create a page-table on the parent page of the products and then when you view the product parent page you would see that list.

- - - -

However, if your needs are simpler, then you could use ProFields Table to make a table like you have, and then you would actually be able to edit the fields inline like that.

With pages you would have to click to get a modal and then edit the 3 fields.

- - - -

And then there is yet another way you could do it using a hybrid of both things described above; I'm actually doing this 3rd approach on a site now (and the reason is to save time on entering many rows really fast, but we need the products to be pages for other reasons..)

1.) setup the ProFields table with the fields (and it would look almost identical to your screenshot)

2.) write a simple module to create products (using pages) when you save the page containing the table. The module would cycle through the table and check to see if the product already exists, and if it doesn't it would create the product; it would also check each page-product for changes/edits to the fields and update as necessary; so your Table would become sort of a proxy entry-instrument for the product-pages;

  • Like 4
Link to comment
Share on other sites

hi zeka, welcome to processwire :)

i switched from seblod to pw some months ago and i hope you will enjoy your move as much as i do! you will be impressed by the great community and the fast and knowledgeable answers you will get here, i'm sure (knowing the pain with seblods forum support...).

to your question... coming from joomla/seblod you have to change your mindset a little bit, i hope that i can help you with some comparisons:

articles/items (joomla/seblod) = pages (pw)

in pw everything is a page! thats very important to understand. pages can store any data you want. it's like in seblod everything is stored in joomla articles, pw stores everything in pages. pages can have completely individual set of data-fields (eg. headline, body, images, starttime, endtime etc.). this setting of fields is defined by "templates":

content types (seblod) = templates (pw)

in your templates you define which fields will be available in your page. some examples:

template "blog-post.php"
# field "title"
# field "body"
# field "author"

template "product.php"
# field "title"
# field "description"
# field "price"
# field "image"

so if you created a new page "product" you would only have the fields "title, desc, price, image" available for editing.

list&search (seblod) = selectors (pw)

forget list&search types!! selectors are the way to go with pw ;) say we want to display some products with template "product" from above:

$products = $pages->find("template=product, price>100, sort=price");
foreach($products as $item) {
    echo "<a href=\"$item->url\">$item->title</a><br>";
}

see here for a quick glance: http://processwire.com/api/selectors/ (yes, everything is very well DOCUMENTED - that's another huge difference to seblod ;) )

don't try to bring editing features to the frontend unless it is REALLY necessary

joomla has a very complex backend, so i tried to hide this complexity for my clients by giving them edit access only for some parts of their website from frontend. processwire's backend is so simple that you will not need to hide it from your client ;)

anyway: if you have some experience in seblod, i think you will learn pw really fast and enjoy how clear and simple everything can be ;)

and now put everything together: https://processwire.com/talk/topic/693-small-project-walkthrough-planets/

if you have no dev-environment you can instantly setup a fresh copy of processwire here for free: https://lightning.pw/

have fun with processwire :)

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...