Author Topic: Category Template  (Read 636 times)

rhand-vm

  • Jr. Member
  • **
  • Posts: 76
Category Template
« on: April 18, 2019, 04:39:20 am »
Hadn't done any Joomla! (version here is 1.5.26 (yes, that old)) / Virtuemart work for quite some time so please bare with me. I have a Virtuemart category for which we wanted a wider view. The class deciding the width was inside webroot/components/com_virtuemart/themes/workcycles/templates/browse/includes/browse_header_category.tpl.php and there I added:

Code: [Select]
<div class="parentCategoryInfo">
    <?php if ($category_id !=16) { 
    echo 
'<div class="parentCategoryDesc">';
     
?>

    <?php } else {
        echo 
'<div>';
    }
?>


First I tried to add it to webroot/components/com_virtuemart/themes/theme-name/templates/product_details/flypage-wide.tpl.php, but as the class deciding the width was not there, but inside browse_header_category.tpl.php I could not. Any tips how I can still create a template for this particular category so it can be chosen from the Joomla! > Virtuemart backend?

Also, is there an existing way to add a body tag which automatically loads category name, template name and such as WordPress tends to do with body_class?

StefanSTS

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 331
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Category Template
« Reply #1 on: April 22, 2019, 11:35:41 am »
If I am not mistaken, most of the VM 1 experts died long before the dinosaurs were extinct.

There are nice extensions for a migration to VM3 available. Your customers might be happy about the added security of their personal data.

Regards
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8890
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Category Template
« Reply #2 on: April 23, 2019, 08:36:36 am »
As Stefan says...  long dead

but if u want to add body classes dependent on pages this is a general Joomla question

do something like

Code: [Select]
$app = JFactory::getApplication();

$option = $app->input->getCmd('option');
$view = $app->input->getCmd('view');
$task = $app->input->getCmd('task');
$tmpl = $app->input->getCmd('tmpl');
$itemid = $app->input->getCmd('Itemid');

$menu = $app->getMenu();
$lang = JFactory::getLanguage();
if ($menu->getActive() == $menu->getDefault($lang->getTag())) {
  $home = 'home';
}
else {
  $home = 'nothome';
}

$bodyclass = $home . ' ' . $option . ' ' . $view. ' menuid-'.$itemid;


then in the template

Code: [Select]
<body id="body" class="<?php echo $bodyclass?>"
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation