Author Topic: VM Categories Navigation with dependent multi drop down list  (Read 3206 times)

riordi80

  • Beginner
  • *
  • Posts: 7
VM Categories Navigation with dependent multi drop down list
« on: November 07, 2011, 14:21:41 pm »
Hello guys,

i'm trying to integrate a dependent drop list to select a main category and the his own subcategories. I just found a great extension with this function but i'm not a profesional and i don't know how can i retrieve the cookie created when select item for manipulate the output. Without configure this module, you only can select the categorys, but the "action" is empty and not run.


the link to this great module is http://convergenceservices.in/index.php?page=shop.product_details&flypage=extensions.tpl&product_id=77&category_id=10&option=com_virtuemart&Itemid=394

Can somebody help me? Thank you so much

riordi80

  • Beginner
  • *
  • Posts: 7
Re: VM Categories Select with dependent drop down list
« Reply #1 on: November 07, 2011, 14:54:43 pm »
Well, i'll put the code for help...

default.php
Code: [Select]
<?php // no direct access
defined'_JEXEC' ) or die( 'Restricted access' ); ?>

<script type="text/javascript">
function setCookie(c_name,exdays,element)
{
value = element.value;

var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
element.form.submit();
}
</script>
<form name="vmcatlistform" method="post"  action="" /\>
<?php echo $list?>
</form>

helper.php
Code: [Select]
<?php
/**
 * Helper class for catselectlist module
 * 
 * @package    
 * @subpackage 
 * @link http://convergenceservices.inzz
 * @license        GPL
 * creates a select list of virtuemart categories
 */
 
// no direct access
defined('_JEXEC') or die('Restricted access');

class 
modcatselectlistHelper
{
    
/**
     * Retrieves the hello message
     *
     * @param array $params An object containing the module parameters
     * @access public
     */    
    
function getHello$params )
    {
        return 
'Hello, World!';
    }
function getCategories($params)
{
$isall $params->get('allcat');
$parent $params->get('parent',0);
if(isset($_COOKIE['vmcat']))
{
$cookie $_COOKIE['vmcat'];
}
$vmcat JRequest::getVar('vmcat');
       
   // echo $cookie;
  // if(!empty($vmcat))
   //{
    //setcookie("vmcat", $vmcat, time()+1800);
//$cookie = $vmcat;

//}
$db JFactory::getDBO();
$query "";

$query "SELECT category_id, category_name from #__vm_category where category_publish='Y'";

if(!$isall)
{
$query .= " AND category_id in (select category_child_id from #__vm_category_xref where category_parent_id = $parent)";
}
$query .=" order by category_name";
$db->setQuery($query);
$recrd $db->loadObjectList();

$options = array();

foreach($recrd as $row)
{
$options[] = JHTML::_('select.option'$row->category_id$row->category_name );
}

$selectlist JHTML::_('select.genericlist'$options'vmcat','onChange="setCookie(\'vmcat\',1,this);"''value''text',$cookie);

return $selectlist;
}
}
?>




balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1372
Re: VM Categories Navigation with dependent multi drop down list
« Reply #2 on: January 06, 2012, 15:41:56 pm »
You can use progressive catfilters.
It is commercial but i think it worths every single cent. It also works out of the box without additional hacks to the core code.

http://demo.breakdesigns.net
*Its the module at the right