Page 1 of 1

[Solved] Products Module - Detail template

Posted: Sun Jun 22, 2008 12:56 pm
by Coldman
Hello!

I have installed Products 2.0.1 and it works great!
But I would be very grateful if someone could help me with detail template?

My menu looks like this:
Shirts | jackets | etc...

When I klick on Shirts it will go to index.php?page=shirts and there i have {Products category="shirts"} and all the things in "shirts" will be listed. When I click on one product so shows  details template with image . So far so good...

But now to my problem.
In detalis template I also want to show the same list(menu) I have in page "shirts"
I've tried with something like this but haven't succeed.

Code: Select all

<div class="ProductDirectoryItem">
<p>
<table style="border-color: #d6d7d5; border-width: 2px;" border="0" cellspacing="0" cellpadding="0" frame="cols">
<tbody>
<tr>
<td width="30%" valign="top">
</p>

<p>
// HERE I WANT TO SHOW THE SAME LIST!
{if $entry->detail_url}

 {foreach from=$entry item=entry}
        
<a href="{$entry->detail_url}">{$entry->product_name}</a>


{/foreach}
    {/if}  
     
</p>
</td>
<td width="70%" valign="top">


Name: {$entry->product_name}<br />
File Location: {$entry->file_location}<br/>

{if $entry->price ne ''}
Price {$currency_symbol}: {$entry->price}<br />
{/if}

{if $entry->weight ne ''}
Weight {$weight_units}: {$entry->weight}<br />
{/if}

{if $entry->details ne ''}
Details:<br />
{$entry->details}<br />
{/if}

{* accessing all of the fields in a list *}
{if count($entry->fields)}
  <h4>Custom Fields</h4>
  {foreach from=$entry->fields key='name' item='field'}
     <div class="product_detail_field"><p>
       {$mod->Lang('name')}: {$name}<br/>
       {$mod->lang('type')}: {$field->type}<br/>
       {$mod->lang('value')}: {$field->value}<br/>
       {if $field->type == 'image' && isset($field->thumbnail)}
         <img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}"/>
       {/if}
     </p></div>
  {/foreach}
{/if}

{* print out attributes *}
{if isset($entry->attributes)}
  <h4>Attributes</h4>
  {foreach from=$entry->attributes key='name' item='attribset'}
     <h6>{$name}</h6>
     <div class="product_detail_field"><p>
       {foreach from=$attribset key='label' item='adjustment'}
         {$label}: {$adjustment}<br/>
       {/foreach}
     </p></div>
  {/foreach}
{/if}


</td>
</tr>
</tbody>
</table>
</p>
</div>
Hope someone understand what I mean and then will help me.

Regards / Coldman

Re: Products Module - Detail template

Posted: Wed Jun 25, 2008 10:41 pm
by CarpElgin
Which menu/list do you want to appear on the details page?

This menu:
Coldman wrote: My menu looks like this:
Shirts | jackets | etc...
Or this list:
Coldman wrote: all the things in "shirts" will be listed
If you want the first (a menu of all Categories) it'll be easy. If your menu was created by something like {Products action='categorylist'}, then you would insert that same tag into the details template.

Code: Select all

// HERE I WANT TO SHOW THE SAME LIST!
{Products action='categorylist'}

If you want the second, then it's a whole lot more complicated.

A Product can have several different Categories selected (more than one checkbox marked at a time) so there isn't any way of knowing which of the selected Categories to create the list of Products for.

You'd have to do something like this...

Code: Select all

// HERE I WANT TO SHOW THE SAME LIST!
{if isset($entry->categories)}
  <div class="categories">
  {foreach from=$entry->categories item=cat}
    <h3>{$cat->name}</h3>
    {Products category=$cat->name}
  {/foreach}
   </div>
{/if}
... And you should look at your HTML code. I really don't want to be a standards freak and will ignore the hives I get when someone uses tables for layout. But you've got some and -- paragraph tags - starting and ending in weird places (like in the middle of the table) which can cause some really weird browser problems.

Carp

Re: Products Module - Detail template

Posted: Thu Jun 26, 2008 5:18 pm
by Coldman
Thanks!
This was exactly what I meant!  ;D
CarpElgin wrote:

Code: Select all

// HERE I WANT TO SHOW THE SAME LIST!
{if isset($entry->categories)}
  <div class="categories">
  {foreach from=$entry->categories item=cat}
    <h3>{$cat->name}</h3>
    {Products category=$cat->name}
  {/foreach}
   </div>
{/if}
About my html code it wasn't original . After copy and paste in Tiny it went out like that  ;)

Thanks again...I'd really appriciate this bit of code u gave me!