2017-05-25 14 views
0

私は学習目的のためにeコマースサイトを作成していますが、問題があります。私は何かが上間違っていると思う、私は製品のバッジや製品価格との最大の問題を持っているBEM命名規則と混同 - 修正が必要か?

<div class="product product--miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" itemscope itemtype="http://schema.org/Product"> 
    <figure class="product__thumbnail"> 
    <div class="product__badges"> 
     <span class="badge badge--{$flag.type}">{$flag.label}</span> 
    </div> 
    <img src="{$product.cover.medium.url}" alt="{$product.cover.legend}" data-full-size-image-url="{$product.cover.large.url}"> 
    </figure> 
    <div class="product__info"> 
    <h3 class="product__name" itemprop="name"><a href="{$product.url}">{$product.name}</a></h3> 
    <div class="product__prices"> 
     <span class="price" itemprop="price">{$product.price}</span> 
     <span class="price--discount">{$product.regular_price}</span> 
    </div> 
    </div> 
</div> 

:私はBEMの命名規則を使用していると私はそれが良いやっている場合、私は知らないが、ここに私のコードです?

+0

にすべて変更されているようです。多くのIDの使用を避け(重複IDを使用しないでください)、クラスを使用して要素を示唆的に名前を付けることができない限り、私は問題を見ることができません。詳細な回答については、https://codereview.stackexchange.com/をご覧ください。 –

答えて

1

私がここで考えることができるのは、pricebadgeブロッククラスの使用だけです。彼らが自分で(productブロックの外に)存在することができるなら、あなたが持っているものは大丈夫です。しかし、製品内にしか存在しない場合は、product__priceproduct__badge