News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

VM 3.0.11 does not honor hidden menu items

Started by z-analysts, October 15, 2015, 20:11:12 PM

Previous topic - Next topic

z-analysts

I have a hidden menu item defined for index.php?option=com_virtuemart&view=cart however when I click on View Cart from the add to cart modal popup the native URL is displayed AND the page template used is my home page override template instead of the default template.

Here is a link - http://zclientdev.com/solfairtrade/fair-trade-products/hand-bags/shopping-bags

Click add to cart and the View Cart and you will see the problem.

VM 3.0.11
Joomla 3.4.4
PHP 5.4.33

Studio 42

#1
It's a bug in router file, i have already reported some months ago.(cart get current menu item_id)
in JOOMLA\components\com_virtuemart\router.php
replace after case 'cart';
if(!isset($query['Itemid'])){
if ( isset($jmenu['cart']) ) {
$query['Itemid'] = $jmenu['cart'];
} else if ( isset($jmenu['virtuemart']) ) {
$query['Itemid'] = $jmenu['virtuemart'];
}
}

to
    //if(!isset($query['Itemid'])){
if ( isset($jmenu['cart']) ) {
$query['Itemid'] = $jmenu['cart'];
} else if ( isset($jmenu['virtuemart']) ) {
$query['Itemid'] = $jmenu['virtuemart'];
}
//}


Patrick

z-analysts

Hello Patrick!

Thank you for your solution however it does not work for me. Also, the code in my router.php file for the case 'cart' looks slightly different:


if (isset($jmenu['cart'])) {
   $query['Itemid'] = $jmenu['cart'];
} else if ( isset($jmenu['virtuemart']) ) {
$query['Itemid'] = $jmenu['virtuemart'];
$segments[] = $helper->lang('cart') ;
} else {
// the worst
$segments[] = $helper->lang('cart') ;
}

Studio 42

if (isset($jmenu['cart'])) {
should set the right itemID from menu.
Perhaps you dont have set the right language, or dont used right vm link for the menu ?
Test a visible menu. But i doubt that this change anything. Or perhaps force the language in menu.
You can use a menu and not publish any module for it, but i think it's wath you do ?

z-analysts


Studio 42

#5
I have check in your site and you have raw url.
DO you have an overide in your template ?
Eg. http://zclientdev.com/solfairtrade/index.php?option=com_virtuemart&view=category&virtuemart_category_id=50&Itemid=201
I don't think this is a VM problem but the links are not passed to router
Your link should use in PHP
jroute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$cid);
but i think this is not the case

check your file JOOMLA/templates/gantry/html/com_virtuemart/cart/mini_cart.php if this exist
or JOOMLA\components\com_virtuemart\views\cart\tmpl\mini_cart.php

Perhaps the problem comes because you run in a subfolder and you have not set corretly Joomla.
> Sometime you need to set "live_site" in joomla config or set to empty.

And i see another potential problem : http://zclientdev.com/solfairtrade/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=&Itemid=201
lang is set to empty. Is better to have nothing then have empty. I think this was not the case in old VM releases

z-analysts

I have two override files in my setup. Both are my customizations of original VM files. One is for the category page and the other is for product details. I reapply the customizations each time I update VM.

I do not have a template override for mini_cart.php.

I tried setting the $live_site variable with the subfolder but that did not fix the hidden menu item problem.

Are you suggesting that my problem is with the fact the site is currently using a subfolder? This is only a development configuration so it is only temporary.

I am not explicitly setting the site language. I let it default to en-GB.


Studio 42

I suspect that this comes from a bad setting in Joomla :
index.php?option=com_virtuemart&view=category&virtuemart_category_id=50&Itemid=201
this should be replaced by the SEF URL but is not the case.
Check perhaps in your joomla core multilanguage plugin settings.
I checked manually change URL removing lang parameter, adding lang=en ... This do not change anything then i think, it's a joomla BUG or setting.
If you want to see the json response :
http://zclientdev.com/solfairtrade/index.php?option=com_virtuemart&view=cart&task=addJS&format=json&&virtuemart_product_id[]=280&lang=en

z-analysts

You are pointing out many interesting issues however what does the language setting have to do with the hidden menu item? The problem I am having is that the hidden menu item is not being honored by VM and the wrong template is being used when the shopping cart is displayed.

Can we please get back on track?

Thank you!

Studio 42

Last Joomla have problem with language, i had some problem on my own developpement.
Having raw link should be never with jroute.
Why you have this issu is a mistery, it's why i give you some way that can fix this.
In your case jroute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=50&Itemid=201') should givv the right SEF link back with or without language.
But it's not the case and this is a Joomla problem.

maks

Any solutions on that?
This is bug and it shuld not bahave like that.
Im using 2 languages and separate templates (for each lang). Now user when click link continue shoping go to wrong template.