VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: CraftyMc on September 16, 2013, 04:37:22 AM

Title: Notice: Array to string conversion ?
Post by: CraftyMc on September 16, 2013, 04:37:22 AM
Notice: Array to string conversion in C:\xampp\htdocs\components\com_virtuemart\router.php on line 32   ???

The code,

function virtuemartBuildRoute(&$query) {

$segments = array();


$helper = vmrouterHelper::getInstance($query);
/* simple route , no work , for very slow server or test purpose */
if ($helper->router_disabled) {
foreach ($query as $key => $value){
if  ($key != 'option')  {
if ($key != 'Itemid') {
$segments[]=$key.'/'.$value;
unset($query[$key]);
}
}

}
return $segments;
}

if ($helper->edit) return $segments;


If anyone could advise me on how to fix this i would very much appreciate it.
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 16, 2013, 05:17:25 AM
Maybe you could just hide this unimportant notice in Joomla config (Error Reporting)?
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 16, 2013, 05:24:40 AM
possible, however when i click 'add to cart' on a product the product never actually goes into the cart so i cannot buy anything =/ also when i click to add/edit shipping address i get taken to a forbidden, NO access page. When i click 'add to cart' on a product i get redirected to the checkout instead of staying in the shop and my product appearing in the basket? I'm not sure what i have done wrong but it's not looking good so far as the problems i have are all pretty serious and render the extension useless to me at the moment. Any suggestions? :( 
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 16, 2013, 05:46:05 AM
forum.virtuemart.net/index.php?topic=79799

Do you have any other 3rd party extensions?
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 16, 2013, 06:25:01 AM
i have fixed most of the issues, it was Jquery conflict. only problem i have now is the shipping page still goes to a forbidden/NO access page and when filling out the billing address info it asks to select a country so i do (UK) then it says select a state/province however when i click the drop down box, there is no options to choose and i cannot save because it asks me to choose one before i can continue. 

I am using version virtuemart 2.0.22c with Joomla! 2.5.14 my live site is http://www.ldaypcrepairs.co.uk/index.php/shop and i am using this template http://demoseite.ah-68.de/kleinesschwarzes/

regards crafty :)
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 16, 2013, 17:05:10 PM
SO i managed to solve the billing info problem by removing the state/province field. However the edit/change shipping address page is still broken and it is because of the Notice: Array to string conversion in C:\xampp\htdocs\components\com_virtuemart\router.php on line 32... The reason i know this is when i click the tab to edit/change shipping address the notice: code in question is pasted into my browser as shown here,

http://www.ldaypcrepairs.co.uk/%3Cbr%20/%3E%3Cb%3ENotice%3C/b%3E:%20%20Array%20to%20string%20conversion%20in%20%3Cb%3EC:/xampp/htdocs/ldaypcrepair/components/com_virtuemart/router.php%3C/b%3E%20on%20line%20%3Cb%3E32%3C/b%3E%3Cbr%20/%3E/index.php/component/virtuemart/view/user/task/editaddresscart/addrtype/ST/virtuemart_user_id/Array

you can use this link to test yourself, http://www.ldaypcrepairs.co.uk/index.php/component/virtuemart/view/cart
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 16, 2013, 17:10:10 PM
Quote from: Maxim Pishnyak on September 16, 2013, 05:46:05 AM
Do you have any other 3rd party extensions?
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 16, 2013, 17:22:53 PM
Yes, i have a few,

I think that's about it.. once i fix the Notice: issue then i believe everything will work. I just have no idea how to correct the code as i am a front end designer and speshitpille in digital media / animation, I have very limited knowledge when it comes to php/html so array to string conversion means? 
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 18, 2013, 12:10:41 PM
still haven't solved this issue, anyone have suggestions?
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 18, 2013, 16:28:54 PM
Let's resolve this issue
1.
Quote from: CraftyMc on September 16, 2013, 06:25:01 AM
only problem i have now is the shipping page still goes to a forbidden/NO access page and when filling out the billing address info it asks to select a country so i do (UK) then it says select a state/province however when i click the drop down box, there is no options to choose and i cannot save because it asks me to choose one before i can continue. 
or this one
2.
Quote from: Maxim Pishnyak on September 16, 2013, 05:17:25 AM
Maybe you could just hide this unimportant notice in Joomla config (Error Reporting)?
1. Screen shot of your 'Css Styles & Javascripts' options in VM config? Make a test with ToTop template feature.
2. Use my advice. Check Joomla config.
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 18, 2013, 20:21:11 PM
I have attached screenshots of my config settings, I cannot hide the Notice: because this will not fix the issue, merely disguise it :( I have also took your advice and checked my joomla config but cannot find any issues in my joomla setup?

[attachment cleanup by admin]
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 18, 2013, 20:35:11 PM
After seeing rokbooster I don't have much patience. So pm me access.
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 18, 2013, 20:39:10 PM
ohh is it that bad... lol i read up about it and it seemed like a good idea  :-\
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 18, 2013, 21:04:40 PM
Nice idea, but not while you are seeking support here.
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 18, 2013, 21:14:46 PM
Ohh I apologise, I can remove it if I must?
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 18, 2013, 21:16:28 PM
You could turn on and use it later.
Title: Re: Notice: Array to string conversion ?
Post by: Maxim Pishnyak on September 18, 2013, 21:29:53 PM
Google Jquery incorporated in your template probably doesn't allow States field to work properly. I haven't access to cut this google jquery to test is it right or not. Also you have strange hosting. Your own or just Windows based?

I turned off showing of this notice in http://www.ldaypcrepairs.co.uk/administrator/index.php?option=com_config Server/Server Settings/Error Reporting - None.
Title: Re: Notice: Array to string conversion ?
Post by: CraftyMc on September 18, 2013, 21:46:42 PM
yes I host this using xampp locally on WIN 7 Ultimate x64, this is just my test web server to make sure everything works. I can send you my template files and you can have a butchers if you like?   
Title: Re: Notice: Array to string conversion ?
Post by: whisky on January 16, 2014, 14:52:23 PM
I was also particularly annoyed with this notice.

as it sound most of the time, the Notice is the fact that the array is a user_id value (virtuemart_user_id) I changed line 32 to


$segments[]=$key.'/'.(is_array($value) ? join(',',$value) : $value);


which produce a valid query string for the router.

Everything is fine so far for me.

I don't know how to push/verify that upward in the virtuemart foodchain, but could solve your problem