VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: cmatte on December 23, 2011, 14:29:36 PM

Title: Can't edit products
Post by: cmatte 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:
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 78
when 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?


Title: Re: Can't edit products
Post by: Studio 42 on December 23, 2011, 21:39:29 PM
replace line 69
$product_model = $this->getModel('product');
by
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
if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php');
$product_model = new VirtueMartModelProduct();

:)
Title: Re: Can't edit products
Post by: cmatte 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:
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.
Title: Re: Can't edit products
Post by: dontflinch on December 26, 2011, 21:05:18 PM
Quote from: Electrocity on December 23, 2011, 21:39:29 PM
replace line 69
$product_model = $this->getModel('product');
by
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
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'.
Title: Re: Can't edit products
Post by: Studio 42 on December 27, 2011, 12:08:18 PM
after
   // Load the category
replace the line 125
$category_model = $this->getModel('category');
by
if (!class_exists('VirtueMartModelCategory')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'category.php');
$category_model = new VirtueMartModelCategory();


and

$ratingModel = $this->getModel('ratings');
by
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...
Title: Re: Can't edit products
Post by: cmatte 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
Title: Re: Can't edit products
Post by: Rabble 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.
Title: Re: Can't edit products
Post by: mangotti 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.
Title: Re: Can't edit products
Post by: cmatte 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.
Title: Re: Can't edit products
Post by: mangotti 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?

Title: Re: Can't edit products
Post by: John2400 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