2012-05-22 93 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> 
相关问题