alos
alos

Reputation: 13

Is it possible to target just Simple Product from phtml template?

I see something like:

     <?php if(!$_item->isComposite() && $_item->isSaleable()): ?>

and this

  <?php if(!$_product->isGrouped()): ?>

But couldn't find a way to target only the Simple Product type in similar manner.

Upvotes: 0

Views: 1834

Answers (3)

Mukesh Chapagain
Mukesh Chapagain

Reputation: 25976

<?php if( $_product->getTypeId() == 'simple' ): ?>

Upvotes: 2

clockworkgeek
clockworkgeek

Reputation: 37700

As an alternative possibility you could assume a Simple product is on that is no other type.

<?php if (!$_item->isComposite() && !$_item->isSuper() && !$_item->isVirtual()): ?>
    <!-- Simple type only -->
<?php endif; ?>

Upvotes: 1

clockworkgeek
clockworkgeek

Reputation: 37700

There is already a template file catalog/product/view/type/simple.phtml that only displays for Simple type products.

If that doesn't show in the right place for you look in layout/catalog.xml for <PRODUCT_TYPE_simple> to see how to make your own Simple-only template file.

Upvotes: 1

Related Questions