From 747cfd729bfb4ffb6cd9a24d8e4e1e59a59303c7 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Fri, 3 Aug 2012 07:55:45 +0000 Subject: [PATCH] [-] BO : fixed bug #PSCFV-3457 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16674 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Product.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index a3a976b28..ea291b7e5 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1164,12 +1164,16 @@ class ProductCore extends ObjectModel */ public function addSupplierReference($id_supplier, $id_product_attribute, $supplier_reference = null, $price = null, $id_currency = null) { + //in some case we need to add price without supplier reference + if ($supplier_reference === null) + $supplier_reference = ''; + //Try to set the default supplier reference - if ($id_supplier > 0 && $supplier_reference != null) + if ($id_supplier > 0) { - $id_product_supplier = ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier); + $id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier); - if (empty($id_product_supplier)) + if (!$id_product_supplier) { //create new record $product_supplier_entity = new ProductSupplier();