Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi

Got a little issue here.
I think I'm missing something with the folder concept.

I have clonable prouducts listed on a template. (not listed trough a folder selection)
I want to show per product in which folder they belong, just by name, nothing more.

Is this the right way?

Code: Select all
<cms:folders>
      <cms:show k_folder_title /> <br>
</cms:folders>


Because now I get al the differtent folders displayed at each product, even they haven't any folder yet.

This is my complete template:

(I also included a dropdown filter on the page, currently not working properly, it just show every product. Could you please check if this is configured right?)

Thanks!

Code: Select all
<?php require_once ('dashboard/cms.php'); ?>

<cms:embed 'lang_getter.html' />

<cms:if "<cms:gpc 'date' method='get'/>">
   <cms:redirect url="<cms:link masterpage='gerechten.php' folder="<cms:gpc 'date' method='get'/>"/>"/>
</cms:if>

<cms:template title="Gerechten" order="10" clonable="1" dynamic_folders="1">

  <cms:embed 'product_editables.html'/>

</cms:template>

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Gerechten - Casa Di Batavia</title>
    <meta name="description" content="Naast de schitterende natuurlandschappen, de prachtige kustlijnen en de indrukwekkende cultuur staat
    Indonesië bekend om haar heerlijke keuken. Dit komt voornamelijk door de zeer uiteenlopende specerijen die beschikbaar zijn in het land. Vandaag
    brengt Casa di Batavia deze keuken voor u tot in Gent.">
    <cms:embed 'styles.html'/>
  </head>
  <body>
    <div id="wrapper" class="container">
      <header>
        <cms:embed 'header.html'/>
      </header>
      <div class="row">
        <div id="content" class="col-md-9">

          <h1>
            <cms:if my_lang='nl'><cms:show 'Gerechten' /></cms:if>
            <cms:if my_lang='en'><cms:show page_title_en /></cms:if>
            <cms:if my_lang='fr'><cms:show page_title_fr /></cms:if>
            <cms:if my_lang='in'><cms:show page_title_in /></cms:if>
          </h1>

          <cms:set current_folder_name = k_folder_name/>

          <form method="get" action="">
             <select name="date" onchange="if (this.options[this.options.selectedIndex].getAttribute('data-url') != '#') window.location.href = this.options[this.options.selectedIndex].getAttribute('data-url');">
                <option data-url="#" value="">-- Kies gerecht --</option>
                <cms:folders masterpage='gerechten.php'>
                   <cms:if k_folder_pagecount>
                      <option data-url="<cms:show k_folder_link/>" value="<cms:show k_folder_name/>"<cms:if k_folder_name == current_folder_name> selected="true"</cms:if>><cms:show k_folder_title/></option>
                   </cms:if>
                </cms:folders>
             </select>
             <noscript>
                <input type="submit" value="Filter">
             </noscript>
          </form>

            <cms:pages order='asc'>
             
              <div class="row product-item">
                <div class="col-md-3 col-xs-3 product-img">
                  <img src="<cms:show productimg />">
                </div>
                <div class="col-md-6 col-xs-9">
                  <h2>
                    <cms:if my_lang='nl'><cms:show page_title_nl /></cms:if>
                    <cms:if my_lang='en'><cms:show page_title_en /></cms:if>
                    <cms:if my_lang='fr'><cms:show page_title_fr /></cms:if>
                    <cms:if my_lang='in'><cms:show page_title_in /></cms:if>
                  </h2>
                  <p>
                    <cms:if my_lang='nl'><cms:show page_content_nl /></cms:if>
                    <cms:if my_lang='en'><cms:show page_content_en /></cms:if>
                    <cms:if my_lang='fr'><cms:show page_content_fr /></cms:if>
                    <cms:if my_lang='in'><cms:show page_content_in /></cms:if>
                  </p>
                </div>
                <div class="col-md-3 col-xs-9 pull-right order-section">
                  <h3>
                    <cms:set price="<cms:mul pp_price multiplier /> " />
                    € <cms:number_format price decimal_precision='2' /> / <cms:show eenheid />
                  </h3>
                  <cms:pp_product_form redirect=k_page_link class="cart-form">
                  <input name="qty" id="quantity" type="number" step="<cms:show stap />" value="<cms:show startwaarde/>" min="0" title="Quantity"><span> <cms:show pp_eenheid_af /></span>
                  <div class="row" style="padding-left:15px;">
                    <input type="submit" value="Toevoegen" class="cart-form">
                  </div>
                </cms:pp_product_form>
                <h4>
                  <cms:folders masterpage='gerechten.php'>
                    <cms:show k_folder_title /> <br>
                </cms:folders>
              </h4>
              </div>
              </div>

          </cms:pages>
        </div>
        <aside id="sidebar" class="col-md-3">

          <cms:embed 'sidebar.html' />
         
        </aside>
      </div>
    </div>   
    <footer class="container-fluid">
      <cms:embed 'footer.html' />
    </footer>
    <cms:embed 'scripts.html' />
  </body>
</html>

<?php COUCH::invoke(); ?>   
Hi Sam,

That dropdown invokes your template in folder-view (please see http://www.couchcms.com/docs/concepts/views.html if you are unsure about the term).

In a folder-view, the selected folder's name is made available by Couch as 'k_folder_name' variable (again, this is explained at http://www.couchcms.com/docs/concepts/v ... views.html)

We can now make use of this variable to constrain the listing done by cms:pages tag to show only pages belonging to that folder like this -
<cms:pages order='asc' folder=k_folder_name>

So please try adding the highlighted part above to your code and that should do the listing the way you want.

You can find more details about listing pages here - http://www.couchcms.com/docs/concepts/l ... pages.html
and all the parameters supported by cms:pages here -
http://www.couchcms.com/docs/tags-reference/pages.html

Hope this helps :)
Thanks! The dropdown folder does his thing now. :)
Is it possible to link al the folders to the first value "-- Kies gerecht--"?
So when I choose for this option al the products are showing again.

Other issue:
The folder title per product are only showing up when I select a foldername in the dropdown.
But I would like to always show the folder title on a product section, no matter what selection.

Thanks for looking into it!
Is it possible to link al the folders to the first value "-- Kies gerecht--"?
So when I choose for this option al the products are showing again.

I suppose you can do that by changing the following -
<option data-url="#" value="">-- Kies gerecht --</option>
to this -
<option data-url="<cms:show k_template_link />" value="">-- Kies gerecht --</option>
Thanks! :)
5 posts Page 1 of 1
cron