Помогите исправить код "node--product.tpl.php" модуль Commerce

Главные вкладки

Комментарии

Аватар пользователя iTux iTux 29 января 2013 в 23:40

"<a href="mailto:volocuga@drupal.org">volocuga@drupal.org</a>" wrote:
Говнокод, чтоже вы хотели. Выносите логику в препроцесс.

Ecommerce pro )))

<?php
    drupal_add_js
(drupal_get_path('theme''cos') . '/js/tabs.js');
    
drupal_add_js(drupal_get_path('theme''cos') . '/js/toggler.js');
?>
 
<?php if (!$page) { ?>
          <div class="asinItem">
                <div class="prodImage">
                  <a href="<?php print url('node/'.$nid?>">
                    <?php $image array_pop(field_get_items('node'$node'field_image')); $image_render theme('product_thumb', array(  'style_name' => 'product_big''path' => $image['uri'], 'alt' => $image['alt'], 'title' => $image['title'], 'attributes' => array(), 'getsize' => false)); print $image_render ?>
                  </a></div>
                <h3>
                  <a href="<?php print url('node/'.$nid?>"><?php print $node->title ?> <strong>(<?php print render($content['product:commerce_price']) ?>)</strong></a><strong></strong></h3>
                <div class="srating"><?php print render($content['rate_customer_rating']) ?></div>
               <?php print render($content['field_productref']) ?>
          </div>
<?php } else { ?>
      <div class="product_image">
        <div id="big_image_container">
 
<?php $image array_pop(field_get_items('node'$node'field_image')); $image_render theme('image_style', array(  'style_name' => 'product_big''path' => $image['uri'], 'alt' => $image['alt'], 'title' => $image['title'], 'attributes' => array(), 'getsize' => false)); print '<div class = "image-block">' $image_render '</div>'?>
</div>
        <div class="image_options"> <a href="javascript:;" id="toggler" class="silver_btn"><span>Gallery</span></a> <a href="javascript:;" id="next_button" class="silver_btn"><span>Next</span></a><a href="javascript:;" id="prev_button" class="silver_btn"><span>Back</span></a>
          <div id="thumbs_container">
         <div class="thumbs_background clearfix">
         <h2 class="page_subtitle"><a href="javascript:;" class="close">Close</a>Gallery</h2>
            <ul class="image_gallery">
            <?php $images=field_get_items('node'$node'field_image');
            if (
is_array($images) and count($images)) foreach ($images as $i => $data) if ($data['uri']) { ?>
              <li<?php if ($i == 3) print ' class="last"'?>><a rel="<?php print image_style_url('product_big'$data['uri']) ?>"><?php print theme('image_style', array('style_name' => 'product_thumb''path' => $data['uri'], 'alt' => $data['alt'], 'title' => $data['title'], 'attributes' => array('class' => 'thumb'),'getsize' => false));?></a></li>
            <?php ?>
            </ul></div>
          </div>
        </div>
      </div>
      <div class="product_information">
        <?php 
        
if (isset($node->field_statusdetail[$node->language][0]['value'])) {
          
$field_statusdetail $node->field_statusdetail[$node->language][0]['value'];
        } else {
          
$field_statusdetail '';
        }
        
?>
        <div class="product_status<?php if ($field_statusdetail == 'In Stock') { ?> in_stock<?php ?><?php if ($field_statusdetail == 'Not Available') { ?> not_available<?php ?>"><span><?php print $field_statusdetail ?></span></div>
        <div class="row end">&nbsp;</div>
        <div class="description"><?php print render($content['body']) ?></div>
        <div class="product_options"><?php print render($content['field_productref']) ?>
          <h2 class="price"><?php print t('Price'?>: <strong><?php print render($content['product:commerce_price']) ?></strong></h2>
          <div class="rating_holder"><span><?php print t('Customer Rating'?>:</span>
            <div class="rating"><?php print render($content['rate_customer_rating']) ?></div>
          </div>
          <p class="rate_banner">&nbsp;</p>
        </div>
        <?php 
        $field_guideline 
render($content['field_guideline']); 
        
$field_technical render($content['field_technical']); 
        
$field_share render($content['field_share']); 
        
?>
        <ul class="ttabs">
          <?php if ($field_guideline) { ?><li><a href="#tab1"><?php print t('Product Guideline'?></a></li><?php ?>
          <?php if ($field_technical) { ?><li><a href="#tab2"><?php print t('Technical Information'?></a></li><?php ?>
          <?php /*if ($field_share) {*/ ?><li><a href="#tab3"><?php print t('Share'?></a></li><?php //} ?>
        </ul>
        <div class="tab_container">
            <?php if ($field_guideline) { ?>
                <div id="tab1" class="tab_content help_icon"><?php print $field_guideline ?></div>
            <?php ?>
            <?php if ($field_technical) { ?>
                <div id="tab2" class="tab_content"><?php print $field_technical ?></div>
            <?php ?>
            <?php /*if ($field_share) {*/ ?>
                <div id="tab3" class="tab_content">
<?php $li 'http://'.$_SERVER['SERVER_NAME'].url('node/'.$nid); ?>
        <div id="share">
            <span style="float: left; position: relative;"><img src="<?php print base_path().drupal_get_path('theme''cos'); ?>/share/share-twitter.gif" align="left" style="margin: 0px; margin-right: 5px;"><a href="http://twitter.com/home/?status=<?php print $node->title.' '.$_SERVER['SERVER_NAME'].url('node/'.$nid); ?>" rel="nofollow" target="blank">Tweet This</a></span>
            <span style="float: left; position: relative;"><img src="<?php print base_path().drupal_get_path('theme''cos'); ?>/share/share-digg.gif" align="left"><a href="http://digg.com/submit?url=<?php print $li?>" rel="nofollow" target="blank">Digg This</a></span>
            <span style="float: left; position: relative;"><img src="<?php print base_path().drupal_get_path('theme''cos'); ?>/share/share-delicious.gif" align="left"><a href="http://del.icio.us/post?url=<?php print $li?>&title=<?php print $node->title?>" rel="nofollow" target="blank">Delicious</a></span>
            <span style="float: left; position: relative;"><img src="<?php print base_path().drupal_get_path('theme''cos'); ?>/share/share-stumble.gif" align="left"><a href="http://www.stumbleupon.com/submit?url=<?php print $li?>&title=<?php print $node->title?>" rel="nofollow" target="blank">Stumble it</a></span>
        </div>              
                </div>
            <?php //} ?>
        </div>
      </div>
    <div class="row end">&nbsp;</div>
    <h2 class="page_subtitle"><a href="<?php print url('comment/reply/'.$node->nid?>#comment-form" class="silver_btn"><?php print t('Write a Comment'?></a><?php if ($node->comment_count 0) { ?><?php print t('Latest Customer Comments'?><?php ?></h2>
  <?php print render($content['comments']) ?>
<?php 
?>
<?php 
//print '<pre>'. check_plain(print_r($content, 1)) .'</pre>'; ?>
<?php 
print t(''?>

код не проверил, в этот топик больше не захожу.

Аватар пользователя Kwadrik Kwadrik 29 января 2013 в 23:55

Спасибо за помощь, все работает!

Еще вопрос, почему если в коде пишешь текст Русским языком, вместо букв ромбики?

Аватар пользователя multpix multpix 29 января 2013 в 23:58

"Kwadrik" wrote:
если в коде пишешь текст Русским языком, вместо букв ромбики?

потому, что исходный файл в кодировке отличной от utf8

Аватар пользователя multpix multpix 30 января 2013 в 0:18

конвертировать существующий в utf8 без BOM
создавать новый в utf8 без BOM

на будущее от внутреннего телепата: notepad++ sublimetext2 netbeans ....

p.s.
это не ошибка, это куча мусора вместо рабочего места...
читай http://drupal.org/node/147789