private function map(Ess_M2ePro_Model_Amazon_Template_NewProduct $amazonTemplateNewProductInstance)
 {
     if (count($this->listingProductIds) < 1) {
         $this->_getSession()->addError(Mage::helper('M2ePro')->__('There are no items to assign.'));
         return $this->_redirect('*/adminhtml_common_listing');
     }
     $result = $amazonTemplateNewProductInstance->map($this->listingProductIds);
     $type = 'addSuccess';
     $message = Mage::helper('M2ePro')->__('Template has been successfully assigned.');
     if (!$result) {
         $type = 'addError';
         $message = Mage::helper('M2ePro')->__('Some products were not assigned.');
     }
     $listingId = Mage::helper('M2ePro/Component_Amazon')->getObject('Listing_Product', reset($this->listingProductIds))->getListingId();
     $this->_getSession()->{$type}($message);
     return $this->_redirect('*/adminhtml_common_amazon_listing/view', array('id' => $listingId));
 }
 private function map(Ess_M2ePro_Model_Amazon_Template_NewProduct $amazonTemplateNewProductInstance)
 {
     if (count($this->listingProductIds) < 1) {
         $this->_getSession()->addError(Mage::helper('M2ePro')->__('There are no items to assign.'));
         return $this->_redirect('*/adminhtml_listing');
     }
     $result = $amazonTemplateNewProductInstance->map($this->listingProductIds);
     if (!$result) {
         $this->_getSession()->addError(Mage::helper('M2ePro')->__('Product(s) was not assigned'));
         return $this->_redirect('*/adminhtml_amazon_template_newProduct/index', array('marketplace_id' => $this->getRequest()->getParam('marketplace_id')));
     }
     $listingId = Mage::helper('M2ePro/Component_Amazon')->getObject('Listing_Product', reset($this->listingProductIds))->getListingId();
     $tempMessage = Mage::helper('M2ePro')->__('Template has been successfully assigned.');
     $this->_getSession()->addSuccess($tempMessage);
     return $this->_redirect('*/adminhtml_amazon_listing/view', array('id' => $listingId));
 }