You are here:  » grid in latest version

Active Forum Topics


grid in latest version

Submitted by wilkins on Sun, 2016-11-06 08:56 in

hi David

Been changing our sites to the latest version. I have some sites that have results in grid as default, is it possilbe to bo this with the new version?, also they are full screen (100% not fixed),is this possible also?

Regards

Brent

Submitted by support on Mon, 2016-11-07 10:25

Hello Brent,

Here's a replacement html/searchresults.php for grid layout in the Foundation based Responsive HTML template (since 14/06A):

<?php
  if (file_exists("html/user_searchresults_before.php")) require("html/user_searchresults_before.php");
?>
<style type='text/css'>
.pt_sr_center {
  text-align: center !important;
}
</style>
<div class='row pt_sr'>
  <div class='small-12 columns'>
    <ul id='pt_sr_ul' class="small-block-grid-1 medium-block-grid-4">
      <?php foreach($searchresults["products"] as $product): ?>
        <li>
          <div class='row'>
            <div class='small-12 columns'>
              <p class='pt_sr_name pt_sr_center'><a href='<?php print $product["productHREF"]; ?>'><?php print $product["name"]; ?></a></p>
            </div>
          </div>
          <div class='row'>
            <?php if ($product["image_url"]): ?>
            <div class='pt_sr_1 small-12 columns'>
              <p class='pt_sr_center'><a href='<?php print $product["productHREF"]; ?>'><img alt='<?php print translate("Image of"); ?> <?php print htmlspecialchars($product["name"],ENT_QUOTES,$config_charset); ?>' class='pt_fp_image' src='<?php print htmlspecialchars($product["image_url"],ENT_QUOTES,$config_charset); ?>' /></a></p>
            </div>
            <?php endif; ?>
            <div class='pt_sr_3 small-12 columns last'>
              <p class='pt_sr_center'>
                <span class='pt_sr_from'><?php print ($product["numMerchants"]>1?translate("from")."&nbsp;":""); ?></span>
                <span class='pt_sr_price'><?php print tapestry_price($product["minPrice"]); ?></span>
                <br />
                <a class='button tiny radius secondary' href='<?php print $product["productHREF"]; ?>'><?php print ($product["numMerchants"]>1?translate("Compare")." ".$product["numMerchants"]." ".translate("Prices"):translate("More Information")); ?></a>
              </p>
            </div>
          </div>
        </li>
      <?php endforeach; ?>
    </ul>
  </div>
</div>
<?php
  if (file_exists("html/user_searchresults_after.php")) require("html/user_searchresults_after.php");
?>

This uses Foundations -block-grid classes, defaulting to small-block-grid-1 medium-block-grid-2 large-block-grid-4 for a single column on mobile, 2 columns on tablet and 4 columns for desktop sizes but you could configure these how you want, Foundation supports up to -block-grid-12.

When using a grid view, it's best to configure $config_resultsPerPage (line 20 in config.php) for an example multiple in all cases, e.g. 12 which would give 4 rows of 4 products on desktop...

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Mon, 2017-01-23 10:41

Hello David,

Is this code still okai for 16/10A ?

Thank you.

Jan Roel

Submitted by support on Mon, 2017-01-23 10:47

Hello Jan,

Yes - it will work fine!

Cheers,
David.
--
PriceTapestry.com