-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Syam Mohan
committed
Oct 7, 2014
1 parent
c815921
commit 00fea8d
Showing
128 changed files
with
8,704 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
app/code/community/Medma/MarketPlace/Block/Adminhtml/Catalog/Product/Grid.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid | ||
{ | ||
protected function _prepareMassaction() | ||
{ | ||
$this->setMassactionIdField('entity_id'); | ||
$this->getMassactionBlock()->setFormFieldName('product'); | ||
|
||
$this->getMassactionBlock()->addItem('delete', array( | ||
'label'=> Mage::helper('catalog')->__('Delete'), | ||
'url' => $this->getUrl('*/*/massDelete'), | ||
'confirm' => Mage::helper('catalog')->__('Are you sure?') | ||
)); | ||
|
||
$statuses = Mage::getSingleton('catalog/product_status')->getOptionArray(); | ||
|
||
$roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role'); | ||
|
||
$current_user = Mage::getSingleton('admin/session')->getUser(); | ||
|
||
if ($current_user->getRole()->getRoleId() == $roleId) | ||
$statuses = array(Mage_Catalog_Model_Product_Status::STATUS_DISABLED => Mage::helper('catalog')->__('Disabled')); | ||
|
||
array_unshift($statuses, array('label'=>'', 'value'=>'')); | ||
$this->getMassactionBlock()->addItem('status', array( | ||
'label'=> Mage::helper('catalog')->__('Change status'), | ||
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)), | ||
'additional' => array( | ||
'visibility' => array( | ||
'name' => 'status', | ||
'type' => 'select', | ||
'class' => 'required-entry', | ||
'label' => Mage::helper('catalog')->__('Status'), | ||
'values' => $statuses | ||
) | ||
) | ||
)); | ||
|
||
if (Mage::getSingleton('admin/session')->isAllowed('catalog/update_attributes')){ | ||
$this->getMassactionBlock()->addItem('attributes', array( | ||
'label' => Mage::helper('catalog')->__('Update Attributes'), | ||
'url' => $this->getUrl('*/catalog_product_action_attribute/edit', array('_current'=>true)) | ||
)); | ||
} | ||
|
||
Mage::dispatchEvent('adminhtml_catalog_product_grid_prepare_massaction', array('block' => $this)); | ||
return $this; | ||
} | ||
} | ||
?> |
32 changes: 32 additions & 0 deletions
32
app/code/community/Medma/MarketPlace/Block/Adminhtml/Order.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?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_Order extends Mage_Adminhtml_Block_Widget_Grid_Container { | ||
|
||
public function __construct() { | ||
parent::__construct(); | ||
$this->_controller = 'adminhtml_order'; | ||
$this->_blockGroup = 'marketplace'; | ||
$this->_headerText = Mage::helper('marketplace')->__('Orders'); | ||
$this->_removeButton('add'); | ||
} | ||
|
||
} | ||
|
||
?> |
33 changes: 33 additions & 0 deletions
33
app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Empty.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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_Order_Empty extends Mage_Core_Block_Template | ||
{ | ||
protected function _prepareLayout() | ||
{ | ||
$this->setTemplate('marketplace/sales/order/empty.phtml'); | ||
return parent::_prepareLayout(); | ||
} | ||
|
||
public function getSalesOrderUrl() | ||
{ | ||
return $this->getUrl('adminhtml/sales_order/index', array('_current' => true)); | ||
} | ||
} | ||
?> |
139 changes: 139 additions & 0 deletions
139
app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<?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_Order_Form extends Mage_Adminhtml_Block_Template { | ||
|
||
public function __construct() { | ||
$this->setTemplate('marketplace/sales/order/view/form.phtml'); | ||
parent::__construct(); | ||
} | ||
|
||
public function getHeaderText() { | ||
if (Mage::registry('current_order') && Mage::registry('current_order')->getId()) { | ||
return Mage::helper('marketplace')->__("Order # %s | %s", $this->getOrder()->getIncrementId(), $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true) | ||
); | ||
} | ||
} | ||
|
||
public function getOrder() { | ||
return Mage::registry('current_order'); | ||
} | ||
|
||
public function getPaymentHtml() { | ||
return $this->getChildHtml('order_payment'); | ||
} | ||
|
||
public function getGiftmessageHtml() { | ||
return $this->getChildHtml('order_giftmessage'); | ||
} | ||
|
||
public function displayPriceAttribute($code, $strong = false, $separator = '<br/>') { | ||
return Mage::helper('adminhtml/sales')->displayPriceAttribute($this->getPriceDataObject(), $code, $strong, $separator); | ||
} | ||
|
||
public function getPriceDataObject() { | ||
$obj = null; | ||
if (is_null($obj)) { | ||
return $this->getOrder(); | ||
} | ||
return $obj; | ||
} | ||
|
||
public function displayShippingPriceInclTax($order) { | ||
$shipping = $order->getShippingInclTax(); | ||
if ($shipping) { | ||
$baseShipping = $order->getBaseShippingInclTax(); | ||
} else { | ||
$shipping = $order->getShippingAmount() + $order->getShippingTaxAmount(); | ||
$baseShipping = $order->getBaseShippingAmount() + $order->getBaseShippingTaxAmount(); | ||
} | ||
return $this->displayPrices($baseShipping, $shipping, false, ' '); | ||
} | ||
|
||
public function displayPrices($basePrice, $price, $strong = false, $separator = '<br/>') { | ||
return Mage::helper('adminhtml/sales')->displayPrices($this->getPriceDataObject(), $basePrice, $price, $strong, $separator); | ||
} | ||
|
||
public function getBackUrl() { | ||
return Mage::helper('adminhtml')->getUrl('*/*/index'); | ||
} | ||
|
||
public function getShipUrl() { | ||
return Mage::helper('adminhtml')->getUrl('*/*/ship') . 'order_id/' . $this->getOrder()->getId(); | ||
} | ||
|
||
public function getInvoiceUrl() { | ||
return Mage::helper('adminhtml')->getUrl('*/*/invoice') . 'order_id/' . $this->getOrder()->getId(); | ||
} | ||
|
||
public function isShipButtonDisplay() { | ||
$roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role'); | ||
|
||
// $role = Mage::getModel('admin/roles')->load($roleId); | ||
|
||
$current_user = Mage::getSingleton('admin/session')->getUser(); | ||
|
||
if ($current_user->getRole()->getRoleId() == $roleId) { | ||
$productIds = $this->getProductIdsCollection(); | ||
|
||
foreach ($this->getOrder()->getAllItems() as $item) { | ||
if (in_array($item->getProductId(), $productIds) && $item->canShip()) | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public function isInvoiceButtonDisplay() { | ||
$roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role'); | ||
|
||
// $role = Mage::getModel('admin/roles')->load($roleId); | ||
|
||
$current_user = Mage::getSingleton('admin/session')->getUser(); | ||
|
||
if ($current_user->getRole()->getRoleId() == $roleId) { | ||
$productIds = $this->getProductIdsCollection(); | ||
|
||
foreach ($this->getOrder()->getAllItems() as $item) { | ||
if (in_array($item->getProductId(), $productIds) && $item->canInvoice()) | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public function getProductIdsCollection() { | ||
$roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role'); | ||
|
||
// $role = Mage::getModel('admin/roles')->load($roleId); | ||
|
||
$current_user = Mage::getSingleton('admin/session')->getUser(); | ||
|
||
$collection = Mage::getModel('catalog/product')->getCollection() | ||
->addAttributeToFilter('status', 1); | ||
|
||
if ($current_user->getRole()->getRoleId() == $roleId) | ||
$collection->addAttributeToFilter('vendor', $current_user->getId()); | ||
|
||
return $collection->getAllIds(); | ||
} | ||
|
||
} | ||
|
||
?> |
62 changes: 62 additions & 0 deletions
62
app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Info.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?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_Order_Form_Info extends Mage_Adminhtml_Block_Template { | ||
|
||
public function __construct() { | ||
$this->setTemplate('marketplace/sales/order/view/form/info.phtml'); | ||
parent::__construct(); | ||
} | ||
|
||
public function getOrder() { | ||
return Mage::registry('current_order'); | ||
} | ||
|
||
public function shouldDisplayCustomerIp() { | ||
return !Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $this->getOrder()->getStoreId()); | ||
} | ||
|
||
public function getCustomerGroupName() { | ||
if ($this->getOrder()) { | ||
return Mage::getModel('customer/group')->load((int) $this->getOrder()->getCustomerGroupId())->getCode(); | ||
} | ||
return null; | ||
} | ||
|
||
public function getOrderStoreName() { | ||
if ($this->getOrder()) { | ||
$storeId = $this->getOrder()->getStoreId(); | ||
if (is_null($storeId)) { | ||
$deleted = Mage::helper('adminhtml')->__(' [deleted]'); | ||
return nl2br($this->getOrder()->getStoreName()) . $deleted; | ||
} | ||
$store = Mage::app()->getStore($storeId); | ||
$name = array( | ||
$store->getWebsite()->getName(), | ||
$store->getGroup()->getName(), | ||
$store->getName() | ||
); | ||
return implode('<br/>', $name); | ||
} | ||
return null; | ||
} | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.