Wednesday, July 01, 2009

Increase Username field for Silent Registration in Virtuemart. Allows for long email addresses to be used as a username

FOR Joomla 1.0.x & Virtuemart 1.10.x only

use phpMyAdmin to modify jos_users

Change Type/Length of username field from 25 to 255

Edit File:

administrator\components\com_virtuemart\classes\ps_shopper.php

Line: 174

Change Code:

$silent_username = substr( str_replace( '-', '_', $d['email'] ), 0, 25 );

To:

$silent_username = substr( str_replace( '-', '_', $d['email'] ), 0, 255 );


Editincludes/joomla.php file

find the lines

// check that username is not greater than 25 characters
$username = $this->username;
if ( strlen($username) > 25 ) {
$this->username = substr( $username, 0, 25 );

To:

$username = $this->username;
if ( strlen($username) > 25 ) {
$this->username = substr( $username, 0, 25 );

To Increase in com_registration

EDIT:

administrator/components/com_users/admin.users.html.php

Replace <> with []

[input type="text" name="username" class="inputbox" size="40" value="username; ?>" maxlength="25" /]

to

[input type="text" name="username" class="inputbox" size="40" value="username; ?>" maxlength="255" /]

EDIT:

line 123

components/com_registration/registration.html.php

Browser specific CSS hacks

Safari 3 Specific Hack:


@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari 3.0 and Opera 9 rules here */
}

eg:


@media screen and (-webkit-min-device-pixel-ratio:0) {
body { background-color: blue; }
}


Firefox 3 HACK: example:

html>/**/body #con_left, x:-moz-any-link, x:default {
padding: 104px 0px 0px 1px;
}

Lightbox Modal Effect

-in your scripts.js goes:

SqueezeBox.initialize({});
$$('a.lightbox').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
SqueezeBox.fromElement(el);
});
});
OR if no domready

window.addEvent('domready', function() {
SqueezeBox.initialize({});
$$('a.lightbox').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
SqueezeBox.fromElement(el);
});
});
});



-in template your index.php, to call Joomla's Mootool engine...before html goes:

JHTML::_('behavior.modal');

-In article ADD class="lightbox" example:

NOTE Replace [ ] with <>

[a class="lightbox" href="images/stories/image.jpg"][img class="noborder" src="images/stories/small_image.jpg" border="0" alt="Image" /][/a]

How to add and validate extra field in contact form (com_contact)

- component/com_contact/views/contact/tmpl/default_form.php
- component/com_contact/views/contact/controller.php

TO MAKE A FIELD VALIDATE ADD class="inputbox required" to input field thats reads as:

Repalce [] with <> below

[input type="text" name="name" id="contact_name" class="inputbox required" value=""]

===============================================

Example: to catch Form post PHONE FIELD

add

$phone = JRequest::getVar( 'phone', '', 'post' );

to line 116 in controller.php

add

.$phone.

to line 178 which reads

$body = $prefix."\n"."Name: ".$name."\n"."Phone: ".$phone.' <'.$email.'>'."\r\n\r\n".stripslashes($body);


To ADD into the default_form.php ADD (remember to replace [] with <> tags below)

[label for="contact_phone"] [?php echo JText::_( 'Phone' );?]:[/label]
[input type="text" name="phone" id="contact_phone" size="30" class="inputbox" value="" /]

Wednesday, January 21, 2009

Custom CSS Class in TinyMCE

edit: plugins\editors\tinymce.php

line 229 IF CONDITION: if($content_css) should read:

if($content_css)
            {
                $file_path = JPATH_SITE .'/templates/'. $template .'/css/';
                if ( !file_exists( $file_path .DS. 'editor.css' ) ) {
                    $template = 'template_folder_name_here';
                }

                $content_css = 'content_css : "' . JURI::root() .'templates/'. $template . '/css/editor.css",';
            } else {
                $content_css = '';
            }
        }

Allow Javascript in TinyMCE editor

In TinyMCE plugin settings/parameters

set 

Extended Valid Elements to

script[language|type]

Reset Virtuemart Invoice Number

delete all records from:

jos_vm_orders
jos_vm_order_history
jos_vm_order_item
jos_vm_order_payment
jos_vm_order_user_info

goto  jos_vm_orders  then click on Operations tab, then change auto increment value to whatever you want your Invoice number to start with

Tuesday, January 20, 2009

Auto Expand Sections/Categories in Extended Menu Module for Joomla 1.5

The solution for this is altering some files from the module:

modules/mod_exmenu-j15/exmenu/loader/autoexpandedmenu.menuloader.class.php

Change lines 177 to 192 from:

Code:

switch($menuNode->type) {
case 'content_category':
case 'content_blog_category':
case 'content_archive_category':
if ($contentItemVisible) {
$this->categoryMenuNodeList[] =& $menuNode;
}
break;
case 'content_section':
case 'content_blog_section':
case 'content_archive_section':
if (($categoryVisible) || ($contentItemVisible)) {
$this->sectionMenuNodeList[] =& $menuNode;
}
break;
}



to:

Code:

$tipoMenu = $this->getRawUrlParameter($menuNode->link, 'view');
switch($tipoMenu) {
case 'category':
if ($contentItemVisible) {
$this->categoryMenuNodeList[] =& $menuNode;
}
break;
case 'section':
if (($categoryVisible) || ($contentItemVisible)) {
$this->sectionMenuNodeList[] =& $menuNode;
}
break;
}



This will do the work to generate the links, but Extended Menu won't give then the proper classes when they are active, so it's needed to change one more file:

modules/mod_exmenu-j15/exmenu/loader/menuloader.class.php

Change lines 297 to 303 from:

Code:

switch($task) {
case 'view':
case 'edit':
case 'cancel':
$result = $id;
break;
}



to:

Code:

$result = $id;

Virtuemart hack - Auto Expand all Virtuemart Categories

This method works for display type: LINK LIST

edit 

administrator/components/com_virtuemart/classes/ps_product_category.php

disable code in line 686 and line 810

$allowed = false;

to

//$allowed = false;

For Dtree:

In components/com_virtuemart/js/vm_dtree.php change line 38 from

$openAll = 'false';

to

$openAll = 'true';