Author Topic: Can't edit products  (Read 5016 times)

cmatte

  • Beginner
  • *
  • Posts: 40
Can't edit products
« on: December 23, 2011, 14:29:36 pm »
Hi.
I had already and succesfully developed a shop with vm 1.x.
Now I am trying to develop a new online shop based on J!1.7.3 and the new beast Vm 2.0.0.
Server is aruba.it with Php 5.3.8 with out_buffering_off option, linux of course.   
I've correctly installed j!, vm and aio and the shop is up and running, the new interface is very clean and satisfactional!
The problem is I always get the error:
Code: [Select]
Fatal error: Call to a member function getProduct() on a non-object in /web/htdocs/www.mywebsite.it/home/negozio/components/com_virtuemart/views/productdetails/view.html.php on line 78when I try to edit every (sample) product from the frontend.
The edit from the admin page works.
Checking out line 78 I see an empty line and there is only a call to that function at $product = $product_model->getProduct($virtuemart_product_id); in line 155.
Seems like I'm unable to troubleshoot the problem more than this right now :-\
Ideas?



Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4022
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Can't edit products
« Reply #1 on: December 23, 2011, 21:39:29 pm »
replace line 69
Code: [Select]
$product_model = $this->getModel('product');by
Code: [Select]
if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$productModel = new VirtueMartModelProduct();
must solve this
We had many trouble with joomla function getmodel() and swaped to this method in the code give always syccesfull result

Oups right syntax is
Code: [Select]
if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$product_model = new VirtueMartModelProduct();
:)

cmatte

  • Beginner
  • *
  • Posts: 40
Re: Can't edit products
« Reply #2 on: December 24, 2011, 09:48:40 am »
That code here was at line 155, do you think this is normal? I see my code has a blank line every line.
Anyway, doing that modification made another error appear:
Code: [Select]
Fatal error: Call to a member function allowReview() on a non-object in /web/htdocs/www.mywebsite.it/home/negozio/components/com_virtuemart/views/productdetails/view.html.php on line 334 :-\
Another fact I notice is the edit button hasn't any image, but of course this is a minor problem :)
Btw, do you think I should select php 5.3.8 or php 5.2.17 for this combination of J! 1.7.3 and vm 2.?
--edit1--
Sorry I made confusion while testing.
I see using php 5.2.17 with or without your mod, makes a 500 internal server error appear. 5.3.8 gives the fatal error.

dontflinch

  • Jr. Member
  • **
  • Posts: 152
Re: Can't edit products
« Reply #3 on: December 26, 2011, 21:05:18 pm »
replace line 69
Code: [Select]
$product_model = $this->getModel('product');by
Code: [Select]
if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$productModel = new VirtueMartModelProduct();
must solve this
We had many trouble with joomla function getmodel() and swaped to this method in the code give always syccesfull result

Oups right syntax is
Code: [Select]
if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$product_model = new VirtueMartModelProduct();
:)

hi again,

I am having this problem too.  minor compared to the cart issue but still there.

I tried to make the mod that electrocity suggested but then I get a similar error about allowReview 'on line 334'.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4022
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Can't edit products
« Reply #4 on: December 27, 2011, 12:08:18 pm »
after
   // Load the category
replace the line 125
Code: [Select]
$category_model = $this->getModel('category'); by
Code: [Select]
if (!class_exists('VirtueMartModelCategory')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'category.php');
$category_model = new VirtueMartModelCategory();

and

Code: [Select]
$ratingModel = $this->getModel('ratings');by
Code: [Select]
if (!class_exists('VirtueMartModelRatings')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'ratings.php');
$ratingModel = new VirtueMartModelRatings();

Is i said getModel() is a joomla core function but does not work time to time.
We modify it in next release...

cmatte

  • Beginner
  • *
  • Posts: 40
Re: Can't edit products
« Reply #5 on: December 27, 2011, 12:36:13 pm »
This hasn't worked here.
Fatal error: Call to a member function getProduct() on a non-object in components/com_virtuemart/views/productdetails/view.html.php on line 78

Rabble

  • Beginner
  • *
  • Posts: 14
Re: Can't edit products
« Reply #6 on: January 05, 2012, 03:45:45 am »
I have this problem too.  No image on the Edit Product button and the following error: Fatal error: Call to a member function getProduct() on a non-object in /components/com_virtuemart/views/productdetails/view.html.php on line 78

My Add to Cart button doesn't work either, and JQuery is only loading once on the page.  :/

Running VM 2.0 on Joomla 1.7.3 with PHP 5.3.5.

mangotti

  • Jr. Member
  • **
  • Posts: 63
Re: Can't edit products
« Reply #7 on: January 25, 2012, 18:49:04 pm »
I as well was experiencing this problem. I made the three edits to view.html.php and the errors are gone. However, when I click to edit, the page is just blank. Please advise as this is a very frustrating situation.

cmatte

  • Beginner
  • *
  • Posts: 40
Re: Can't edit products
« Reply #8 on: January 25, 2012, 19:49:45 pm »
There's still something more to do before making front end admin functions available. Only back end edit can be used atm.

mangotti

  • Jr. Member
  • **
  • Posts: 63
Re: Can't edit products
« Reply #9 on: January 25, 2012, 20:57:56 pm »
Thanks, Cmatte. Where di you obtain this information? Do you know what the roadmap is for this?


John2400

  • Virtuemart - the Future is ever Changing
  • Global Moderator
  • Full Member
  • *
  • Posts: 1568
  • VirtueMart Version: Use VM3.0.12
Re: Can't edit products
« Reply #10 on: February 11, 2012, 10:33:45 am »
Fatal error: Class 'VirtuemartControllerProduct' not found in /home/*******/public_html/components/com_virtuemart/virtuemart.php on line 91

From the front end login I get this message when I try to edit any image or try to resize a product By clcicking on the edit buttin + - 16 or edit info.

* I can do this from the back end - this is jsut to let some one know -
1.7.5 - VM 2.0.1 f