Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Using the JomGenuis + Virtuemart + Categories

Using the JomGenuis + Virtuemart + Categories

I am able to produce the list of categories a product resides in.....

$vm = JomGenius("virtuemart");

$a1 = $vm->info("category_names");


foreach( $a1 as $number => $name){
    echo ": $name, : $number ";



}


How do I grab the id of the category to be able create an url to the categories? I have tried combining the category_id with category_names but without any luck.

Thanks Steve

Edited By: uglykidjoe
21-Dec-10 14:22:38

uglykidjoe
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Using the JomGenuis + Virtuemart + Categories

Hi,

a typical non-SEF URL for a VM category looks something like this:

index.php?option=com_virtuemart&page=shop.browse&category_id=21&Itemid=61

You can convert this to a SEF URL when SEF is turned on like this:

JRoute::_( $url )

So you could construct some URLs like this:

$vm = JomGenius("virtuemart");
$ids = $vm->info("category_ids");
$names = $vm->info("category_names");
$c = count( $ids );
for ($i = 0; $i < $c; $i++ ){
    $the_id = $ids[$i];
    $the_name = $names[$i];
    $url = 'index.php?option=com_virtuemart&page=shop.browse&category_id=';
    $url .= $the_id;
    $url .= '&Itemid=1'; // replace 1 with a suitable Itemid
    $sef = JRoute::_( $url );
    echo '<a href="' . $sef . '">' . $the_name . "</a><br />";
}


I haven't tried this out but it's how I would start out.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11509
Newest User:
michael2154
Members Online:
0
Guests Online:
138

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked