public function addProductToListing(Ess_M2ePro_Model_Listing $listing, Mage_Catalog_Model_Product $productNew, $templateCategoryId, $templateOtherCategoryId) { /** @var $listingProduct Ess_M2ePro_Model_Listing_Product */ $listingProduct = $listing->addProduct($productNew); if (!$listingProduct instanceof Ess_M2ePro_Model_Listing_Product) { return; } if (is_null($templateCategoryId)) { return; } $listingProduct->setData('template_category_id', $templateCategoryId)->setData('template_other_category_id', $templateOtherCategoryId)->save(); }