Joomla Development

13 March 2012 Community Builder Phoca Gallery Plugin

Check out our Community Builder plugin for the Phoca Gallery extension.

   

12 September 2011 Front Page Slideshow Link Problem

FPSS is a great slideshow addon for Joomla, Drupal, and standalone slideshows. They have a new version for Joomla 1.7, with a much improved interface. When it comes to linking slides, it seems you can choose to display links for all slides, or not. But what if you want links on some slides but not others? In such a case, if the user did not supply a URL, the link will say "http://www.yoursite.com/URL". You could enter "#" or "javascript:;" as the URL, but one cannot expect non web developers to remember to do this. The user should not be required to take additional action just to NOT link a slide.

We wrote a quick fix for this. Open up the default.php template file for the FPSS layout you're using. We used JJ-Oobs so we opened up /modules/mod_fpss/tmpl/JJ-Obs/default.php. Right after "foreach($slides as $slide):" insert the following:

if($slide->link == 'URL'){
$slide->link = 'javascript:;';
}

We used a "javascript:;" URL rather than "#" because this way if you slideshow is far down the page, clicking it will not take you back to the top of the page ... using "#" can conflict with named anchors but "javascript:;" does not.

   

26 April 2011 VirtueMart Category Dropdown Module

VirtueMart is an e-commerce component for Joomla, and it comes with a module called Product Categories (mod_product_categories). This module comes with several display options, such as a link list, CSS menu, and some JavaScript menus. Strangely, though, it does not come with a dropdown select option (a <select> menu). This post will show you how to add that option. This VirtueMart core modification also adds a "selected" attribute to the currently selected <option>.

Rather than writing it as a separate module, I have extended the the normal product categories module to have this as an option in addition to all the other options such as Transmenu, Links List, and so on. This should make it easier to incorporate in the next release since the work's already done.

The following is in use on a site running Joomla 1.5.23 and VirtueMart 1.1.8. You can download VirtueMart here. Download the "complete package", unzip it, and look in the modules directory for mod_product_categories_1.1.8.j15.zip. This is the module that need to be modified.

After making the following modifications, you will need to edit your categories module and set the category display type to "Dropdown select menu".

There are two file modifications and one new file:
- modules/mod_product_categories/mod_product_categories.php (modified)
- modules/mod_product_categories/mod_product_categories.xml (modified)
- modules/mod_virtuemart/vm_select.php (new file).

Modify modules/mod_product_categories/mod_product_categories.php:

After:

case 'tigratree':
/* TigraTree script to display structured categories */
include( $vm_path . '/vm_tigratree.php' );
break;

Paste this:

//product categories select mod
case 'select':
include( $vm_path . '/vm_select.php' );
break; 
//
 

Modify modules/mod_product_categories/mod_product_categories.xml:

After:

<option value="dtree">dTree</option>
 

Paste this:

<!--product categories select mod-->
<option value="select">Dropdown select menu</option>
<!--end-->

Paste this into a new file at modules/mod_virtuemart/vm_select.php:

<?php
//plethora mod

if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

global $mosConfig_live_site, $mosConfig_absolute_path;

if( vmIsJoomla('1.5')) {
	$live_module_dir = $mosConfig_live_site.'/modules/mod_virtuemart';
	$absolute_module_dir = $mosConfig_absolute_path.'/modules/mod_virtuemart';
} else {
	$live_module_dir = $mosConfig_live_site.'/modules';
	$absolute_module_dir = $mosConfig_absolute_path.'/modules';
}
/*change following:*/
$params->set( 'module_name', 'ShopMenu' );
$params->set( 'module', 'vm_transmenu' );
$params->set( 'absPath', $absolute_module_dir . '/' . $params->get( 'module' ) );
$params->set( 'LSPath', $live_module_dir . '/' . $params->get( 'module' ) );

//include_once( $params->get( 'absPath' ) .'/Shop_Menu.php' );

global $my, $db;

//$mbtmenu= new Shop_Menu($db, $params);

//$mbtmenu->genMenu();
require_once(CLASSPATH.'ps_product_category.php');
$ps_product_category = new ps_product_category();

function get_category_tree_select( $category_id=0,
				$links_css_class="mainlevel",
				$list_css_class="mm123",
				$highlighted_style="font-style:italic;" ) {
		global $sess;

		$categories = ps_product_category::getCategoryTreeArray(); // Get array of category objects
		$result = ps_product_category::sortCategoryTreeArray($categories); // Sort array of category objects
		$row_list = $result['row_list'];
		$depth_list = $result['depth_list'];
		$category_tmp = $result['category_tmp'];
		$nrows = sizeof($category_tmp);

		// Copy the Array into an Array with auto_incrementing Indexes
		$key = array_keys($categories); // Array of category table primary keys
		
		$nrows = $size = sizeOf($key); // Category count

		$html = "";

		// Find out if we have subcategories to display
		$allowed_subcategories = Array();
		if( !empty( $categories[$category_id]["category_parent_id"] ) ) {
			// Find the Root Category of this category
			$root = $categories[$category_id];
			$allowed_subcategories[] = $categories[$category_id]["category_parent_id"];
			// Loop through the Tree up to the root
			while( !empty( $root["category_parent_id"] )) {
				$allowed_subcategories[] = $categories[$root["category_child_id"]]["category_child_id"];
				$root = $categories[$root["category_parent_id"]];
			}
		}
		// Fix the empty Array Fields
		if( $nrows < count( $row_list ) ) {
			$nrows = count( $row_list );
		}

		// Now show the categories
		for($n = 0 ; $n < $nrows ; $n++) {

			if( !isset( $row_list[$n] ) || !isset( $category_tmp[$row_list[$n]]["category_child_id"] ) )
			continue;
			if( $category_id == $category_tmp[$row_list[$n]]["category_child_id"] )
			$style = $highlighted_style;
			else
			$style = "";

			$allowed = false;
			if( $depth_list[$n] > 0 ) {
				// Subcategory!
				if( isset( $root ) && in_array( $category_tmp[$row_list[$n]]["category_child_id"], $allowed_subcategories )
				|| $category_tmp[$row_list[$n]]["category_parent_id"] == $category_id
				|| $category_tmp[$row_list[$n]]["category_parent_id"] == @$categories[$category_id]["category_parent_id"]) {
					$allowed = true;

				}
			}
			else
			$allowed = true;
			$append = "";
			if( $allowed ) {
				if( $style == $highlighted_style ) {
					$append = 'id="active_menu"';
				}
				if( $depth_list[$n] > 0 ) {
					$css_class = "sublevel";
				}
				else {
					$css_class = $links_css_class;
				}

				$catname = shopMakeHtmlSafe( $category_tmp[$row_list[$n]]["category_name"] );

				if ($_REQUEST['category_id'] == $category_tmp[$row_list[$n]]["category_child_id"]){
				$selected = ' selected="selected"';
				}
				else{
				$selected = '';
				}
				$Itemid = (int) vmRequest::getInt( 'Itemid', '' );
				$html .= '
				<option value="'.$sess->url(URL."index.php?page=shop.browse&category_id=".
				$category_tmp[$row_list[$n]]["category_child_id"].'&option=com_virtuemart&Itemid='.$Itemid).'" label="'.$catname.'" id="'.
				$category_tmp[$row_list[$n]]["category_child_id"].'"'. $selected. '>'
				. str_repeat("   ",$depth_list[$n]) . $catname
				. ps_product_category::products_in_category( $category_tmp[$row_list[$n]]["category_child_id"] )
				. '</option>';
			}
		}

		return $html;
	}
?>
<script type="text/javascript">
<!--
function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<form id="vmcatselectform" name="vmcatselectform" action="">
  <select name="vmcatselect" id="vmcatselect" onchange="MM_jumpMenu('parent',this,0)">
   <?php
echo get_category_tree_select( $category_id, $class_mainlevel );
?>
  </select>
  <input type="button" name="go_button" id="go_button" value="Go" onclick="MM_jumpMenuGo('vmcatselect','parent',0)" />
</form>
 <?php
 //end
 ?>

   

20 April 2011 Phoca Download CommunityBuilder - new 1.6 plugin

We're pleased to announce a new version of our CommunityBuilder Phoca Download plugin. The new version works in both Joomla 1.6 and 1.5, and allows users to edit their files' titles and descriptions, and lets them delete their own files. We are working on adding more refined group-based access controls in the plugin parameters. 

The editing interface is still a bit clunky and will also be improved.

Download it here

Enjoy! 

   

11 January 2011 Fixing Itemids for Joomla / K2's tag view

This article is about K2, which works with Joomla.

We created menu items pointing to “generic” tag views. Each tag has its own Itemid, which is fine. However, when you click on “read more” for any of the items on the generic tag page, the ‘read more’ link uses the default K2 Itemid rather than the Itemid of the current page / menu item. This does seem like a bug to me. The read more links should use the Itemids of the current page or at least the menu item that brought the viewer to that ‘read more’ link.

In our case, K2′s default Itemid is 17 (as set in the menu).  We also have a menu item for a tag view, with an Itemid of 37.
The ‘read more’ URLs should have been in this format:

index.php?option=com_k2&view=itemlist&layout=generic&tag=Health%20Care&task=tag&Itemid=37

.. but were showing up as:

index.php?option=com_k2&view=itemlist&layout=generic&tag=Health%20Care&task=tag&Itemid=17

We have written a small override that solved this for us, since I could find no other way to solve this. We dislike core modifications but in this case it seemed to be the only way:

In /components/k2/models/item.php around line 62 (search for “read more link” .. it should be the first one), add this:

 
//mod to replace K2 Itemid with current page’s Itemid.  
if(JRequest::getVar(‘Itemid’) && JRequest::getVar(‘layout’) && (JRequest::getVar(‘layout’) == ‘generic’) && JRequest::getVar(‘task’) && (JRequest::getVar(‘task’) == ‘tag’)){   
//MAKE SURE TO CHANGE “Itemid=17″ TO WHATEVER ITEMID YOUR K2 USES:
$link = str_replace(‘Itemid=17′,’Itemid=’.JRequest::getInt(‘Itemid’),$link);
}
//end
   

28 December 2010 Joomla / K2; disabling modal image popups on some items

We are in the middle of designing a new version of plethoradesign.com using Joomla and K2. Most images in our web design portfolio have a large version that can be clicked and enlarged, but in some cases this was not desirable; for example for logos. There was no way to turn off this feature (not easily anyway), so it was time to add this option to K2.

Thanks to a post over at the K2 Forums, we customized our K2 installation so it is now possible to turn off the popup modal link on an item-by-item basis.

Download: k2-item-image-link-option.zip

Changed files;
administrator/com_k2/models/item.xml
components/com_k2/templates/default/item.php

The code in item.php is set up so items will show popup links on images by default, but if the item options have been set to disable the popup, it will not be linked.

   

08 October 2010 Phoca Download CB Plugin

A Community Builder plugin for Joomla 1.5 that displays a user’s files. If the user is viewing his/her own profile, the user can also delete the file from the frontend, which is not yet supported officially by Phoca Download itself!  Download it here

   

22 June 2010 Client login for Joomla 1.5 banner component

For the longest time I have been frustrated that the standard banner component doesn't let banner clients login and view theirbanner statistics. I had been using OpenX but it is a resource hog and is really overkill when all I want is to be able to show a client how many clicks they've had so far. I don't want them to just take my word for it.

Well, after trying out various solutions besides OpenX, I thought to myself 2 hours ago, "why can't I just use Contact field in thebanner client area and enter a Joomla username, and then write a custom model for com_banners to display the statistics if the current Joomla user is the same as the one listed as the contact for a client?"

So that's what I did. It is actually two queries. #1 checks the current username and selects all clients with that username (should be just one .. I limited it to one in the query), and selects the correct cid (client id). #2 selects all active banners for a given cid and spits them out, showing the banner, clicks, impressions, and CTR. I also added in some custom HTML to display a PayPal button … ideally this should be done in a View, not a Model, but the Banners component doesn't seem to follow the MVC structure 100% so I didn't either.

I did have to modify a few other files. Here are my modifications – this is on Joomla 1.5.18 but should work for any 1.5 release.

It's as easy as 1-2-3;

/components/com_banners/controller.php:

Add this after the end of function click():

function bannerstats(){
$model = $this->getModel( 'Bannerstats' );
$model->bannerstats();  }

Note that some older Joomla code might read:

$model = &$this->getModel( 'Bannerstats' );

PHP 5 requires:

$model = $this->getModel( 'Bannerstats' );

 

/components/com_banners/bannerstats.php
This is a new file – containing this code:

 // Create the controller $controller = new BannersController( array('default_task' => 'bannerstats') ); // Perform the Requested task $controller->execute(JRequest::getVar('task', null, 'bannerstats', 'cmd')); // Redirect if set by the controller $controller->redirect(); 

/components/com_banners/models/bannerstats.php

