VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: kdmonk on May 08, 2014, 14:12:53 PM

Title: Manufacturer Layout
Post by: kdmonk on May 08, 2014, 14:12:53 PM
Does anyone have any advice on what module to you when laying out the manufacturer page? I would like to display my manufacturer page like the screenshot attached. I know it is possible but I would like to know if anyone know of an extension or maybe have done this for their site. Any help would be appreciated.



[attachment cleanup by admin]
Title: Re: Manufacturer Layout
Post by: GJC Web Design on May 08, 2014, 14:22:49 PM
It is just displaying the information available in the manufacturers view ( index.php?option=com_virtuemart&view=manufacturer ) in a different way - i.e. templating

You need to over ride the components/com_virtuemart/views/manufacturer/tmpl/default.php

sort the results alphabetically - break them into 1st letter groups and display

This isn't a module - and you need some codimng skills

the designers A-Z will be a module - probably bespoke unless you can find one
Title: Re: Manufacturer Layout
Post by: kdmonk on May 12, 2014, 13:53:26 PM
Thanks GJC, I was able to add the letter to the manufacturers page but I am having issues with the alignments. Any thoughts from anyone who would like to try. I believe that once the sorting is corrected then it should look presentable.

Location: /components/com_virtuemart/views/manufacturer/tmpl/default.php

<?php
/**
*
* Description
*
* @package   VirtueMart
* @subpackage Manufacturer
* @author Kohl Patrick, Eugen Stranz
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 2701 2011-02-11 15:16:49Z impleri $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

// Category and Columns Counter
$iColumn = 1;
$iManufacturer = 1;
$firstLetter = -1;

// Calculating Categories Per Row
$manufacturerPerRow = 4;

if ($manufacturerPerRow != 1) {
   $manufacturerCellWidth = ' width'.floor ( 100 / $manufacturerPerRow );
} else {
   $manufacturerCellWidth = '';
}

// Separator
$verticalSeparator = " vertical-separator";
$horizontalSeparator = '<div class="horizontal-separator"></div>';

// Lets output the categories, if there are some
if (!empty($this->manufacturers)) { ?>

<div class="manufacturer-view-default">

   <?php // Start the Output
   foreach ( $this->manufacturers as $manufacturer ) {

      // Show the horizontal seperator
      if ($iColumn == 1 && $iManufacturer > $manufacturerPerRow) {
         echo $horizontalSeparator;
      }

      // this is an indicator wether a row needs to be opened or not
      if ($iColumn == 1) { ?>
      <div class="row">
      <?php }

      // Show the vertical seperator
      if ($iManufacturer == $manufacturerPerRow or $iManufacturer % $manufacturerPerRow == 0) {
         $showVerticalSeparator = ' ';
      } else {
         $showVerticalSeparator = $verticalSeparator;
      }

      // Manufacturer Elements
      $manufacturerURL = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $manufacturer->virtuemart_manufacturer_id, FALSE);
      $manufacturerIncludedProductsURL = JRoute::_( 'index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $manufacturer->virtuemart_manufacturer_id, FALSE);
      $manufacturerImage = $manufacturer->images[0]->displayMediaThumb("",false);
      //echo "<strong>$firstLetter</strong> <br />"; $firstLetter = $manufacturer->mf_name[0];
      
      if ($manufacturer->mf_name[0] !== $firstLetter)
       {
           echo "<strong>$firstLetter</strong> <br />"; $firstLetter = $manufacturer->mf_name[0];
       }
      
      // Show Category ?>
      <div class="manufacturer floatleft<?php echo $manufacturerCellWidth . $showVerticalSeparator ?>">
         <div class="spacer">
            <h2>
               <a title="<?php echo $manufacturer->mf_name; ?>" href="<?php echo $manufacturerURL; ?>"><?php echo $manufacturer->mf_name; ?></a>
            </h2>
            <a title="<?php echo $manufacturer->mf_name; ?>" href="<?php echo $manufacturerURL; ?>"><?php echo $manufacturerImage;?></a>
         </div>
      </div>
      <?php
      $iManufacturer ++;

      // Do we need to close the current row now?
      if ($iColumn == $manufacturerPerRow) {
         echo '<div class="clear"></div></div>';
         $iColumn = 1;
      } else {
         $iColumn ++;
      }
   }

   // Do we need a final closing row tag?
   if ($iColumn != 1) { ?>
      <div class="clear"></div>
   </div>
   <?php } ?>

</div>
<?php
}
?>
Title: Re: Manufacturer Layout
Post by: kdmonk on May 12, 2014, 13:55:47 PM
Forgot to add, Here is a reference that was used: http://stackoverflow.com/questions/4187498/php-order-in-alphabetical-order
Title: Re: Manufacturer Layout
Post by: kdmonk on May 14, 2014, 06:43:43 AM
Can anyone provide help on this?
Title: Re: Manufacturer Layout
Post by: kdmonk on June 11, 2014, 18:53:45 PM
Can anyone provide help on this?
Title: Re: Manufacturer Layout
Post by: jenkinhill on June 11, 2014, 19:12:40 PM
See http://forum.virtuemart.net/index.php?topic=116620.0