Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I have a ecommerce site that has Products and Accessories. O n the "store" page it loads all of the products and accessories. I want to load the products on the product section and the accessories on the accessories section on the page. Is there a way to detect the folder and have it load the accessories in the appropriate section of the same page?
tonjaggart wrote: I have a ecommerce site that has Products and Accessories. O n the "store" page it loads all of the products and accessories. I want to load the products on the product section and the accessories on the accessories section on the page. Is there a way to detect the folder and have it load the accessories in the appropriate section of the same page?


It would take a little javascript (or jQuery, for ease), I think, but it's doable. Say that you have <div id="products"> and <div id="accessories">

Code: Select all
<cms:pages masterpage="store.php" >
   <cms:if k_folder_name = 'products' >
      <script>
         $('#products').append("<cms:show productinfo /> or what have you");
      </script>
   <cms:else_if k_folder_name = 'accessories' />
      <script>
         $('#accessories').append("<cms:show accessoryinfo /> or such");
      </script>
   </cms:if>
</cms:pages>


I haven't tested it, but it should work assuming that Couch tags and Javascript play well together (and they have thus far for me), but as it's just putting the raw text in the <div>, it should.
Thank you so much for the reply slink. I am still a bit confused of where to plug this in since I am using repeatable regions. Here is the markup:
Code: Select all
<div class="row-fluid">
         <ul class="thumbnails portfolio">
            <cms:pages>
               <li class="span4">
                  <figure class="round-box box-huge no-rounded">
                     <a class="box-inner" href="<cms:show k_page_link/>">
                        <cms:show_repeatable 'product_images'>
                           <cms:if k_count='1'>
                              <img alt="<cms:show k_page_title/>" class="img-circle" src="<cms:show product_image/>">
                           </cms:if>
                        </cms:show_repeatable>
                     </a>
                     <figcaption>
                        <h3>
                           <a href="<cms:show k_page_link/>">
                              <cms:do_shortcodes><cms:show product_title/></cms:do_shortcodes>
                           </a>
                        </h3>
                        <p><a href="<cms:show k_page_link/>" class="btn btn-warning">View Details</a></p>
                        <span class="tag">
                           $<cms:show product_price/>
                        </span>
                     </figcaption>
                  </figure>
               </li>
            </cms:pages>
         </ul>
         <div class="section-header">
            <h1>
               PILLO1
               <small class="light">Accesories</small>
            </h1>
         </div>
      </div>
Hi all,

@slink, alternatively we can use cms:pages twice (with different folders) on the same page to populate both the sections. e.g.
Code: Select all
<cms:pages folder='products'>
   <!-- only pages of folder 'products' will get listed here -->
</cms:pages>

<cms:pages folder='accessories'>
   <!-- only pages of folder 'accessories' will get listed here -->
</cms:pages>

@tonjaggart
I think you can use the mentioned technique to create the two sections (the code will be identical in both except for the 'folder' parameter of cms:pages block).

Does this help?
Please let us know.
@KK this worked perfectly! Thank you so much!
KK wrote: Hi all,

@slink, alternatively we can use cms:pages twice (with different folders) on the same page to populate both the sections. e.g.
Code: Select all
<cms:pages folder='products'>
   <!-- only pages of folder 'products' will get listed here -->
</cms:pages>

<cms:pages folder='accessories'>
   <!-- only pages of folder 'accessories' will get listed here -->
</cms:pages>

@tonjaggart
I think you can use the mentioned technique to create the two sections (the code will be identical in both except for the 'folder' parameter of cms:pages block).

Does this help?
Please let us know.


Or that, which is more efficient, since it's all server-side. :D

Thanks, KK! :)
6 posts Page 1 of 1
cron