Ask about the Front-End (FE) Modules and the templates used by them.
Printable View
Ask about the Front-End (FE) Modules and the templates used by them.
I hope this is the correct section. I'm having a tough time getting a specific thing to work and I'm not sure where to start exactly. Currently I have a catalog list of items, each item is assigned to a category in taxonomy. I'm using a filter dropdown on the page, and everything works as it should. My problem is that I'd rather not have the entire catalog listed on the default page for the store, but rather have it default to the items assigned in the first category of the dropdown. In fact, I'd rather not have the whole catalog viewable at all on the default 'Select' option. I've tried enabling the conditional list, which goes so far as to stop listing the entire catalog, instead showing 'Please first select the following filter(s):' message. So I'm not sure where to go from here, or what to edit.
My second issue is that I'd like to include a heading for each section which I know involves a template for sure, and I've come close, except that the foreach puts the heading above each item instead of just once at the top of the page. I imagine I just need to use a different function to extract the value. Something like if all the entries 'data' 'section_id' 'value' == 'CDs' then display the header once. I can probably figure this out later, but if you know the function I'd need I'd appreciate that too. Thanks for any assistance!
hey visigoth
This is obviously not a general release FE module function, but a custom catalog thing, maybe just for your site.
You can simply place a redirect on your page, so that if it tries to launch the page with a "blank" catalog (no parameters), that you redirect it to the URL containing the filter already, e.g. just click on the filter and then you get the "base url" if its blank, redirect to the "new base url". That is the simplest solution.
The filtering won't do what you're looking for, and the conditional listing should only be enabled together with a tree-based selection staging, e.g. area, city, town. Its designed to prevent listing until you've made a selection, it doesn't detect if a selection is already at a certain value.
Sometimes its more effort, but you can use the page method to split the catalog into sections, each listing a custom condition that only lists the catalog for that category/page. Its a little more effort but if you use the page_id as your categories, you can create a module that uses the page_id as its automatic filter for all catalog listing pages.
Thanks for the reply, I do appreciate it. I think I'll try just going with the page method. For this I would basically have to create a separate catalog for each section, say one for cd's and one for vinyl and have them listed on their invidiual pages. So if I have a taxonomy section called item_browse listing tags of cd and vinyl, I can't just use one catalog and have it pull just the CD's with the condition? ie item_browse='cds'. I must not be understanding the regular condition feature properly. I was hoping to avoid multiple catalogs but it may be the easiest method. Thanks so much for working with the community on this extension, its really amazing, and I'd be at a major loss without it. Thanks!
Nope, You can still create 1 catalog with a pageID field, which you can then use in the conditional clause to filter the catalog by that "page"' ID value.
First create 3 pages (as categories, e.g. CD's, Vinyl, etc.) then create a category field that uses the tl_page as its tablename and then the pagename (or page title) as the display field and then use the sorting value as the sort field. Then create 3 catalog items, 1 in each category (as a drop-down) to test that you only get 1 item per page.
Then you create a SINGLE catalog list module and within the list module, go to the catalog condition block and enter the following information:
TL will then automatically substitute the current page ID into the inserttag above (the {{ss:ss}} part) and then I'll evaluate the statemant as category=2 (if the page_id was 2). Then you will ONLY get a catalog list with the category of your choice.Code:category={{env::page_id}}
PS. You can find out more about inserttags here: http://dev.typolight.org/wiki/EnglishInserttags
You can then assign the Catalog LIST module to the page layout for all your pages, so you don't have to create many catalog list modules either. You can also have a single catalog reader where the JumpTo page points to.
It would also be possible to assign the {{env::page_title}} into the HEADING section of the module, so it will automatically label the heading as your current page title at the top. Otherwise if you're trying to create a group heading (different from your main group of CDs, vinyl, etc. then you can use an interator to perform that.
[code=php:1wb14uvc]<span class="syntaxhtml">
<?php*oldheading*=*'';*?>
<?php*foreach*($this->entries*as*$entry):*?>
<?php*if*($oldheading*!=*$entry['data']['myheading']['value']):*?>
<?php*$oldheading*=*$entry['data']['myheading']['value'];*?>
<h2*class="heading"><?php*echo*$entry['data']['myheading']['value'];*?></h2>
<?php*endif;*?>
...
...
...
<?php*endforeach;*?>
</span>[/code:1wb14uvc]
Probably a very simple thing.
I´m using the template catalog_simple.tpl and want to have the title field linkable, as it is in the catalog_simpletable.tpl.
How can I achieve that?
Now it is:
i´ve played around but had no success.Code:<?php if (count($this->entries)): ?>
<div class="layout_simple">
<?php foreach ($this->entries as $entry): ?>
<div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
<?php foreach ($entry['data'] as $field=>$data): ?>
<?php if (!in_array($field, array('catalog_name','parentJumpTo'))): ?>
<div class="field <?php echo $field; ?>">
<div class="label"><?php echo $data['label']; ?></div>
<div class="value"><?php echo $data['value']; ?></div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($entry['link']): ?>
<div class="link"><?php echo $entry['link']; ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<?php if ($this->condition): ?>
<div class="condition"><?php echo $this->condition; ?></div>
<?php else: ?>
<p class="info">There are no entries matching your search.</p>
<?php endif; ?>
<?php endif; ?>
Hi valentine,
i think this would help you -> http://dev.typolight.org/wiki/Tutorials ... undmytitle
thank you, i´ve read that but still couldn´t figure out how do to that.
all i need is a template that is exactly like the one in the layout_simple.tpl but instead of the link on the bottom a "linkable" titlefield.
when i paste this wrapper-thing i get really strange results.
i have no PHP skills, so I´m don´t really know how to do that but i can imagine that someone must have wanted this before...
best regards,
v
I have copy-pasted something like this. It kind of works but all other fields are not recognized via CSS anymore...
Please, can anyone help me with this. I´m really stuck here.
Thanks!
Code:<?php if (count($this->entries)): ?>
<tr>
<?php list($field, $heading) = each($this->entries); ?>
<?php foreach ($heading['data'] as $field=>$data): ?>
<?php if (!in_array($field, array('catalog_name','parentJumpTo'))): ?>
<?php endif; ?>
<?php endforeach; ?>
<tbody class="body<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
<?php foreach ($this->entries as $entry): ?>
<tr class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
<?php foreach ($entry['data'] as $field=>$data): ?>
<?php if (!in_array($field, array('catalog_name','parentJumpTo'))): ?>
<td class="field <?php echo $field; ?>"><?php if (strlen($data['value'])): ?>
<?php if ($entry['url'] && $field == 'title'): ?><a href="<?php echo $entry['url']; ?>"><?php endif; ?>
<?php echo $data['value']; ?>
<?php if ($entry['url'] && $field == 'title'): ?></a><?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<?php if ($this->condition): ?>
<div class="condition"><?php echo $this->condition; ?></div>
<?php else: ?>
<p class="info">There are no entries matching your search.</p>
<?php endif; ?>
<?php endif; ?>
Hi valentin. This stupid forum doesn't send messages if you forget to read 1. ouch. means I'm going to miss a lot of questions.
just check your looping, it looks like your routines to write out the labels/values is no longer inbetween your loop, so you have this.
foreach
endforeach
write out stuff...
that's only going to write out the stuff once, instead, it should be inside the loop. I told you guys this is an advanced module :lol:
i know this is an advanced module. i´ve been trying around - i still don´t get it working.
would it be to much to ask for, that someone posted an working example here? i´d appreciate this very much, since it makes it much easier for me to understand if it is in coherent code.
Valentin, I think the problem is that you didn't try hard enough. Spotting the difference between the two templates took less time then writing this post. To continue using this extension I think it is a good thing for you to study PHP, HTML and CSS some more. But I must admit that the template code looks rather messy Thyon ;).Quote:
Originally Posted by valentin
Below is the template code that should turn the value into a link. I did not test it, so you might get some errors, but debugging it shouldn't be very difficult...
ps, just wanted to add that I am not just going to solve any problem from now on :|Code:<?php if (count($this->entries)): ?>
<div class="layout_simple">
<?php foreach ($this->entries as $entry): ?>
<div class="item<?php echo $entry['class'] ? ' '.$entry['class'] : ''; ?>">
<?php foreach ($entry['data'] as $field=>$data): ?>
<?php if (!in_array($field, array('catalog_name','parentJumpTo'))): ?>
<div class="field <?php echo $field; ?>">
<div class="label"><?php echo $data['label']; ?></div>
<div class="value"><?php if (strlen($data['value'])): ?>
<?php if ($entry['url'] && $field == 'title'): ?><a href="<?php echo $entry['url']; ?>"><?php endif; ?>
<?php echo $data['value']; ?>
<?php if ($entry['url'] && $field == 'title'): ?></a><?php endif; ?>
<?php endif; ?></div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($entry['link']): ?>
<div class="link"><?php echo $entry['link']; ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<?php if ($this->condition): ?>
<div class="condition"><?php echo $this->condition; ?></div>
<?php else: ?>
<p class="info">There are no entries matching your search.</p>
<?php endif; ?>
<?php endif; ?>
hi
i'm trying to create a custom catalog filter template. im stuck withi wonder how i could display its value. i've tried json_encode but no luckCode:$this->widgets['filter']['options']
thanks in advance
jhOy
just use the debug statement print_r($this->widgets['filter']['options']);
thanks. i am able to display the value for that field
but how could i read/parse/run through each of the value for this. it is just a plain text and not even in a json format.
a:3:{i:0;a:3:{s:5:"label";s:11:"Select Tags";s:5:"value";s:60:"http://localhost/samplesite/index.php/home.html";s:8:"selected";b:1;}i:1;a:2:{s:5:"label ";s:12:"Bags";s:5:"value";s:86:"http://localhost/samplesite/index.php/home/tags/bags.html";}i:2;a:2:{s:5:"label";s:14:"Shirts";s:5 :"value";s:88:"http://localhost/samplesite/index.php/home/tags/shirts.html";}}
sorry but i am really stuck here.
thanks
Use the php function unserialize().
Actually this is a typical TL serialized array (very similar to JSON). You should ideally use the TL function instead of the Unix function:
deserialize($this->widgets['filter']['options']);
Quote:
Originally Posted by thyon
cool! thanks very much :)