From 923af93fc3f84ab5c799c8a9d7949e3ea2b7de7b Mon Sep 17 00:00:00 2001 From: lLefevre Date: Thu, 22 Dec 2011 10:30:25 +0000 Subject: [PATCH] // fix bug virtual product git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11578 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/admin/AdminProductsController.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3c892159a..d0f3bdf7e 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1148,19 +1148,15 @@ class AdminProductsControllerCore extends AdminController $combinations[$key]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']); // Added fields virtual product - if (count($product_download)) - { - $combinations[$key]['id_product_download'] = $product_download[0]['id_product_download']; - $combinations[$key]['display_filename'] = $product_download[0]['display_filename']; - $combinations[$key]['filename'] = $product_download[0]['filename']; - $combinations[$key]['date_expiration'] = $product_download[0]['date_expiration']; - $combinations[$key]['nb_days_accessible'] = $product_download[0]['nb_days_accessible']; - $combinations[$key]['nb_downloadable'] = $product_download[0]['nb_downloadable']; - $combinations[$key]['is_shareable'] = $product_download[0]['is_shareable']; - } + $combinations[$key]['id_product_download'] = count($product_download) ? $product_download[0]['id_product_download'] : ''; + $combinations[$key]['display_filename'] = count($product_download) ? $product_download[0]['display_filename'] : ''; + $combinations[$key]['filename'] = count($product_download) ? $product_download[0]['filename'] : ''; + $combinations[$key]['date_expiration'] = count($product_download) ? $product_download[0]['date_expiration'] : '0000-00-00'; + $combinations[$key]['nb_days_accessible'] = count($product_download) ? $product_download[0]['nb_days_accessible'] : 0; + $combinations[$key]['nb_downloadable'] = count($product_download) ? $product_download[0]['nb_downloadable'] : 0; + $combinations[$key]['is_shareable'] = count($product_download) ? $product_download[0]['is_shareable'] : 0; } - die(Tools::jsonEncode($combinations)); } }