0

I had this scenario working before:

  1. A Stash "standard.hmtl" template with {exp:stash:get name="maincontent"}
  2. A single-view template for products that looks like this:

    {!-- set the page layout --}
    {stash:embed:layouts:standard}
    
    {exp:stash:set name="body_id"}category_index{/exp:stash:set}
    
    {!-- main page variables --}
    {exp:stash:set name="maincontent" parse_tags="yes"}
    
    {if no_results OR segment_3!=""}{redirect="404"}{/if}
    
    <div id="content">
    
            <div class="intro">
    
                    <div class="text">
                            {ll_intro}
                    </div><!-- /text -->
    
                    <div class="clear"></div>
    
            </div><!-- /intro -->
    
            <div class="products-new">
    
                    <ul class="noGrid">
                    {exp:low_variables:pair var="ll_products" multiple="yes" 
                            status='{exp:stash:get name="functions:preview-status" file="yes" parse_tags="yes" parse_conditionals="yes"}' 
                            parse="inward"}
    
                     {if no_results:no_results}
                     {exp:stash:get name="sn_no_results" type="snippet"}
                     {/if}
    
                     {stash:embed name="snippets:productdiv-new" process="start"}
    
                      {/exp:low_variables:pair}
                      <li class="gap"></li>
                      <li class="gap"></li>
                      </ul>
    
             </div>
    
    </div><!-- /content -->
    {/exp:stash:set}
    

snippets:productdiv-new contains:

<li class="mix {if product_price:plus_tax_numeric > "88.99"}freeshipping{/if} {brand}" data-price="{product_price:plus_tax_numeric}">
                            {if status == "Draft"}<img class="draft" src="/assets/img/site/draft.png" />{/if}
                            {exp:entry_age unit="days" max_age="21" entry_date="{entry_date}"}
                            <a href="{page_url}">
                                <img class="new-badge" src="/assets/img/site/neu.png" alt="Neu! (ein 'Fähnchen', welches signalisiert, dass dieses Produkt neu in unseren Shop aufgenommen wurde)" />
                            </a>
                            {/exp:entry_age}
                            <a href="{page_url}">
                                {if produktbilder}
                                {exp:channel_images:images entry_id="{entry_id}" cover_only="yes"}
                                <img class="product" src="{image:url:index_thumbnail}" width="{image:width:index_thumbnail}" height="{image:height:index_thumbnail}" alt="{image:title}" />
                                {/exp:channel_images:images}
                                {if:else}

                                <img class="product" src="/assets/img/site/no_picture.png" alt="Platzhaltergrafik mit der Aufschrift 'Kein bild'" />
                                {/if}

                                <div class="availability-new">
                                    {if product_inventory == "0"}

                                    <img src="/assets/img/site/availability_red.png" alt="Ampel, die auf rot steht" title="Dieser Artikel ist bald wieder für Sie verfügbar" />{/if}
                                    {if product_inventory > "0"}

                                    <img src="/assets/img/site/availability_green.png" alt="Ampel, die auf rot steht" title="Der Artikel ist auf Lager" />{/if}

                                </div>
                            </a>

                            <div class="meta">
                                {if product_price:plus_tax_numeric > "88.99"}

                                <a class="image" href="{page_url}">
                                    <img src="/assets/img/site/truck-green-23.png" alt="Truck" title="Kostenfreier Versand!" />
                                </a>
                                {/if}
                                {if channel_video}
                                {exp:channel_videos:videos entry_id="{entry_id}"}
                                <a class="video image" href="{video:url}">
                                    <img src="/assets/img/site/play-red-20.png" alt="Kamerasymbol" title="Zu diesem Artikel ist ein Produktvideo vorhanden" />
                                </a>
                                {/exp:channel_videos:videos}
                                {/if}

                            </div><!-- /meta -->

                            <div class="schatten">
                                <img src="/assets/img/site/shadow_img_index.png" alt="Schatten" style="width: 190px;"/>
                            </div>

                            <h3>{title}{if subtitle}<br /><span>{subtitle}</span>{/if}</h3>

                            <div class="price">
                                {if product_original_price && product_original_price > product_price}

                                <span class="reduced_price">{product_price:plus_tax}&nbsp;&#8364;</span>&nbsp;<span class="original_price">{product_original_price:plus_tax}&nbsp;&#8364;</span>
                                {if:else}

                                <div class="price">{product_price:plus_tax}&nbsp;&#8364;</div>
                                {/if}

                            </div><!-- /price -->
                        </li>

When pasting the content from snippets:productdiv-new directly into the single-view template everything's working as desired.

When putting the code into a Stash snippet and then calling it like in the above codeblock ({stash:embed name="snippets:productdiv-new" process="start"}) everything works BUT the images from {exp:channel_images:images...} are not being displayed, the inventory doesn't get reflected and videos and freeshipping if conditionals don't get parsed.

So, basiclly all of the if conditionals don't get evaluated.

I had the very same code working before but since upgrading Stash from 2.3.9 to 2.4.4 it isn't working anymore.

Anyone able to spot the problem?

Thanks and Cheers!

1

Since Stash 2.4.3 embeds with process="start" are parsed by default to be consistent with the other process stages (inline and end).

Add parse="no" to disable parsing:

{stash:embed name="snippets:productdiv-new" process="start" parse="no"}
  • Working. Awesome. I'd like to spend 10min in your head. :) – Marc Apr 4 '14 at 10:58
  • Small follow-up: I have "status='{exp:stash:get name="functions:preview-status" file="yes" parse_tags="yes" parse_conditionals="yes"}'" (function: {if group_id == "1" || group_id == "6"}open|draft{if:else}open{/if}). This is basically still working but then I have a "{if status == "Draft"}" conditional in the embed which doesn't get triggered it seems. Is this a related problem? – Marc Apr 4 '14 at 11:20
  • Not sure tbh. You could try {if "{status}" ... instead? – Mark Croxton Apr 9 '14 at 18:31
  • Well, I don't know. I tried your suggestion, although I think I had already tried all possible variations. Turns out that today it works, even with the above seeemingly "faulty" chunk. Sometimes it's like that... Thanks again! – Marc Apr 11 '14 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.