News:

Support the VirtueMart project and become a member

Main Menu

SEF URLs in product admin

Started by Matt_Ginn, May 13, 2015, 15:55:26 PM

Previous topic - Next topic

Matt_Ginn

We have a site (Joomla 2.5.28, VM2.6.18) http://www.mardens-trading.co.uk where we have SEO/SEF turned on in both Joomla and Virtuemart. Thus the product urls are, for example - http://www.mardens-trading.co.uk/portwest-workwear/workwear-jackets/tx60-texo-sport-jacket-detail. This is all working fine, however we're trying to use a component in the backend that automatically posts the product to our facebook page when you save the product. We'd like it to pass the SEF url for the product but I can't seem to find a way to access that in the product admin. The only values I can get from the product object are 'unfriendly' urls! Is there a property of the product object that holds the friendly version or can I use the router.php to translate it??

jjk

I'm not aware of any method to display the frontend SEF url in the backend. Perhaps the developer of the facebook component can add that feature into his extension. I think it is possible to build the SEF url from an sql query. Some sitemap generators use that approach.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

PRO



Do you use joomla menu for categories?

If so,

I made a function that can get your started working on this
It will return the sef path to the category, as well as any other link that's in the menu.


function menuPathLink($mlink){
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('path');
$query->from($db->quoteName('#__menu'));
$query->where($db->quoteName('link')." = ".$db->quote($mlink) );
$db->setQuery($query);
$row = $db->loadResult();
if (!empty($row)){return $row;}
else return $mlink;
}

So then, you just throw a non-sef category link into it, and then it returns the path


For example  here is a standard non-sef category link
index.php?option=com_virtuemart&view=category&virtuemart_category_id=11&virtuemart_manufacturer_id=0&categorylayout=0&showcategory=1&showproducts=1&productsublayout=0

So to use it, you just

echo menuPathLink('index.php?option=com_virtuemart&view=category&virtuemart_category_id=11&virtuemart_manufacturer_id=0&categorylayout=0&showcategory=1&showproducts=1&productsublayout=0');

& ofcourse, you have to have the virtuemart_category_id   be dynamic

THEN: place the product alias, and the -suffix to the end.
Of course, you need to add the base link.





jessica_watson


jjk

Note that the file linked by Jessica is for Joomla 1.5 and VirtueMart 1.x. It will not work on Joomla 2.5.x/3.x and VM 2.x or 3.x.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations