2012-05-22 92 views
0

試圖將「添加到願望清單」添加到編碼中,以便它顯示在類別頁面上。因此,類別字段中顯示的每個產品都會有自己的「添加願望清單」按鈕。我也會將其複製到搜索方法中,因爲我的很多類別實際上都是搜索。我工作的網站有很多類似的產品,主要是視覺效果,所以它真的能派上用場。Opencart - 將「添加到願望清單」添加到類別頁面

,我在地方的加入收藏目前的代碼是(排除在CSS - 無需承擔任何人!):

<a class="wish_add" href="<?php echo $add_to_wishlist[$j]['add']; ?>" title="<?php echo $button_to_wishlist; ?>" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a> 

了代號爲整個頁面(CATEGORY.TPL ):

<div class="clear">&nbsp;</div><!--[if lt IE 7]><br /><![endif]--> 
    <?php if (!$categories && !$products) { ?> 
    <div class="content"><?php echo $text_error; ?></div> 
    <?php } ?> 
    <?php 
    if($_SERVER['QUERY_STRING']!='_route_=ketubahs'){ 
    ?> 
    <!--<?php /* if ($categories) { */ ?> --> 
    <?php if ($categories && $heading_title!="Scroll Down to View All Our Ketubahs on One Page") { ?> 
    <table class="listC" cellspacing="7"> 
     <?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) { 
     $numpages=sizeof($products); 
     ?> 
     <tr> 
     <?php for ($j = $i; $j < ($i + 4); $j++) { ?> 
     <td width="25%"><?php if (isset($categories[$j])) { ?> 
      <a href="<?php echo $categories[$j]['href']; ?>"><img src="<?php echo $categories[$j]['thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a><br /> 
      <a href="<?php echo $categories[$j]['href']; ?>"><?php echo $categories[$j]['name']; ?></a> 
      <?php } ?></td> 
     <?php } ?> 
     </tr> 
     <?php } ?> 
    </table> 
    <?php } 
                } 
    ?> 
    <?php if ($products) { ?> 
<!-- <div class="sort"> --> 
     <div class="sort" <?php if ($heading_title=="Scroll Down to View All Our Ketubahs on One Page") { echo "style='margin-top:-40px;'"; } ?> > 
     <div class="div1"> 
     <select name="sort" onchange="location = this.value"> 
      <?php foreach ($sorts as $sorts) { ?> 
      <?php if (($sort . '-' . $order) == $sorts['value']) { ?> 
      <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option> 
      <?php } else { ?> 
      <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option> 
      <?php } ?> 
      <?php } ?> 
     </select> 
     </div> 
     <div class="div2"><?php echo $text_sort; ?></div> 
    </div> 
    <table class="listC" cellspacing="7"> 
     <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { 
     $numpages=sizeof($products); 
     ?> 
     <tr> 
     <?php for ($j = $i; $j < ($i + 4); $j++) { ?> 
     <td width="25%"> 
<?php if (isset($products[$j])) { ?> 
       <a href="<?php echo $products[$j]['href']; ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" width="210px" height="210px" /></a><br /><Br /> 
      <div style="margin-top:-15px;"><a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br /> 
<?php  if($products[$j]['artist'] != 'Rosenthal, Gary' and $products[$j]['artist'] != 'Jessy Judaica' and !empty($products[$j]['artist'])){ 
      $artist_fname=substr($products[$j]['artist'],strpos($products[$j]['artist'],",")+1); 
      $artist_lname=substr($products[$j]['artist'],0,strpos($products[$j]['artist'],",")); 
     $artist_fullname=trim($artist_fname)." ".trim($artist_lname); 
     if (trim($products[$j]['artist'])=="Zeev") { 
     $artist_fullname="Ze&#39;ev"; } 
     if (trim($products[$j]['artist'])=="This is not a Ketubah") { 
     $artist_fullname="This is not a Ketubah"; } 
     $artistname=str_replace(' ','-',$artist_fullname); 
     if (trim($artistname)=="Ze&#39;ev") { 
     $artistname="Ze-ev"; } 
     if (trim($artistname)=="This is not a Ketubah") { 
     $artistname="This is not a Ketubah"; } 
     $artist_path='meet-our-artists/'.strtolower($artistname); 
?> 
      <a href="<?php echo $artist_path; ?>"><span style="color:#FFF;font-weight:200;"><?php echo $artist_fullname; ?></span></a><br /> 
<?php } else { ?> 
      <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br /> 
<?php } ?> 
      <?php if ($display_price) { ?> 
      <?php if (!$products[$j]['special']) { ?> 
      <span style="color: #00d8ff; font-weight: bold;cursor:default;"><?php echo $products[$j]['price']; ?></span> 
      <?php } else { ?> 
      <span style="color: #00d8ff; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #FAA; font-weight: bold;"><?php echo $products[$j]['special']; ?></span> 
      <?php } ?> 
</div> 
      <?php } ?> 
      <br /> 
      <?php if ($products[$j]['rating']) { ?> 
      <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" /> 
      <?php } ?> 
      <?php } ?> 

     <a class="wish_add" href="<?php echo $add_to_wishlist[$j]['add']; ?>" title="<?php echo $button_to_wishlist; ?>" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a> 
      <a class="cart_add" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" ><span><?php echo $button_add_to_cart; ?></span></a> 

      </td> 
     <?php } ?> 
     </tr> 
     <?php } ?> 

    </table> 
    <div class="pagination" style="width:950px;text-align:right"><?php 
    if (($numpages-$ii)>1) { 
    echo "Displaying all ".($numpages-$ii)." items in this category."; 
    } else { 
    echo "Displaying 1 item in this category."; 
    } ?></div> 
     <?php } ?> 



    </div> 
    <div class="bottom"> 
    <div class="left"></div> 
    <div class="right"></div> 
    <div class="center"></div> 
    </div> 
</div> 
<?php echo $footer; ?> 

任何幫助將是驚人的!

乾杯

AG

回答

0

想通了這一點。有在被阻止進入生產按鈕控制器禁用功能:

位於控制器/分類/ category.php

$this->data['add_to_wishlist'] = HTTPS_SERVER . 'index.php?route=product/wishlist&p=' . $result['product_id']; 

一旦啓用它喂的願望清單代碼,休息Opencart的讓我放在收藏和他類別頁面內添加到購物車對每一個產品:

位於視圖/分類/ category.php

<a href="<?php echo $add_to_wishlist; ?>" class="wish_add" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a> 
相關問題