# {if} Problem mit Artikel Attributen

**URL:** <https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070>\
**Category:** Shopware 3.5\
**Tags:** templates--design\
**Created:** [11. November 2011 um 14:13 UTC](https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070 "2011-11-11T14:13:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![itmotion](https://avatars.discourse-cdn.com/v4/letter/i/8e8cbc/32.png) [@itmotion](https://forum.shopware.com/u/itmotion)\
**Post date:** [11. November 2011 um 14:13 UTC](https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070/1 "2011-11-11T14:13:42Z")

</div>

Hallo, folgendes Problem ich habe im den Grundeinstellungen ein neues Artikel Attribut mit dem Namen attr4 angelegt und dieses als boolean definiert. klappt auch soweit alles ich kann diesen Haken nun Artikeln hinzufügen oder entfernen. Nun zum Problem, in der Template Datei (fontend/detail/index.tpl) steht folgendes drin ` {extends file="templates/\_default/frontend/detail/index.tpl"} {if $sArticle.attr4 == 1} {block name='frontend\_index\_content' prepend}FAHRZEUG="{$sArticle.attr4}"{/block} {/if} ` Das Problem ist, dass er den Text FAHRZEUG=1 oder 0 immer anzeigt auch wenn der Artikel in attr4 nicht angehakt ist. ich habe es auch schon mit ` {if $sArticle.attr4 eq 1} oder mit {if $sArticle.attr4 eq "1"} ` probiert selbes Problem was ist an der Stelle falsch dass er den Code immer ausführt egal ob der Haken gesezt ist oder nicht.

---

<div class="post-metadata">

**Author:** ![Patrick\_Stahl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/patrick_stahl/32/7679_2.png) [@Patrick\_Stahl](https://forum.shopware.com/u/Patrick_Stahl)\
**Post date:** [11. November 2011 um 14:49 UTC](https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070/2 "2011-11-11T14:49:36Z")

</div>

Hallo, was passiert denn, wenn du das If IN dem Block platzierst? Wenn es false ist, wird halt nichts vorne angehangen. Gruß, Patrick :shopware:

---

<div class="post-metadata">

**Author:** ![itmotion](https://avatars.discourse-cdn.com/v4/letter/i/8e8cbc/32.png) [@itmotion](https://forum.shopware.com/u/itmotion)\
**Post date:** [11. November 2011 um 14:58 UTC](https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070/3 "2011-11-11T14:58:38Z")

</div>

also in dem Beispiel hier klappt das mit der BuyBox ` {extends file='templates/\_default/frontend/detail/index.tpl'} {block name="frontend\_detail\_index\_buybox"} {\* Include buy button and quantity box \*} {if $sArticle.attr4 == 0} {include file="frontend/detail/buy.tpl"} {/if} {/block} {if $sArticle.attr4} {block name='frontend\_detail\_index\_supplier'}{/block} {block name='frontend\_detail\_index\_tabs\_rating'}{/block} {/if} ` Mit der BuyBox klappt das ja auch wunderbar da diese nochmal included wird. Es geht mir um solche sachen wie die Hersteller Box die in der standart Template Datei so aussieht: ` {\* Supplier name \*} {if $sArticle.supplierName} {block name='frontend\_detail\_index\_supplier'} **{se name="DetailFrom"}{/se}: {$sArticle.supplierName}** {/block} {/if} ` dieser Block {block name=‘frontend\_detail\_index\_supplier’} soll nur angezeigt werden wenn das Artikel Attribut attr4 nicht gesetzt ist. Darum dachte ich mir mit einer if Abfrage den Block einfach leer zu setzen wenn das attribut4 = 1 ist.

---

<div class="post-metadata">

**Author:** ![itmotion](https://avatars.discourse-cdn.com/v4/letter/i/8e8cbc/32.png) [@itmotion](https://forum.shopware.com/u/itmotion)\
**Post date:** [11. November 2011 um 17:31 UTC](https://forum.shopware.com/t/if-problem-mit-artikel-attributen/5070/4 "2011-11-11T17:31:55Z")

</div>

hab es gelöst man muss es wohl doch in die einzelnen Blöcke schreiben 😢 so klappte es ` {extends file='templates/\_default/frontend/detail/index.tpl'} {block name="frontend\_detail\_index\_buybox"} {\* Include buy button and quantity box \*} {if $sArticle.attr4 eq 0} {include file="frontend/detail/buy.tpl"} {/if} {/block} {block name='frontend\_detail\_index\_tabs\_rating'} {if $sArticle.attr4 eq 0} {include file="frontend/detail/comment.tpl"} {/if} {/block} {block name="frontend\_detail\_index\_actions"} {if $sArticle.attr4 eq 0} {include file="frontend/detail/actions.tpl"} {/if} {/block} {block name="frontend\_detail\_index\_tabs\_description"} {if $sArticle.attr4 eq 0} {include file="frontend/detail/description.tpl"} {/if} {/block} {block name="frontend\_index\_header\_css\_screen" append} {if $sArticle.attr4 eq 1} {literal} <style>
			.similar {display:none;}
		</style> {/literal} {/if} {/block} {block name='frontend\_detail\_index\_data'} {if $sArticle.attr4 eq 0} {include file="frontend/detail/data.tpl"} {/if} {/block} `
