简体   繁体   English

opencart jcarousel在最新产品上

[英]opencart jcarousel on latest product

Right now I'm learning Opencart, and I'm trying to make my latest product display with jCarousel. 现在,我正在学习Opencart,并且正在尝试使用jCarousel展示我的最新产品。 I'm using Opencart 1.5.4. 我正在使用Opencart 1.5.4。

This is what I've already tried, but still failed: http://www.packtpub.com/article/opencart-themes-using-jCarousel-plugin 这是我已经尝试过但仍然失败的方法: http : //www.packtpub.com/article/opencart-themes-using-jCarousel-plugin

I'm editing the latest.tpl file step-by-step as in the tutorial, but I'm getting stuck on the eight step. 我正在按照教程中的步骤一步一步地编辑Latest.tpl文件,但我陷入了第八步。

When I open Firefox and hit refresh nothing happens, no error or message. 当我打开Firefox并单击刷新时,没有任何反应,没有错误或消息。 This is my latest.tpl file: 这是我的Latest.tpl文件:

<script type="text/javascript" src="catalog/view/javascript/jquery/jCarousel/js/jquery.jcarousel.min.js"></script>

<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />

<script type="text/javascript">
jQuery(document).ready(function() {
   jQuery('#latestcarousel').jcarouseljcarousel();
});

</script>

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div id="latestcarousel" class="box-product">
      <?php foreach ($products as $product) { ?>
      <div class="jCarousel-skin-tango">
        <?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>
      <?php } ?>  
    </div>
  </div>
</div>

Any suggestion? 有什么建议吗?

Please follow the step by step tutorial. 请按照分步教程进行。 You are not following it :). 您没有关注它:)。 You have to write <ul> , <li> tags, but you are using <div> , please rewrite the code as suggested by the book. 您必须编写<ul><li>标记,但是您正在使用<div> ,请按照本书的建议重写代码。 Thanks for choosing the book. 感谢您选择这本书。 The book uses properly running code examples, So, if there is any error, then we are not following the steps as mentioned in the opencart book . 该书使用了正确运行的代码示例,因此,如果有任何错误,则我们将不执行opencart书中提到的步骤。

This is what I do with latest.tpl file. 这就是我对latest.tpl文件的处理。 It works now. 现在可以使用了。

<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />

<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#latestcarousel').jcarousel({
scroll: 1,
visible: 3,
auto: 3,
rtl: true,
wrap: 'circular'
});
});

</script>

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-product">
        <ul id="latestcarousel" class="jcarousel-skin-tango">
        <?php foreach ($products as $product) { ?>
        <li class="carousel-latest">
            <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
            <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 } ?>
        </li>
        <?php } ?>
        </ul>
    </div>
  </div>
</div>

Thanks for anything. 谢谢你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM