Joomla Templates shop

Premium Template

Search files

Search For: 
Search File Titles: 
Search File Descriptions: 
Home
Virtuemart Pathway - Why is it not working? PDF Print E-mail
Written by Administrator   
Wednesday, 28 March 2007

After installing Virtuemart, a highly integrated shopping cart for Joomla!, I realized that there was a small issue. The issue was with how Virtuemart and Joomla displayed the pathway of the cart. When looking at the product it displayed the a double pathway and with most of the links not working. While browsing a category you couldn’t go back to the main store because the link was not linkable. This was very annoying to me and after hours of figuring out what was going and going through code pieces I collaborated on a bunch of various different hacks and this is what ended up working for me and has been tested on all versions of Joomla and only with Virtuemart 1.0.5.

Open up the following file in your favorite editor:

/administrator/components/com_virtuemart/classes/ps_product_category.php

Find the following code:


function get_navigation_list($category_id) {
global $sess, $mosConfig_live_site;
$db = new ps_DB;

static $i=0;
static $html = "";
$q = "SELECT category_id, category_name,category_parent_id FROM #__{vm}_category, #__{vm}_category_xref WHERE ";
$q .= "#__{vm}_category_xref.category_child_id='$category_id' ";
$q .= "AND #__{vm}_category.category_id='$category_id'";
$db->setQuery($q); $db->query();
$db->next_record();
if ($db->f("category_parent_id")) {
$link = "url($_SERVER[’PHP_SELF’] . “?page=shop.browse&category_id=$category_id”);
$link .= “\”>”;
$link .= $db->f(”category_name”);
$link .= “
“;
$category_list[$i++] = ” “.$this->pathway_separator().” “. $link;
$this->get_navigation_list($db->f(”category_parent_id”));
}
else {
$link = “url($_SERVER[’PHP_SELF’] . “?page=shop.browse&category_id=$category_id”);
$link .= “\”>”;
$link .= $db->f(”category_name”);
$link .= “
“;
$category_list[$i++] = $link;

}
while (list(, $value) = each($category_list)) {
$html .= $value;
}

return $html;
}

and replace with:


function get_navigation_list($category_id, $pd = 0) {
global $sess, $mosConfig_live_site;
$db = new ps_DB;

static $i=0;
static $html = "";
$q = "SELECT category_id, category_name,category_parent_id FROM #__{vm}_category, #__{vm}_category_xref WHERE ";
$q .= "#__{vm}_category_xref.category_child_id='$category_id' ";
$q .= "AND #__{vm}_category.category_id='$category_id'";
$db->setQuery($q); $db->query();
$db->next_record();
if (($db->f("category_parent_id")) && ($i == 0) && ($pd == 0)) {
$link .= $db->f("category_name");
$category_list[$i++] = " ".$this->pathway_separator()." ". $link;
$this->get_navigation_list($db->f("category_parent_id"));
}
elseif ($db->f("category_parent_id")) {
$link = "url($_SERVER[’PHP_SELF’] . “?page=shop.browse&category_id=$category_id”);
$link .= “\”>”;
$link .= $db->f(”category_name”);
$link .= “
“;
$category_list[$i++] = ” “.$this->pathway_separator().” “. $link;
$this->get_navigation_list($db->f(”category_parent_id”));
}
elseif (($i == 0) && ($pd == 0)) {
$link .= $db->f(”category_name”);
$category_list[$i++] = $link;
}
else {
$link = “url($_SERVER[’PHP_SELF’] . “?page=shop.browse&category_id=$category_id”);
$link .= “\”>”;
$link .= $db->f(”category_name”);
$link .= “
“;
$category_list[$i++] = $link;

}
while (list(, $value) = each($category_list)) {
$html .= $value;
}

return $html;
}

Now after replacing the code with that there are two more files that need to be edited. Search for the next file: /administrator/components/com_virtuemart/html/shop.product_details.php

Fine the following line of code:


$navigation_pathway .= $ps_product_category->get_navigation_list($category_id);
$navigation_pathway .= " ".$ps_product_category->pathway_separator()." ". $product_name;

and replace with:


$navigation_pathway .= $ps_product_category->get_navigation_list($category_id, 1);
$navigation_pathway .= " ".$ps_product_category->pathway_separator()." ". $product_name;

And after that we have one last file to edit…almost done.

Open /includes/pathway.php

Find the following line of code:


// if it is the current page, then display a non hyperlink
if ($item->id == $Itemid || empty( $mid ) || empty($item->link)) {
$newlink = " $itemname";

and replace with:


// if it is the current page, then display a non hyperlink
if (($item->id == $Itemid && !$mainframe->getCustomPathWay()) || empty( $mid ) || empty($item->link)) {
$newlink = " $itemname";

Now you have edited 3 different files. Make sure you save your files as well that you also backed up your files. Now upload these to the server over top of the original files and you will now have working pathways for your shop.

Update:
And lastly open up all the templates located in /administrator/components/com_virtuemart/html/templates and delete the following code from all of your templates: {navigation_pathway} and this will conclude your pathway issues to make them just like ours.

Enjoy!

Hits: 3378
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy




Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Saturday, 14 April 2007 )
 
< Prev   Next >

Polls

Best hosting for joomla
 

Newsflash

Freqently people want to know how to customize the free templates that come with Joomla.  And, knowing how to do some template customization is an important Joomla skill to have.

A frequent question on the Joomla forums is, "how to I change or remove the "footer" text on a template."

It might be a "Template by ---- " or "Powered by Joomla"  or something like that.

Read more...