diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Catalog/Product/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Catalog/Product/Grid.php
new file mode 100644
index 0000000..7c7122b
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Catalog/Product/Grid.php
@@ -0,0 +1,68 @@
+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;
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order.php
new file mode 100644
index 0000000..d0fcdb5
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order.php
@@ -0,0 +1,32 @@
+_controller = 'adminhtml_order';
+ $this->_blockGroup = 'marketplace';
+ $this->_headerText = Mage::helper('marketplace')->__('Orders');
+ $this->_removeButton('add');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Empty.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Empty.php
new file mode 100644
index 0000000..77bf35f
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Empty.php
@@ -0,0 +1,33 @@
+setTemplate('marketplace/sales/order/empty.phtml');
+ return parent::_prepareLayout();
+ }
+
+ public function getSalesOrderUrl()
+ {
+ return $this->getUrl('adminhtml/sales_order/index', array('_current' => true));
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form.php
new file mode 100644
index 0000000..57ce328
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form.php
@@ -0,0 +1,139 @@
+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 = '
') {
+ 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 = '
') {
+ 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();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Info.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Info.php
new file mode 100644
index 0000000..3e59f1a
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Info.php
@@ -0,0 +1,62 @@
+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('
', $name);
+ }
+ return null;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Items.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Items.php
new file mode 100644
index 0000000..f68307e
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Items.php
@@ -0,0 +1,84 @@
+setTemplate('marketplace/sales/order/view/form/items.phtml');
+ parent::__construct();
+ }
+
+ public function getOrder() {
+ return Mage::registry('current_order');
+ }
+
+ public function getItemsCollection() {
+ return $this->getOrder()->getItemsCollection();
+ }
+
+ 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();
+ }
+
+ public function getAdminCommission($item) {
+ $product_id = $item->getProductId();
+ $product = Mage::getModel('catalog/product')->load($product_id);
+ if (!is_null($product)) {
+ $vendor_id = $product->getData('vendor');
+ $profile = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $vendor_id)->getFirstItem();
+ if (!is_null($profile)) {
+ $commission_percentage = $profile->getAdminCommissionPercentage();
+ $commission_amount = (($item->getPriceInclTax() * $item->getQtyOrdered()) * $commission_percentage) / 100;
+ return $commission_amount;
+ }
+ }
+ return 0;
+ }
+
+ public function getVendorAmount($item) {
+ $product_id = $item->getProductId();
+ $product = Mage::getModel('catalog/product')->load($product_id);
+ if (!is_null($product)) {
+ $vendor_id = $product->getData('vendor');
+ $profile = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $vendor_id)->getFirstItem();
+ if (!is_null($profile)) {
+ $commission_percentage = $profile->getAdminCommissionPercentage();
+ $total_price = ($item->getPriceInclTax() * $item->getQtyOrdered());
+ $vendor_amount = $total_price - (($total_price * $commission_percentage) / 100);
+ return $vendor_amount;
+ }
+ }
+ return 0;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Totals.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Totals.php
new file mode 100644
index 0000000..75f21e5
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Form/Totals.php
@@ -0,0 +1,29 @@
+setTemplate('marketplace/sales/order/view/form/totals.phtml');
+ parent::__construct();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Grid.php
new file mode 100644
index 0000000..40b4eef
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Order/Grid.php
@@ -0,0 +1,132 @@
+setId('orderGrid');
+ $this->setDefaultSort('id');
+ }
+
+ protected function _prepareCollection() {
+ $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 = Mage::getModel('catalog/product')->getCollection()
+ ->addAttributeToFilter('status', 1)
+ ->addAttributeToFilter('vendor', $current_user->getId())->getAllIds();
+
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
+
+ foreach ($collection as $order) {
+ foreach ($order->getAllItems() as $item) {
+ $productId = $item->getData('product_id');
+ if (in_array($productId, $productIds)) {
+ $orderIds[] = $order->getId();
+ break;
+ }
+ }
+ }
+
+ $collection = Mage::getResourceModel($this->_getCollectionClass())
+ ->addFieldToFilter('entity_id', array('in' => $orderIds));
+ }
+ else
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _getCollectionClass() {
+ return 'sales/order_grid_collection';
+ }
+
+ protected function _prepareColumns() {
+ $hlp = Mage::helper('marketplace');
+
+ $this->getIndex();
+
+ $this->addColumn('increment_id', array(
+ 'header' => $hlp->__('Order #'),
+ 'align' => 'right',
+ 'width' => '80px',
+ 'index' => 'increment_id',
+ ));
+
+ $this->addColumn('created_at', array(
+ 'header' => $hlp->__('Purchased On'),
+ 'index' => 'created_at',
+ 'type' => 'datetime',
+ 'width' => '100px',
+ ));
+
+ $this->addColumn('billing_name', array(
+ 'header' => $hlp->__('Bill to Name'),
+ 'index' => 'billing_name',
+ 'width' => '400px',
+ ));
+
+ $this->addColumn('shipping_name', array(
+ 'header' => $hlp->__('Ship to Name'),
+ 'index' => 'shipping_name',
+ 'width' => '400px',
+ ));
+
+ $this->addColumn('status', array(
+ 'header' => $hlp->__('Status'),
+ 'index' => 'status',
+ 'type' => 'options',
+ 'width' => '70px',
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
+ ));
+
+ $this->addColumn('action', array(
+ 'header' => $hlp->__('Action'),
+ 'width' => '50px',
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => $hlp->__('View'),
+ 'url' => array('base' => '*/*/view'),
+ 'field' => 'order_id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'index' => 'stores',
+ 'is_system' => true,
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ public function getRowUrl($row) {
+ return $this->getUrl('*/*/view', array('order_id' => $row->getId()));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype.php
new file mode 100644
index 0000000..f638331
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype.php
@@ -0,0 +1,32 @@
+_controller = 'adminhtml_prooftype';
+ $this->_blockGroup = 'marketplace';
+ $this->_headerText = Mage::helper('marketplace')->__('Manage Types');
+ $this->_addButtonLabel = Mage::helper('marketplace')->__('Add Type');
+
+ parent::__construct();
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit.php
new file mode 100644
index 0000000..08a2a12
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit.php
@@ -0,0 +1,41 @@
+_objectId = 'entity_id';
+ $this->_blockGroup = 'marketplace';
+ $this->_controller = 'adminhtml_prooftype';
+ $this->_updateButton('save', 'label', 'Save Type');
+ $this->_updateButton('delete', 'label', 'Delete Type');
+ }
+
+ public function getHeaderText() {
+ if (Mage::registry('type_data') && Mage::registry('type_data')->getId()) {
+ return 'Edit Type';
+ } else {
+ return 'Add New Type';
+ }
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit/Form.php
new file mode 100644
index 0000000..480f710
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Edit/Form.php
@@ -0,0 +1,64 @@
+ 'edit_form',
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
+ 'method' => 'post',
+ )
+ );
+
+ $form->setUseContainer(true);
+
+ $this->setForm($form);
+
+ $model = Mage::registry('type_data');
+
+ $fieldset = $form->addFieldset('type_form', array('legend' => 'General'));
+
+ $fieldset->addField('name', 'text', array(
+ 'name' => 'name',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Name'),
+ 'title' => Mage::helper('adminhtml')->__('Name'),
+ ));
+
+ $fieldset->addField('status', 'select', array(
+ 'name' => 'status',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Status'),
+ 'title' => Mage::helper('adminhtml')->__('Status'),
+ 'values' => array('1' => 'Enabled', '0' => 'Disabled'),
+ 'value' => '1',
+ 'style' => 'width: 100px',
+ ));
+
+ if ($model) {
+ $form->addValues($model->getData());
+ }
+ return parent::_prepareForm();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Grid.php
new file mode 100644
index 0000000..df321a9
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Prooftype/Grid.php
@@ -0,0 +1,76 @@
+setId('prooftypeGrid');
+ $this->setDefaultSort('entity_id');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ protected function _prepareCollection() {
+ $collection = Mage::getModel('marketplace/prooftype')->getCollection();
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns() {
+ $this->addColumn('entity_id', array(
+ 'header' => Mage::helper('adminhtml')->__('ID'),
+ 'align' => 'right',
+ 'width' => '50px',
+ 'index' => 'entity_id',
+ ));
+
+ $this->addColumn('name', array(
+ 'header' => Mage::helper('adminhtml')->__('Name'),
+ 'align' => 'left',
+ 'index' => 'name',
+ ));
+
+ $this->addColumn('status', array(
+ 'header' => Mage::helper('adminhtml')->__('Status'),
+ 'align' => 'left',
+ 'index' => 'status',
+ 'width' => '90px',
+ 'type' => 'options',
+ 'options' => array(
+ 1 => Mage::helper('adminhtml')->__('Enabled'),
+ 0 => Mage::helper('adminhtml')->__('Disabled'),
+ ),
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Row click url
+ *
+ * @return string
+ */
+ public function getRowUrl($row) {
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating.php
new file mode 100644
index 0000000..ba56629
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating.php
@@ -0,0 +1,32 @@
+_controller = 'adminhtml_rating';
+ $this->_blockGroup = 'marketplace';
+ $this->_headerText = Mage::helper('marketplace')->__('Manage Ratings');
+ $this->_addButtonLabel = Mage::helper('marketplace')->__('Add Rating');
+
+ parent::__construct();
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit.php
new file mode 100644
index 0000000..ba595dd
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit.php
@@ -0,0 +1,41 @@
+_objectId = 'entity_id';
+ $this->_blockGroup = 'marketplace';
+ $this->_controller = 'adminhtml_rating';
+ $this->_updateButton('save', 'label', 'Save Rating');
+ $this->_updateButton('delete', 'label', 'Delete Rating');
+ }
+
+ public function getHeaderText() {
+ if (Mage::registry('rating_data') && Mage::registry('rating_data')->getId()) {
+ return 'Edit Rating';
+ } else {
+ return 'Add New Rating';
+ }
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit/Form.php
new file mode 100644
index 0000000..30c1691
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Edit/Form.php
@@ -0,0 +1,73 @@
+ 'edit_form',
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
+ 'method' => 'post',
+ )
+ );
+
+ $form->setUseContainer(true);
+
+ $this->setForm($form);
+
+ $model = Mage::registry('rating_data');
+
+ $fieldset = $form->addFieldset('rating_form', array('legend' => 'General'));
+
+ $fieldset->addField('name', 'text', array(
+ 'name' => 'name',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Name'),
+ 'title' => Mage::helper('adminhtml')->__('Name'),
+ ));
+
+ $fieldset->addField('sort_order', 'text', array(
+ 'name' => 'sort_order',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Sort Order'),
+ 'title' => Mage::helper('adminhtml')->__('Sort Order'),
+ 'class' => 'validate-number',
+ 'style' => 'width:50px',
+ ));
+
+ $fieldset->addField('status', 'select', array(
+ 'name' => 'status',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Status'),
+ 'title' => Mage::helper('adminhtml')->__('Status'),
+ 'values' => array('1' => 'Enabled', '0' => 'Disabled'),
+ 'value' => '1',
+ 'style' => 'width: 100px',
+ ));
+
+ if ($model) {
+ $form->addValues($model->getData());
+ }
+ return parent::_prepareForm();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Grid.php
new file mode 100644
index 0000000..681b99f
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Rating/Grid.php
@@ -0,0 +1,83 @@
+setId('ratingGrid');
+ $this->setDefaultSort('entity_id');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ protected function _prepareCollection() {
+ $collection = Mage::getModel('marketplace/rating')->getCollection();
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns() {
+ $this->addColumn('entity_id', array(
+ 'header' => Mage::helper('adminhtml')->__('ID'),
+ 'align' => 'right',
+ 'width' => '50px',
+ 'index' => 'entity_id',
+ ));
+
+ $this->addColumn('name', array(
+ 'header' => Mage::helper('adminhtml')->__('Name'),
+ 'align' => 'left',
+ 'index' => 'name',
+ ));
+
+ $this->addColumn('sort_order', array(
+ 'header' => Mage::helper('adminhtml')->__('Order'),
+ 'align' => 'left',
+ 'index' => 'sort_order',
+ 'width' => '90px',
+ ));
+
+ $this->addColumn('status', array(
+ 'header' => Mage::helper('adminhtml')->__('Status'),
+ 'align' => 'left',
+ 'index' => 'status',
+ 'width' => '90px',
+ 'type' => 'options',
+ 'options' => array(
+ 1 => Mage::helper('adminhtml')->__('Enabled'),
+ 0 => Mage::helper('adminhtml')->__('Disabled'),
+ ),
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Row click url
+ *
+ * @return string
+ */
+ public function getRowUrl($row) {
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review.php
new file mode 100644
index 0000000..fdf1679
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review.php
@@ -0,0 +1,34 @@
+_controller = 'adminhtml_review';
+ $this->_blockGroup = 'marketplace';
+ if(Mage::getSingleton('core/session')->getReviewType() != Medma_MarketPlace_Model_Review::PENDING)
+ $this->_headerText = 'All Reviews';
+ else
+ $this->_headerText = 'Pending Review';
+ parent::__construct();
+ $this->_removeButton('add');
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit.php
new file mode 100644
index 0000000..dabe9e5
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit.php
@@ -0,0 +1,41 @@
+_objectId = 'entity_id';
+ $this->_blockGroup = 'marketplace';
+ $this->_controller = 'adminhtml_review';
+ $this->_updateButton('save', 'label', 'Save Review');
+ $this->_updateButton('delete', 'label', 'Delete Review');
+ }
+
+ public function getHeaderText() {
+ if (Mage::registry('review_data') && Mage::registry('review_data')->getId()) {
+ return 'Edit Review';
+ } else {
+ return 'Add New Review';
+ }
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit/Form.php
new file mode 100644
index 0000000..181c5ad
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Edit/Form.php
@@ -0,0 +1,88 @@
+ 'edit_form',
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
+ 'method' => 'post',
+ )
+ );
+
+ $form->setUseContainer(true);
+
+ $this->setForm($form);
+
+ $model = Mage::registry('review_data');
+
+ $fieldset = $form->addFieldset('review_form', array('legend' => 'General'));
+
+ $fieldset->addField('title', 'text', array(
+ 'name' => 'title',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Title'),
+ 'title' => Mage::helper('adminhtml')->__('Title'),
+ ));
+
+ $fieldset->addField('summary', 'textarea', array(
+ 'name' => 'summary',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Summary'),
+ 'title' => Mage::helper('adminhtml')->__('Summary'),
+ 'style' => 'width:400px;height:70px;',
+ ));
+
+ $fieldset->addField('type', 'select', array(
+ 'name' => 'type',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Type'),
+ 'title' => Mage::helper('adminhtml')->__('Type'),
+ 'values' => array(
+ Medma_MarketPlace_Model_Review::POSITIVE => Mage::helper('adminhtml')->__('Positive'),
+ Medma_MarketPlace_Model_Review::NEUTRAL => Mage::helper('adminhtml')->__('Neutral'),
+ Medma_MarketPlace_Model_Review::NEGATIVE => Mage::helper('adminhtml')->__('Negative')
+ ),
+ 'style' => 'width: 100px',
+ ));
+
+ $fieldset->addField('status', 'select', array(
+ 'name' => 'status',
+ 'required' => true,
+ 'label' => Mage::helper('adminhtml')->__('Status'),
+ 'title' => Mage::helper('adminhtml')->__('Status'),
+ 'values' => array(
+ Medma_MarketPlace_Model_Review::PENDING => Mage::helper('adminhtml')->__('Pending'),
+ Medma_MarketPlace_Model_Review::APPROVED => Mage::helper('adminhtml')->__('Approved'),
+ Medma_MarketPlace_Model_Review::CANCEL => Mage::helper('adminhtml')->__('Cancel')
+ ),
+ 'style' => 'width: 100px',
+ ));
+
+ if ($model) {
+ $form->addValues($model->getData());
+ }
+ return parent::_prepareForm();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Empty.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Empty.php
new file mode 100644
index 0000000..58ccac3
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Empty.php
@@ -0,0 +1,33 @@
+setTemplate('marketplace/vendor/review/empty.phtml');
+ return parent::_prepareLayout();
+ }
+
+ public function getReviewGridUrl()
+ {
+ return Mage::helper('adminhtml')->getUrl('marketplace/adminhtml_review/index', array('_current' => true));
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Grid.php
new file mode 100644
index 0000000..19ad1ad
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Grid.php
@@ -0,0 +1,170 @@
+setId('reviewGrid');
+ $this->setDefaultSort('entity_id');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ protected function _prepareMassaction()
+ {
+ $this->setMassactionIdField('entity_id');
+ $this->getMassactionBlock()->setFormFieldName('review_id');
+ $this->getMassactionBlock()->addItem('pending', array(
+ 'label'=> Mage::helper('core')->__('Pending'),
+ 'url' => $this->getUrl('*/*/massPending', array('' => '')),
+ 'confirm' => Mage::helper('core')->__('Are you sure?')
+ ));
+ $this->getMassactionBlock()->addItem('approve', array(
+ 'label'=> Mage::helper('core')->__('Approved'),
+ 'url' => $this->getUrl('*/*/massApprove', array('' => '')),
+ 'confirm' => Mage::helper('core')->__('Are you sure?')
+ ));
+ $this->getMassactionBlock()->addItem('cancel', array(
+ 'label'=> Mage::helper('core')->__('Cancel'),
+ 'url' => $this->getUrl('*/*/massCancel', array('' => '')),
+ 'confirm' => Mage::helper('core')->__('Are you sure?')
+ ));
+ return $this;
+ }
+
+ protected function _prepareCollection() {
+ $collection = Mage::getModel('marketplace/review')->getCollection();
+
+ if(Mage::getSingleton('core/session')->getReviewType() == Medma_MarketPlace_Model_Review::PENDING)
+ $collection->addFieldToFilter('status', Medma_MarketPlace_Model_Review::PENDING);
+
+ $roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+ if ($current_user->getRole()->getRoleId() == $roleId)
+ {
+ $productIds = Mage::getModel('catalog/product')->getCollection()
+ ->addAttributeToFilter('vendor', $current_user->getId())->getAllIds();
+
+ $invoiceItemIds = Mage::getModel('sales/order_invoice_item')->getCollection()
+ ->addFieldToFilter('product_id', array('in' => $productIds))->getAllIds();
+
+ $collection->addFieldToFilter('invoice_item_id', array('in' => $invoiceItemIds));
+ }
+
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns() {
+
+ $roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+
+ $this->addColumn('entity_id', array(
+ 'header' => Mage::helper('adminhtml')->__('ID'),
+ 'align' => 'right',
+ 'width' => '50px',
+ 'index' => 'entity_id',
+ ));
+
+ if ($current_user->getRole()->getRoleId() != $roleId)
+ {
+ $this->addColumn('vendor_name', array(
+ 'header' => Mage::helper('adminhtml')->__('Vendor Name'),
+ 'align' => 'left',
+ 'index' => 'invoice_item_id',
+ 'renderer' => 'Medma_MarketPlace_Block_Adminhtml_Review_Renderer_Vendor'
+ ));
+ }
+
+ $this->addColumn('product_name', array(
+ 'header' => Mage::helper('adminhtml')->__('Product Name'),
+ 'align' => 'left',
+ 'index' => 'invoice_item_id',
+ 'renderer' => 'Medma_MarketPlace_Block_Adminhtml_Review_Renderer_Product'
+ ));
+
+ $this->addColumn('title', array(
+ 'header' => Mage::helper('adminhtml')->__('Title'),
+ 'align' => 'left',
+ 'index' => 'title',
+ ));
+
+ $this->addColumn('summary', array(
+ 'header' => Mage::helper('adminhtml')->__('Summary'),
+ 'align' => 'left',
+ 'index' => 'summary',
+ ));
+
+ $this->addColumn('posted_date', array(
+ 'header' => Mage::helper('adminhtml')->__('Posted Date'),
+ 'align' => 'left',
+ 'index' => 'posted_date',
+ ));
+
+ $this->addColumn('type', array(
+ 'header' => Mage::helper('adminhtml')->__('Type'),
+ 'align' => 'left',
+ 'index' => 'type',
+ 'width' => '90px',
+ 'type' => 'options',
+ 'options' => array(
+ Medma_MarketPlace_Model_Review::POSITIVE => Mage::helper('adminhtml')->__('Positive'),
+ Medma_MarketPlace_Model_Review::NEUTRAL => Mage::helper('adminhtml')->__('Neutral'),
+ Medma_MarketPlace_Model_Review::NEGATIVE => Mage::helper('adminhtml')->__('Negative')
+ ),
+ ));
+
+ if(Mage::getSingleton('core/session')->getReviewType() != Medma_MarketPlace_Model_Review::PENDING)
+ {
+ $this->addColumn('status', array(
+ 'header' => Mage::helper('adminhtml')->__('Status'),
+ 'align' => 'left',
+ 'index' => 'status',
+ 'width' => '90px',
+ 'type' => 'options',
+ 'options' => array(
+ Medma_MarketPlace_Model_Review::PENDING => Mage::helper('adminhtml')->__('Pending'),
+ Medma_MarketPlace_Model_Review::APPROVED => Mage::helper('adminhtml')->__('Approved'),
+ Medma_MarketPlace_Model_Review::CANCEL => Mage::helper('adminhtml')->__('Cancel')
+ ),
+ ));
+ }
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Row click url
+ *
+ * @return string
+ */
+ public function getRowUrl($row)
+ {
+ $roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+
+ if ($current_user->getRole()->getRoleId() != $roleId)
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Product.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Product.php
new file mode 100644
index 0000000..7e8c5a8
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Product.php
@@ -0,0 +1,35 @@
+_getValue($row);
+ }
+
+ protected function _getValue(Varien_Object $row)
+ {
+ $value = $row->getData($this->getColumn()->getIndex());
+ $invoiceItemModel = Mage::getModel('sales/order_invoice_item')->load($value);
+ $productModel = Mage::getModel('catalog/product')->load($invoiceItemModel->getProductId());
+ return $productModel->getName();
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Vendor.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Vendor.php
new file mode 100644
index 0000000..70597cc
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Review/Renderer/Vendor.php
@@ -0,0 +1,36 @@
+_getValue($row);
+ }
+
+ protected function _getValue(Varien_Object $row)
+ {
+ $value = $row->getData($this->getColumn()->getIndex());
+ $invoiceItemModel = Mage::getModel('sales/order_invoice_item')->load($value);
+ $productModel = Mage::getModel('catalog/product')->load($invoiceItemModel->getProductId());
+ $userModel = Mage::getModel('admin/user')->load($productModel->getVendor());
+ return $userModel->getName();
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Account/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Account/Edit/Form.php
new file mode 100644
index 0000000..801e431
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Account/Edit/Form.php
@@ -0,0 +1,263 @@
+getUser()->getId();
+ $user = Mage::getModel('admin/user')
+ ->load($userId);
+ $user->unsetData('password');
+
+ //$form = new Varien_Data_Form();
+ $form = new Varien_Data_Form(array(
+ 'id' => 'edit_form',
+ 'enctype' => 'multipart/form-data'
+ )
+ );
+
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Account Information')));
+
+ $fieldset->addField('username', 'text', array(
+ 'name' => 'username',
+ 'label' => Mage::helper('adminhtml')->__('User Name'),
+ 'title' => Mage::helper('adminhtml')->__('User Name'),
+ 'required' => true,
+ )
+ );
+
+ $fieldset->addField('firstname', 'text', array(
+ 'name' => 'firstname',
+ 'label' => Mage::helper('adminhtml')->__('First Name'),
+ 'title' => Mage::helper('adminhtml')->__('First Name'),
+ 'required' => true,
+ )
+ );
+
+ $fieldset->addField('lastname', 'text', array(
+ 'name' => 'lastname',
+ 'label' => Mage::helper('adminhtml')->__('Last Name'),
+ 'title' => Mage::helper('adminhtml')->__('Last Name'),
+ 'required' => true,
+ )
+ );
+
+ $fieldset->addField('user_id', 'hidden', array(
+ 'name' => 'user_id',
+ )
+ );
+
+ $fieldset->addField('email', 'text', array(
+ 'name' => 'email',
+ 'label' => Mage::helper('adminhtml')->__('Email'),
+ 'title' => Mage::helper('adminhtml')->__('User Email'),
+ 'required' => true,
+ )
+ );
+
+ $fieldset->addField('password', 'password', array(
+ 'name' => 'new_password',
+ 'label' => Mage::helper('adminhtml')->__('New Password'),
+ 'title' => Mage::helper('adminhtml')->__('New Password'),
+ 'class' => 'input-text validate-admin-password',
+ )
+ );
+
+ $fieldset->addField('confirmation', 'password', array(
+ 'name' => 'password_confirmation',
+ 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
+ 'class' => 'input-text validate-cpassword',
+ )
+ );
+
+ $form->setValues($user->getData());
+
+ $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) {
+ $profileCollection = Mage::getModel('marketplace/profile')
+ ->getCollection()->addFieldToFilter('user_id', $userId);
+
+ $profile = Mage::getModel('marketplace/profile');
+ if ($profileCollection->count() > 0)
+ $profile->load($profileCollection->getFirstItem()->getId());
+
+ $fieldset = $form->addFieldset('profile_fieldset', array('legend' => Mage::helper('adminhtml')->__('Profile Information')));
+
+ $fieldset->addField('shop_name', 'text', array(
+ 'name' => 'shop_name',
+ 'label' => Mage::helper('adminhtml')->__('Shop Name'),
+ 'title' => Mage::helper('adminhtml')->__('Shop Name'),
+ 'required' => true,
+ 'value' => $profile->getShopName(),
+ )
+ );
+
+ $fieldset->addField('message', 'textarea', array(
+ 'name' => 'message',
+ 'label' => Mage::helper('adminhtml')->__('Message'),
+ 'title' => Mage::helper('adminhtml')->__('Message'),
+ 'value' => $profile->getMessage(),
+ 'style' => 'width: 400px; height: 90px;'
+ )
+ );
+
+ $fieldset->addField('contact_number', 'text', array(
+ 'name' => 'contact_number',
+ 'label' => Mage::helper('adminhtml')->__('Contact Number'),
+ 'title' => Mage::helper('adminhtml')->__('Contact Number'),
+ 'value' => $profile->getContactNumber(),
+ 'required' => true,
+ 'class' => 'validate-phoneLax'
+ )
+ );
+
+ $fieldset->addField('country', 'select', array(
+ 'name' => 'country',
+ 'label' => Mage::helper('adminhtml')->__('Country'),
+ 'title' => Mage::helper('adminhtml')->__('Country'),
+ 'class' => 'input-select',
+ 'required' => true,
+ 'value' => $profile->getCountry(),
+ 'options' => $this->_getCountryList()
+ ));
+
+ $fieldset->addField('image', 'file', array(
+ 'name' => 'image',
+ 'label' => Mage::helper('adminhtml')->__('Profile Picture'),
+ 'title' => Mage::helper('adminhtml')->__('Profile Picture'),
+ 'after_element_html' => '
' . $this->_getImage($profile->getImage())
+ ));
+
+ $proofList = Mage::helper('marketplace')->getVarificationProofTypeList();
+
+ if(count($proofList) > 1)
+ {
+ $fieldset->addField('proof_type', 'text', array(
+ 'name' => 'proof_type',
+ 'label' => Mage::helper('adminhtml')->__('Proof Type'),
+ 'title' => Mage::helper('adminhtml')->__('Proof Type'),
+ 'value' => $profile->getProofType(),
+ 'style' => 'display: none;',
+ 'after_element_html' => $this->_getFiles($profile->getProofType(), $profile->getVarificationFiles())
+ ));
+ }
+
+ $fieldset->addField('admin_commission_percentage', 'text', array(
+ 'name' => 'admin_commission_percentage',
+ 'label' => Mage::helper('adminhtml')->__('Commission (in %)'),
+ 'title' => Mage::helper('adminhtml')->__('Commission (in %)'),
+ 'class' => 'validate-number validate-digits-range digits-range-0-100',
+ 'required' => true,
+ 'style' => 'display:none;',
+ 'value' => $profile->getAdminCommissionPercentage(),
+ 'after_element_html' => '' . $profile->getAdminCommissionPercentage() . '',
+ )
+ );
+
+ $fieldset->addField('total_admin_commission', 'text', array(
+ 'name' => 'total_admin_commission',
+ 'label' => Mage::helper('adminhtml')->__('Admin Earnings'),
+ 'title' => Mage::helper('adminhtml')->__('Admin Earnings'),
+ 'disabled' => true,
+ 'style' => 'display:none;',
+ 'value' => $profile->getTotalAdminCommission(),
+ 'after_element_html' => '' . $this->formatPrice($profile->getTotalAdminCommission()) . '',
+ )
+ );
+
+ $fieldset->addField('total_vendor_amount', 'text', array(
+ 'name' => 'total_vendor_amount',
+ 'label' => Mage::helper('adminhtml')->__('Vendor Balance'),
+ 'title' => Mage::helper('adminhtml')->__('Vendor Balance'),
+ 'disabled' => true,
+ 'style' => 'display:none;',
+ 'value' => number_format(($profile->getTotalVendorAmount() - $profile->getTotalVendorPaid()), 4, '.', ''),
+ 'after_element_html' => '' . $this->formatPrice(($profile->getTotalVendorAmount() - $profile->getTotalVendorPaid())) . '',
+ )
+ );
+ }
+ $form->setAction($this->getUrl('*/system_account/save'));
+ $form->setMethod('post');
+ $form->setUseContainer(true);
+ $form->setId('edit_form');
+
+ $this->setForm($form);
+
+ //return parent::_prepareForm();
+ return Mage_Adminhtml_Block_Widget_Form::_prepareForm();
+ }
+
+ protected function _getImage($image_name) {
+ if (!isset($image_name) || $image_name == '')
+ return '';
+
+ $dir_name = 'vendor' . DS . 'images';
+ $dir_path = Mage::helper('marketplace')->getImagesUrl($dir_name);
+
+ $str = '
';
+ $str .= '
Remove';
+ return $str;
+ }
+
+ protected function formatPrice($price) {
+ return Mage::helper('core')->currency($price, true, false);
+ }
+
+ protected function _getCountryList()
+ {
+ $countries[''] = '';
+
+ $coutryCollection = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
+
+ foreach($coutryCollection as $country)
+ $countries[$country['value']] = $country['label'];
+
+ return $countries;
+ }
+
+ protected function _getFiles($proofType, $fileList)
+ {
+ $fileListArray = json_decode($fileList, true);
+ $proofTypeModel = Mage::getModel('marketplace/prooftype')->load($proofType);
+ $proofName = $proofTypeModel->getName();
+ if(isset($proofName))
+ {
+ $fileString = '
' . $proofName . '
';
+ foreach($fileListArray as $file)
+ {
+ $dir_name = 'vendor' . DS . 'varifications';
+ $dir_url = Mage::helper('marketplace')->getImagesUrl($dir_name);
+
+ $fileString .= '';
+ }
+ }
+ else
+ $fileString = 'N/A
';
+ return $fileString;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction.php
new file mode 100644
index 0000000..7d81f77
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction.php
@@ -0,0 +1,58 @@
+setTemplate('marketplace/vendor/transaction.phtml');
+ parent::__construct();
+ }
+
+ public function getHeaderText() {
+ if (Mage::registry('vendor_user') && Mage::registry('vendor_user')->getId()) {
+ return Mage::helper('marketplace')->__("Balance sheet | %s", Mage::registry('vendor_user')->getName()
+ );
+ }
+ }
+
+ public function getBackUrl() {
+ return Mage::helper('adminhtml')->getUrl('*/adminhtml_vendor/index');
+ }
+
+ public function getAddUrl() {
+ return Mage::helper('adminhtml')->getUrl('*/*/new', array('vendor_id' => $this->getRequest()->getParam('id')));
+ }
+
+ public function isToShowButtons()
+ {
+ $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) {
+ return false;
+ }
+ return true;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit.php
new file mode 100644
index 0000000..11e4fe0
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit.php
@@ -0,0 +1,47 @@
+_objectId = 'user_id';
+ $this->_blockGroup = 'marketplace';
+ $this->_controller = 'adminhtml_transaction';
+ $this->_updateButton('save', 'label', 'Save Transaction');
+ $this->_updateButton('delete', 'label', 'Delete Transaction');
+
+ $data = array(
+ 'label' => 'Back',
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/index', array('id' => Mage::registry('vendor_user')->getId())) . '\')',
+ 'class' => 'back'
+ );
+ $this->addButton('my_back', $data, 0, 0, 'header');
+
+ $this->_removeButton('back');
+ $this->_removeButton('reset');
+ }
+
+ public function getHeaderText() {
+ return Mage::helper('adminhtml')->__('New Transaction');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit/Form.php
new file mode 100644
index 0000000..cb66344
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Edit/Form.php
@@ -0,0 +1,74 @@
+getTotalVendorAmount() - $profile->getTotalVendorPaid());
+ $remaining_amount = Mage::helper('core')->currency($remaining_amount, true, false);
+
+ $form = new Varien_Data_Form(
+ array(
+ 'id' => 'edit_form',
+ 'action' => $this->getUrl('*/*/save', array('vendor_id' => $profile->getData('user_id'))),
+ 'method' => 'post',
+ )
+ );
+
+ $form->setUseContainer(true);
+
+ $this->setForm($form);
+
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Transaction Information')));
+
+ $fieldset->addField('Information', 'note', array(
+ 'text' => Mage::helper('adminhtml')->__('You can not transfer more then ') . '' . $remaining_amount . '',
+ ));
+
+ $fieldset->addField('information', 'select', array(
+ 'name' => 'information',
+ 'label' => Mage::helper('adminhtml')->__('Method'),
+ 'id' => 'information',
+ 'title' => Mage::helper('adminhtml')->__('Method'),
+ 'required' => true,
+ 'class' => 'input-select',
+ 'options' => array('Cash' => Mage::helper('adminhtml')->__('Cash'), 'Check' => Mage::helper('adminhtml')->__('Check')),
+ ));
+
+ $fieldset->addField('amount', 'text', array(
+ 'name' => 'amount',
+ 'label' => Mage::helper('adminhtml')->__('Amount'),
+ 'id' => 'amount',
+ 'title' => Mage::helper('adminhtml')->__('Amount'),
+ 'class' => 'required-entry validate-number',
+ 'required' => true,
+ 'value' => Mage::getSingleton('adminhtml/session')->getAmount(),
+ ));
+
+ Mage::getSingleton('adminhtml/session')->unsAmount();
+
+ $this->setForm($form);
+
+ return parent::_prepareForm();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Empty.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Empty.php
new file mode 100644
index 0000000..6bcdd75
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Empty.php
@@ -0,0 +1,33 @@
+setTemplate('marketplace/vendor/transaction/empty.phtml');
+ return parent::_prepareLayout();
+ }
+
+ public function getVendorGridUrl()
+ {
+ return Mage::helper('adminhtml')->getUrl('admin_marketplace/adminhtml_vendor/index', array('_current' => true));
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Items.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Items.php
new file mode 100644
index 0000000..d592325
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Transaction/Items.php
@@ -0,0 +1,38 @@
+setTemplate('marketplace/vendor/transaction/items.phtml');
+ parent::__construct();
+ }
+
+ public function getTransactions() {
+ return Mage::getModel('marketplace/transaction')
+ ->getCollection()
+ ->addFieldToFilter('vendor_id', Mage::registry('vendor_user')->getId());
+ }
+
+ public function formatAmount($amount) {
+ return Mage::helper('core')->currency($amount, true, false);
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor.php
new file mode 100644
index 0000000..1c58eb6
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor.php
@@ -0,0 +1,33 @@
+_controller = 'adminhtml_vendor';
+ $this->_blockGroup = 'marketplace';
+ $this->_headerText = Mage::helper('marketplace')->__('Vendors');
+ $this->_addButtonLabel = Mage::helper('marketplace')->__('Add Vendor');
+
+ parent::__construct();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit.php
new file mode 100644
index 0000000..344b962
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit.php
@@ -0,0 +1,41 @@
+_objectId = 'user_id';
+ $this->_blockGroup = 'marketplace';
+ $this->_controller = 'adminhtml_vendor';
+ $this->_updateButton('save', 'label', 'Save Vendor');
+ $this->_updateButton('delete', 'label', 'Delete Vendor');
+ }
+
+ public function getHeaderText() {
+ if (Mage::registry('vendor_user')->getId()) {
+ return Mage::helper('adminhtml')->__("Edit Vendor '%s'", $this->escapeHtml(Mage::registry('vendor_user')->getUsername()));
+ } else {
+ return Mage::helper('adminhtml')->__('New Vendor');
+ }
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit/Form.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit/Form.php
new file mode 100644
index 0000000..6734cfd
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Edit/Form.php
@@ -0,0 +1,299 @@
+getCollection()->addFieldToFilter('user_id', $this->getRequest()->getParam('id'));
+
+ $profile = Mage::getModel('marketplace/profile');
+ if ($profileCollection->count() > 0)
+ $profile->load($profileCollection->getFirstItem()->getId());
+
+ $form = new Varien_Data_Form(
+ array(
+ 'id' => 'edit_form',
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))
+ ),
+ 'method' => 'post',
+ 'enctype' => 'multipart/form-data'
+ )
+ );
+
+ $form->setUseContainer(true);
+
+ $this->setForm($form);
+
+ $form->setHtmlIdPrefix('user_');
+
+ $base_fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Account Information')));
+
+ if ($model->getUserId()) {
+ $base_fieldset->addField('user_id', 'hidden', array(
+ 'name' => 'user_id',
+ ));
+ } else {
+ if (!$model->hasData('is_active')) {
+ $model->setIsActive(1);
+ }
+ }
+
+ $base_fieldset->addField('username', 'text', array(
+ 'name' => 'username',
+ 'label' => Mage::helper('adminhtml')->__('User Name'),
+ 'id' => 'username',
+ 'title' => Mage::helper('adminhtml')->__('User Name'),
+ 'required' => true,
+ ));
+
+ $base_fieldset->addField('firstname', 'text', array(
+ 'name' => 'firstname',
+ 'label' => Mage::helper('adminhtml')->__('First Name'),
+ 'id' => 'firstname',
+ 'title' => Mage::helper('adminhtml')->__('First Name'),
+ 'required' => true,
+ ));
+
+ $base_fieldset->addField('lastname', 'text', array(
+ 'name' => 'lastname',
+ 'label' => Mage::helper('adminhtml')->__('Last Name'),
+ 'id' => 'lastname',
+ 'title' => Mage::helper('adminhtml')->__('Last Name'),
+ 'required' => true,
+ ));
+
+ $base_fieldset->addField('email', 'text', array(
+ 'name' => 'email',
+ 'label' => Mage::helper('adminhtml')->__('Email'),
+ 'id' => 'customer_email',
+ 'title' => Mage::helper('adminhtml')->__('User Email'),
+ 'class' => 'required-entry validate-email',
+ 'required' => true,
+ ));
+
+ if ($model->getUserId()) {
+ $base_fieldset->addField('password', 'password', array(
+ 'name' => 'new_password',
+ 'label' => Mage::helper('adminhtml')->__('New Password'),
+ 'id' => 'new_pass',
+ 'title' => Mage::helper('adminhtml')->__('New Password'),
+ 'class' => 'input-text validate-admin-password',
+ ));
+
+ $base_fieldset->addField('confirmation', 'password', array(
+ 'name' => 'confirmation',
+ 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
+ 'id' => 'confirmation',
+ 'class' => 'input-text validate-cpassword',
+ ));
+ } else {
+ $base_fieldset->addField('password', 'password', array(
+ 'name' => 'new_password',
+ 'label' => Mage::helper('adminhtml')->__('Password'),
+ 'id' => 'customer_pass',
+ 'title' => Mage::helper('adminhtml')->__('Password'),
+ 'class' => 'input-text required-entry validate-admin-password',
+ 'required' => true,
+ ));
+ $base_fieldset->addField('confirmation', 'password', array(
+ 'name' => 'password_confirmation',
+ 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
+ 'id' => 'confirmation',
+ 'title' => Mage::helper('adminhtml')->__('Password Confirmation'),
+ 'class' => 'input-text required-entry validate-cpassword',
+ 'required' => true,
+ ));
+ }
+
+ if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
+ $base_fieldset->addField('is_active', 'select', array(
+ 'name' => 'is_active',
+ 'label' => Mage::helper('adminhtml')->__('This account is'),
+ 'id' => 'is_active',
+ 'title' => Mage::helper('adminhtml')->__('Account Status'),
+ 'class' => 'input-select',
+ 'style' => 'width: 80px',
+ 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')),
+ ));
+ }
+
+ $base_fieldset->addField('user_roles', 'hidden', array(
+ 'name' => 'user_roles',
+ 'id' => '_user_roles',
+ ));
+
+ $data = $model->getData();
+
+ unset($data['password']);
+
+ $form->setValues($data);
+
+ $profile_fieldset = $form->addFieldset('profile_fieldset', array('legend' => Mage::helper('adminhtml')->__('Profile Information')));
+
+ $profile_fieldset->addField('shop_name', 'text', array(
+ 'name' => 'shop_name',
+ 'label' => Mage::helper('adminhtml')->__('Shop Name'),
+ 'title' => Mage::helper('adminhtml')->__('Shop Name'),
+ 'required' => true,
+ 'value' => $profile->getShopName(),
+ )
+ );
+
+ $profile_fieldset->addField('message', 'textarea', array(
+ 'name' => 'message',
+ 'label' => Mage::helper('adminhtml')->__('Message'),
+ 'title' => Mage::helper('adminhtml')->__('Message'),
+ 'value' => $profile->getMessage(),
+ 'style' => 'width: 400px; height: 90px;'
+ )
+ );
+
+ $profile_fieldset->addField('contact_number', 'text', array(
+ 'name' => 'contact_number',
+ 'label' => Mage::helper('adminhtml')->__('Contact Number'),
+ 'title' => Mage::helper('adminhtml')->__('Contact Number'),
+ 'value' => $profile->getContactNumber(),
+ 'required' => true,
+ 'class' => 'validate-phoneLax'
+ )
+ );
+
+ $profile_fieldset->addField('country', 'select', array(
+ 'name' => 'country',
+ 'label' => Mage::helper('adminhtml')->__('Country'),
+ 'title' => Mage::helper('adminhtml')->__('Country'),
+ 'class' => 'input-select',
+ 'required' => true,
+ 'value' => $profile->getCountry(),
+ 'options' => $this->_getCountryList()
+ ));
+
+ $profile_fieldset->addField('image', 'file', array(
+ 'name' => 'image',
+ 'label' => Mage::helper('adminhtml')->__('Profile Picture'),
+ 'title' => Mage::helper('adminhtml')->__('Profile Picture'),
+ 'after_element_html' => '
' . $this->_getImage($profile->getImage())
+ ));
+
+ $proofList = Mage::helper('marketplace')->getVarificationProofTypeList();
+
+ if(count($proofList) > 1)
+ {
+ $profile_fieldset->addField('proof_type', 'text', array(
+ 'name' => 'proof_type',
+ 'label' => Mage::helper('adminhtml')->__('Proof Type'),
+ 'title' => Mage::helper('adminhtml')->__('Proof Type'),
+ 'value' => $profile->getProofType(),
+ 'style' => 'display: none;',
+ 'after_element_html' => $this->_getFiles($profile->getProofType(), $profile->getVarificationFiles())
+ ));
+ }
+
+ $profile_fieldset->addField('admin_commission_percentage', 'text', array(
+ 'name' => 'admin_commission_percentage',
+ 'label' => Mage::helper('adminhtml')->__('Commission (in %)'),
+ 'title' => Mage::helper('adminhtml')->__('Commission (in %)'),
+ 'class' => 'validate-number',
+ 'required' => true,
+ 'value' => $profile->getAdminCommissionPercentage(),
+ )
+ );
+
+ $profile_fieldset->addField('total_admin_commission', 'text', array(
+ 'name' => 'total_admin_commission',
+ 'label' => Mage::helper('adminhtml')->__('Admin Earnings'),
+ 'title' => Mage::helper('adminhtml')->__('Admin Earnings'),
+ 'disabled' => true,
+ 'style' => 'display:none;',
+ 'value' => $profile->getTotalAdminCommission(),
+ 'after_element_html' => '' . $this->formatPrice($profile->getTotalAdminCommission()) . '',
+ )
+ );
+
+ $profile_fieldset->addField('total_vendor_amount', 'text', array(
+ 'name' => 'total_vendor_amount',
+ 'label' => Mage::helper('adminhtml')->__('Vendor Balance'),
+ 'title' => Mage::helper('adminhtml')->__('Vendor Balance'),
+ 'disabled' => true,
+ 'style' => 'display:none;',
+ 'value' => number_format(($profile->getTotalVendorAmount() - $profile->getTotalVendorPaid()), 4, '.', ''),
+ 'after_element_html' => '' . $this->formatPrice(($profile->getTotalVendorAmount() - $profile->getTotalVendorPaid())) . '',
+ )
+ );
+
+ $this->setForm($form);
+
+ return parent::_prepareForm();
+ }
+
+ protected function _getImage($image_name) {
+ if (!isset($image_name) || $image_name == '')
+ return '';
+
+ $dir_name = 'vendor' . DS . 'images';
+ $dir_path = Mage::helper('marketplace')->getImagesUrl($dir_name);
+
+ $str = '
';
+ $str .= '
Remove';
+ return $str;
+ }
+
+ protected function formatPrice($price) {
+ return Mage::helper('core')->currency($price, true, false);
+ }
+
+ protected function _getCountryList()
+ {
+ $countries[''] = '';
+
+ $coutryCollection = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
+
+ foreach($coutryCollection as $country)
+ $countries[$country['value']] = $country['label'];
+
+ return $countries;
+ }
+
+ protected function _getFiles($proofType, $fileList)
+ {
+ $fileListArray = json_decode($fileList, true);
+ $proofTypeModel = Mage::getModel('marketplace/prooftype')->load($proofType);
+ $proofName = $proofTypeModel->getName();
+ if(isset($proofName))
+ {
+ $fileString = '' . $proofName . '
';
+ foreach($fileListArray as $file)
+ {
+ $dir_name = 'vendor' . DS . 'varifications';
+ $dir_url = Mage::helper('marketplace')->getImagesUrl($dir_name);
+
+ $fileString .= '';
+ }
+ }
+ else
+ $fileString = 'N/A
';
+ return $fileString;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Grid.php
new file mode 100644
index 0000000..b0f3035
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/Vendor/Grid.php
@@ -0,0 +1,116 @@
+setId('vendorGrid');
+ $this->setDefaultSort('entity_id');
+ $this->setDefaultDir('DESC');
+ $this->setSaveParametersInSession(true);
+ }
+
+ protected function _prepareCollection() {
+
+ $roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+
+ $role = Mage::getModel('admin/roles')->load($roleId);
+
+ $userIds = Mage::getResourceModel('admin/roles')->getRoleUsers($role);
+
+ $collection = Mage::getModel('admin/user')
+ ->getCollection()
+ ->addFieldToFilter('user_id', array('in' => $userIds));
+
+ $this->setCollection($collection);
+
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns() {
+ $this->addColumn('user_id', array(
+ 'header' => Mage::helper('adminhtml')->__('ID'),
+ 'width' => 5,
+ 'align' => 'right',
+ 'sortable' => true,
+ 'index' => 'user_id'
+ ));
+
+ $this->addColumn('username', array(
+ 'header' => Mage::helper('adminhtml')->__('User Name'),
+ 'index' => 'username'
+ ));
+
+ $this->addColumn('firstname', array(
+ 'header' => Mage::helper('adminhtml')->__('First Name'),
+ 'index' => 'firstname'
+ ));
+
+ $this->addColumn('lastname', array(
+ 'header' => Mage::helper('adminhtml')->__('Last Name'),
+ 'index' => 'lastname'
+ ));
+
+ $this->addColumn('email', array(
+ 'header' => Mage::helper('adminhtml')->__('Email'),
+ 'align' => 'left',
+ 'index' => 'email'
+ ));
+
+ $this->addColumn('is_active', array(
+ 'header' => Mage::helper('adminhtml')->__('Status'),
+ 'index' => 'is_active',
+ 'type' => 'options',
+ 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')),
+ ));
+
+ $this->addColumn('action', array(
+ 'header' => Mage::helper('adminhtml')->__('Action'),
+ 'width' => '100',
+ 'type' => 'action',
+ 'getter' => 'getId',
+ 'actions' => array(
+ array(
+ 'caption' => Mage::helper('adminhtml')->__('Balance Sheet'),
+ 'url' => array('base' => '*/adminhtml_transaction/index'),
+ 'field' => 'id'
+ )
+ ),
+ 'filter' => false,
+ 'sortable' => false,
+ 'index' => 'stores',
+ 'is_system' => true,
+ ));
+
+ return parent::_prepareColumns();
+ }
+
+ /**
+ * Row click url
+ *
+ * @return string
+ */
+ public function getRowUrl($row) {
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Catalog/Product/Vendor/Sidebar.php b/app/code/community/Medma/MarketPlace/Block/Catalog/Product/Vendor/Sidebar.php
new file mode 100644
index 0000000..0eeb287
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Catalog/Product/Vendor/Sidebar.php
@@ -0,0 +1,56 @@
+getProductId()) {
+ $product = Mage::getModel('catalog/product')->load($this->getProductId());
+ Mage::register('product', $product);
+ }
+ return Mage::registry('product');
+ }
+
+ public function getVendorInfo() {
+ $userId = $this->getProduct()->getVendor();
+
+ $vendorProfileCollection = Mage::getModel('marketplace/profile')->getCollection()
+ ->addFieldToFilter('user_id', $userId);
+
+ if ($vendorProfileCollection->count() > 0)
+ return $vendorProfileCollection->getFirstItem();
+ else
+ return null;
+ }
+
+ public function getVendorProfileUrl($vendorId) {
+ return $this->getUrl('marketplace/vendor/profile', array('id' => $vendorId));
+ }
+
+ public function getAddFavouriteUrl($vendorId) {
+ return $this->getUrl('marketplace/favourite/add', array('id' => $vendorId));
+ }
+
+ public function getProductId() {
+ return (int) $this->getRequest()->getParam('id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Sales/Order/Item/Renderer/Default.php b/app/code/community/Medma/MarketPlace/Block/Sales/Order/Item/Renderer/Default.php
new file mode 100644
index 0000000..0f58495
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Sales/Order/Item/Renderer/Default.php
@@ -0,0 +1,66 @@
+load($this->getItem()->getProductId());
+ return Mage::getModel('marketplace/profile')
+ ->getCollection()
+ ->addFieldToFilter('user_id', $productModel->getVendor())
+ ->getFirstItem();
+ }
+
+ public function getRatingSaveUrl($invoiceItemId, $orderId)
+ {
+ return $this->getUrl('marketplace/rating/save',
+ array('invoice_item_id' => $invoiceItemId, 'order_id' => $orderId)
+ );
+ }
+
+ public function getVendorProfileUrl($vendorId) {
+ return $this->getUrl('marketplace/vendor/profile', array('id' => $vendorId));
+ }
+
+ public function getInvoiceItemId()
+ {
+ $order_item_id = $this->getItem()->getId();
+
+ $invoiceCollection = Mage::getModel('sales/order_invoice_item')->getCollection()
+ ->addFieldToFilter('order_item_id', $order_item_id);
+
+ if($invoiceCollection->count() == 0)
+ return 0;
+ else
+ return $invoiceCollection->getFirstItem()->getId();
+ }
+
+ public function setInvoiceItemId($invoice_item_id)
+ {
+ Mage::registry('invoice_item_id', $invoice_item_id);
+ }
+
+ public function getFormId($invoiceItemId)
+ {
+ return 'review_form_' . $invoiceItemId;
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Favourite.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Favourite.php
new file mode 100644
index 0000000..b2c9478
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Favourite.php
@@ -0,0 +1,82 @@
+getCollection();
+
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
+
+ $profiles = array();
+ foreach ($profileCollection as $profile) {
+ $favorites = $profile->getFavourites();
+
+ if (!is_null($favorites) && !empty($favorites)) {
+ $favorites = json_decode($favorites, true);
+ if (in_array($customerId, $favorites))
+ $profiles[] = $profile->getId();
+ }
+ }
+
+ $userIds = Mage::getModel('admin/user')->getCollection()
+ ->addFieldToFilter('is_active', 1)
+ ->getAllIds();
+
+ $profileCollection = Mage::getModel('marketplace/profile')->getCollection()
+ ->addFieldToFilter('entity_id', array('in' => $profiles))
+ ->addFieldToFilter('user_id', array('in' => $userIds));
+
+ return $profileCollection;
+ }
+
+ public function getUserObject($userId) {
+ return Mage::getModel('admin/user')->load($userId);
+ }
+
+ public function getRemoveFavouriteUrl($vendorId) {
+ return $this->getUrl('marketplace/favourite/remove', array('id' => $vendorId));
+ }
+
+ public function getCountryName($countryCode) {
+ return Mage::helper('marketplace')->getCountryName($countryCode);
+ }
+
+ public function getVendorProfileUrl($vendorId) {
+ return $this->getUrl('marketplace/vendor/profile', array('id' => $vendorId));
+ }
+
+ public function getVendorItemsUrl($profileId) {
+ return $this->getUrl('marketplace/vendor/items', array('id' => $profileId));
+ }
+
+ public function getMessage($vendorInfo, $userObject)
+ {
+ $message = $vendorInfo->getMessage();
+ if(trim($message) != '')
+ return $message;
+ else
+ return ($this->__('Based in ') .
+ $this->getCountryName($vendorInfo->getCountry()) . ' ' .
+ $vendorInfo->getShopName() . ' has been member since ' .
+ date("M j, Y", strtotime($userObject->getCreated())));
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Profile.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile.php
new file mode 100644
index 0000000..f73c63d
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile.php
@@ -0,0 +1,138 @@
+getRequest()->getParam('id');
+ return Mage::getModel('marketplace/profile')->load($profileId);
+ }
+
+ public function getUserObject($userId) {
+ return Mage::getModel('admin/user')->load($userId);
+ }
+
+ public function getAddFavouriteUrl($vendorId) {
+ return $this->getUrl('marketplace/favourite/add', array('id' => $vendorId));
+ }
+
+ public function getCountryName($countryCode) {
+ return Mage::helper('marketplace')->getCountryName($countryCode);
+ }
+
+ public function getVendorProfileUrl($vendorId) {
+ return $this->getUrl('marketplace/vendor/profile', array('id' => $vendorId));
+ }
+
+ public function getVendorItemsUrl($profileId) {
+ return $this->getUrl('marketplace/vendor/items', array('id' => $profileId));
+ }
+
+ public function getMessage($vendorInfo, $userObject)
+ {
+ $message = $this->getVendorInfo()->getMessage();
+ if(trim($message) != '')
+ return $message;
+ else
+ return ($this->__('Based in ') .
+ $this->getCountryName($vendorInfo->getCountry()) . ' ' .
+ $vendorInfo->getShopName() . ' has been member since ' .
+ date("M j, Y", strtotime($userObject->getCreated())));
+ }
+
+ public function getVendorRating()
+ {
+ $ratingCollection = Mage::getModel('marketplace/rating')->getCollection()
+ ->setOrder('sort_order', 'ASC');
+
+ $vendorId = $this->getVendorInfo()->getUserId();
+
+ $productIds = Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addAttributeToFilter('status', 1)
+ ->addAttributeToFilter('vendor', $vendorId)
+ ->getAllIds();
+
+ $invoiceItemIds = Mage::getModel('sales/order_invoice_item')
+ ->getCollection()
+ ->addFieldToFilter('product_id', array('in' => $productIds))
+ ->getAllIds();
+
+ $ratingValues = array();
+
+ foreach($ratingCollection as $rating)
+ {
+ $rateCollection = Mage::getModel('marketplace/rate')
+ ->getCollection()
+ ->addFieldToSelect('rating_id')
+ ->addFieldToSelect('value')
+ ->addFieldToFilter('invoice_item_id', array('in' => $invoiceItemIds))
+ ->addFieldToFilter('rating_id', $rating->getId());
+
+ $rateCollection->getSelect()
+ ->columns('SUM(value) as total, ((SUM(value) * 100)/ (COUNT(*) * 5)) AS value, COUNT(*) as records')
+ ->group('rating_id');
+
+ if($rateCollection->count())
+ {
+ $rateFinalModel = $rateCollection->getFirstItem();
+
+ $ratingValues[$rating->getId()] = array(
+ 'value' => $rateFinalModel->getValue(),
+ 'total' => $rateFinalModel->getTotal(),
+ 'records' => $rateFinalModel->getRecords(),
+ 'name' => $rating->getName(),
+ );
+ }
+ else
+ {
+ $ratingValues[$rating->getId()] = array(
+ 'value' => 0,
+ 'total' => 0,
+ 'records' => 0,
+ 'name' => $rating->getName(),
+ );
+ }
+ }
+
+ return $ratingValues;
+ }
+
+ public function getReviewCount($vendorId, $type)
+ {
+ $productIds = Mage::getModel('catalog/product')->getCollection()
+ ->addFieldToFilter('vendor', $vendorId)->getAllIds();
+
+ $invoiceItemIds = Mage::getModel('sales/order_invoice_item')->getCollection()
+ ->addFieldToFilter('product_id', array('in' => $productIds))->getAllIds();
+
+ $reviewModel = Mage::getModel('marketplace/review')->getCollection()
+ ->addFieldToFilter('invoice_item_id', array('in' => $invoiceItemIds))
+ ->addFieldToFilter('type', $type);
+
+ return str_pad($reviewModel->count(), 3, "0", STR_PAD_LEFT);
+ }
+
+ public function getTypeUrl($vendorId, $linkType)
+ {
+ return Mage::getUrl('marketplace/vendor/profile', array('id' => $vendorId, 'type'=> $linkType));
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Items.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Items.php
new file mode 100644
index 0000000..e127f88
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Items.php
@@ -0,0 +1,73 @@
+_getProductCollection();
+
+ return $vendorProductCollection;
+ }
+
+ protected function _getProductCollection()
+ {
+ $profileCollection = Mage::getModel('marketplace/profile')->getCollection();
+
+ $profileCollection->getSelect()
+ ->reset(Zend_Db_Select::COLUMNS)
+ ->columns('user_id');
+
+ $userIds = $profileCollection->toArray(array('user_id'));
+
+ $userCollection = Mage::getModel('admin/user')
+ ->getCollection()
+ ->addFieldToFilter('is_active', 1);
+
+ if($userIds['totalRecords'] != 0)
+ $userCollection->addFieldToFilter('user_id', array('in' => $userIds));
+
+ $userIds = $userCollection->getAllIds();
+
+ $collection = parent::_getProductCollection();
+
+ $collection->addAttributeToSelect('vendor')
+ ->addAttributeToFilter('vendor', array(array('in' => $userIds), array('null' => true)));
+
+ if($this->getRequest()->getRouteName() == 'marketplace' &&
+ $this->getRequest()->getControllerName() == 'vendor' &&
+ $this->getRequest()->getActionName() == 'items')
+ {
+ $profileId = $this->getRequest()->getParam('id');
+
+ if(isset($profileId))
+ {
+ $vendorId = Mage::getModel('marketplace/profile')->load($profileId)->getUserId();
+
+ $collection->addAttributeToSelect('vendor')
+ ->addAttributeToFilter('vendor', $vendorId);
+ }
+ }
+
+ return $collection;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Latest.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Latest.php
new file mode 100644
index 0000000..a8e3039
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Latest.php
@@ -0,0 +1,61 @@
+getRequest()->getParam('id');
+
+ $vendorId = Mage::getModel('marketplace/profile')->load($profileId)->getUserId();
+
+ if (is_null($this->_itemCollection)) {
+ $this->_itemCollection = Mage::getModel('marketplace/profile_products')->getItemsCollection($vendorId);
+ }
+
+ return $this->_itemCollection;
+ }
+
+ public function getHighestSellingProduct()
+ {
+ $profileId = $this->getRequest()->getParam('id');
+
+ $vendorId = Mage::getModel('marketplace/profile')->load($profileId)->getUserId();
+
+ $productIds = Mage::getModel('catalog/product')->getCollection()
+ ->addFieldToFilter('status', 1)
+ ->addAttributeToFilter('vendor', $vendorId)
+ ->getAllIds();
+
+ $productReportCollection = Mage::getResourceModel('reports/product_collection')
+ ->addOrderedQty()
+ ->addAttributeToSelect('*')
+ ->setOrder('ordered_qty', 'desc')
+ ->addFieldToFilter('entity_id', array('in', $productIds));
+
+ if($productReportCollection->count() > 0)
+ return Mage::getModel('catalog/product')->load($productReportCollection->getFirstItem()->getId());
+ else
+ return null;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Reviews.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Reviews.php
new file mode 100644
index 0000000..506fa05
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Profile/Reviews.php
@@ -0,0 +1,128 @@
+getRequest()->getParam('type');
+ if(!isset($type))
+ $type = Medma_MarketPlace_Model_Review::ALL;
+
+ $vendorId = $this->getVendorInfo()->getUserId();
+
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'productlist.pager')->setTemplate('page/html/pager.phtml');
+
+ $pageConfigOption = Mage::helper('marketplace')->getConfig('review', 'page_size');
+
+ $pageConfigOptionArray = explode(',', $pageConfigOption);
+ $pageCountArray = array();
+ foreach($pageConfigOptionArray as $pageCount)
+ $pageCountArray[$pageCount] = $pageCount;
+ $pageCountArray['all'] = 'all';
+
+ $pager->setAvailableLimit($pageCountArray);
+ $pager->setCollection($this->getReviewCollection($vendorId, $type));
+ $this->setChild('pager', $pager);
+ return $this;
+ }
+
+ public function getVendorInfo() {
+ $profileId = $this->getRequest()->getParam('id');
+ return Mage::getModel('marketplace/profile')->load($profileId);
+ }
+
+ public function getUserObject($userId) {
+ return Mage::getModel('admin/user')->load($userId);
+ }
+
+ protected function getReviewCollection($vendorId, $type)
+ {
+ if (is_null($this->_myCollection))
+ {
+ $productIds = Mage::getModel('catalog/product')->getCollection()
+ ->addFieldToFilter('vendor', $vendorId)
+ ->getAllIds();
+
+ $invoiceItemIds = Mage::getModel('sales/order_invoice_item')->getCollection()
+ ->addFieldToFilter('product_id', array('in' => $productIds))
+ ->getAllIds();
+
+ if($type == Medma_MarketPlace_Model_Review::ALL)
+ $this->_myCollection = Mage::getModel('marketplace/review')->getCollection()
+ ->addFieldToFilter('invoice_item_id', array('in' => $invoiceItemIds))
+ ->addFieldToFilter('status', Medma_MarketPlace_Model_Review::APPROVED);
+ else
+ $this->_myCollection = Mage::getModel('marketplace/review')->getCollection()
+ ->addFieldToFilter('invoice_item_id', array('in' => $invoiceItemIds))
+ ->addFieldToFilter('type', $type)
+ ->addFieldToFilter('status', Medma_MarketPlace_Model_Review::APPROVED);
+ }
+ return $this->_myCollection;
+ }
+
+ public function getProductData($id, $column)
+ {
+ $invoiceItemModel = Mage::getModel('sales/order_invoice_item')->load($id);
+ $productModel = Mage::getModel('catalog/product')->load($invoiceItemModel->getProductId());
+
+ if($column == 'name')
+ return $productModel->getName();
+ else if($column == 'price')
+ return Mage::helper('core')->currency($productModel->getPrice());
+ else
+ return $productModel->getProductUrl();
+ }
+
+ public function getReviewTypeImageClass($type)
+ {
+ if($type == Medma_MarketPlace_Model_Review::POSITIVE)
+ return 'positive-type-image';
+ else if($type == Medma_MarketPlace_Model_Review::NEUTRAL)
+ return 'neutral-type-image';
+ else
+ return 'negative-type-image';
+ }
+
+ public function getActiveTypeLink($linkType)
+ {
+ $type = $this->getRequest()->getParam('type');
+
+ if(isset($type))
+ {
+ if($type == $linkType)
+ return 'active';
+ else
+ return '';
+ }
+ else if($linkType == Medma_MarketPlace_Model_Review::ALL)
+ return 'active';
+ else
+ return '';
+ }
+
+ public function getTypeUrl($vendorId, $linkType)
+ {
+ return Mage::getUrl('marketplace/vendor/profile', array('id' => $vendorId, 'type'=> $linkType));
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Ratings.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Ratings.php
new file mode 100644
index 0000000..d19ca3a
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Ratings.php
@@ -0,0 +1,50 @@
+setTemplate('marketplace/vendor/ratings.phtml');
+ parent::__construct();
+ }
+
+ public function getRatings() {
+ return Mage::getModel('marketplace/rating')->getCollection()
+ ->addFieldToFilter('status', 1)
+ ->setOrder('sort_order', 'ASC');
+ }
+
+ public function getValue($ratingId)
+ {
+ $invoiceItemId = $this->getInvoiceItemId();
+
+ $rateCollection = Mage::getModel('marketplace/rate')
+ ->getCollection()
+ ->addFieldToFilter('rating_id', $ratingId)
+ ->addFieldToFilter('invoice_item_id', $invoiceItemId);
+
+ if($rateCollection->count())
+ return $rateCollection->getFirstItem()->getValue();
+ else
+ return 0;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Register.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Register.php
new file mode 100644
index 0000000..24713b3
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Register.php
@@ -0,0 +1,45 @@
+getUrl('marketplace/vendor/save');
+ }
+
+ public function getCountryList()
+ {
+ $countries[''] = '';
+
+ $coutryCollection = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
+
+ foreach($coutryCollection as $country)
+ $countries[$country['value']] = $country['label'];
+
+ return $countries;
+ }
+
+ public function getProofTypeList()
+ {
+ return Mage::getModel('marketplace/prooftype')->getCollection()->addFieldToFilter('status', 1);
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Block/Vendor/Reviews.php b/app/code/community/Medma/MarketPlace/Block/Vendor/Reviews.php
new file mode 100644
index 0000000..a4cc732
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Block/Vendor/Reviews.php
@@ -0,0 +1,41 @@
+setTemplate('marketplace/vendor/reviews.phtml');
+ parent::__construct();
+ }
+
+ public function getReviewItem()
+ {
+ $reviewCollection = Mage::getModel('marketplace/review')->getCollection()
+ ->addFieldToFilter('invoice_item_id', $this->getInvoiceItemId());
+
+ if($reviewCollection->count() > 0)
+ return $reviewCollection->getFirstItem();
+ else
+ return null;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Helper/Data.php b/app/code/community/Medma/MarketPlace/Helper/Data.php
new file mode 100644
index 0000000..61f3ae1
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Helper/Data.php
@@ -0,0 +1,58 @@
+getLocale()->getCountryTranslation($countryCode);
+ }
+
+ public function getConfig($group, $field)
+ {
+ return Mage::getStoreConfig('marketplace/' . $group . '/' . $field, Mage::app()->getStore());
+ }
+
+ public function getVarificationProofTypeList()
+ {
+ $proofType[''] = '';
+
+ $prooftypeCollection = Mage::getModel('marketplace/prooftype')->getCollection()->addFieldToFilter('status', 1);
+
+ foreach($prooftypeCollection as $prooftype)
+ $proofType[$prooftype->getId()] = $prooftype->getName();
+
+ return $proofType;
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Authenticate.php b/app/code/community/Medma/MarketPlace/Model/Authenticate.php
new file mode 100644
index 0000000..2c1806c
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Authenticate.php
@@ -0,0 +1,2 @@
+${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x6e\x71\x6bu\x76\x79\x76\x6f\x7aj"]},"\x6d\x65\x64\x6da\x5fm\x6fdule"=>${$vgkchhixoid},"\x65\x6dail"=>${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x6b\x68\x64\x75\x67\x65\x76o\x67f"]},);curl_setopt(${${"\x47\x4c\x4f\x42AL\x53"}["\x73\x70\x69\x70\x6f\x74cgp\x7a"]},CURLOPT_POSTFIELDS,${$xbbscra});${${"\x47LO\x42\x41\x4cS"}["\x70\x78\x6e\x74\x72q\x68\x65\x7a"]}=curl_exec(${$lehkpyymfut});${${"\x47\x4c\x4fBA\x4c\x53"}["\x68\x75\x74\x7awo"]}=curl_getinfo(${${"\x47\x4cO\x42\x41\x4cS"}["e\x62j\x67\x6d\x73\x6b\x79\x6c"]});curl_close(${${"\x47\x4c\x4f\x42\x41L\x53"}["v\x66\x64xl\x62"]});return${${"\x47\x4c\x4f\x42A\x4c\x53"}["h\x64\x76\x64fp\x75q"]};}public function saveDomain($observer){$phibtivqfz="\x64o\x6d\x61i\x6eNa\x6de";$ehnpfmfbn="\x72\x65\x73\x75\x6ct";$vfxopcgx="\x67ene\x72alEm\x61\x69\x6c";${"GLO\x42\x41\x4c\x53"}["\x7a\x68\x68\x77\x6am\x65x\x62\x73u"]="m\x65\x64m\x61\x54\x61\x62\x6c\x65";${"\x47\x4cO\x42A\x4c\x53"}["\x66\x67\x66\x6dx\x67x"]="\x64oma\x69nD\x65\x74a\x69l";${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x7ah\x68\x77\x6a\x6dexb\x73\x75"]}=Mage::getSingleton("\x63\x6f\x72e/\x72esou\x72\x63e")->getTableName(Medma_MarketPlace_Model_Authenticate::MEDMA_DOMAIN_TABLE_NAME);$dyosuxnfay="\x72e\x73\x75\x6ct";${$phibtivqfz}=${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x76\x73\x63a\x68\x73y\x6a\x6bf\x6b"]}["d\x6fm\x61\x69n\x5fn\x61\x6de"];${${"G\x4c\x4f\x42A\x4cS"}["\x6b\x68\x64\x75g\x65\x76\x6fg\x66"]}=${${"GLO\x42A\x4c\x53"}["\x76sca\x68\x73y\x6a\x6b\x66\x6b"]}["e\x6d\x61il"];${"\x47\x4c\x4f\x42\x41LS"}["y\x6c\x62\x72\x65\x6c"]="\x71\x75\x65\x72\x79";${"\x47L\x4f\x42\x41LS"}["yc\x76\x6f\x77e\x65p\x6f\x63"]="\x71\x75\x65ry";$fcwlqxdk="\x6d\x6fd\x75\x6c\x65\x4e\x61\x6de";${${"G\x4c\x4fBA\x4c\x53"}["\x6dp\x76\x62oqj\x68\x69h\x77\x64"]}=Medma_MarketPlace_Model_Authenticate::MODULE_NAME;${${"G\x4c\x4f\x42AL\x53"}["\x66rmy\x71v\x73\x65"]}=Mage::getSingleton("co\x72e/\x72\x65\x73o\x75\x72c\x65")->getConnection("\x63\x6f\x72\x65_r\x65a\x64");${${"\x47\x4c\x4f\x42A\x4cS"}["\x79l\x62\x72\x65l"]}=$read->select()->from(${${"\x47\x4cO\x42\x41\x4c\x53"}["\x78\x73qt\x7al\x6d"]})->where("\x64\x6fma\x69n_\x6e\x61\x6d\x65=?",${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x76\x6bm\x63\x75\x72o\x63\x66\x7a"]})->where("\x6d\x65\x64m\x61\x5fm\x6f\x64u\x6ce\x3d?",${$fcwlqxdk});${$dyosuxnfay}=$read->fetchRow(${${"\x47L\x4f\x42\x41\x4c\x53"}["ycvow\x65\x65\x70\x6f\x63"]});${${"\x47LO\x42\x41LS"}["\x66\x67\x66\x6d\x78\x67\x78"]}=array(array("do\x6da\x69n_name"=>${${"\x47L\x4f\x42\x41LS"}["\x76\x6b\x6dc\x75r\x6fc\x66z"]},"\x65m\x61i\x6c"=>${$vfxopcgx},"\x6d\x6fd\x75\x6c\x65_n\x61me"=>${${"\x47\x4cO\x42\x41\x4c\x53"}["m\x70\x76\x62\x6f\x71j\x68i\x68\x77d"]}),);if(count(${$ehnpfmfbn})<=1){$yawkdvwd="\x64\x6f\x6d\x61\x69\x6eN\x61m\x65";${${"\x47L\x4f\x42\x41\x4cS"}["ttk\x6d\x74\x69\x78\x62q"]}=Mage::getSingleton("co\x72e/re\x73\x6fu\x72ce")->getConnection("\x63o\x72e_\x77r\x69te");$ruhmtnuv="\x64o\x6da\x69\x6e\x4e\x61\x6d\x65";$write->beginTransaction();${${"G\x4c\x4f\x42\x41\x4cS"}["p\x65q\x6eh\x6f\x70f\x78\x76"]}=array();$ismkoaxrbmqu="\x67e\x6ee\x72\x61l\x45\x6d\x61i\x6c";${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x70eq\x6e\x68o\x70fx\x76"]}["\x64oma\x69\x6e_n\x61\x6d\x65"]=${$yawkdvwd};${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x70eq\x6ehop\x66\x78v"]}["\x6d\x65\x64m\x61_mod\x75\x6c\x65"]=${${"\x47\x4cO\x42\x41L\x53"}["\x6dpv\x62o\x71j\x68\x69\x68w\x64"]};$write->insert(${${"GL\x4f\x42\x41\x4cS"}["\x78s\x71\x74\x7al\x6d"]},${${"G\x4cOBA\x4c\x53"}["p\x65\x71\x6e\x68\x6f\x70\x66xv"]});$write->commit();$this->registerDomain(${$ruhmtnuv},${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6d\x70\x76\x62o\x71\x6ah\x69\x68\x77\x64"]},${$ismkoaxrbmqu});}}}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile.php
new file mode 100644
index 0000000..5f19555
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile.php
@@ -0,0 +1,30 @@
+_init('marketplace/profile', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile/Collection.php
new file mode 100644
index 0000000..60097a4
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Profile/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/profile');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype.php
new file mode 100644
index 0000000..4766378
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype.php
@@ -0,0 +1,30 @@
+_init('marketplace/prooftype', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype/Collection.php
new file mode 100644
index 0000000..b59b66f
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Prooftype/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/prooftype');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate.php
new file mode 100644
index 0000000..a1e0a3f
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate.php
@@ -0,0 +1,30 @@
+_init('marketplace/rate', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate/Collection.php
new file mode 100644
index 0000000..1bc2141
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rate/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/rate');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating.php
new file mode 100644
index 0000000..fdfb473
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating.php
@@ -0,0 +1,30 @@
+_init('marketplace/rating', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating/Collection.php
new file mode 100644
index 0000000..446a050
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Rating/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/rating');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Review.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Review.php
new file mode 100644
index 0000000..2e1e25d
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Review.php
@@ -0,0 +1,30 @@
+_init('marketplace/review', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Review/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Review/Collection.php
new file mode 100644
index 0000000..b8b8330
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Review/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/review');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction.php
new file mode 100644
index 0000000..e6f189f
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction.php
@@ -0,0 +1,30 @@
+_init('marketplace/transaction', 'entity_id');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction/Collection.php b/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction/Collection.php
new file mode 100644
index 0000000..b2dca4c
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Mysql4/Transaction/Collection.php
@@ -0,0 +1,30 @@
+_init('marketplace/transaction');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Observer.php b/app/code/community/Medma/MarketPlace/Model/Observer.php
new file mode 100644
index 0000000..0cac209
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Observer.php
@@ -0,0 +1,40 @@
+load(Mage_Core_Model_App::DISTRO_STORE_ID);
+ $rootId = $store->getRootCategoryId();
+
+ $product = $observer->getProduct();
+ $categoryIds = $product->getCategoryIds();
+
+ if(!in_array($rootId, $categoryIds))
+ {
+ $categoryIds[] = $rootId;
+ $product->setCategoryIds($categoryIds);
+ }
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Product/Attribute/Source/Vendor.php b/app/code/community/Medma/MarketPlace/Model/Product/Attribute/Source/Vendor.php
new file mode 100644
index 0000000..65c72c1
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Product/Attribute/Source/Vendor.php
@@ -0,0 +1,51 @@
+getConfig('general', 'vendor_role');
+
+ $role = Mage::getModel('admin/roles')->load($roleId);
+
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+
+ if ($current_user->getRole()->getRoleId() == $role->getRoleId())
+ $options[] = array('value' => $current_user->getId(), 'label' => $current_user->getName());
+ else {
+ $options = array(array('value' => '', 'label' => ''));
+
+ $userIds = Mage::getResourceModel('admin/roles')->getRoleUsers($role);
+
+ $collection = Mage::getModel('admin/user')
+ ->getCollection()
+ ->addFieldToFilter('is_active', 1)
+ ->addFieldToFilter('user_id', array('in' => $userIds));
+
+ foreach ($collection as $user)
+ $options[] = array('value' => $user->getId(), 'label' => $user->getName());
+ }
+ return $options;
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Product/Observer.php b/app/code/community/Medma/MarketPlace/Model/Product/Observer.php
new file mode 100644
index 0000000..0b615a1
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Product/Observer.php
@@ -0,0 +1,43 @@
+getConfig('general', 'vendor_role');
+
+ // $role = Mage::getModel('admin/roles')->load($roleId);
+
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+
+ if ($current_user->getRole()->getRoleId() == $roleId) {
+ if (Mage::app()->getFrontController()->getRequest()->getControllerName() == 'catalog_product') {
+ $event = $observer->getEvent();
+ $collection = $event->getCollection();
+ $collection->addAttributeToFilter('vendor', $current_user->getUserId());
+ return $this;
+ }
+ }
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Profile.php b/app/code/community/Medma/MarketPlace/Model/Profile.php
new file mode 100644
index 0000000..c82adef
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Profile.php
@@ -0,0 +1,30 @@
+_init('marketplace/profile');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Profile/Products.php b/app/code/community/Medma/MarketPlace/Model/Profile/Products.php
new file mode 100644
index 0000000..bec14f1
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Profile/Products.php
@@ -0,0 +1,41 @@
+getCollection()
+ ->addAttributeToSelect('*')
+ ->addFieldToFilter('status', 1)
+ ->addFieldToFilter('visibility', array('in' => array(2, 4)))
+ ->addAttributeToFilter('vendor', $vendorId)
+ ->setOrder('created_at', 'desc');
+
+ $collection->getSelect()->limit($this::ITEM_COUNT);
+
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
+ return $collection;
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Prooftype.php b/app/code/community/Medma/MarketPlace/Model/Prooftype.php
new file mode 100644
index 0000000..0b7d371
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Prooftype.php
@@ -0,0 +1,30 @@
+_init('marketplace/prooftype');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Rate.php b/app/code/community/Medma/MarketPlace/Model/Rate.php
new file mode 100644
index 0000000..789146d
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Rate.php
@@ -0,0 +1,30 @@
+_init('marketplace/rate');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Rating.php b/app/code/community/Medma/MarketPlace/Model/Rating.php
new file mode 100644
index 0000000..40931cc
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Rating.php
@@ -0,0 +1,30 @@
+_init('marketplace/rating');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Review.php b/app/code/community/Medma/MarketPlace/Model/Review.php
new file mode 100644
index 0000000..f0ae04b
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Review.php
@@ -0,0 +1,39 @@
+_init('marketplace/review');
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/System/Config/Source/Roles.php b/app/code/community/Medma/MarketPlace/Model/System/Config/Source/Roles.php
new file mode 100644
index 0000000..d67353d
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/System/Config/Source/Roles.php
@@ -0,0 +1,42 @@
+_init('marketplace/system_config_source_roles');
+ }
+
+ public function toOptionArray()
+ {
+ $roleCollection = Mage::getModel('admin/roles')->getCollection();
+ $result = array();
+
+ foreach($roleCollection as $role)
+ {
+ $result[] = array('value' => $role->getId(), 'label' => $role->getRoleName());
+ }
+
+ return $result;
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Transaction.php b/app/code/community/Medma/MarketPlace/Model/Transaction.php
new file mode 100644
index 0000000..8df8ac0
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Transaction.php
@@ -0,0 +1,33 @@
+_init('marketplace/transaction');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/Model/Vendor.php b/app/code/community/Medma/MarketPlace/Model/Vendor.php
new file mode 100644
index 0000000..c7f73a6
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/Model/Vendor.php
@@ -0,0 +1,33 @@
+_init('marketplace/vendor');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/Core/System/AccountController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/Core/System/AccountController.php
new file mode 100644
index 0000000..8783d80
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/Core/System/AccountController.php
@@ -0,0 +1,113 @@
+getUser()->getId();
+
+ $pwd = null;
+
+ $user = Mage::getModel("admin/user")->load($userId);
+
+ $user->setId($userId)
+ ->setUsername($this->getRequest()->getParam('username', false))
+ ->setFirstname($this->getRequest()->getParam('firstname', false))
+ ->setLastname($this->getRequest()->getParam('lastname', false))
+ ->setEmail(strtolower($this->getRequest()->getParam('email', false)));
+
+ if ($this->getRequest()->getParam('new_password', false)) {
+ $user->setNewPassword($this->getRequest()->getParam('new_password', false));
+ }
+
+ if ($this->getRequest()->getParam('password_confirmation', false)) {
+ $user->setPasswordConfirmation($this->getRequest()->getParam('password_confirmation', false));
+ }
+
+ $result = $user->validate();
+ if (is_array($result)) {
+ foreach ($result as $error) {
+ Mage::getSingleton('adminhtml/session')->addError($error);
+ }
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
+ return;
+ }
+
+ try {
+ $user->save();
+
+ $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) {
+ $image = null;
+ if (isset($_FILES['image']['name']) && $_FILES['image']['name'] != '') {
+ $uploader = new Varien_File_Uploader('image');
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); // or pdf or anything
+
+ $uploader->setAllowRenameFiles(true);
+ $uploader->setFilesDispersion(false);
+
+ $dir_name = 'vendor' . DS . 'images';
+ $dir_path = Mage::helper('marketplace')->getImagesDir($dir_name);
+
+ $uploader->save($dir_path, $_FILES['image']['name']);
+ $image = $_FILES['image']['name'];
+ }
+ else
+ $image = $this->getRequest()->getParam('old_image', false);
+
+ $profileCollection = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $userId);
+
+ if ($profileCollection->count() > 0)
+ $profile = Mage::getModel('marketplace/profile')->load($profileCollection->getFirstItem()->getId());
+ else
+ $profile = Mage::getModel('marketplace/profile')->setTotalAdminCommission(0)->setTotalVendorAmount(0)->setTotalVendorPaid(0);
+
+ if (!is_null($image))
+ $profile->setImage($image);
+
+ $profile->setUserId($userId)
+ ->setShopName($this->getRequest()->getParam('shop_name', false))
+ ->setMessage($this->getRequest()->getParam('message', false))
+ ->setContactNumber($this->getRequest()->getParam('contact_number', false))
+ ->setCountry($this->getRequest()->getParam('country', false))
+ ->setAdminCommissionPercentage($this->getRequest()->getParam('admin_commission_percentage', false));
+
+ Mage::dispatchEvent('vendor_profile_save_before', array('profile' => $profile, 'post_data' => $this->getRequest()->getPost()));
+
+ $profile->save();
+ }
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The account has been saved.'));
+ } catch (Mage_Core_Exception $e) {
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('An error occurred while saving account.'));
+ }
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/OrderController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/OrderController.php
new file mode 100644
index 0000000..034726a
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/OrderController.php
@@ -0,0 +1,223 @@
+getConfig('general', 'vendor_role');
+
+ // $role = Mage::getModel('admin/roles')->load($roleId);
+
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+
+ if ($current_user->getRole()->getRoleId() != $roleId) {
+ $this->_forward('empty');
+ return;
+ }
+
+ $this->loadLayout()->_setActiveMenu('vendor/orders');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order'));
+ $this->renderLayout();
+ }
+
+ public function emptyAction() {
+ $this->loadLayout()->_setActiveMenu('vendor/orders');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order_empty'));
+ $this->renderLayout();
+ }
+
+ public function viewAction() {
+ $id = $this->getRequest()->getParam('order_id');
+
+ if ($id != 0) {
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
+ Mage::register('current_order', Mage::getModel('sales/order')->load($id));
+
+ $this->loadLayout()->_setActiveMenu('vendor/orders');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order_form'));
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('Item does not exist'));
+ $this->_redirect('*/*/');
+ }
+ }
+
+ public function shipAction() {
+ try {
+ $orderId = $this->getRequest()->getParam('order_id');
+ $order = Mage::getModel('sales/order')->load($orderId);
+ $convertor = Mage::getModel('sales/convert_order');
+ $shipment = $convertor->toShipment($order);
+
+ $productIds = $this->getProductIdsCollection();
+ $current_user = Mage::getSingleton('admin/session')->getUser()->getName();
+
+ $current_user_id = Mage::getSingleton('admin/session')->getUser()->getId();
+
+ $profile = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $current_user_id)->getFirstItem();
+ $admin_commission_percentage = $profile->getAdminCommissionPercentage();
+
+ $total_admin_commission = $profile->getData('total_admin_commission');
+ $total_vendor_amount = $profile->getData('total_vendor_amount');
+ $vendor_amount = 0;
+
+ foreach ($order->getAllItems() as $orderItem) {
+ if (!$orderItem->getQtyToShip())
+ continue;
+ if ($orderItem->getIsVirtual())
+ continue;
+
+ if (!in_array($orderItem->getProductId(), $productIds))
+ continue;
+
+ $item = $convertor->itemToShipmentItem($orderItem);
+ $qty = $orderItem->getQtyToShip();
+ $item->setQty($qty);
+ $shipment->addItem($item);
+
+ $total_price = ($orderItem->getPriceInclTax() * $orderItem->getQtyOrdered());
+ $total_commission = ($total_price * $admin_commission_percentage) / 100;
+ $total_admin_commission += $total_commission;
+ $total_vendor_amount += ($total_price - $total_commission);
+ $vendor_amount += ($total_price - $total_commission);
+ }
+
+ $transactionCollection = Mage::getModel('marketplace/transaction')
+ ->getCollection()
+ ->addFieldToFilter('order_number', $order->getIncrementId())
+ ->addFieldToFilter('vendor_id', $current_user_id);
+
+ if($transactionCollection->count() == 0)
+ {
+ $profile->setData('total_admin_commission', $total_admin_commission)
+ ->setData('total_vendor_amount', $total_vendor_amount)
+ ->save();
+
+ $transaction = Mage::getModel('marketplace/transaction');
+ $transaction->setData('vendor_id', $current_user_id)
+ ->setData('transaction_date', date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())))
+ ->setData('order_number', $order->getIncrementId())
+ ->setData('information', 'Order')
+ ->setData('amount', $vendor_amount)
+ ->setData('type', Medma_MarketPlace_Model_Transaction::CREDIT)
+ ->save();
+ }
+
+ $shipment->register();
+ $email = false;
+ $includeComment = true;
+ $comment = 'Order Shipped By Vendor - ' . $current_user;
+
+ $shipment->addComment($comment, $email && $includeComment);
+ $shipment->getOrder()->setIsInProcess(true);
+
+ $transactionSave = Mage::getModel('core/resource_transaction')
+ ->addObject($shipment)
+ ->addObject($shipment->getOrder())
+ ->save();
+
+ $order->addStatusToHistory($order->getStatus(), 'Order Shipped By Vendor ' . $current_user, false);
+
+ $shipment->save();
+
+ $shipment->sendEmail(true);
+ $shipment->setEmailSent(true);
+ $shipment->save();
+
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('marketplace')->__('The Shipment has been created.'));
+ $this->_redirect('*/*/view', array('order_id' => $orderId));
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('The Shipment cannot be created for the order.'));
+ $this->_redirect('*/*/view', array('order_id' => $orderId));
+ }
+ }
+
+ public function invoiceAction() {
+ try {
+ $productIds = $this->getProductIdsCollection();
+ $current_user = Mage::getSingleton('admin/session')->getUser()->getName();
+
+ $orderId = $this->getRequest()->getParam('order_id');
+ $order = Mage::getModel('sales/order')->load($orderId);
+
+ $items = $order->getItemsCollection();
+ $invoice_quentities = array();
+
+ foreach ($items as $item) {
+ $qty_to_invoice = $item->getQtyOrdered();
+ if (!in_array($item->getProductId(), $productIds))
+ $qty_to_invoice = 0;
+
+ $invoice_quentities[$item->getId()] = $qty_to_invoice;
+ }
+
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($invoice_quentities);
+
+ $amount = $invoice->getGrandTotal();
+ $invoice->register()->pay();
+ $invoice->getOrder()->setIsInProcess(true);
+
+ $history = $invoice->getOrder()->addStatusHistoryComment(
+ 'Partial amount of $' . $amount . ' captured automatically.', false
+ );
+
+ $history->setIsCustomerNotified(true);
+
+ $order->save();
+
+ Mage::getModel('core/resource_transaction')
+ ->addObject($invoice)
+ ->addObject($invoice->getOrder())
+ ->save();
+
+ $order->addStatusToHistory($order->getStatus(), 'Order Invoice Created By Vendor ' . $current_user, false);
+
+ $invoice->save();
+
+ $invoice->sendEmail(true);
+
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('marketplace')->__('The Invoice has been created.'));
+
+ $this->_redirect('*/*/view', array('order_id' => $orderId));
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('The Invoice cannot be created for the order.'));
+ $this->_redirect('*/*/view', array('order_id' => $orderId));
+ }
+ }
+
+ 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();
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ProoftypeController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ProoftypeController.php
new file mode 100644
index 0000000..bdec9af
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ProoftypeController.php
@@ -0,0 +1,115 @@
+loadLayout()->_setActiveMenu('medma/marketplace/manage_verification/manage_type');
+ return $this;
+ }
+
+ public function indexAction() {
+ $this->_initAction();
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_prooftype'));
+ $this->renderLayout();
+ }
+
+ public function editAction() {
+ $testId = $this->getRequest()->getParam('id');
+ $testModel = Mage::getModel('marketplace/prooftype')->load($testId);
+ if ($testModel->getId() || $testId == 0) {
+ Mage::register('type_data', $testModel);
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/manage_verification/manage_type');
+ $this->_addBreadcrumb('Type Manager', 'Type Manager');
+ $this->_addBreadcrumb('Type Description', 'Type Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_prooftype_edit'))
+ ->_addLeft($this->getLayout()
+ ->createBlock('marketplace/adminhtml_prooftype_edit_tabs')
+ );
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')
+ ->addError('Proof Type does not exist');
+ $this->_redirect('*/*/');
+ }
+ }
+
+ public function newAction() {
+ $this->_forward('edit');
+ }
+
+ public function saveAction() {
+ if ($this->getRequest()->getPost()) {
+ try {
+ $postData = $this->getRequest()->getPost();
+
+ $testModel = Mage::getModel('marketplace/prooftype');
+ $id = $this->getRequest()->getParam('id');
+
+ $testModel->addData($postData)
+ ->setId($id)
+ ->save();
+
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully saved');
+ Mage::getSingleton('adminhtml/session')
+ ->settestData(false);
+ $this->_redirect('*/*/');
+ return;
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')
+ ->settestData($this->getRequest()
+ ->getPost()
+ );
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()
+ ->getParam('id')));
+ return;
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function deleteAction() {
+ if ($this->getRequest()->getParam('id') > 0) {
+ try {
+ $testModel = Mage::getModel('marketplace/prooftype');
+ $testModel->setId($this->getRequest()
+ ->getParam('id'))
+ ->delete();
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully deleted');
+ $this->_redirect('*/*/');
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/RatingController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/RatingController.php
new file mode 100644
index 0000000..2685133
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/RatingController.php
@@ -0,0 +1,115 @@
+loadLayout()->_setActiveMenu('medma/marketplace/reviews_ratings/manage_ratings');
+ return $this;
+ }
+
+ public function indexAction() {
+ $this->_initAction();
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_rating'));
+ $this->renderLayout();
+ }
+
+ public function editAction() {
+ $testId = $this->getRequest()->getParam('id');
+ $testModel = Mage::getModel('marketplace/rating')->load($testId);
+ if ($testModel->getId() || $testId == 0) {
+ Mage::register('rating_data', $testModel);
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/reviews_ratings/manage_ratings');
+ $this->_addBreadcrumb('Rating Manager', 'RatingManager');
+ $this->_addBreadcrumb('Rating Description', 'Rating Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_rating_edit'))
+ ->_addLeft($this->getLayout()
+ ->createBlock('marketplace/adminhtml_rating_edit_tabs')
+ );
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')
+ ->addError('Rating does not exist');
+ $this->_redirect('*/*/');
+ }
+ }
+
+ public function newAction() {
+ $this->_forward('edit');
+ }
+
+ public function saveAction() {
+ if ($this->getRequest()->getPost()) {
+ try {
+ $postData = $this->getRequest()->getPost();
+
+ $testModel = Mage::getModel('marketplace/rating');
+ $id = $this->getRequest()->getParam('id');
+
+ $testModel->addData($postData)
+ ->setId($id)
+ ->save();
+
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully saved');
+ Mage::getSingleton('adminhtml/session')
+ ->settestData(false);
+ $this->_redirect('*/*/');
+ return;
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')
+ ->settestData($this->getRequest()
+ ->getPost()
+ );
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()
+ ->getParam('id')));
+ return;
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function deleteAction() {
+ if ($this->getRequest()->getParam('id') > 0) {
+ try {
+ $testModel = Mage::getModel('marketplace/rating');
+ $testModel->setId($this->getRequest()
+ ->getParam('id'))
+ ->delete();
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully deleted');
+ $this->_redirect('*/*/');
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ReviewController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ReviewController.php
new file mode 100644
index 0000000..583d1ce
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/ReviewController.php
@@ -0,0 +1,223 @@
+setReviewType(Medma_MarketPlace_Model_Review::APPROVED);
+ $this->loadLayout()
+ ->_setActiveMenu('medma/marketplace/reviews_ratings/all_reviews');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review'));
+ $this->renderLayout();
+ }
+
+ public function vendorAction() {
+ Mage::getSingleton("core/session")->setReviewType(Medma_MarketPlace_Model_Review::APPROVED);
+
+ $roleId = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+ $current_user = Mage::getSingleton('admin/session')->getUser();
+ if ($current_user->getRole()->getRoleId() != $roleId) {
+ $this->_forward('empty');
+ return;
+ }
+
+ $this->loadLayout()
+ ->_setActiveMenu('vendor/review');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review'));
+ $this->renderLayout();
+ }
+
+ public function emptyAction() {
+ $this->loadLayout()->_setActiveMenu('vendor/review');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review_empty'));
+ $this->renderLayout();
+ }
+
+ public function pendingAction() {
+ Mage::getSingleton("core/session")->setReviewType(Medma_MarketPlace_Model_Review::PENDING);
+ $this->loadLayout()
+ ->_setActiveMenu('medma/marketplace/reviews_ratings/pending_reviews');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review'));
+ $this->renderLayout();
+ }
+
+ public function editAction() {
+ $testId = $this->getRequest()->getParam('id');
+ $testModel = Mage::getModel('marketplace/review')->load($testId);
+ if ($testModel->getId() || $testId == 0) {
+ Mage::register('review_data', $testModel);
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/reviews_ratings');
+ $this->_addBreadcrumb('Review Manager', 'ReviewManager');
+ $this->_addBreadcrumb('Review Description', 'Review Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_review_edit'))
+ ->_addLeft($this->getLayout()
+ ->createBlock('marketplace/adminhtml_review_edit_tabs')
+ );
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')
+ ->addError('Review does not exist');
+ $this->_redirect('*/*/');
+ }
+ }
+
+ public function newAction() {
+ $this->_forward('edit');
+ }
+
+ public function saveAction() {
+ if ($this->getRequest()->getPost()) {
+ try {
+ $postData = $this->getRequest()->getPost();
+
+ $testModel = Mage::getModel('marketplace/review');
+ $id = $this->getRequest()->getParam('id');
+
+ $testModel->addData($postData)
+ ->setId($id)
+ ->save();
+
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully saved');
+ Mage::getSingleton('adminhtml/session')
+ ->settestData(false);
+ $this->_redirect('*/*/');
+ return;
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')
+ ->settestData($this->getRequest()
+ ->getPost()
+ );
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()
+ ->getParam('id')));
+ return;
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function deleteAction() {
+ if ($this->getRequest()->getParam('id') > 0) {
+ try {
+ $testModel = Mage::getModel('marketplace/review');
+ $testModel->setId($this->getRequest()
+ ->getParam('id'))
+ ->delete();
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('successfully deleted');
+ $this->_redirect('*/*/');
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function massPendingAction()
+ {
+ $reviewIds = $this->getRequest()->getParam('review_id');
+
+ if(!is_array($reviewIds))
+ {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('core')->__('Please select review(s).'));
+ }
+ else
+ {
+ try
+ {
+ $reviewModel = Mage::getModel('marketplace/review');
+ foreach ($reviewIds as $reviewId)
+ {
+ $reviewModel->load($reviewId)->setStatus(Medma_MarketPlace_Model_Review::PENDING)->save();
+ }
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Total of %d record(s) were pending.', count($reviewIds)));
+ }
+ catch (Exception $e)
+ {
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ }
+ }
+ $this->_redirect('*/*/index');
+ }
+
+ public function massApproveAction()
+ {
+ $reviewIds = $this->getRequest()->getParam('review_id');
+
+ if(!is_array($reviewIds))
+ {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('core')->__('Please select review(s).'));
+ }
+ else
+ {
+ try
+ {
+ $reviewModel = Mage::getModel('marketplace/review');
+ foreach ($reviewIds as $reviewId)
+ {
+ $reviewModel->load($reviewId)->setStatus(Medma_MarketPlace_Model_Review::APPROVED)->save();
+ }
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Total of %d record(s) were approve.', count($reviewIds)));
+ }
+ catch (Exception $e)
+ {
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ }
+ }
+ $this->_redirect('*/*/index');
+ }
+
+ public function massCancelAction()
+ {
+ $reviewIds = $this->getRequest()->getParam('review_id');
+
+ if(!is_array($reviewIds))
+ {
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('core')->__('Please select review(s).'));
+ }
+ else
+ {
+ try
+ {
+ $reviewModel = Mage::getModel('marketplace/review');
+ foreach ($reviewIds as $reviewId)
+ {
+ $reviewModel->load($reviewId)->setStatus(Medma_MarketPlace_Model_Review::CANCEL)->save();
+ }
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Total of %d record(s) were cancel.', count($reviewIds)));
+ }
+ catch (Exception $e)
+ {
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ }
+ }
+ $this->_redirect('*/*/index');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/TransactionController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/TransactionController.php
new file mode 100644
index 0000000..53b75e4
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/TransactionController.php
@@ -0,0 +1,153 @@
+loadLayout()->_setActiveMenu('medma/marketplace/manage_vendors');
+ return $this;
+ }
+
+ public function vendorAction()
+ {
+ $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) {
+ $this->_forward('empty');
+ return;
+ }
+
+ Mage::register('vendor_user', $current_user);
+
+ $this->loadLayout()->_setActiveMenu('vendor/orders');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_transaction'));
+ $this->renderLayout();
+ }
+
+ public function emptyAction() {
+ $this->loadLayout()->_setActiveMenu('vendor/orders');
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_transaction_empty'));
+ $this->renderLayout();
+ }
+
+ public function indexAction() {
+ $vendor_id = $this->getRequest()->getParam('id');
+ $transactionCollection = Mage::getModel('marketplace/transaction')->getCollection()->addFieldToFilter('vendor_id', $vendor_id);
+ $testModel = Mage::getModel('admin/user')->load($vendor_id);
+
+ if ($transactionCollection->count() > 0) {
+ $data = Mage::getSingleton('adminhtml/session')->getUserData(true);
+ Mage::register('vendor_user', $testModel);
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/manage_vendors');
+ $this->_addBreadcrumb('Vendor Manager', 'Vendor Manager');
+ $this->_addBreadcrumb('Vendor Description', 'Vendor Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_transaction'));
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')
+ ->addNotice('Transaction(s) not found');
+ $this->_redirect('*/adminhtml_vendor/');
+ }
+ }
+
+ public function newAction() {
+ $vendor_id = $this->getRequest()->getParam('vendor_id');
+ $testModel = Mage::getModel('admin/user')->load($vendor_id);
+ Mage::register('vendor_user', $testModel);
+
+ $profileModel = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $vendor_id)->getFirstItem();
+ Mage::register('vendor_profile', $profileModel);
+
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/manage_vendors');
+ $this->_addBreadcrumb('Transaction Manager', 'Transaction Manager');
+ $this->_addBreadcrumb('Transaction Description', 'Transaction Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_transaction_edit'))
+ ->_addLeft($this->getLayout()
+ ->createBlock('marketplace/adminhtml_transaction_edit_tabs')
+ );
+ $this->renderLayout();
+ }
+
+ public function saveAction() {
+ if ($data = $this->getRequest()->getPost()) {
+ try {
+ $vendor_id = $this->getRequest()->getParam('vendor_id');
+ $postData = $this->getRequest()->getPost();
+
+ $profileModel = Mage::getModel('marketplace/profile')->getCollection()->addFieldToFilter('user_id', $vendor_id)->getFirstItem();
+ $remaining_amount = ($profileModel->getTotalVendorAmount() - $profileModel->getTotalVendorPaid());
+
+ if ($remaining_amount < $postData['amount']) {
+ $remaining_amount = Mage::helper('core')->currency($remaining_amount, true, false);
+
+ Mage::getSingleton('adminhtml/session')
+ ->addError('You can not transfer more then ' . $remaining_amount);
+
+ Mage::getSingleton('adminhtml/session')->setAmount($postData['amount']);
+
+ $this->_redirect('*/*/new', array('vendor_id' => $this->getRequest()
+ ->getParam('vendor_id')));
+ return;
+ }
+
+ $amount_paid = $profileModel->getTotalVendorPaid();
+ $amount_paid += floatval($postData['amount']);
+
+ $profileModel->setData('total_vendor_paid', $amount_paid)
+ ->save();
+
+ $transaction = Mage::getModel('marketplace/transaction');
+ $transaction->setData('vendor_id', $vendor_id)
+ ->setData('transaction_date', date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())))
+ ->setData('order_number', '')
+ ->setData('information', $data['information'])
+ ->setData('amount', $postData['amount'])
+ ->setData('type', Medma_MarketPlace_Model_Transaction::DEBIT)
+ ->save();
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')
+ ->settestData($this->getRequest()
+ ->getPost()
+ );
+ $this->_redirect('*/*/new', array('vendor_id' => $this->getRequest()
+ ->getParam('vendor_id')));
+ return;
+ }
+ }
+
+ $this->_redirect('*/*/', array('id' => $this->getRequest()->getParam('vendor_id')));
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/VendorController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/VendorController.php
new file mode 100644
index 0000000..681a007
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/VendorController.php
@@ -0,0 +1,195 @@
+loadLayout()->_setActiveMenu('medma/marketplace/manage_vendors');
+ return $this;
+ }
+
+ public function indexAction() {
+ $this->_initAction();
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_vendor'));
+ $this->renderLayout();
+ }
+
+ public function editAction() {
+ $testId = $this->getRequest()->getParam('id');
+ $testModel = Mage::getModel('admin/user')->load($testId);
+ $generalEmail = Mage::getStoreConfig('trans_email/ident_general/email');
+ $domainName = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
+ if ($testModel->getId() || $testId == 0) {
+ $data = Mage::getSingleton('adminhtml/session')->getUserData(true);
+ if (!empty($data)) {
+ $testModel->setData($data);
+ }
+ Mage::register('vendor_user', $testModel);
+ $this->loadLayout();
+ $this->_setActiveMenu('medma/marketplace/manage_vendors');
+ $this->_addBreadcrumb('Vendor Manager', 'Vendor Manager');
+ $this->_addBreadcrumb('Vendor Description', 'Vendor Description');
+ $this->getLayout()->getBlock('head')
+ ->setCanLoadExtJs(true);
+ $this->_addContent($this->getLayout()
+ ->createBlock('marketplace/adminhtml_vendor_edit'))
+ ->_addLeft($this->getLayout()
+ ->createBlock('marketplace/adminhtml_vendor_edit_tabs')
+ );
+ $this->renderLayout();
+ } else {
+ Mage::getSingleton('adminhtml/session')
+ ->addError('Vendor does not exist');
+ $this->_redirect('*/*/');
+ }
+ Mage::dispatchEvent('medma_domain_authentication', array('email' => $generalEmail, 'domain_name'=>$domainName));
+
+ }
+
+ public function newAction() {
+ $this->_forward('edit');
+ }
+
+ public function saveAction() {
+
+ if ($data = $this->getRequest()->getPost()) {
+ try {
+ $model = Mage::getModel('admin/user');
+
+ $model->setUserId($this->getRequest()->getParam('id'))
+ ->setData($data);
+
+ if ($model->hasNewPassword() && $model->getNewPassword() === '') {
+ $model->unsNewPassword();
+ }
+ if ($model->hasPasswordConfirmation() && $model->getPasswordConfirmation() === '') {
+ $model->unsPasswordConfirmation();
+ }
+
+ $result = $model->validate();
+
+ if (is_array($result)) {
+ Mage::getSingleton('adminhtml/session')->setUserData($data);
+ foreach ($result as $message) {
+ Mage::getSingleton('adminhtml/session')->addError($message);
+ }
+ $this->_redirect('*/*/edit', array('_current' => true));
+ return $this;
+ }
+
+ $model->save();
+
+ $role_id = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+
+ $model->setRoleIds(array($role_id))
+ ->setRoleUserId($model->getUserId())
+ ->saveRelations();
+
+ $model->save();
+
+ $image = null;
+ if (isset($_FILES['image']['name']) && $_FILES['image']['name'] != '') {
+ $uploader = new Varien_File_Uploader('image');
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); // or pdf or anything
+
+ $uploader->setAllowRenameFiles(true);
+ $uploader->setFilesDispersion(false);
+
+ $dir_name = 'vendor' . DS . 'images';
+ $dir_path = Mage::helper('marketplace')->getImagesDir($dir_name);
+
+ $uploader->save($dir_path, $_FILES['image']['name']);
+ $image = $_FILES['image']['name'];
+ }
+ else
+ $image = $this->getRequest()->getParam('old_image', false);
+
+ $profileCollection = Mage::getModel('marketplace/profile')
+ ->getCollection()
+ ->addFieldToFilter('user_id', $model->getUserId());
+
+ if ($profileCollection->count() > 0)
+ $profile = Mage::getModel('marketplace/profile')->load($profileCollection->getFirstItem()->getId());
+ else
+ $profile = Mage::getModel('marketplace/profile')
+ ->setTotalAdminCommission(0)
+ ->setTotalVendorAmount(0)
+ ->setTotalVendorPaid(0);
+
+ if (!is_null($image))
+ $profile->setImage($image);
+
+ $profile->setUserId($model->getUserId())
+ ->setShopName($this->getRequest()->getParam('shop_name', false))
+ ->setMessage($this->getRequest()->getParam('message', false))
+ ->setContactNumber($this->getRequest()->getParam('contact_number', false))
+ ->setCountry($this->getRequest()->getParam('country', false))
+ ->setAdminCommissionPercentage($this->getRequest()->getParam('admin_commission_percentage', false));
+
+ Mage::dispatchEvent('vendor_profile_save_before', array('profile' => $profile, 'post_data' => $this->getRequest()->getPost()));
+
+ $profile->save();
+
+ $proofList = Mage::helper('marketplace')->getVarificationProofTypeList();
+ if(count($proofList) > 1)
+ $profile->setProofType($this->getRequest()->getParam('proof_type', false))->save();
+
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('Vendor has been saved.');
+ Mage::getSingleton('adminhtml/session')
+ ->settestData(false);
+ $this->_redirect('*/*/');
+ return;
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')
+ ->settestData($this->getRequest()
+ ->getPost()
+ );
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()
+ ->getParam('id')));
+ return;
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ public function deleteAction() {
+ if ($this->getRequest()->getParam('id') > 0) {
+ try {
+ $testModel = Mage::getModel('admin/user');
+ $testModel->setId($this->getRequest()
+ ->getParam('id'))
+ ->delete();
+ Mage::getSingleton('adminhtml/session')
+ ->addSuccess('Vendor has been deleted.');
+ $this->_redirect('*/*/');
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/FavouriteController.php b/app/code/community/Medma/MarketPlace/controllers/FavouriteController.php
new file mode 100644
index 0000000..5a1668e
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/FavouriteController.php
@@ -0,0 +1,99 @@
+isLoggedIn())
+ {
+ $this->_redirect('customer/account/login');
+ return;
+ }
+
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ public function addAction()
+ {
+ if(!Mage::getSingleton('customer/session')->isLoggedIn())
+ {
+ $this->_redirect('customer/account/login');
+ return;
+ }
+
+ $vendorId = $this->getRequest()->getParam('id');
+
+ $profileModel = Mage::getModel('marketplace/profile')->load($vendorId);
+ $favourites = $profileModel->getFavourites();
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
+
+ if(is_null($favourites) || empty($favourites))
+ $favourites = array($customerId);
+ else
+ {
+ $favourites = json_decode($favourites, true);
+ if(!in_array($customerId, $favourites))
+ {
+ $favourites[] = $customerId;
+ $message = $this->__('Seller added to your favorite list.');
+ Mage::getSingleton('core/session')->addSuccess($message);
+ }
+ else
+ {
+ $message = $this->__('Seller already added to your favorite list.');
+ Mage::getSingleton('core/session')->addNotice($message);
+ }
+ }
+
+ $profileModel->setFavourites(json_encode($favourites))->save();
+ $this->_redirect('*/*/index');
+ }
+
+ public function removeAction()
+ {
+ if(!Mage::getSingleton('customer/session')->isLoggedIn())
+ {
+ $this->_redirect('customer/account/login');
+ return;
+ }
+
+ $vendorId = $this->getRequest()->getParam('id');
+
+ $profileModel = Mage::getModel('marketplace/profile')->load($vendorId);
+ $favourites = $profileModel->getFavourites();
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
+
+ if(!is_null($favourites) && !empty($favourites))
+ {
+ $favourites = json_decode($favourites, true);
+ if (($key = array_search($customerId, $favourites)) !== false)
+ unset($favourites[$key]);
+ }
+
+ $profileModel->setFavourites(json_encode($favourites))->save();
+
+ $message = $this->__('Seller removed to your favorite list.');
+ Mage::getSingleton('core/session')->addSuccess($message);
+
+ $this->_redirect('*/*/index');
+ }
+}
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/RatingController.php b/app/code/community/Medma/MarketPlace/controllers/RatingController.php
new file mode 100644
index 0000000..acc9575
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/RatingController.php
@@ -0,0 +1,59 @@
+getRequest()->getPost();
+
+ $invoice_item_id = $this->getRequest()->getParam('invoice_item_id');
+
+ if(isset($postData['title']))
+ {
+ $reviewModel = Mage::getModel('marketplace/review')
+ ->setData($postData)
+ ->setInvoiceItemId($invoice_item_id)
+ ->setPostedDate(Mage::getModel('core/date')->timestamp(time()))
+ ->setStatus(Medma_MarketPlace_Model_Review::PENDING)
+ ->save();
+ }
+
+ if(count($postData['ratings']) > 0)
+ {
+ foreach($postData['ratings'] as $key => $value)
+ {
+ Mage::getModel('marketplace/rate')
+ ->setRatingId($key)
+ ->setInvoiceItemId($invoice_item_id)
+ ->setValue($value)
+ ->save();
+ }
+ }
+
+ if(isset($postData['title']) || count($postData['ratings']) > 0)
+ Mage::getSingleton('core/session')->addSuccess('Feedback has been submitted successfully.');
+ else
+ Mage::getSingleton('core/session')->addNotice('Please enter proper values to submit feedback.');
+
+ $this->_redirect('sales/order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/controllers/VendorController.php b/app/code/community/Medma/MarketPlace/controllers/VendorController.php
new file mode 100644
index 0000000..0ef48f7
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/controllers/VendorController.php
@@ -0,0 +1,136 @@
+loadLayout();
+ $this->renderLayout();
+ }
+
+ public function profileAction()
+ {
+ $vendorId = $this->getRequest()->getParam('id');
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ public function itemsAction()
+ {
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ public function saveAction()
+ {
+ if ($data = $this->getRequest()->getPost())
+ {
+ try
+ {
+ $total_file_upload = $this->getRequest()->getParam('total_file_upload', false);
+
+ $uploaded_files = array();
+ for($i = 1; $i <= $total_file_upload; $i++)
+ {
+ $file_control_name = 'varification_proof_' . $i;
+
+ if (isset($_FILES[$file_control_name]['name']) && $_FILES[$file_control_name]['name'] != '')
+ {
+ $uploader = new Varien_File_Uploader($file_control_name);
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'pdf', 'png'));
+
+ $uploader->setAllowRenameFiles(false);
+ $uploader->setFilesDispersion(false);
+
+ $dir_name = 'vendor' . DS . 'varifications';
+ $dir_path = Mage::helper('marketplace')->getImagesDir($dir_name);
+
+ $uploader->save($dir_path, $_FILES[$file_control_name]['name']);
+ $uploaded_files[] = $_FILES[$file_control_name]['name'];
+ }
+ }
+
+ $user = Mage::getModel("admin/user");
+
+ $user->setUsername($this->getRequest()->getParam('username', false))
+ ->setFirstname($this->getRequest()->getParam('firstname', false))
+ ->setLastname($this->getRequest()->getParam('lastname', false))
+ ->setPassword($this->getRequest()->getParam('password', false))
+ ->setEmail(strtolower($this->getRequest()->getParam('email', false)))
+ ->setIsActive(0);
+
+ if ($this->getRequest()->getParam('password', false)) {
+ $user->setNewPassword($this->getRequest()->getParam('password', false));
+ }
+
+ if ($this->getRequest()->getParam('confirmation', false)) {
+ $user->setPasswordConfirmation($this->getRequest()->getParam('confirmation', false));
+ }
+
+ $result = $user->validate();
+ if (is_array($result)) {
+ foreach($result as $error) {
+ Mage::getSingleton('core/session')->addError($error);
+ }
+ Mage::getSingleton('core/session')->setTestData($data);
+ $this->_redirect('*/*/register');
+ return;
+ }
+
+ $user->save();
+
+ $role_id = Mage::helper('marketplace')->getConfig('general', 'vendor_role');
+
+ $user->setRoleIds(array($role_id))
+ ->setRoleUserId($user->getUserId())
+ ->saveRelations();
+
+ $user->save();
+
+ $profile = Mage::getModel('marketplace/profile')
+ ->setTotalAdminCommission(0)
+ ->setTotalVendorAmount(0)
+ ->setTotalVendorPaid(0);
+
+ $profile->setUserId($user->getUserId())
+ ->setShopName($this->getRequest()->getParam('shop_name', false))
+ ->setContactNumber($this->getRequest()->getParam('contact_number', false))
+ ->setCountry($this->getRequest()->getParam('country', false))
+ ->setProofType($this->getRequest()->getParam('proof_type', false))
+ ->setVarificationFiles(json_encode($uploaded_files))
+ ->save();
+
+ Mage::getSingleton('core/session')
+ ->addSuccess('Request has been sent successfully, we will contact you soon.');
+
+ $this->_redirect('*/*/register');
+ return;
+ } catch (Exception $e) {
+ Mage::getSingleton('adminhtml/session')
+ ->addError($e->getMessage());
+ Mage::getSingleton('core/session')->setTestData($data);
+ $this->_redirect('*/*/register');
+ return;
+ }
+ }
+ }
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/etc/config.xml b/app/code/community/Medma/MarketPlace/etc/config.xml
new file mode 100644
index 0000000..be67360
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/etc/config.xml
@@ -0,0 +1,272 @@
+
+
+
+
+ 2.0.0
+
+
+
+
+
+ Medma_MarketPlace_Model
+ marketplace_mysql4
+
+
+ Medma_MarketPlace_Model_Mysql4
+
+
+ medma_marketplace_profile
+
+
+ medma_marketplace_transaction
+
+
+
+
+
+
+
+
+ medma_marketplace_prooftype
+
+
+
+
+
+
+
+
+
+
+ Medma_MarketPlace
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Medma_MarketPlace_Block
+
+
+
+ Medma_MarketPlace_Block_Sales_Order_Item_Renderer_Default
+
+
+
+
+ Medma_MarketPlace_Block_Vendor_Profile_Items
+
+
+
+
+ Medma_MarketPlace_Block_Adminhtml_System_Account_Edit_Form
+ Medma_MarketPlace_Block_Adminhtml_Catalog_Product_Grid
+
+
+
+
+
+ Medma_MarketPlace_Helper
+
+
+
+
+
+
+ singleton
+ Medma_MarketPlace_Model_Observer
+ catalogProductSaveBefore
+
+
+
+
+
+
+ Medma_MarketPlace_Model_Authenticate
+ saveDomain
+
+
+
+
+
+
+
+
+
+
+ Medma_MarketPlace
+ marketplace
+
+
+
+
+
+
+ marketplace.xml
+
+
+
+
+
+
+
+
+
+ Medma_MarketPlace
+ admin_marketplace
+
+
+
+
+
+ Medma_MarketPlace_Adminhtml_Core
+
+
+
+
+
+
+
+
+
+ marketplace.xml
+
+
+
+
+
+
+
+ singleton
+ Medma_MarketPlace_Model_Product_Observer
+ filterProductCollection
+
+
+
+
+
+
+
+
+
+
+ Vendor
+
+
+ Orders
+
+
+ Transactions
+
+
+ Reviews
+
+
+
+
+
+
+
+
+ Market Place Section
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3,6,9
+
+
+
+
diff --git a/app/code/community/Medma/MarketPlace/etc/system.xml b/app/code/community/Medma/MarketPlace/etc/system.xml
new file mode 100644
index 0000000..825c66d
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/etc/system.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+ 100
+ 1
+ 1
+ 1
+
+
+
+
+ separator-top
+
+ medma
+ 10
+ 1
+ 1
+ 1
+
+
+
+ text
+ 10
+ 1
+ 1
+ 1
+
+
+
+ Please select the role which will work as vendor role.
+ select
+ 10
+ 1
+ 1
+ 1
+ marketplace/system_config_source_roles
+
+
+
+
+
+ select
+ 30
+ 1
+ 1
+ 1
+
+
+
+ Enter comma separated page size.
+ text
+ validate-per-page-value-list input-text
+ 10
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-install-1.0.0.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-install-1.0.0.php
new file mode 100644
index 0000000..1690b36
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-install-1.0.0.php
@@ -0,0 +1,38 @@
+getCollection()
+ ->addFieldToFilter('role_name', Medma_MarketPlace_Model_Vendor::ROLE);
+
+if ($roleCollection->count() == 0) {
+ $role = Mage::getModel('admin/roles')
+ ->setName(Medma_MarketPlace_Model_Vendor::ROLE)
+ ->setRoleType(Medma_MarketPlace_Model_Vendor::ROLE_TYPE)
+ ->save();
+
+ Mage::getModel('admin/rules')
+ ->setRoleId($role->getId())
+ ->setResources(array('admin/catalog', 'admin/catalog/products', 'admin/system', 'admin/system/myaccount', 'admin/vendor', 'admin/vendor/orders', 'admin/vendor/transaction', 'admin/vendor/review'))
+ ->saveRel();
+}
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.0-1.0.1.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.0-1.0.1.php
new file mode 100644
index 0000000..3c72635
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.0-1.0.1.php
@@ -0,0 +1,64 @@
+startSetup();
+$table = $installer->getConnection()->newTable($installer->getTable('marketplace/profile'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'identity' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => true,
+ ), 'User Id')
+ ->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
+ 'nullable' => true,
+ ), 'Image')
+ ->addColumn('admin_commission_percentage', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
+ 'nullable' => true,
+ ), 'Admin Commission Percentage')
+ ->addColumn('total_admin_commission', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
+ 'nullable' => true,
+ ), 'Total Admin Commission')
+ ->addColumn('total_vendor_amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
+ 'nullable' => true,
+ ), 'Total Vendor Amount')
+ ->addColumn('total_vendor_paid', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
+ 'nullable' => true,
+ ), 'Total Vendor Paid');
+$installer->getConnection()->createTable($table);
+
+$installer->run("
+
+CREATE TABLE IF NOT EXISTS {$this->getTable(Medma_Marketplace_Model_Authenticate::MEDMA_DOMAIN_TABLE_NAME)} (
+ `modules` int(11) unsigned NOT NULL auto_increment,
+ `domain_name` varchar(255),
+ `medma_module` varchar(255),
+ PRIMARY KEY (`modules`)
+) ENGINE = INNODB CHARSET=utf8;
+
+");
+
+$installer->endSetup();
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.1-1.0.2.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.1-1.0.2.php
new file mode 100644
index 0000000..1a59580
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.1-1.0.2.php
@@ -0,0 +1,49 @@
+startSetup();
+$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
+
+$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'vendor', array(
+ 'group' => 'General',
+ 'type' => 'int',
+ 'backend' => '',
+ 'frontend' => '',
+ 'label' => 'Vendor',
+ 'input' => 'select',
+ 'class' => '',
+ 'source' => 'marketplace/product_attribute_source_vendor',
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
+ 'visible' => true,
+ 'required' => false,
+ 'user_defined' => false,
+ 'searchable' => false,
+ 'filterable' => false,
+ 'comparable' => false,
+ 'visible_on_front' => false,
+ 'unique' => false,
+ 'apply_to' => 'simple,configurable,bundle,grouped,virtual,downloadable',
+ 'is_configurable' => false,
+));
+
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.2-1.0.3.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.2-1.0.3.php
new file mode 100644
index 0000000..86bf5aa
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.2-1.0.3.php
@@ -0,0 +1,51 @@
+startSetup();
+$table = $installer->getConnection()->newTable($installer->getTable('marketplace/transaction'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'identity' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('vendor_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => true,
+ ), 'Vendor Id')
+ ->addColumn('transaction_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
+ 'nullable' => true,
+ ), 'Transaction Date')
+ ->addColumn('order_number', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
+ 'nullable' => true,
+ ), 'Order Number')
+ ->addColumn('information', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
+ 'nullable' => true,
+ ), 'Information')
+ ->addColumn('amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
+ 'nullable' => true,
+ ), 'Amount')
+ ->addColumn('type', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
+ 'nullable' => true,
+ ), 'Type');
+$installer->getConnection()->createTable($table);
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.3-1.0.4.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.3-1.0.4.php
new file mode 100644
index 0000000..70a5f74
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.3-1.0.4.php
@@ -0,0 +1,33 @@
+startSetup();
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'shop_name', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Shop Name',
+ )
+ );
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.4-1.0.5.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.4-1.0.5.php
new file mode 100644
index 0000000..e00e690
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.4-1.0.5.php
@@ -0,0 +1,49 @@
+startSetup();
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'message', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Message',
+ )
+ );
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'contact_number', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Contact Number',
+ )
+ );
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'country', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Country',
+ )
+ );
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.5-1.0.6 .php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.5-1.0.6 .php
new file mode 100644
index 0000000..68a78eb
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.5-1.0.6 .php
@@ -0,0 +1,33 @@
+startSetup();
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'favourites', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Favourites',
+ )
+ );
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.6-1.0.7.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.6-1.0.7.php
new file mode 100644
index 0000000..6092722
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.6-1.0.7.php
@@ -0,0 +1,35 @@
+startSetup();
+
+$role = Mage::getModel('admin/roles')
+ ->getCollection()
+ ->addFieldToFilter('role_name', Medma_MarketPlace_Model_Vendor::ROLE)
+ ->getFirstItem();
+
+Mage::getConfig()->saveConfig('marketplace/general/vendor_role', $role->getId());
+Mage::getConfig()->reinit();
+Mage::app()->reinitStores();
+
+$installer->endSetup();
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.7-1.0.8.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.7-1.0.8.php
new file mode 100644
index 0000000..2aa301c
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.7-1.0.8.php
@@ -0,0 +1,44 @@
+startSetup();
+$table = $installer->getConnection()->newTable($installer->getTable('marketplace/rating'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'identity' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR,50, null, array(
+ 'nullable' => false,
+ ), 'Rating Name')
+ ->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Sort Order')
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
+ 'nullable' => false,
+ 'default' => 0,
+ ), 'Status');
+$installer->getConnection()->createTable($table);
+$installer->endSetup();
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.8-1.0.9.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.8-1.0.9.php
new file mode 100644
index 0000000..1bc4429
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.8-1.0.9.php
@@ -0,0 +1,53 @@
+startSetup();
+$table = $installer->getConnection()->newTable($installer->getTable('marketplace/rate'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'identity' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('rating_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Rating Id')
+ ->addColumn('invoice_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Invoice Item Id')
+ ->addColumn('value', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Value')
+ ->addIndex($installer->getIdxName('marketplace/rating', array('rating_id')),
+ array('rating_id')
+ )
+ ->addForeignKey($installer->getFkName('marketplace/rate', 'rating_id', 'marketplace/rating', 'entity_id'),
+ 'rating_id',
+ $installer->getTable('marketplace/rating'),
+ 'entity_id',
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
+ )
+ ->setComment('Rating');
+$installer->getConnection()->createTable($table);
+$installer->endSetup();
+
+?>
diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.9-2.0.0.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.9-2.0.0.php
new file mode 100644
index 0000000..9797883
--- /dev/null
+++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-1.0.9-2.0.0.php
@@ -0,0 +1,91 @@
+startSetup();
+
+$table = $installer->getConnection()->newTable($installer->getTable('marketplace/prooftype'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'identity' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR,50, null, array(
+ 'nullable' => false,
+ ), 'Rating Name')
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
+ 'nullable' => false,
+ 'default' => 0,
+ ), 'Status');
+
+$installer->getConnection()->createTable($table);
+
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'proof_type', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
+ 'nullable' => true,
+ 'comment' => 'Proof Type',
+ )
+ );
+
+$installer->getConnection()
+ ->addColumn(
+ $installer->getTable('marketplace/profile'), 'varification_files', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => true,
+ 'comment' => 'Varification Files',
+ )
+ );
+
+$table = $installer->getConnection()
+ ->newTable($installer->getTable('marketplace/review'))
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'auto_increment' => true,
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ ), 'Id')
+ ->addColumn('invoice_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Invoice Item Id')
+ ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
+ 'nullable' => false,
+ ), 'Title')
+ ->addColumn('summary', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
+ 'nullable' => false,
+ ), 'Summary')
+ ->addColumn('posted_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
+ 'nullable' => true,
+ ), 'Time Stamp')
+ ->addColumn('type', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Type')
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'nullable' => false,
+ ), 'Status');
+
+$installer->getConnection()->createTable($table);
+
+$installer->endSetup();
+
+?>
diff --git a/app/design/adminhtml/default/default/layout/marketplace.xml b/app/design/adminhtml/default/default/layout/marketplace.xml
new file mode 100644
index 0000000..4795fc7
--- /dev/null
+++ b/app/design/adminhtml/default/default/layout/marketplace.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ marketplace/catalog/product/edit.phtml
+
+
+
+
+
+
+ marketplace/catalog/product/edit.phtml
+
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/catalog/product/edit.phtml b/app/design/adminhtml/default/default/template/marketplace/catalog/product/edit.phtml
new file mode 100644
index 0000000..5cffb99
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/catalog/product/edit.phtml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+getConfig('general', 'vendor_role'); ?>
+getUser(); ?>
+getRole()->getRoleId() == $roleId): ?>
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/sales/order/empty.phtml b/app/design/adminhtml/default/default/template/marketplace/sales/order/empty.phtml
new file mode 100644
index 0000000..692b281
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/sales/order/empty.phtml
@@ -0,0 +1,43 @@
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form.phtml b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form.phtml
new file mode 100644
index 0000000..783bf5f
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form.phtml
@@ -0,0 +1,119 @@
+
+getOrder() ?>
+
+
+
+ getChildHtml('order_messages') ?>
+
+getLayout()->createBlock('marketplace/adminhtml_order_form_info')->toHtml(); ?>
+
+getIsVirtual()): ?>
+
+
+
+
+
+
+
+
__('Payment Information') ?>
+
+
+
+
+ getIsVirtual()): ?>
+
+
+
+
+
__('Shipping & Handling Information') ?>
+
+
+
+
+
+
+ getGiftOptionsHtml() ?>
+
+
+
+
__('Items Ordered') ?>
+
+
+ getLayout()->createBlock('marketplace/adminhtml_order_form_items')->toHtml(); ?>
+
+
+
__('Order Totals') ?>
+
getLayout()->createBlock('marketplace/adminhtml_order_form_totals')->toHtml(); ?>
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/info.phtml b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/info.phtml
new file mode 100644
index 0000000..24ebcab
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/info.phtml
@@ -0,0 +1,170 @@
+
+
+getOrder() ?>
+formatDate($_order->getCreatedAtDate(), 'medium', true);
+ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
+?>
+
+
+
+ getEmailSent()):
+ $_email = Mage::helper('sales')->__('the order confirmation email was sent');
+ else:
+ $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
+ endif; ?>
+
+ getNoUseOrderLink()): ?>
+
__('Order # %s', $_order->getRealOrderId()) ?> ()
+
+
__('Order # %s', $_order->getRealOrderId()) ?>
+
()
+
+
+
+
+
+
+
+
+
+
__('Account Information') ?>
+
getAccountEditLink()?>
+
+
+
+
+
+
+
+
+
+
+
__('Billing Address') ?>
+
getAddressEditLink($_order->getBillingAddress())?>
+
+
+
+
+getOrder()->getIsVirtual()): ?>
+
+
+
+
+
__('Shipping Address') ?>
+
getAddressEditLink($_order->getShippingAddress())?>
+
+
+
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/items.phtml b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/items.phtml
new file mode 100644
index 0000000..78e6301
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/items.phtml
@@ -0,0 +1,119 @@
+
+
+getOrder(); ?>
+getOrderCurrencyCode(); ?>
+getProductIdsCollection(); ?>
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/totals.phtml b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/totals.phtml
new file mode 100644
index 0000000..9f9aa44
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/sales/order/view/form/totals.phtml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ __("Total Commission") ?>
+ |
+
+
+ |
+
+
+
+ __("Total Vendor Amount") ?>
+ |
+
+
+ |
+
+
+
+ __("Grand Total") ?>
+ |
+
+
+ |
+
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/vendor/review/empty.phtml b/app/design/adminhtml/default/default/template/marketplace/vendor/review/empty.phtml
new file mode 100644
index 0000000..561bea5
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/vendor/review/empty.phtml
@@ -0,0 +1,43 @@
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/vendor/transaction.phtml b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction.phtml
new file mode 100644
index 0000000..929dfac
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction.phtml
@@ -0,0 +1,42 @@
+
+
+getLayout()->createBlock('marketplace/adminhtml_transaction_items')->toHtml(); ?>
diff --git a/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/empty.phtml b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/empty.phtml
new file mode 100644
index 0000000..7b7192c
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/empty.phtml
@@ -0,0 +1,43 @@
+
+
+
diff --git a/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/items.phtml b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/items.phtml
new file mode 100644
index 0000000..9ac1abb
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/marketplace/vendor/transaction/items.phtml
@@ -0,0 +1,74 @@
+
+getTransactions(); ?>
+
+
diff --git a/app/design/frontend/base/default/layout/marketplace.xml b/app/design/frontend/base/default/layout/marketplace.xml
new file mode 100644
index 0000000..87d3dc7
--- /dev/null
+++ b/app/design/frontend/base/default/layout/marketplace.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+ marketplace/css/styles.css
+
+
+
+
+
+ marketplace/vendor/register
+ Request Seller
+ true
+
+ 1
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+ My Favourite Sellers
+ marketplace/favourite
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+ 5
+
+
+
+
+
+
+ marketplace/sales/order/items.phtml
+
+ defaultsales/order_item_renderer_defaultmarketplace/sales/order/items/renderer/default.phtml
+ groupedsales/order_item_renderer_groupedmarketplace/sales/order/items/renderer/default.phtml
+
+ colspan="5" class="a-right"
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/catalog/product/vendor/sidebar.phtml b/app/design/frontend/base/default/template/marketplace/catalog/product/vendor/sidebar.phtml
new file mode 100644
index 0000000..4929213
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/catalog/product/vendor/sidebar.phtml
@@ -0,0 +1,46 @@
+
+
+getVendorInfo(); ?>
+
+
+
+
+ __('Seller Information'); ?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/sales/order/items.phtml b/app/design/frontend/base/default/template/marketplace/sales/order/items.phtml
new file mode 100644
index 0000000..5b5b837
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/sales/order/items.phtml
@@ -0,0 +1,76 @@
+
+getOrder() ?>
+
+
+
+
+
+
+
+
+
+ __('Product Name') ?> |
+ __('SKU') ?> |
+ __('Price') ?> |
+ __('Qty') ?> |
+ __('Subtotal') ?> |
+ |
+
+
+
+ getChildHtml('order_totals') ?>
+
+ getItemsCollection(); ?>
+
+ count(); ?>
+
+ getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+
+ helper('giftmessage/message')->getGiftMessageForEntity($_item); ?>
+
+ __('Close') ?>
+
+ - __('From:') ?> escapeHtml($_giftMessage->getRecipient()) ?>
+ - __('To:') ?> escapeHtml($_giftMessage->getSender()) ?>
+ - helper('giftmessage/message')->getEscapedGiftMessage($_item) ?>
+
+ |
+
+
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/sales/order/items/renderer/default.phtml b/app/design/frontend/base/default/template/marketplace/sales/order/items/renderer/default.phtml
new file mode 100644
index 0000000..907d753
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/sales/order/items/renderer/default.phtml
@@ -0,0 +1,355 @@
+
+getItem() ?>
+
+ escapeHtml($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ - escapeHtml($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ - class="truncated">
+
+
+
+
+ - escapeHtml($_option['label']) ?>
+
+
+
+
+
+
+ -
+ escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) )) ?>
+
+
+
+
+
+ getProductAdditionalInformationBlock(); ?>
+
+ setItem($_item)->toHtml(); ?>
+
+ escapeHtml($_item->getDescription()) ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+ |
+ escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?> |
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
+
+
+
+
+
+ |
+
+
+ getItem()->getQtyOrdered() > 0): ?>
+ __('Ordered'); ?>: getItem()->getQtyOrdered()*1 ?>
+
+ getItem()->getQtyShipped() > 0): ?>
+ __('Shipped'); ?>: getItem()->getQtyShipped()*1 ?>
+
+ getItem()->getQtyCanceled() > 0): ?>
+ __('Canceled'); ?>: getItem()->getQtyCanceled()*1 ?>
+
+ getItem()->getQtyRefunded() > 0): ?>
+ __('Refunded'); ?>: getItem()->getQtyRefunded()*1 ?>
+
+
+ |
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
+
+
+
+
+
+
+
+
+ |
+
+
+
+ __('Feedback'); ?>
+ |
+
+
+getVendorProfile(); ?>
+getInvoiceItemId(); ?>
+
+
+
+ 0): ?>
+ getId())): ?>
+
+
+
+ ' . $this->__('NOTE: ') . '' . $this->__('This item uploaded by site admin. you can give feed back to vendor only.'); ?>
+
+
+ ' . $this->__('NOTE: ') . '' . $this->__('Item has not been shipped yet. You can give feedback after invoice generation.'); ?>
+
+
+ |
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/favourite.phtml b/app/design/frontend/base/default/template/marketplace/vendor/favourite.phtml
new file mode 100644
index 0000000..c844000
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/favourite.phtml
@@ -0,0 +1,63 @@
+
+getFavouriteVendors(); ?>
+
+
+
__('My Favourite Sellers'); ?>
+
+
+count() == 0): ?>
+
__('You have no sellers added.'); ?>
+
+
+ getUserObject($vendorInfo->getUserId()); ?>
+
+
+ getImagesUrl('images') . 'default.jpg'; ?>
+ getImage()): ?>
+ getImagesUrl('vendor' . DS . 'images') . $vendorInfo->getImage(); ?>
+
+

