Multi regional dependant catalogue - ideas needed.

Author Message

Nathan Kelly

Thursday 01 September 2005 8:20:30 pm

Hi there.

I'm looking for some ideas and suggestions on how to accomplish/solve a multi national catalogue. I know that's a bit vague so I'll try to explain the situation as best I can.

Situation: -
I am developing a website for a Multi National manufacturer of 'Widgets'. Some of these Widgets differ from region to region. Widgets come in all sorts of shapes and sizes, for instance a Widget that is available in the USA comes in a jar and the standard measurement is a fluid ounce (fl oz), whereas the same Widget available in Australia comes in a bottle and the standard measurement is a millilitre (ml).

Now depending on the region you are in you should only be able to see the Widgets that are available in your area.

e.g. Widget (A) in the USA is a jar that contains 8.4 fl oz of Widget goo, whereas Widget (A) in Australia is a bottle that contains 250ml of Widget goo. It's the same product in a different form.

<i>Note: This site will not list prices as the prices continually fluctuate and it would become a full time job to maintain the prices alone, whereas the products themselves will rarely change.</i>

Lets assume the site uses site access settings for each region following this convention - (USA access is widgets.us) and (Australia access is widget.com.au).

If you access the USA site you should see jars and fluid ounces, if you access the Australian site you should see bottles and millilitres.

Ok so now you know how the site access works I need to figure out how to tell the Widgets where they belong. The way I would like this to work is as follows.

From the admin interface I would like to add Widget (A) to the catalogue, Widget (A) is available in both the USA and Australia. What I would like to do is add Widget A to the catalogue once and once only, I don't want to add Widget (A) to 2 separate catalogues, the reason for this is there are thousands of Widgets to be added to as many as 10 regions and I would like to cut the data entry down as much as possible.

My thoughts are that if I could create a content class/Object? that would allow me to add a Widget with all of the necessary attributes and some how use the site access to identify the attributes that should be displayed I'm home free, but I have no idea how to go about this or if in fact it is even possible.

For this example my Widgets (content class/Object?) would need to store following information.

An image of a bottle for Australia
An image of a jar for the USA
The size of the bottle in millilitres for Australia
The size of the jar in fluid ounces for the USA
Any other information required for Australia
Any other Information required for the USA

I would also need an option to specify the regional availability of a Widget, for instance if Widget (B) is only available in Australia the USA site should ignore it totally.

To access the information I assume I would need to create a catalogue template for each site access that can extract the information relevant to the region accessed.

Questions: -

Did any of this make sence?
If so does this sound possible?
If so, how would I identify the required attributes through the template?
If not, what other options might there be?

I hope that was not too confusing, any ideas or suggestions are most welcome.

Thanks in advance.

Pardon me while I burst into flames...

Salvatore Guarino

Friday 02 September 2005 1:23:09 am

I think that your ideas are good. A step by step guide could be this:
1. Create a new widget class (if you want start with a copy of standard product class) and add all the necessary attributes (image for Australia, image for Usa, size1, size2 etc.)
2. For every site access you have to create a set of override template (one for full view, one for inline view etc.) that show only attributes necessary.
3. For every site access edit the file settings/siteaccess/<i>yoursiteaccess</i>/override.ini.php like this example (for site access usa):

[full_widget_usa]
Source=node/view/full.tpl
MatchFile=full/widget_usa.tpl
Subdir=templates
Match[class_identifier]=widget

Template full/widget_usa.tpl obviously show only attribute for usa.

This is a way...

Bye!

Salvatore

Nathan Kelly

Friday 02 September 2005 2:06:06 am

Ok thanks for your suggestion Salvatore, that sounds like the type of method I need to consider.

My only question is how do I single out the attributes I need. That is how do i define my attributes within the content class and then make the template get the right attributes?

The thing I cant get my head around is the attributes, I know I can specify an image attribute for Australia and an attribute for USA, but what would I do within my templates to filter the required information?

I noticed you mention full view and line view, I gather this is where the answer lies but to be honest I am really not very familiar with the line view thing. I understand the concept of overrides but I have never looked into the line view override, only the full view.

Can I assume the line view override has the ability to gather information from specific attributes?

Sorry if I ask too many questions but for a non programmer it can be difficult to get your head around the methods of ezPublish.

Cheers.

Pardon me while I burst into flames...

Salvatore Guarino

Friday 02 September 2005 3:01:24 am

The full view is used to output an object when you are visiting the object node (i.e when you are visiting an article node). Line view is used, for example, to output the children of the visited node (ie. you are visiting a folder node that contains articles, folder object is output with full template, the article (children) with inline template:

------full  folder template-------
|                                |
|      Title                     |
|                                |
|      Text                      |
|                                |
|   ----inline article tpl---    |
|   |                       |    |
|   |article 1              |    |
|   |                       |    |
|   -------------------------    |
|                                |
|   ----inline article tpl---    |
|   |                       |    |
|   |article 2              |    |
|   |                       |    |
|   -------------------------    |
|                                |
----------------------------------

In your case maybe it's sufficient to create only one line template and use this for every siteaccess, and several full template, one for site access. To output correct attributes you can use these template function:

{attribute_view_gui attribute=attribute [ parameter=value [...] ]}

i.e. to output the short_description attribute you have to use:

{attribute_view_gui attribute=$node.object.data_map.short_description}

It's very important take a look to the template language documentation:

http://ez.no/doc/ez_publish/technical_manual/3_6/templates/the_template_language

Bye!

Nathan Kelly

Sunday 04 September 2005 4:34:31 pm

Thanks for that explanation Salvatore, I have gone over the documentation a few times, though the docs are much better than they used to be I still find it hard to figure out sometime due to a lack of examples and scenarios.

I'll look into the methods you have suggested and see how I go, thanks for your help.

Pardon me while I burst into flames...

Nathan Kelly

Wednesday 14 September 2005 6:48:00 pm

Hi again, I am yet to implement my catalogue but I have identified the general structure of the content.

I would like to hear some more opinions/suggestions and/or corrections on the following ideas that I have been tossing around.

I have started testing some ideas for the catalogue and trying to establish the structure to some degree, in the process it has become a more complex task than I had hoped. I'll try to illustrate the structure and the ideas I have considered to accomplish it.

This is going to be hard to explain, but please try to stick with me!

Basically the catalogue is a paint catalogue so there are many things that need to be taken into account. I have created a class for the product that contains a title, a description and a related object for a.) a USA image b.) an AU image etc.

This class is a container as it will contain other classes/objects such as the following table: -

Series 1 Colours
|-----------------------------------------|
|                 |     Product Code      |
|                 |-----------------------|
|   Colour Name   | 40ml | 250ml | 1Litre |
|-----------------|------|-------|--------|
|[swatch] Name    | 0694 | 0695  |  0696  |
|[swatch] Name    | 0684 | 0685  |  0686  |
|[swatch] Name    | 0674 | 0675  |  0676  |
|                                         |
|repeat rows                              |
|-----------------------------------------|

For this class (Product Colour Table) I have used the matrix datatype, There are a number of sizes ranging from 40ml up to 2Litres so I have made a column for each one in the matrix, most products only come in three sizes but those sizes are different depending on the product/Series. Also the product codes don't change per region.

As you can see I have used (ml) as the standard measurement, if I was to add the US equivalent (fl.oz) I would end up with possibly 50 to 60 columns in my matrix. I figure this leaves me with two choices.

1. Duplicate the Product Colour Table class for each region. The down side to this would mean I would have to do twice as much work to enter the data.

2. Use a custom translation/conversion file? to convert for example(250ml) to (8.4fl.oz) depending on site access and/or translation. This would mean I only have to enter data once, all I need to be sure of is that I have covered every possible size in the matrix and in the translation/conversion file.

Option 2 is the way I would like to go but I am unsure if this is even possible, can I make a custom translation file, and if so how would I instruct my templates to use it?

I hope all of that makes some sense, I'd like to hear what any of you think and any suggestions that may help to make this possible would be greatly appreciated.

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Thursday 15 September 2005 9:16:37 pm

Ok so after hours of trial and error it seems that the <b>complete inflexibility</b> of the matrix datatype is going to cause me a lot of grief to come.

So far I have found it imposable to access the column name attributes so that I can configure the table structure to suit my needs, I have no chance it seems of hiding empty unused columns and there seems to be a rather large shortage of documentation surrounding the implementation of said datatype.

That leaves me to ask the question, can EzPublish handle this type of catalogue or have I just waisted the last 2 months developing a site with arguably the most powerful CMS on the planet only to be let down by lack of the <b>most required feature</b> on the final leg?

The problem I have is I am unable to access the values individually so that I can do what I will with them. If I use these commands I can see all of the attributes and their values but I don't know how to access them within my sections.

input: {$matrix.columns.sequential|attribute(show)}
Output:

Columns Sequential

Attribute 	Type 	     Value

0 	        array 	     Array(4)
>identifier 	string 	     'colour_swatch'
>index 	        integer      0
>name 	        string 	     'Colour Swatch'
>rows 	        array 	     Array(5)

1 	        array 	     Array(4)
>identifier 	string 	     'colour_name'
>index 	        integer      1
>name 	        string 	     'Colour Name'
>rows 	        array 	     Array(5)

2 	        array 	     Array(4)
>identifier 	string 	     'colour_extended'
>index 	        integer      2
>name 	        string 	     'Colour Extended'
>rows 	        array 	     Array(5)

3 	        array 	     Array(4)
>identifier 	string 	     '120_ml'
>index 	        integer      3
>name 	        string 	     '120 ml'
>rows 	        array 	     Array(5)

4 	        array 	     Array(4)
>identifier 	string 	     '250_ml'
>index 	        integer      4
>name 	        string 	     '250 ml'
>rows 	        array 	     Array(5)

5 	        array 	     Array(4)
>identifier 	string 	     '1000_ml'
>index 	        integer      5
>name 	        string       '1 Litre'
>rows 	        array 	     Array(5)

---------------------------------------------
input: {$matrix.columns.id|attribute(show)}
output:

Columns id

Attribute 	Type 	     Value

colour_swatch 	array 	     Array(4)
>identifier 	string 	     'colour_swatch'
>index 	        integer      0
>name 	        string 	     'Colour Swatch'
>rows 	        array 	     Array(5)

colour_name 	array 	     Array(4)
>identifier 	string 	     'colour_name'
>index 	        integer      1
>name 	        string 	     'Colour Name'
>rows 	        array 	     Array(5)

colour_extended array 	     Array(4)
>identifier 	string 	     'colour_extended'
>index 	        integer      2
>name 	        string 	     'Colour Extended'
>rows 	        array 	     Array(5)

120_ml 	        array 	     Array(4)
>identifier 	string 	     '120_ml'
>index 	        integer      3
>name 	        string 	     '120 ml'
>rows 	        array 	     Array(5)

250_ml 	        array 	     Array(4)
>identifier 	string 	     '250_ml'
>index 	        integer      4
>name 	        string 	     '250 ml'
>rows 	        array 	     Array(5)

1000_ml 	array 	     Array(4)
>identifier 	string 	     '1000_ml'
>index 	        integer      5
>name 	        string       '1 Litre'
>rows 	        array 	     Array(5)

I have tried all manner of requests from:

{section show=$matrix.columns.contentclass_attribute_identifier,'colour_name'}
			<th>{$:item.name}</th>
{/section}

To (similar variations of this): -

{section show=$node.object.data_map.xx.content.rows.sequential}
{attribute_view_gui attribute=$node.object.data_map.xx}

{/section}
from the documentation

And many more variations to no avail. I'm sorry I sound so frustrated (I don't intend to offend)

Is there anybody on these forums that has a good deal of experience with the matrix datatype, who may be able to guide me in the ways of presenting matrix data the way a client expects it?

This catalogue is the key feature of the site, if the matrix can't do it, is there any other alternative to the matrix datatype? (other than creating massive amounts of custom classes).

Please help, any ideas / suggestions / knowledge welcome.

Cheers!

Pardon me while I burst into flames...

Lex 007

Friday 16 September 2005 3:09:27 am

Hi,

For question 2, I suggest you write a custom template operator to convert ml to fl.oz

The use would be : {ml2floz(1234,$section)} in your templates.

If section is US, then it is converted and "floz" is concatenated, otherwise, the value is not converted and "ml" is concatenated. You will have to write an ini file to define the sections.

Hope it helps.

Nathan Kelly

Saturday 17 September 2005 7:01:37 pm

Thanks for the suggestion Lex I'll look into that idea when I get past the matrix problem.

I'm doing my head in on the matrix, I've spent almost 3 full days trying to extract information from individual columns but for the life of me can't get it no matter what I try.

I hate to beg but I'm begging, if anybody has any idea how to access column attributes please please help.

Cheers!

Pardon me while I burst into flames...

Lex 007

Monday 19 September 2005 9:27:28 am

Why don't you have a look at related objects with the following contributions :

- http://ez.no/community/contribs/datatypes/datatype_ezobjectrelationbrowse

- http://ez.no/community/contribs/datatypes/enhanced_objectrelation

Create a Color class and assign it (with an object relation) to each of your Colors Series. And each Color codes has several relations with Product Codes objects.

Hope it helps.

Lex

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.