VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: razor7 on May 17, 2012, 19:43:36 PM

Title: function addJS from cart.php controller misses Itemid on links
Post by: razor7 on May 17, 2012, 19:43:36 PM
Hi, I think Itemid must be added to JS popup link buttons

On line 125 and 126, links misses the Itemid parameter
$this->json->msg = '<a class="continue" href="' . $continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
$this->json->msg .= '<a class="showcart floatright" href="' . JRoute::_("index.php?option=com_virtuemart&view=cart") . '">' . JText::_('COM_VIRTUEMART_CART_SHOW_MODAL') . '</a>';


Tryed to get Itemid like this
$Itemid = &JSite::getMenu()->getActive()->id;

But I can't find the item id, because  $Itemid gets empty ¿?

Thanks in advise.
Title: Re: function addJS from cart.php controller misses Itemid on links
Post by: WebStuff on July 23, 2013, 11:17:57 AM
This should give you an ItemId string to add to the end of the URL if one is returned.
//Find VM2 Itemid from Joomla.
$db = &JFactory::getDbo();
$qry = "SELECT `id` FROM #__menu WHERE `link` LIKE \"%com_virtuemart%\" AND `client_id` =0 ";
$db->setQuery($qry);
$db->query();
$modules = $db->loadResult();

$ItemIdString = "";
if ($modules) {
$ItemIdString = "&Itemid=".$modules;
}

Hope this helps.
Title: Re: function addJS from cart.php controller misses Itemid on links
Post by: razor7 on July 23, 2013, 14:44:41 PM
Thank you!