Jump to content

Ideas on page structure and dealing with page references that need to be unique.


spiroue
 Share

Recommended Posts

Hi,

I’m in the planning phase of building a new PW-site (my first). It will have multiple purposes. One is providing information to contact center agents.

It will contain information about stores with attributes like Name, Contact information, Services provided (max 10 different kind of services exists, a store can provide 1 to 10 of them), Opening hours etc. They belong to a country (1 out of 4) and a brand (1 out of 6). A brand can exist in one or more countries

A store can have one or more phone numbers. When an agent receives a call I wan’t to be able to pop a browser window with an url like: www.example.com/phone-number/12345678which loads the page with information about the specific Store. The phone number is the only identifier the call center system has to put into a url

I’m planning to have Country and Brand as parent pages with the different countries and brands as child pages. Then use page reference field to assign Stores to their country and brand. Maybe also do the same with Services provided or is it better to have it as a simple multiple select field?

In order to be able to have the phone number in the url I’m considering giving each number a page and again use page reference field to connect it to a specific Store.

Does this seem like a good approach?

My main concern is how to handle those phone numbers (about 1000). I want to assign a number to a Store. It should not be possible to assign a number to more than one Store but possible to assign more than one number to a Store. How to make it easy to select one Store of a hundreds? How to avoid a number getting referenced to multiple stores?

Store data (meta) will be accessed directly from the DB from another system (eg. getting their names, country and brand etc) when reporting number of calls etc. (with phone number as identifier/key)
Later on I would like to build a REST API using PW to get information on Stores as JSON.

The site will also contain routines and processes, kind of a knowledge base. Some unique to a country or brand, some common for all. Likely to be in different languages.

As you see, quite a lot to take into consideration before building a monster that will be cumbersome to make changes to.

All tips and reflections to get me started much appreciated but mainly on page structure and how to deal with those numbers in a good and easy way.

 

Thanks!

 

 

Link to comment
Share on other sites

Welcome to the Forum @spiroue.

Only one point to start: If you want to process the phone number from the URL, think about URL Segments.

Then you only have a single real page named phone-number which processes the following part of the URL ('12345678' in your example). With that number you may do anything like searching for that number somewhere else. That enables you to simply have a table of phone numbers per store, no need to have one page per number.

  • Like 3
Link to comment
Share on other sites

Hi @spiroue and welcome,

will this be a public website or will all your clients have a login? If yes, you might consider developing a lot in the backend: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/

3 hours ago, spiroue said:

How to make it easy to select one Store of a hundreds? How to avoid a number getting referenced to multiple stores?

Easy with the core field: https://modules.processwire.com/modules/inputfield-page-autocomplete/ (just install it with one click in the backend)

You can do all kinds of custom logic quite easily (depending on your skills) via hooks: https://processwire.com/docs/modules/hooks/

PS: Ther's also @kongondo's great tutorial: 

 

  • Like 4
Link to comment
Share on other sites

12 hours ago, spiroue said:

It should not be possible to assign a number to more than one Store but possible to assign more than one number to a Store.

The easiest way to implement this would be via a Repeater field containing a Text Unique field.

But it feels a little wrong to me to use a Repeater for just a single repeating field (that might just be me) and the UI would be a bit more bulky than necessary. So personally I would be inclined to use a more streamlined repeating fieldtype such as Multiplier or Table. Then in a Pages::saveReady hook you do a $pages->count($selector) to check if any stores are using any of the submitted phone numbers and if so you reset the value for that number and show an inputfield error. If you need any tips for coding that just ask when you get to it.

P.S. It seems like you could use Multiplier with Text Unique specified as the field type to multiply, but I tested it and the uniqueness is not enforced when these modules are combined.

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...