VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: NickM52 on June 21, 2016, 13:41:39 PM

Title: Incorrect Hyperlinks in Cart
Post by: NickM52 on June 21, 2016, 13:41:39 PM
When my products are displayed in the cart they have a a thumbnail picture and then their description, which is a hyperlink to the product detail page.
How is this hyperlink text is generated? The reason I ask is that some of my products have an incorrect hyperlink. I think the link should be to the product slug with "-detail" appended to it.

However, for some of my products the hyperlink references a non-existent itemid (121). For instance the hyperlink might read;

<a href="/index.php/component/virtuemart/cus-524-detail?Itemid=121">Custom Picture Frame</a>

there is no such Itemid in my product database. If the user clicks on this hyperlink the whole cart refreshes and then the hyperlink is correct. It now displays

<a href="/index.php/component/virtuemart/cus-524-detail">Custom Picture Frame</a>\

If the user clicks on the link again then they are taken to the detail page. Obviously this means the user has to click the link twice and wait for the cart to refresh before they can see the detail.
I'm thinking this must trace back to an error in my data. If anyone can tell how the link is created, I can go and check my data.

I'm using Joomla 3.5.1 and Virtuemart 3.0.14

Thanks.
Title: Re: Incorrect Hyperlinks in Cart
Post by: GJC Web Design on June 21, 2016, 15:06:13 PM
121 must exist somewhere...  check hidden, trashed etc menu items leading to the cart
Title: Re: Incorrect Hyperlinks in Cart
Post by: NickM52 on June 28, 2016, 11:33:57 AM
I'm still having this problem and I've checked everything I can think of.  Is there anyone on this forum who is involved with the coding of the cart that can tell me how these links are created?
Thanks.
Title: Re: Incorrect Hyperlinks in Cart
Post by: GJC Web Design on June 28, 2016, 19:53:13 PM
hmm .. checked a few of my sites.. that link never has an itemid on mine

you can do a dirty filthy hack and go in templates\your_template\html\com_virtuemart\cart\default_pricelist.php ~ line 44


<?php $link1 = JHtml::link ($prow->url, $prow->product_name);

      $link = str_replace('?Itemid=121','',$link1);
//or if it varies remove everything after ?
//$link = preg_replace("/(.*?)\?(.*)/", "$1", $link1);//remove after ?

echo $link;

?>

;)
Title: Re: Incorrect Hyperlinks in Cart
Post by: NickM52 on June 30, 2016, 07:39:21 AM
That's awesome - thanks John!
Nick
Title: Re: Incorrect Hyperlinks in Cart
Post by: Milbo on July 20, 2016, 07:34:02 AM
Nick, I would like to solve the problem, the "fix" of GJC is not useable for the core and to prevent it in future.

So to check if there is a trashed cart item is a good idea. Maybe a trashed item, which is published is used, then I just need to extend the router sql.