Skip to content

Commit

Permalink
2.0.5 files added
Browse files Browse the repository at this point in the history
  • Loading branch information
Syam Mohan committed Oct 16, 2014
1 parent bdac8e8 commit 890d31c
Show file tree
Hide file tree
Showing 20 changed files with 1,189 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Medma Marketplace
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Team
* that is bundled with this package of Medma Infomatix Pvt. Ltd.
* =================================================================
* MAGENTO EDITION USAGE NOTICE
* =================================================================
* This package designed for Magento COMMUNITY edition
* Contact us Support does not guarantee correct work of this package
* on any other Magento edition except Magento COMMUNITY edition.
* =================================================================
*
* @category Medma
* @package Medma_MarketPlace
**/
class Medma_MarketPlace_Block_Adminhtml_System_Convert_Gui_Grid extends Mage_Adminhtml_Block_System_Convert_Gui_Grid
{

protected function _prepareCollection()
{
$collection = Mage::getResourceModel('dataflow/profile_collection')
->addFieldToFilter('entity_type', array('notnull'=>''));


$isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not

if($isVendor)
{
$collection->addFieldToFilter('name',array('in'=>array('Vendor Import Products','Vendor Export Products')));
//$collection->addFieldToFilter('entity_type','product');
$this->setCollection($collection);
return $this;
}
else
{
$this->setCollection($collection);
return parent::_prepareCollection();
}


}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
class Medma_MarketPlace_Block_Adminhtml_System_Convert_Profile_Edit_Tab_Run extends Mage_Adminhtml_Block_System_Convert_Profile_Edit_Tab_Run
{
public function __construct()
{
parent::__construct();

/**Code For Vendor**/
$isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not

$model = Mage::registry('current_convert_profile');

if($isVendor && $model->getDirection()=='export')
{
$this->setTemplate('marketplace/system/convert/profile/run.phtml');
}
}


}
?>
40 changes: 40 additions & 0 deletions app/code/community/Medma/MarketPlace/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,45 @@ public function getVarificationProofTypeList()

return $proofType;
}


/**Check current user is a vendor**/
public function isVendor()
{
$result = '';

/**Fetch Current User Id**/
$user = Mage::getSingleton('admin/session');
$userId = $user->getUser()->getUserId();

/**Fetch Parent Id For Current Role**/
$role = Mage::getModel('admin/role')
->getCollection()
->addFieldToFilter('user_id',$userId)
->getFirstItem();

$parentId = $role->getParentId();


/**Fetch Role Name of current parent id**/

$parentRole = Mage::getModel('admin/role')
->getCollection()
->addFieldToFilter('role_id',$parentId)
->getFirstItem();

$roleName = $parentRole->getRoleName();

if($roleName == 'VENDORS')
{
$result = true;
}
else
{
$result = false;
}

return $result;
}
}
?>
Loading

0 comments on commit 890d31c

Please sign in to comment.