Contao Open Source CMS > Contao forum

Switch to german forum

Index > Extensions > [catalog_ext] Catalog Extension Module

thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
Hi Everyone

The Catalog Extension allows you to extend the Catalog with new features, front-end modules and more. Check out the wiki below. I've decided to move the discussion to a seperate topic, as it was starting to clutter the catalog topic a bit.

Basic Summary:
  • Adds jumpTo to Catalog Reader page
  • Searchindex integration (optional)
  • Reference lookup and template integration for select/tags
  • Catalog Filter Module: build your filter on field values, range, date, search
  • Catalog List Module: displays a list of items responding to the filter above
  • Catalog Reader: displays item detail view + reference info (jump links to other catalogs)
  • Catalog Notify: creates contact form for clients to send contact info on catalog item (used on reader page)
  • Catalog Featured: selectable number of (random) items filtered by a preset condition
  • Catalog Related: show related catalog items (except current) with selectable matching parameters
  • Catalog Reference: show child catalog items where a selected reference field is matching the current viewed parent item.


Wiki:
http://dev.typolight.org/wiki/ExtensionsCatalogExt

Catalog Module (required by this extension) discussion topic:
http://www.typolight.org/forum/topic/1599.html
Last edited by thyon, 2009-02-23 10:35
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-22 15:19
iconQuote:
I specifically created the Catalog Filter module to do just that. I am developing a dealer network for one of my clients using the catalog module. They have dealers based on province (region), which is in another catalog. The Catalog filter can then be easily set-up to filter by province. You can position the Catalog Filter in the left/right nav to create a menu as its already an UL/LI set. You can even create a map to click on.

I didn't see any subcategory functionality. Do I need to specify this in any specific way???
2008-05-22 15:52
thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
maybe I misunderstood. the catalog allows you to choose a select parent root point, but it still obtains a linear list from all the children, e.g.

Taxonomy
[+] Genre (genre)
- Action Adventure (action)
- Driving Simulation (drive)
- First Person Shooter (fps)
[+] Available Formats (formats)
- Playstation 3 (ps3)
- XBOX 360 (xbox360)
- Nintendo Wii (wii)

Then you can choose e.g. Genre as the select parent and all the sub-items will appear in the select drop-down.

At the moment there is no way to create a category tree and have items displayed as that. Scare was working on that, but he gave up. A similar idea would be to have Catalog Categories as another back-end module, like Site Structure -- which provides a root point for the article to attach. In a similar way, the Catalog Items could attach to a root point in the catalog Categories.

In this case above, the Categories module would have to contain the parent catalog and define its items, and the "article" or items would just add an item into the category point.

There are just so many ways to do it, its too much to think about. I want linear categories, so I'm safe for now.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-22 16:26
thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
i've changed the way the Catalog Filter module works. Now there are checkbox Enable's for search/filter/range/sort, this works better, so you now have to select at least 1 field if you enable a section.

I've also added the ability to search in selects, but tags is proving to be quite a nightmare, but I'll be able to do it with lots of repeat queries (not the most efficient). I'll upload this version when I've figured out the tags.

Also, if you remove the search field and range fields (e.g. post with blanks), it now also removes them from the query, so you can keep your filtering specs, but clear a search string.

Remember that you can have multiple Catalog Filters on a single page, e.g. (1) Left Nav (for Category browsing), and (2) above the Catalog list for sorting and searching and (3) Right Nav for range variables, e.g. price.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-23 09:53
I like the idea of clearing a search field but keeping the other filter settings. I wanted to sggest the possibility to add filter specs and add a "remove" button next to each spec so they can be removed. This is something that would work very well with tags; find me all fruits that are green, round and grow in trees. But then later remove the tag "round" but keep the other two filter settings. (In this example "green, "round" and "grows in trees" are all tags in the same taxonomy collection and they are all in a single property field of a catalog item.)

That last feature is actually pretty nice, wouldn't have thought that would work.

You could send me the code as far as you have it right now and just pseudo code a bit and I'll finish searching inside tags. Perhaps you'll sleep better then ;) Or would you like to do it yourself?

I changed my mind about the categories. I'll use layered navigation, my boss liked the idea as well. Making a catalog category module might be an idea though and perhaps it is easily copied from site structure. I'll take a short look at that tomorrow. But since I don't need that any longer I'm not certain about the result, if I'll ever attempt to make that module...
Last edited by Ruud, 2008-05-23 11:10
2008-05-23 11:05
spirelli
User
Avatar
Thanks for continuing your effort with this! I'm thinking to upgrade to the latest version, but it almost sounds as if I should wait until the next one comes out.

What is the process for updating?
Last edited by spirelli, 2008-05-23 11:31
2008-05-23 11:31
Thyon, I've made a change to the extention that I think is usefull. When adding an image field to the catalog you can select the option for multiple images. These images get the rel="lightbox" added. But this means you can click one image and then have the javascript display only display this one image. The next and prev buttons are missing. So to be able to show all images I made a very simple adjustment which I hope you'll include in your extention.

In file ModuleCatalog.php around line 606:

iconCode:
< $files = $fieldConf['eval']['catalog']['multiple'] ? deserialize($raw) : array($value);
---
> $files = $fieldConf['eval']['catalog']['multiple'] ? deserialize($raw) : array($value);
>
> $lightboxId = count($files) > 1
>                      ? "[{$this->type}-{$this->id}]"
>                       : '';

< old
> new

And a bit further in the same file:

iconCode:
< $locValue = "<a ".($file->isGdImage ? 'rel="lightbox"' : '')." title=\"$alt\" href=\"$path\">$text</a>";
---
> $locValue = "<a ".($file->isGdImage ? 'rel="lightbox' . $lightboxId . '"' : '')." title=\"$alt\" href=\"$path\">$text</a>";

Hope this is usefull...

One note: I took type plus id from the reader class as lightbox id. I think a different id should be taken, anything unique to this object will do...
Last edited by Ruud, 2008-05-24 12:16
2008-05-24 12:07
thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
thanks. I was going to add the support for images, e.g. main image and image gallery and have an option to merge their lightboxes as well. Sometimes you need to select a main image in a seperate field as the image_gallery, and its been a pain having two lightboxes for those as well. As per discussion in the catalog module. I'll also be adding an image size and margin override in the Catalog List FE module so the list can have different sizes from the values defined in the catalog itself (used by Catalog Reader).

i'll take a look at the code.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-24 15:33
Sounds like you're two steps ahead of me. But that's good.

When will you upload a new version?

Is there the possibility of filtering based on properties of referenced catalog items (via select). So you have catalog1 (name, catalog2-select) and catalog2 (name, type). And for each catalog1 item I need to assign one catalog2 item. I would like to filter catalog1 based upon the catalog2 name and also be able to do so on type.

catalog1
Max, german sheppard
Pluto, border collie
Sheeba, bengal

catalog2
german sheppard, dog
bengal, cat
border collie, dog

I would like to filter catalog1 based upon type (dog) and also filter it on catalog2 name (border collie) later. This will only select pluto right now.

Currently I am able to filter on one of those if I set the foreign key value column to the one I want to filter on...
Last edited by Ruud, 2008-05-24 16:00
2008-05-24 15:59
thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
this just becomes inefficient on the database level, as i don't think its possible to construct queries in 1 line for that. It will require another query to obtain the related field names anyway (as scare doesn't store them in the DCA), which makes the whole process very tedious, memory hungry and time-consuming on your server. They might even toss you out next month! ;)
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-24 18:21
Ok! Then I'm thinking of a change for the select option. Perhaps under "Table value column" there can be an option to select additional fields that can be searched/filtered for. Is this something that can be made inside this ectention or should they go into the catalog module?
2008-05-25 00:19
thyon
User
Avatar
Posts: 1756
Cape Town, South Africa
that should ideally be in the original. Then I can update my ref field searching to display and search only these fields.

Ok. Now I'm going to focus back on the core functions I need an I'll release those shortly. So I might ignore any new requests for a bit.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
Manuals: QuickPoll, FormAuto, EventsAttend, Galleries, Invitations, Catalog, Catalog Ext, Catalog Tutorials, Catalog Multi-language Tutorial
2008-05-25 08:49
I'm not sure if this can be done, but I'm trying to use the Catalog as a paypal store. What I have been having trouble with is customizing the gallery list template so that I pull the fields of each item and manipulate them. I feel like a newbie asking, and I'm sure the answer is either no or simple, but I could really use the help. In case you don't understand what I'm asking for I'll give you and example.

This is how its displayed in the Catalog Listing Module (bold items are the field values, italic is the label):

Photograph Name Lago Chuisi Pano Ver. 2
Gallery Name Italy
Size 1 6x8
Size 2 8x12
Size 3 12x18

The back end of that:

iconCode:
<?php foreach ($this->entries as $entry): ?> 
<div class="<?php echo $entry['class']; ?>">

<?php foreach ($entry['data'] as $field=>$data): ?> 
<?php //if (in_array($field, array('image','title','genre','price')) && $field['raw']): ?> 
<div class="<?php echo $field; ?>">
<span class="label"><?php echo $data['label']; ?></span>
<span class="value"><?php echo $data['value']; ?></span>
</div>
<?php //endif; ?> 
<?php endforeach; ?> 

<?php if ($entry['link']): ?> 
<div class="link"><?php echo $entry['link']; ?></div>
<?php endif; ?> 

</div>
<?php endforeach; ?>

What I want is to display it like this:

Lago Chuisi Pano Ver. 2
Gallery Name Italy
Size: [dropdown] (6x8,8x12,12x18)

This isn't exactly what I'm doing, but the answer should point me in the right direction.
2008-05-27 21:13
Keyj,

Templates are php scripts. $entry contains everything you need. you can print_r($entry); and see everything that is inside... Below is the code you asked for, but it comes without any warranties.

iconCode:
<?php foreach ($this->entries as $entry): ?> 
<div class="<?php echo $entry['class']; ?>">

<h2><?php echo $entry['data']['photographname']['value']; ?></h2>
<span class="label"><?php echo $entry['data']['galleryname']['label']; ?></span>
<span class="value"><?php echo $entry['data']['galleryname']['value']; ?></span>
<span class="label">Size</span>
<span class="value"><select>
<option value="<?php echo $entry['data']['size1']['raw']; ?>"><?php echo $entry['data']['size1']['value']; ?></option>
<option value="<?php echo $entry['data']['size2']['raw']; ?>"><?php echo $entry['data']['size2']['value']; ?></option>
<option value="<?php echo $entry['data']['size3']['raw']; ?>"><?php echo $entry['data']['size3']['value']; ?></option></span>
</div>
<?php endforeach; ?>
2008-05-27 22:44
Your help is more then appreciated. This is exactly what I needed and more.
2008-05-27 22:58