Product Options Error

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25606

Hi,

I have just tried adding an option to a proudct and i get the following error on the product page on the front end:



Catchable fatal error: Object of class stdClass could not be converted to string in public_html/libraries/joomla/application/component/view.php on line 628.


Line 628 in that file is:

$option = preg_replace('/[^A-Z0-9_\.-]/i', '', $option);

Any idea what's causing this?

Thanks,

Phil


Create your own style of luxury bespoke furniture online

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25621

I would say that this comes from the fact that you have the register globals option of your php turned on, which you shouldn't. Because of that, the option variable we use in our view overwrites the option variable that joomla uses on it end and thus you can that error.

Three solutions:
1. you change that line by:
$option = preg_replace('/[^A-Z0-9_\.-]/i', '', JRequest::getString('option'));

2. You edit the file option of the view product via the menu Display->Views and you change the variable $option by $optionElement to avoid the conflict.

3. You deactivate that php option, supposing that you have access to your php.ini

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25626

Hi Nicolas, is this something I can change in my server's cPanel or something I could ask my hosting supplier to change for me?

Alternatively, what would be the repercussions of changing the $option = preg_replace('/[^A-Z0-9_\.-]/i', '', JRequest::getString('option')); line? Would this impact anything else ont he site? Or can it be changed without worry?

Thanks,

(I'm loving all the new features in the business edition by the way! Well worth the money)

Phil


Create your own style of luxury bespoke furniture online
Last edit: 12 years 7 months ago by plantpotphil.

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25627

Hi,

Apparently you can do it with cpanel:
docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/PhpIni

It might or might not impact the rest of the website. I think it won't but you never know. You can always revert the change if you have a problem...

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25628

Hi Nicolas,

When you say "2. You edit the file option of the view product via the menu Display->Views and you change the variable $option by $optionElement to avoid the conflict." do you mean change all instances of $option to $optionElement in that view?


Create your own style of luxury bespoke furniture online

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25629

Yes, indeed.

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25630

That's fixed that error, thanks for your help.

As another issue, the option doesn't seem to list anywhere on the page?

Where are options supposed to be displayed? :huh:

I have attached my view Product > Show.php in case its something in there which i causing the issue.

File Attachment:

File Name: view_prodcut_show.txt
File Size:21 KB


Create your own style of luxury bespoke furniture online
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25634

Maybe you didn't do the modification properly in the option file of the view product ?

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25635

I don't think so since I simply run a find-replace-all for field $option to $optionElement

That is the only modification I have made in that view. File attached.

File Attachment:

File Name: view_produ...tion.txt
File Size:7 KB


Create your own style of luxury bespoke furniture online
Attachments:
Last edit: 12 years 7 months ago by plantpotphil.

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25636

Could you give a link to that page ?

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25637

I will PM you the details to log in (site is in offline mode)


Create your own style of luxury bespoke furniture online

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 7 months ago #25640

I checked your product on the back end and there is no option configured:
/administrator/index.php?option=com_hikashop&ctrl=product&task=edit&cid[]=15

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 0
12 years 7 months ago #25641

...doh.

I didn't realise you needed to hit the product save button after hitting the 'ok' button in the product options squeezebox.

sorry for wasting your time!!


Create your own style of luxury bespoke furniture online

Please Log in or Create an account to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum