diff --git a/src/MageTest/MagentoExtension/Fixture/Product.php b/src/MageTest/MagentoExtension/Fixture/Product.php index 64e9b00..62d8062 100644 --- a/src/MageTest/MagentoExtension/Fixture/Product.php +++ b/src/MageTest/MagentoExtension/Fixture/Product.php @@ -84,16 +84,16 @@ public function create(array $attributes) \Mage::app()->setCurrentStore(\Mage_Core_Model_App::ADMIN_STORE_ID); - $this->setProductImageAssets($attributes); - $this->model ->setWebsiteIds(array_map(function($website) { return $website->getId(); }, $websiteHelper->getWebsites())) ->setData($this->mergeAttributes($attributes)) - ->setCreatedAt(null) - ->getResource() - ->save($this->model); + ->setCreatedAt(null); + + $this->setProductImageAssets($attributes); + + $this->model->save(); \Mage::app()->setCurrentStore(\Mage_Core_Model_App::DISTRO_STORE_ID); @@ -218,9 +218,7 @@ private function setProductImageAssets(array $attributes) } $visibility = array('thumbnail', 'small_image', 'image'); - $this->model - ->addImageToMediaGallery($imagePath, $visibility, false, false) - ->save(); + $this->model->addImageToMediaGallery($imagePath, $visibility, false, false); } } }