This is a new file containing this code:

 // Check to ensure this file is included in Joomla! defined('_JEXEC') or die( 'Restricted access' ); $document = &JFactory::getDocument(); jimport( 'joomla.application.component.model' ); jimport( 'joomla.application.component.helper' ); /** * @package Joomla * @subpackage Banners */ class BannersModelBannerstats extends JModel { function bannerstats(){ $banneruser = &JFactory::getUser(); $dbgetclient = &$this->getDBO(); echo "
<h2>".$banneruser->name."'s Ads</h2>
"; echo "
Already a customer? If your ad is about to reach the paid for number of clicks, you can make another payment using this button:
"; echo '
form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <input type="hidden" value="_xclick" name="cmd" /> <input type="hidden" value="US" name="lc" /> <input type="hidden" value="youremail@yourdomain.com" name="business" /> <input type="hidden" value="4UXZK24C297M6″> <input name=" name="pal" /> <input width="62″ height=" border="0″ type=" alt="Make payments with PayPal – it\'s fast, free and secure!" name="submit" src="/images/x-click-but01.gif" /> 
 '; $dbgetclient = &$this->getDBO(); echo "
<h2>Active ads for: ".$banneruser->username.":</h2>
"; $getclient = "SELECT cid FROM #__bannerclient WHERE contact='".$banneruser->username."' LIMIT 1″; $dbgetclient->setQuery( $getclient ); $getclientresult = $dbgetclient->loadObjectList(); for($i = 0; $i < count($getclientresult); $i++) { $cid = $getclientresult[$i]->cid; //echo "cid: ".$cid."
"; } $dbgetbanner = &$this->getDBO(); $getbanner = "SELECT * FROM #__banner WHERE cid=".$cid.""; $dbgetbanner->setQuery( $getbanner ); $getbannerresult = $dbgetbanner->loadObjectList(); for($i = 0; $i < count($getbannerresult); $i++) { echo "<img />imageurl."" _mce_src="/".JURI::root()."images/banners/".$getbannerresult[$i]->imageurl."" border='0′>
"; echo 'URL: '.$getbannerresult[$i]->clickurl.'
'; echo 'Clicks: '.$getbannerresult[$i]->clicks.'
'; echo 'Views: '.$getbannerresult[$i]->impmade.'
'; echo 'CTR (clickthrough rate): '.number_format((100*($getbannerresult[$i]->clicks)/($getbannerresult[$i]->impmade)),2).' %
<hr />
'; } } } 

You can then create a link in the User Menu pointing to index.php?option=com_banners&task=bannerstats.

It will detect the current logged-in user's username, check the "contact" field of the banner clients, and select the active banners for that client. Needless to say, the contact field should contain that person's username and nothing else, or it will not work.

In the future maybe there can be a special field allowing us to choose a username or enter one, instead of using the Contact field which is not really meant for that. I had considered making this a separate component, but it is really something I would like to see become part of the regular com_banners component.

Feedback is welcome – as far as I can tell this is secure and works, but others may have a better idea about that.

   

16 June 2010 Monitoring Joomla for file changes

It is often desirable to monitor a site for file changes, so that you can be alerted to unwanted file changes. Those could indicate hacker activity. There is server-side software that can do this for sites, but since our focus is Joomla, we wanted to take a moment to recommend the Eyesite component: http://extensions.lesarbresdesign.info/eyesite. To get the most out of this, you will need to set up a cron job so that it will email you whenever there are outstanding file changes.

   

01 June 2010 Find Joomla section ID for article or category

Sometimes when coding a Joomla template it may be handy to know the section ID of the article or category the user is viewing.

Here is some PHP code you could insert in your template to achieve this (for Joomla 1.5);

$db =&JFactory::getDBO(); 
if(JRequest::getVar(‘view’)==’article’){ 
$query = "SELECT sectionid FROM #__content WHERE id=".JRequest::getVar(‘id’).""; 
$sectionid = $db->loadResult();
}
if(JRequest::getVar(‘view’)==’category’){ 
$query = "SELECT sectionid FROM #__content WHERE catid=".JRequest::getVar(‘id’).""; 
$sectionid = $db->loadResult();
}

Using this, you could for example control which graphics or CSS file are loaded depending on the section of the article/category.

   
request-a-quote

© 2003-2012 Plethora Design, LLC · Contact Us · Make a Payment · Search

877-51_Skype5-6682 / 703-291-8022. Northern Virginia web design company convenient to Washington, D.C. and Maryland.