VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: mar22 on October 05, 2015, 19:31:51 PM

Title: The variable $viewData['product'] does not return any value
Post by: mar22 on October 05, 2015, 19:31:51 PM
Hello

sorry for my English :(

I have a problem with selecting a variable: $ViewData['product'], so I moved the script from the file:

com_virtuemart/sublayouts/customfields.php

to file:

com_virtuemart/productdetails/default.php

and this variable not return any parameters :(

The beginning of the script looks like this:

$product = $viewData['product'];
// Availability
$stockhandle = VmConfig::get('stockhandle', 'none');
$product_available_date = substr($product->product_available_date,0,10);


Does anyone know how to run this variable? to the variable $product they have been transferred to the data?

I would be very grateful for your help.

regards
Marcin
Title: Re: The variable $viewData['product'] does not return any value
Post by: PRO on October 05, 2015, 21:28:54 PM
productdetails template uses

$this->product


what data are you trying to get from customfields?

Title: Re: The variable $viewData['product'] does not return any value
Post by: mar22 on October 05, 2015, 23:40:50 PM
Thank you very much for your help, in fact enough to use the syntax:

$product = $viewData['product'];
// Availability
$stockhandle = VmConfig::get('stockhandle', 'none');
$product_available_date = substr($this->product->product_available_date,0,10);


instead

$product = $viewData['product'];
// Availability
$stockhandle = VmConfig::get('stockhandle', 'none');
$product_available_date = substr($product->product_available_date,0,10);


Now everything works perfectly

Once again, thank you very much for your help

Problem solved

regards
Marcin