Post by Alex76-Bo » Thu Jan 05, 2017 5:13 pm

Hello
How can I set the related product in a column (in product page)...I mean the native OC related product, I don't want an extension.
I could open a new html module in layout panel and paste a code to call the related product but I do not any idea what code to insert

Newbie

Posts

Joined
Thu Jan 05, 2017 5:06 pm

Post by IP_CAM » Fri Jan 06, 2017 3:07 am

I don't know, what you mean with a column, but it all can be made in the
...theme/template/product/product.tpl File, (up to OC v.2.2.x at least!)
in this section, shown below, to get, by example, a layout as shown on the image!

Code: Select all

<div class="row">
<div class="product-list clearfix">
<h3 class="col-md-12">Related Products</h3>
<article class="col-xs-12 col-sm-6 col-md-6">
<div class="product-inner" style="min-height:140px;">
as you can see here, and it's layout form depends on the Browser Resolution :
http://www.hitline.info/shop/index.php? ... duct_id=49

Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by open310 » Thu Jan 19, 2017 9:21 am

I think you may be able to do this in Layout

Newbie

Posts

Joined
Fri Jan 06, 2017 6:01 am

Post by siptec » Fri Oct 27, 2017 1:28 am

I'm looking to move the related products on the standard template from the bottom to a column. Not having much luck trying to even take out related products from the product.tpl file. Get no page displayed when I try.

User avatar
New member

Posts

Joined
Mon Sep 17, 2012 11:32 pm

Post by siptec » Fri Oct 27, 2017 10:25 pm

siptec wrote:
Fri Oct 27, 2017 1:28 am
I'm looking to move the related products on the standard template from the bottom to a column. Not having much luck trying to even take out related products from the product.tpl file. Get no page displayed when I try.
OK... I isolated the related products code on the product.tpl. Any ideas how to get it to the left column. Would be great to make this into a module and place it where I need it.

Code: Select all

      <?php if ($products) { ?>
      <h3><?php echo $text_related; ?></h3>
      <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">
            <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">
                <?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']; ?>');"><span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span> <i class="fa fa-shopping-cart"></i></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>
            </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>
      <?php } ?>

User avatar
New member

Posts

Joined
Mon Sep 17, 2012 11:32 pm
Who is online

Users browsing this forum: No registered users and 39 guests