+
+
+
+
+
getMessage($vendorInfo, $userObject); ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/profile.phtml b/app/design/frontend/base/default/template/marketplace/vendor/profile.phtml
new file mode 100644
index 0000000..a60696c
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/profile.phtml
@@ -0,0 +1,96 @@
+
+getVendorInfo(); ?>
+getUserObject($vendorInfo->getUserId()); ?>
+getVendorRating(); ?>
+
+
+
+ getImagesUrl('images') . 'default.jpg'; ?>
+ getImage()): ?>
+ getImagesUrl('vendor' . DS . 'images') . $vendorInfo->getImage(); ?>
+
+

+
+
+
+
+
getMessage($vendorInfo, $userObject); ?>
+
+
+
+
+
+
+
+
+
+
+
+ Member Since: getCreated())); ?>
+ getCountryName($vendorInfo->getCountry()); ?>
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/profile/items.phtml b/app/design/frontend/base/default/template/marketplace/vendor/profile/items.phtml
new file mode 100644
index 0000000..7209256
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/profile/items.phtml
@@ -0,0 +1,123 @@
+
+
+getVendorProductCollection();
+ $_helper = $this->helper('catalog/output');
+?>
+count()): ?>
+
__('There are no products matching the selection.') ?>
+
+
+
+ getToolbarHtml() ?>
+
+ getMode()!='grid'): ?>
+
+
+
+ -
+
+
+
+
+
+ stripTags($_product->getName(), null, true); ?>
+
+ getRatingSummary()): ?>
+ getReviewsSummaryHtml($_product) ?>
+
+ getPriceHtml($_product, true) ?>
+ isSaleable()): ?>
+
+
+
__('Out of stock') ?>
+
+
+ productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
+
__('Learn More') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ count() ?>
+ getColumnCount(); ?>
+
+
+
+
+ -
+
+
+ getRatingSummary()): ?>
+ getReviewsSummaryHtml($_product, 'short') ?>
+
+ getPriceHtml($_product, true) ?>
+
+ isSaleable()): ?>
+
+
+
__('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ getToolbarHtml() ?>
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/profile/latest.phtml b/app/design/frontend/base/default/template/marketplace/vendor/profile/latest.phtml
new file mode 100644
index 0000000..b9e655a
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/profile/latest.phtml
@@ -0,0 +1,90 @@
+
+
+ getHighestSellingProduct(); ?>
+
+
+
+
+ -
+
+
+
+
+ getPriceHtml($_highestSellingProduct, true) ?>
+
+ isSaleable()): ?>
+
+
+
__('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+ getItems() ?>
+ count() ?>
+ getColumnCount(); ?>
+ count()): ?>
+
+
+
+
+ -
+
+
+
+
+ getPriceHtml($_product, true) ?>
+
+ isSaleable()): ?>
+
+
+
__('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/profile/reviews.phtml b/app/design/frontend/base/default/template/marketplace/vendor/profile/reviews.phtml
new file mode 100644
index 0000000..8708a6b
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/profile/reviews.phtml
@@ -0,0 +1,75 @@
+
+getVendorInfo();?>
+getReviewCollection(); ?>
+
+
+
+
+ getChildHtml('pager'); ?>
+
+ count()): ?>
+
+
+
+
+
getSummary(); ?>
+
getProductData($review->getInvoiceItemId(), 'name'); ?>
+
+
+
__('Buyer'); ?>
+
getProductData($review->getInvoiceItemId(), 'price'); ?>
+
+
+
getPostedDate(); ?>
+
+
+
+
+
+
+
+
+
__('No reviews found !!'); ?>
+
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/ratings.phtml b/app/design/frontend/base/default/template/marketplace/vendor/ratings.phtml
new file mode 100644
index 0000000..7bf8240
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/ratings.phtml
@@ -0,0 +1,63 @@
+
+getRatings(); ?>
+
+
+ count()): ?>
+
+
+
__('Ratings not available to review this seller. '); ?>
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/register.phtml b/app/design/frontend/base/default/template/marketplace/vendor/register.phtml
new file mode 100644
index 0000000..b3e4343
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/register.phtml
@@ -0,0 +1,172 @@
+
+getProofTypeList(); ?>
+getTestData(); ?>
+
+
+
__('Request Seller') ?>
+
+
+
+
diff --git a/app/design/frontend/base/default/template/marketplace/vendor/reviews.phtml b/app/design/frontend/base/default/template/marketplace/vendor/reviews.phtml
new file mode 100644
index 0000000..499596b
--- /dev/null
+++ b/app/design/frontend/base/default/template/marketplace/vendor/reviews.phtml
@@ -0,0 +1,84 @@
+
+getReviewItem(); ?>
+
+
+
+
+ getStatus() == Medma_MarketPlace_Model_Review::APPROVED): ?>
+
+
+
+ __('Note :'); ?>__('Your feedback has been successfully submitted. It will display after vendor\'s approval.'); ?>
+
+
+
+
diff --git a/app/etc/modules/Medma_MarketPlace.xml b/app/etc/modules/Medma_MarketPlace.xml
new file mode 100644
index 0000000..b5fe76f
--- /dev/null
+++ b/app/etc/modules/Medma_MarketPlace.xml
@@ -0,0 +1,9 @@
+
+
+
+
+ true
+ community
+
+
+
diff --git a/media/marketplace/vendor/images/default.jpg b/media/marketplace/vendor/images/default.jpg
new file mode 100644
index 0000000..80dc4aa
Binary files /dev/null and b/media/marketplace/vendor/images/default.jpg differ
diff --git a/package.xml b/package.xml
new file mode 100644
index 0000000..69acbde
--- /dev/null
+++ b/package.xml
@@ -0,0 +1,21 @@
+
+
+ Medma_MarketPlace
+ 2.0.0
+ stable
+ OSL
+ community
+
+ Manage Vendors and its profile, manage vendor transactions and provides platform for managing their accounts.
+ Manage Vendors and its profile, manage vendor transactions and provides platform for managing their accounts.
+ Development:
+1) Manage Vendors and its transaction.
+2) Provide way for the customer to view vendors and their Profile.
+3) Feedback for the sellers.
+ Medma InfomatixMedmagaurav@medma.in
+ 2014-08-20
+
+
+
+ 5.2.06.0.0
+
diff --git a/skin/frontend/base/default/marketplace/css/images/best_selling.png b/skin/frontend/base/default/marketplace/css/images/best_selling.png
new file mode 100644
index 0000000..166453c
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/best_selling.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/contact_icon.png b/skin/frontend/base/default/marketplace/css/images/contact_icon.png
new file mode 100644
index 0000000..98e18b8
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/contact_icon.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/items_icon.png b/skin/frontend/base/default/marketplace/css/images/items_icon.png
new file mode 100644
index 0000000..5ca2223
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/items_icon.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/location_icon.png b/skin/frontend/base/default/marketplace/css/images/location_icon.png
new file mode 100644
index 0000000..9dff81e
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/location_icon.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/negative.png b/skin/frontend/base/default/marketplace/css/images/negative.png
new file mode 100644
index 0000000..e9aa62e
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/negative.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/neutral.png b/skin/frontend/base/default/marketplace/css/images/neutral.png
new file mode 100644
index 0000000..16fdf79
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/neutral.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/positive.png b/skin/frontend/base/default/marketplace/css/images/positive.png
new file mode 100644
index 0000000..92f0909
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/positive.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/rating_blank.png b/skin/frontend/base/default/marketplace/css/images/rating_blank.png
new file mode 100644
index 0000000..c8d9e06
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/rating_blank.png differ
diff --git a/skin/frontend/base/default/marketplace/css/images/rating_filled.png b/skin/frontend/base/default/marketplace/css/images/rating_filled.png
new file mode 100644
index 0000000..063ea53
Binary files /dev/null and b/skin/frontend/base/default/marketplace/css/images/rating_filled.png differ
diff --git a/skin/frontend/base/default/marketplace/css/styles.css b/skin/frontend/base/default/marketplace/css/styles.css
new file mode 100644
index 0000000..956b085
--- /dev/null
+++ b/skin/frontend/base/default/marketplace/css/styles.css
@@ -0,0 +1,105 @@
+.clear { clear: both; }
+.vendor-info .shop-info { padding: 8px 10px 10px; }
+.vendor-info button.button span { border-color: #406a83; background: #618499; }
+
+#user_profile { padding: 10px; background: #FFFFFF; opacity: 0.9; filter: alpha(opacity=90); box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -moz-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -webkit-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); }
+#user_image { float: left; height: 160px; width: 160px; padding: 5px; margin-right: 10px; }
+#user_image > img { width: 100%; height: 100%; }
+#user_detail { float: left; padding: 3px 0; width: 260px; margin-right: 20px; }
+#user_detail > #vendor_name { text-transform: none; color: #000000; }
+#feedback_profile { float: left; width: 420px; padding: 3px 0; }
+#feedback_profile .feedback_header { font-size: 14px; }
+#option_wrapper { margin-bottom: 15px; }
+#option_wrapper > a { color: #000000; text-decoration: none; padding-left: 25px; font-size: 12px; display: block; margin-top: 6px; }
+#option_wrapper > a.contact { background: url('images/contact_icon.png') no-repeat 4px 0px; background-size: 14px 14px; }
+#option_wrapper > .contact-details-container { margin-top: 2px; }
+#option_wrapper > .contact-details-container > .contact-details { margin-left: 4px; margin-top: 2px; }
+#option_wrapper > a.items { background: url('images/items_icon.png') no-repeat 4px 2px; background-size: 14px 14px; }
+#membership_detail { margin-top: 10px; text-align: justify; }
+
+#profile_bottom_link_wrapper { margin: 10px 0px 20px; }
+#profile_bottom_link_wrapper > span { font-size: 12px; border-right: 2px solid #999; padding: 0 10px 0 5px; }
+#profile_bottom_link_wrapper > span.first { padding-left: 0; }
+#profile_bottom_link_wrapper > span.last { border-right: none; }
+#profile_bottom_link_wrapper > span.location { background: url('images/location_icon.png') no-repeat; background-size: 14px 14px; padding-left: 18px; margin-left: 4px; }
+
+#vendor_profile h3.product-grid-header { margin-bottom: 20px; border-bottom: solid 1px #CCC; padding: 10px 0; }
+
+#vendor_profile div.highest-selling-product-container { float: left; margin-right: 20px; width: 180px; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid { margin: 0 auto; width: 128px; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item { float: left; margin: 0 4px 14px; width: 120px; position: relative; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item a.product-image { width: 100%; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item a.product-image img { width: 100%; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item h2.product-name { text-align: center; margin: 5px 0 0; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item div.price-box { text-align: center; margin: 5px 0 0; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item div.price-box .price { font-size: 14px; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item div.actions { text-align: center; margin: 5px 0 0; }
+#vendor_profile div.highest-selling-product-container ul.profile-products-grid li.item div.bestselling { background: url('images/best_selling.png') no-repeat; height: 60px; width: 60px; background-size: 60px 60px; position: absolute; top: 0; left: 0; margin-top: -30px; margin-left: -30px; }
+
+#vendor_profile div.product-grid-container { float: left; }
+#vendor_profile div.product-grid-container ul.profile-products-grid { width: 700px; }
+#vendor_profile div.product-grid-container ul.full { width: 900px; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item { float: left; margin: 0 4px 14px; width: 120px; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item a.product-image { width: 100%; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item a.product-image img { width: 100%; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item h2.product-name { text-align: center; margin: 5px 0 0; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item div.price-box { text-align: center; margin: 5px 0 0; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item div.price-box .price { font-size: 14px; }
+#vendor_profile div.product-grid-container ul.profile-products-grid li.item div.actions { text-align: center; margin: 5px 0 0; }
+
+.account_profile_wrapper { padding: 10px; background: #FFFFFF; opacity: 0.9; filter: alpha(opacity=90); box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -moz-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -webkit-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); margin-bottom: 20px; }
+.account_profile_wrapper #user_detail { float: left; padding: 3px 0; width: 460px; }
+
+.feedback-row { display: none; }
+.feedback-collateral { padding: 5px 0; }
+.feedback-collateral h2 { font-weight: bold; font-size: 15px; color: #e26703; margin: 0 0 15px; }
+.feedback-collateral p { margin: 0 0 5px; }
+.feedback-review-table-container { width: 500px; margin-top: 15px; }
+
+.feedback-buttons-set { margin-top: 20px; }
+.rating-graphics-container { position: relative; float: left; width: 90px; height: 16px; margin-right: 10px; margin-bottom: 6px; }
+.rating-blank { position: absolute; background: url('images/rating_blank.png') no-repeat; width: 100%; height: 100%; background-size: 90px 16px; top: 0; left: 0; }
+.rating-filled { position: absolute; background: url('images/rating_filled.png') no-repeat; width: 100%; height: 100%; background-size: 90px 16px; top: 0; left: 0; z-index: 10; }
+
+.rating-container .rating-totals { float: left; font-size: 12px; text-align: center; font-weight: bold; width: 50px; margin-right: 10px; }
+.rating-container .rating-name { float: left; font-size: 12px; }
+.review-container { margin-top: 15px; color: black; }
+.review-container .black-label { color: black; }
+
+h3.all-product-header { padding-bottom: 5px; }
+
+.review_overview { margin-top: 10px; }
+.review_container { float:left; height: 50px; width: 70px; margin-right: 20px; }
+.review_link { background-size: 30px 30px; background-repeat: no-repeat; display: block; height: 50px; width: 70px; position: relative; text-decoration: none; color: #000000; }
+.positive_review_link { background-image: url('images/positive.png'); }
+.neutral_review_link { background-image: url('images/neutral.png'); }
+.negative_review_link { background-image: url('images/negative.png'); }
+.review_label { position: absolute; top: 32px; left: 2px; }
+.review_count { position: absolute; top: 8px; left: 36px; font-weight: bold; }
+
+
+#customer-reviews { margin: 35px 0 25px; }
+#review-filter { height:30px; width:auto; background:#DEE5E8; font-weight:bold; border-top:1px solid #CCCCCC; }
+#review-filter li { float:left; margin-right:40px; padding:5px 0px 0px 0px; }
+#review-filter li:first-child { margin-left:10px; color:#000; }
+
+#review-data-header { height:30px; width:auto; background:#DEE5E8; font-weight:bold; border-top:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; color:#000; }
+#review-data-header li { float:left; padding-top:6px; }
+#review-data-header li:first-child { margin-left:56px; width:490px; color:#000; margin-right: 10px; }
+#review-data-header li.review-price { width:200px; margin-right: 10px; }
+#review-data-header li.review-date { width:125px; }
+
+div.review-data-row { border-bottom:1px solid #CCCCCC; }
+div.review-data-row div.type-image-column { height:30px; width:30px; float:left; background-size: 30px 30px; background-repeat: no-repeat; margin: 8px 18px 8px 8px; }
+div.review-data-row div.positive-type-image { background-image: url('images/positive.png'); }
+div.review-data-row div.neutral-type-image { background-image: url('images/neutral.png'); }
+div.review-data-row div.negative-type-image { background-image: url('images/negative.png'); }
+
+div.review-data-row div.review-column { width:490px; float:left; margin-right: 10px; }
+div.review-data-row div.price-column { width:200px; float:left; margin-right: 10px; }
+div.review-data-row div.date-column { width:125px; float:left; }
+div.review-data-row div.row1 { margin-top: 6px; }
+div.review-data-row div.row2 { margin-top: 2px; margin-bottom: 5px; }
+div.review-data-row div.no-review-count { margin: 6px; }
+
+.active { color: #000000; cursor:text; text-decoration: none; }