2013-03-24 127 views
0

我想獲得產品代碼(模塊)爲特色的產品模塊Opencart的獲取產品代碼Opencart的

看到有什麼,我想 http://demo.pure-sol.com/fahmy/test.jpg

我做了一些代碼,這個例子但蹊蹺的其結果

\目錄\控制器\模塊\ featured.php

$this->data['text_model'] = $this->language->get('text_model'); // line 10 
$this->data['model'] = $product_info['model']; // line 54 

目錄\語言\英語\模塊\ featured.php

$_['text_model']  = 'Model'; 

目錄\視圖\主題\ fashionfever \模板\模塊\ featured.tpl

<div class="feature"> 

    <h2> <?php echo $heading_title; ?></h2> 
    <div class="box-content"> 
    <div class="box-product"> 
     <?php foreach ($products as $product) { ?> 
     <div> 
     <?php if ($product['thumb']) { ?> 
     <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div> 
     <?php } ?> 
     <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> 
     <?php if ($product['price']) { ?> 
     <div class="price"> 
      <?php if (!$product['special']) { ?> 
      <?php echo $product['price']; ?> 
      <?php } else { ?> 
      <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> 
      <?php } ?> 
     </div> 
     <?php } ?> 
     <?php if ($product['rating']) { ?> 
     <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div> 
     <?php } ?> 
     <div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> 
     </div> 
<!-- additional code --> 
      <p><?php echo $text_model; ?>: <a href="<?php echo $product['href']; ?>"><?php echo $model; ?></a></p> 
 <?php } ?> 
    </div> 
    </div> 
</div> 

回答

1

刪除行

$this->data['model'] = $product_info['model']; // line 54

$this->data['products'][] = array(

加入這一行

'model'  => $product_info['model'], 

添加此

<p><?php echo $text_model; ?>: <a href="<?php echo $product['href']; ?>"><?php echo $product['model']; ?></a></p> 

剛過

<div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div> 
+0

工作很好謝謝 – 2013-03-24 15:57:40