Menu Content

Podpora

> Diskusní fóra, FAQs & placená podpora
Welcome, Guest
Username Password: Remember me

problem writing custom plugins
(1 viewing) (1) Guest
Support forum for users using free edition of JoomSEF 3 (Joomla 1.5 compatible). These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1

TOPIC: problem writing custom plugins

problem writing custom plugins 15 years, 4 months ago #7509

Hello i have a highly customized version of virtuemart and need a very particular layout for the urls (they must match my old seo's urls exact) so i am working on writing a custom plugin for it. i am still in very early stages of development (and the com_example.txt was no help whatsoever it must be outdated because it did NOT work and wasted 6 hours of my time) but i seem to be having a problem where the main function in the class is being called twice. It also seems to be outputting the right url but not showing up as the request string. i am putting the code below and leaving the debuging data up that i found useful. Like i said it is still in an early stage of development so i currently only works on product detail pages.

the site is www.rusticrevelations.com
// Security check to ensure this file is being included by a parent file.
defined('_JEXEC') or die('Restricted access.');
 
//Attempt 2
require_once(CLASSPATH.'ps_database.php');
 
class SefExt_com_virtuemart extends SefExt
{
function get_product_name($product){
$db = new ps_DB();
$query = "SELECT `product_name` FROM `#__{vm}_product` WHERE `product_id`= $product";
$db->query($query);
$result = $db->loadResult();
return stripslashes($result);
}
function get_category_name($category){
$db = new ps_DB();
$query = "SELECT `category_name` FROM `#__{vm}_category` WHERE `category_id`= $category";
$db->query($query);
$result = $db->loadResult();
return stripslashes($result);
}
function create(&$uri) {
$vars = $uri->getQuery(true);
extract($vars);
if(isset($_REQUEST['category_id'])){
$cat_id = $_REQUEST['category_id'];
$title[] = $this->get_category_name($cat_id);
// ^ this form of adding to a array is suposed to increse key by one
}
if(isset($_REQUEST['product_id'])){
$product_id = $_REQUEST['product_id'];
$title[] = $this->get_product_name($product_id);
}
$newUri = $uri;
if (count($title) > 0) {
$newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang);
}
echo var_dump($newUri);
return $newUri;
}
}
 
  • Page:
  • 1
Přihlášení uživatele Prázdný