Re: Catalog BE Configuration
Hi thyon,
I tried to format a catalog field of type "number" with the appropiate format-type "number". Is it possible to format a field input value of e.g. "10000" to output "€ 10.000,-" (i.e. with the currency symbol, the separation mark, comma and dash). What formatting string I have to use in the "format string" field?
Many thx, xchs
NB: In my PHP manual I found some information about string formatting like this
Code:
$money = 63.14;
printf("DM %0.2f", $money);
but though I tried several times, none of that worked...
Re: Catalog BE Configuration
This is clearly explained in the manual here:
http://dev.typolight.org/wiki/Extension ... cimalfield
Remember to ONLY add the format string part. Also, you were mixing number format and sprintf() formatting, no wonder it didn't work.
Re: Catalog BE Configuration
Hi thyon,
thank you for your reply.
I know the catalog wiki's, but there I only found the way to declare the number of decimal digits. As I have seen now on http://us3.php.net/manual/en/function.number-format.php, I can also add the separator for the decimal point and the thousends separator. Is there no way to add also the currency symbol?
I tried also instead of field type "number" the type "text" and to insert in the field directly the string "€ 10.000,-" but than I have problems with the catalog filter module and the range options...
Re: Catalog BE Configuration
Just leave it as number and number format [2] and then add the Currency symbol in your CUSTOM template -- you'll have to write your own template to add this in then, a standard template usually doesn't work in most catalogs anyway.
Field: number
Format Type: number
Format String: 2
You can also use the format type as "string", and this will not interfere with your range, etc. as these are checked with the stored DB value, not the formatted value. You also didn't specify what problems you're having??
Field: number
Format Type: string
Format String: € %0.2f
Re: Catalog BE Configuration
Many thanks, now it works.
I always thought I have to use for the field type "number" also the corresponding format type "number", instead of e.g. "string"...
As you specified
Quote:
Originally Posted by thyon
Field: number
Format Type: string
Format String: € %0.2f
this now just works fine.
Only one thing I observed: If I am in the BE view of a catalog field, any changes I made get only updated in FE view if I use the "save and close" button. Using only the "save" button I see no changes after reloading the FE page...
Re: Catalog BE Configuration
this has to do with the regenerate DCA function, which is only called when you view the field list, not when you edit a field item. this will be obsolete in the new version, as the DCA is always dynamically generated from the database.
Re: Catalog BE Configuration
Re: Catalog BE Configuration
Hi thyon,
may I ask you another question regarding the catalog number formatting option concerning the PHP number_format() function.
As I've seen on the PHP manual this function format looks like
Code:
string number_format ( float $number , int $decimals , string $dec_point , string $thousands_sep )
Like indicated in the referenced examples on that site
Code:
<?php
$number = 1234.56;
// english notation (default)
$english_format_number = number_format($number);
// 1,235
// French notation
$nombre_format_francais = number_format($number, 2, ',', ' ');
// 1 234,56
$number = 1234.5678;
// english notation without thousands seperator
$english_format_number = number_format($number, 2, '.', '');
// 1234.57
?>
I tried to add to my catalog number formatting string one of the following character strings (to get something like 10.000,00 with 'point' for thousands separator and 'comma' for decimal separator):
Code:
2, ',', '.' (with blanks between each parameter)
2,',','.' (without blanks)
2, ",", "."
2,",","."
but without success. Do you know what can be wrong with these strings?
Greetings, xchs
Re: Catalog BE Configuration
<Sigh>
Again, as explained in the manual, you can only specify the DECIMAL DIGITS. The function automatically uses the TYPOlight's assisgned comma and decimal seperators, so you don't have to enter those at all. You can change them through TL's internal settings.
http://dev.typolight.org/wiki/Extension ... cimalfield
Re: Catalog BE Configuration
Ok, now it's clear.
I only thought that I can use this formatting string to overwrite the standard separator setting...
So long,
xchs
Re: Catalog BE Configuration
Hi thyon,
I have two questions regarding the catalog modules:
First, I want to ask you if it would be possible to add all of the catalog items to the TYPOlight search index? I have a multilingual site with two page roots ("de" as so called main language and "it" for the second language). As described in the "Catalog Multilingual Tutorial" I duplicated all the fields that needs to be translated in the main catalog. Then, in the catalog properties I chosed the option "Searchable", as "Condition" I placed "published=1" and for the "Page title field" I selected my title field (for the main language). When I then rebuild the TYPOlight search index all pages were listed from both languages, but only those catalog item pages form the main language "de" (none for the second language). Even if I try to choose in the catalog settings for "Page title field" the title field of the second language "it", there are always only the item pages of the main language. Also, if I go to the TL site structure and to the respective page root (for "de" and "it") to rebuild the XML sitemap files, the items are only generated for my main language. I tried also to omit the field "Condition" and to choose for "Page title field" the option "-", but with the same results. I have no idea what can be wrong or what I can do to add all my catalog items (for both languages) to the TL search index and to the sitemap files.
My second question refers to the taxonomy module: I added several entries with corresponding subitems, then on my catalog I added a field of type "tags", for the option table I chose the the table name "tl_taxonomy", for table value column I chose "name" and for the sorting column "name". However, on my catalog reader page I noticed that the taxonomy tags aren't sorted alphabetically, but sorted in the way like I have entered (FIFO). Even if I choose for the sorting column "sorting" there is still the same sorting output. Do you know somewhat what I can do to achieve an alphabetically sorting of the tags (if ever possible)?
Many thanks, xchs
Re: Catalog BE Configuration
What you're trying to do with the [x] searchable option is not engineered or possible for multiple languages. There can only be 1 index of any 1 catalog, you cannot have multiple indexes of a catalog.
The [ TITLE ] field in the searchable option is not what you say it is. Its very simple. Its the page title for that item, just like NEWS as well. When the indexer indexes the page, it replaces the title with the value you've selected instead of the default -- which would be "Catalog Reader" of whatever you called that page. If you visit the reader page with an item, that is the value at the top of the browser's title bar.
I have tested the [TAGS] again, and it is working as expected, both with a tl_taxonomy table and another catalog as its source. You can sort on any field, e.g. ID, name, sorting values, they all do exactly what they are supposed to.
What you are forgetting is that the catalog creates a static matrix to reference the DCA. This is only built in certain conditions, e.g. you list all the fields for the catalog OR you show the list of items for a catalog -- BOTH in the back-end. You can manually re-generate the DCA with the Regenerate DCA button at the top of the catalog. Therefore, if you change the taxonomy, you have to go back to the catalog and either list, edit or regen the DCA, as the catalog DCA is NOT automated in this current release (this has already been deprecated in the next release).
Re: Catalog BE Configuration
Hi thyon,
Quote:
Originally Posted by thyon
What you're trying to do with the [x] searchable option is not engineered or possible for multiple languages. There can only be 1 index of any 1 catalog, you cannot have multiple indexes of a catalog.
Ok, so I guess it would be the only possible solution to add on separate catalog per site language.
Quote:
Originally Posted by thyon
I have tested the [TAGS] again, and it is working as expected, both with a tl_taxonomy table and another catalog as its source. You can sort on any field, e.g. ID, name, sorting values, they all do exactly what they are supposed to.
What you are forgetting is that the catalog creates a static matrix to reference the DCA. This is only built in certain conditions, e.g. you list all the fields for the catalog OR you show the list of items for a catalog -- BOTH in the back-end. You can manually re-generate the DCA with the Regenerate DCA button at the top of the catalog. Therefore, if you change the taxonomy, you have to go back to the catalog and either list, edit or regen the DCA, as the catalog DCA is NOT automated in this current release (this has already been deprecated in the next release).
I'm also still trying to sort my taxonomy entries alphabetically, but it seems not to work as expected, even if I regenerate the DCA. I've attached a screenshot of my actual settings. In the BE view all taxonomy items are displayed in alphabetically order, however in the FE view the items are displayed in the order as entered in taxonomy. I'm using also a modified version of the catalog_full_ref.tpl Template.
Here the part of code that matters:
Code:
<?php foreach ($entry['data'] as $field=>$data): ?>
<?php if (strlen($data['raw']) && !in_array($field, array('catalog_name','parentJumpTo'))): ?>
<?php if ($field == 'equipment'): ?>
<div class="field equipment">
<?php if ($data['ref']): ?>
<ul>
<?php foreach ($data['ref'] as $id=>$ref): ?>[*]
<?php foreach ($ref as $col=>$value): ?>
<?php if ($col == 'name'): ?>
<span class="item">
<span class="value"><?php echo $value; ?></span>
</span>
<?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?>[/list]
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
Maybe I have to to modify this template with the query structure? What do you think?
xchs
Re: Catalog BE Configuration
I see what you're trying to do now, as you didn't explain it very clearly that you're not talking about the actual tags values, you're talking about the REFERENCE array attached to that tags, coming from the remote table.
The reference items provided in the catalog template array are not queried as another catalog, they are simply retrieved as they appear in the database table -- RAW. You are manually supposed to sort/edit/group them yourself as you see fit as its just raw data -- this data structure was provided for people who wanted it at a low level, not using is as a module for display with ordering controls.
What you're interested in is actually quite simple. Just place a Catalog Reference Module onto the page, which will link to the fields you need and that will then use the correct catalog sorting orders are you've specified.
Re: Catalog BE Configuration
Ok, I will try this with the Catalog Reference Module as supposed by you.
And sorry for my poor english knowledge! Certainly, I didn't explained very well what I'm trying to do.
So long, xchs
Re: Catalog BE Configuration
So your situation won't work because you are using the tl_taxonomy and the Catalog Reference will only work for another catalog. I've added a sorting routine to the reference array, as it was quite simple to add it to the latest build 13+. You can just update to that and the sorting will work as you expect it to. I know not everyone will be able to sort using sort() in php, that's why I thought it made more sense doing it the way you suggested, as you already choose the sorting order in the BE. I just never thought anyone actually used the reference array for anything, until now - LOL.
Re: Catalog BE Configuration
You are really great!! ;)
Ultrafast post answers and excellent module support!
Many, many thanks for your patience, I greatly appreciate it.
Re: Catalog BE Configuration
Just updated the module... and - suprise, suprise now it works!!! Many thanks again!!
Re: Catalog BE Configuration
Hi thyon,
may I ask you another thing (feature request) regarding your catalog extension.
As you know, I'm working on a bi-language website (de | it). Like described in the tutorial I've duplicated all those catalog fields that needs to be translated. One disadvantage of this approach is that I have to duplicate nearly all the fields, even for the case when only the field label has to be translated (and not the value itself), e.g. when I have a field with the offered price, in german I would have the label "Preis", in italian the label "Prezzo", the value of this two fields is always the same (e.g. "10000") and has to be entered twice. This way, the item edit page tends to be pretty long (depending of course on the number of defined fields) and needs some page scrolling to feed all the information. On the other side an advantage of this method is that this way I only have to work on one catalog and to edit only one page (per item), instead of defining another catalog for the other langugage.
As you know, since TYPOlight >2.7 the backend provides the so-called "2-column collapsible layout". So I thought, it would be nice to have also for the catalog item edit page a way to select (if desired) a 2-column list view. Especially, for a bi-language website (with duplicated catalog fields) this layout has the adavantage to place the fields of the main language on the first column and the corresponding fields of the second language on the second column. This way the page length would be much shorter... I don't know very well, but I think that there must be inside TL some core functions that just provide this functionality.
Of course, not everybody wants to have a 2-column layout. So there must be somewhere a select box (for example on the catalog header page) to activate/disactivate this layout option.
What do you think of this idea?
xchs
Re: Catalog BE Configuration
Hi @ll,
I try to give the Items of an catalog an Alias for better url's. Therefor I created an field Named Titel with the type=text, Checked title-field, set it mandantory and single use (don't know the real engl. Name for that).
Then I go to the catalog settings and look at Alias. But there is nothing in the dropdown..
I think i missed something.. but i don't know what it is.
Can someone give me an hint?
regards
Re: Catalog BE Configuration
Look at the Catalog manual, you have to add an ALIAS field to your catalog. Use your title field in the dropdown as the source for your alias field.
Re: Catalog BE Configuration
Oh i got it...
I have to make an Alias Fild like all other alias field in TL... with an Refernz to an Title..
And after that I have it at Alias in the main Configuration...
I was a little bit confused with all the alias filds.
But now I get it.
Thanks again thyon!
regards