Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Using the JomGenuis + Virtuemart +...
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
21-Dec-10 14:22:38
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
- Index
- » MetaMod
- » MetaMod General Support
- » Using the JomGenuis + Virtuemart +...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8026
- Newest User:
- rivas48750
- Members Online:
- 1
- Guests Online:
- 175
- Online:
- rivas48750
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked