Skip to content

Instantly share code, notes, and snippets.

@totaku
Created March 30, 2017 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totaku/2908ba52ff4d9e6c370e335b935e1177 to your computer and use it in GitHub Desktop.
Save totaku/2908ba52ff4d9e6c370e335b935e1177 to your computer and use it in GitHub Desktop.
<?php if (!$page): ?>
<!-- product teaser -->
<div id="<?php print $node->nid; ?>" class="products node node-product-teaser col-md-4">
<?php print render($title_prefix); ?>
<?php print render($title_suffix); ?>
<figure class="product">
<?php if (!empty($content['field_product_status'])): ?>
<?php
/* $field_product_status = field_get_items('node', $node, 'field_product_status');
$product_status = !empty($field_product_status[0]['taxonomy_term']->name) ? $field_product_status[0]['taxonomy_term']->name : ''; */
hide($content['field_product_status']);
?>
<div class="product-discount"><?php print render($content['field_product_status']); ?></div>
<?php endif; ?>
<div class="mediaholder">
<?php if (!empty($content['product:field_image'])): ?>
<?php
hide($content['product:field_image']);
if (!empty($content['product:field_image'][0])) {
print render($content['product:field_image'][0]);
}
?>
<a href="<?php print $node_url; ?>">
<div class="cover">
<?php
$img1 = !empty($content['product:field_image'][1]) ? $content['product:field_image'][1] : $content['product:field_image'][0];
print render($img1);
?>
</div>
</a>
<?php endif; ?>
<?php if (!empty($content['field_product_display'])): ?>
<?php hide($content['field_product_display']); ?>
<div class="product-button">
<?php if (!empty($content['field_product_display']['#items']) && (count($content['field_product_display']['#items']) > 1)): ?>
<div class="commerce-add-to-cart">
<a class="btn" href="<?php print $node_url; ?>" title="<?php print t('Select options'); ?>"><?php print t('Select options'); ?></a>
</div>
<?php else: ?>
<?php print render($content['field_product_display']); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<section>
<?php if ($title): ?>
<a href="<?php print $node_url; ?>">
<h5><?php print $title; ?></h5>
</a>
<?php endif; ?>
<?php
//dsm($node);
hide($content['comments']);
hide($content['links']);
print render($content);
?>
</section>
</figure>
</div>
<!-- // product teaser -->
<?php else: ?>
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> node-product clearfix"<?php print $attributes; ?>>
<?php print $user_picture; ?>
<?php print render($title_prefix); ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
<div class="submitted">
<?php print $submitted; ?>
</div>
<?php endif; ?>
<div class="content"<?php print $content_attributes; ?>>
<?php if (!empty($content['product:field_image'])): ?>
<div class="row">
<div class="col-md-4">
<?php print render($content['product:field_image']); ?>
</div>
<?php endif; ?>
<?php if (!empty($content['product:field_image'])): ?>
<div class="col-md-8">
<?php endif; ?>
<div class="product-title">
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php if (!empty($content['product:commerce_price'])): ?>
<?php print render($content['product:commerce_price']); ?>
<?php endif; ?>
<?php if (!empty($content['field_rating'])): ?>
<div class="product-rating-field">
<?php print render($content['field_rating']); ?>
</div>
<?php endif; ?>
</div>
<?php
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
if (!empty($content['body']) && $page) {
hide($content['body']);
}
if (!empty($content['field_product_display']['attributes'])) {
}
print render($content);
?>
<?php if (!empty($content['product:field_image'])): ?>
<?php if ($page && $node->type != 'product' && $node->type != 'product_display'): ?>
<?php print render($content['links']); ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php if ($page): ?>
<div id="product-tabs-wrapper" class="row">
<div class="col-md-12">
<ul class="product-tab nav nav-tabs" role="tablist" id="trizzyTab">
<li class="active"><a data-toggle="tab" role="tab" href="#product-description"><?php print t('Технические характеристики'); ?></a></li>
<?php if ($node->comment != COMMENT_NODE_HIDDEN): ?>
<li><a data-toggle="tab" role="tab" href="#product-reviews"><?php print t('Отзывы'); ?> <span class="tab-reviews">(<?php print $node->comment_count; ?>)</span></a></li>
<?php endif; ?>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="product-description">
<?php if (!empty($content['body'])): ?>
<?php print render($content['body']); ?>
<?php endif; ?>
</div>
<?php if ($node->comment != COMMENT_NODE_HIDDEN): ?>
<div class="tab-pane" id="product-reviews">
<?php if (!user_access('post comments')): ?>
<?php print _trizzy_product_review_forbidden(array('node' => $node)); ?>
<?php endif; ?>
<?php print render($content['comments']); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment