Post by jasminej » Fri Dec 02, 2016 10:53 pm

I need to have a label on products which were added latly .I have this done on extension/module/latest.tpl ,but i'd like also to have this label working on another pages too ,like product/product.tpl,product/category and so on....
How to get this done ??? (without buying extensions ;) )

Thanks in advance

opencart 2.3
template -default

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by thekrotek » Sat Dec 03, 2016 2:38 am

The same way you did this to latest module. Products display is pretty much generic in all modules and pages.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by jasminej » Sun Dec 04, 2016 1:36 am

Thanks for your reply

This is a part of product/product.tpl page structure

Code: Select all

      <div class="row">
        <?php $i = 0; ?>
        <?php foreach ($products as $product) { ?>
        <?php if ($column_left && $column_right) { ?>
        <?php $class = 'col-xs-8 col-sm-6'; ?>
        <?php } elseif ($column_left || $column_right) { ?>
        <?php $class = 'col-xs-6 col-md-4'; ?>
        <?php } else { ?>
        <?php $class = 'col-xs-6 col-sm-3'; ?>
        <?php } ?>
        <div class="<?php echo $class; ?>">
          <div class="product-thumb transition" id="related-pr">
            <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div>
            <div class="caption">
              <h4><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>
              <p><?php echo $product['description']; ?></p>
              <?php if ($product['rating']) { ?>
              <div class="rating">
                <?php for ($j = 1; $j <= 5; $j++) { ?>
                <?php if ($product['rating'] < $j) { ?>
                <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-1x"></i></span>
                <?php } else { ?>
                <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i><i class="fa fa-star-o fa-stack-1x"></i></span>
                <?php } ?>
                <?php } ?>
              </div>
              <?php } ?>


              <?php if ($product['price']) { ?>
              <p class="price" style="display:none;">
                <?php if (!$product['special']) { ?>
                <?php echo $product['price']; ?>
                <?php } else { ?>
                <span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
                <?php } ?>
                <?php if ($product['tax']) { ?>
                <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
                <?php } ?>
              </p>
              <?php } ?>



            </div>

            <div class="button-group">
			
			
			
                <!-- <button type="button" onclick="cart.add('<?php// echo $product['product_id']; ?>', '<?php//echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php //echo $button_cart; ?></span></button> 
                <button type="button" data-toggle="tooltip" title="<?php //echo $button_wishlist; ?>" onclick="wishlist.add('<?php //echo $product['product_id']; ?>');"><i class="fa fa-heart"></i></button>
                <button type="button" data-toggle="tooltip" title="<?php //echo $button_compare; ?>" onclick="compare.add('<?php //echo $product['product_id']; ?>');"><i class="fa fa-exchange"></i></button>--><!-- <button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php //echo $button_cart; ?></span></button>-->

              <button type="button" onclick="addQtyToCart('<?php echo $product['product_id']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php //echo $button_cart; ?></span></button>



	   <?php if ($product['price']) { ?>
              <p class="price">
                <?php if (!$product['special']) { ?>
                <span id="one-price"><?php echo $product['price']; ?></span>
                <?php } else { ?>
                <span class="price-old"><?php echo $product['price']; ?></span><span class="price-new"><?php echo $product['special']; ?></span>

                <?php } ?>
                <?php if ($product['tax']) { ?>
                <!--<span class="price-tax"><?php //echo $text_tax; ?> <?php //echo $product['tax']; ?></span>-->
                <?php } ?>
              </p>
        <?php } ?>
	   
	    <?php if ($minimum > 0) { ?>

              <input type="text" value="<?php echo $minimum ?>" class="item-<?php echo $product['product_id']; ?>" id="min-numb-input"/>

              <!--<span id="min-numb"><?php //echo $product['minimum']; ?></span>
                  <input type="text" name="quantity" value="<?php //echo $minimum; ?>" size="2" id="input-quantity" class="form-control" />-->
				<!--<div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php //echo $text_minimum; ?></div>-->
        <?php } ?>





			
			</div>
          </div>
        </div>
        <?php if (($column_left && $column_right) && (($i+1) % 2 == 0)) { ?>
        <div class="clearfix visible-md visible-sm"></div>
        <?php } elseif (($column_left || $column_right) && (($i+1) % 3 == 0)) { ?>
        <div class="clearfix visible-md"></div>
        <?php } elseif (($i+1) % 4 == 0) { ?>
        <div class="clearfix visible-md"></div>
        <?php } ?>
        <?php $i++; ?>
        <?php } ?>
      </div>


Here i just have only one unique foreach loop which just brings prosuct's details .(Almost the same code as in default template ).
Is there any way to check --- if it is latly added product ,then show a label on thumbnail (ONLY for those products ,that have been added latly)???

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by thekrotek » Sun Dec 04, 2016 1:59 am

You sure your template doesn't have such feature already? I saw a lot of templates, which have "New" badge on latest products all over the store.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by jasminej » Mon Dec 05, 2016 9:40 pm

I am using default template ,here i don't have any labels,that's why i need help to get this done

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am

Post by jasminej » Thu Dec 08, 2016 9:37 pm

NO help ??? please .... :'( :'( :'(

New member

Posts

Joined
Wed Nov 09, 2016 2:56 am
Who is online

Users browsing this forum: No registered users and 7 guests