Joomla Contact, Display Form

Been having a bit of frustration with the default Joomla contact form (Joomla 3.3.3). I like that you can easily create an attractive, simple, clean contact page right out of the box, but am mystified as to why the basic details is set to show by default, and the form only pops up if you click on the header.

This seems entirely opposite to what most people would want in a contact page. I would imagine that most visitors would want to use a simple form, and just send an email. If they really need to phone, send a letter, or visit they can click to get that information.

Here’s my dilemma; I like the accordion “slider” display, and don’t want to set it to “plain.” I just want to change which section is open when the page loads.

So, here’s how you do that:

1. Find the file: [joomla root folder]/components/com_contact/views/contact/tmpl/default.php

2. Copy this file into your template overrides
(e.g. [joomla root folder]/templates/[your template]/html/com_contact/contact/default.php)

3. find this section, approximately lines 52-63:

<?php if ($this->params->get(‘show_tags’, 1) && !empty($this->item->tags)) : ?>
<?php $this->item->tagLayout = new JLayoutFile(‘joomla.content.tags’); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>

<?php if ($this->params->get(‘presentation_style’) == ‘sliders’) : ?>
<?php echo JHtml::_(‘bootstrap.startAccordion’, ‘slide-contact’, array(‘active’ => ‘basic-details’)); ?>
<?php endif; ?>
<?php if ($this->params->get(‘presentation_style’) == ‘tabs’) : ?>
<?php echo JHtml::_(‘bootstrap.startTabSet’, ‘myTab’, array(‘active’ => ‘basic-details’)); ?>
<?php endif; ?>

4.  Cut and past that directly above this line (if you’ve cut the previous section, it should now be at about line 91):

<?php if ($this->params->get(‘show_email_form’) && ($this->contact->email_to || $this->contact->user_id)) : ?>

5.  Replace ‘basic-details’ with ‘display-form’ in both instances in the pasted section.

Now when the page loads the form shows, and the other contact details are collapsed!

You can also move the whole “display-form” section up above the basic details if you like. Personally, I preferred the look of the page with the collapsed section still on top.

Z

Joomla: Redirect Error Messages

This was not a very elegant solution for my problem, which was to redirect a user to a custom “Welcome” page after registering an account in Virtuemart. So, if someone knows a better one, please feel free to share!

In my set-up, the “Register” page is no longer visible to registered customers, and is replaced with a “Log out” option. (this involves user groups and access levels).

So, normally after logging in, the Virtuemart “Account Management” menu item simply refreshes the same URL. So, now we’ve got 403 Error (and we don’t want that!) I did try editing the redirects in “/com_virtumart/controllers/edit.php”, but it did not seem to have any effect.

So, since I have to go, but need this page working right now, I decided to attack it at the error code instead. To redirect a particular error code in Joomla, go to the “/your-site/templates” and copy the “error.php” file into your own template, e.g. “/your-site/templates/mytemplate”. Then add something like this directly before the “<!DOCTYPE” line.

<?php
if ($this->error->getcode() == ‘403’) {
header(‘Location:http://www.your-domain.com/document.html’); die();
} ?>

Remember to change your link! For other error codes, just change the code number too.

More Fully Explained Here

Browser Page Title for Virtuemart Product Search Results

Virtuemart product search uses the category layout. To change the default browser title from “VirtueMart Category View,” go to “[ROOT]/components/com_virtuemart/views/category/view.html.php” file.

You’ll find:

$title = ‘VirtueMart Category View’;

at about line 555. Put your custom text in place of “Virtuemart Category View” .