Manthan_Multi_Seller_Marketplace - Version 1.0.0

Version Notes

This is first release.

Download this release

Release Info

Developer Manthan Soni
Extension Manthan_Multi_Seller_Marketplace
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (127) hide show
  1. app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Grid.php +58 -0
  2. app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Renderer/Seller.php +29 -0
  3. app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Renderer/Status.php +19 -0
  4. app/code/community/Manthan/Marketplace/Block/Adminhtml/Login.php +14 -0
  5. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order.php +12 -0
  6. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit.php +90 -0
  7. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Form.php +62 -0
  8. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Info.php +47 -0
  9. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Items.php +60 -0
  10. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Items/Renderer/Default.php +11 -0
  11. app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Grid.php +101 -0
  12. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment.php +14 -0
  13. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Edit.php +24 -0
  14. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Edit/Form.php +66 -0
  15. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Grid.php +133 -0
  16. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Adminamount.php +21 -0
  17. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Seller.php +21 -0
  18. app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Sellerpaidamount.php +14 -0
  19. app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating.php +15 -0
  20. app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Edit.php +30 -0
  21. app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Edit/Form.php +45 -0
  22. app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Grid.php +51 -0
  23. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review.php +14 -0
  24. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Edit.php +28 -0
  25. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Edit/Form.php +66 -0
  26. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Grid.php +114 -0
  27. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Rating/Detailed.php +25 -0
  28. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Renderer/Product/Detail.php +19 -0
  29. app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Renderer/Seller/Detail.php +27 -0
  30. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account.php +15 -0
  31. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit.php +37 -0
  32. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Form.php +19 -0
  33. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Tab/Form.php +201 -0
  34. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Tabs.php +65 -0
  35. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Grid.php +110 -0
  36. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Product/Grid.php +72 -0
  37. app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Dashboard/Info.php +48 -0
  38. app/code/community/Manthan/Marketplace/Block/Adminhtml/System/Account/Edit/Form.php +194 -0
  39. app/code/community/Manthan/Marketplace/Block/Rating.php +28 -0
  40. app/code/community/Manthan/Marketplace/Block/Register.php +14 -0
  41. app/code/community/Manthan/Marketplace/Block/Review.php +29 -0
  42. app/code/community/Manthan/Marketplace/Block/Sales/Order/Item/Renderer/Default.php +60 -0
  43. app/code/community/Manthan/Marketplace/Block/Sales/Order/Item/Renderer/Grouped.php +57 -0
  44. app/code/community/Manthan/Marketplace/Block/Seller/Catalog/Product/List.php +29 -0
  45. app/code/community/Manthan/Marketplace/Block/Seller/Profile.php +82 -0
  46. app/code/community/Manthan/Marketplace/Block/Seller/Profile/Review.php +80 -0
  47. app/code/community/Manthan/Marketplace/Block/Seller/Profile/Toolbar.php +63 -0
  48. app/code/community/Manthan/Marketplace/Controller/Router.php +52 -0
  49. app/code/community/Manthan/Marketplace/Helper/Data.php +125 -0
  50. app/code/community/Manthan/Marketplace/Model/Catalog/Product/Attribute/Status.php +38 -0
  51. app/code/community/Manthan/Marketplace/Model/Mysql4/Payment.php +8 -0
  52. app/code/community/Manthan/Marketplace/Model/Mysql4/Payment/Collection.php +10 -0
  53. app/code/community/Manthan/Marketplace/Model/Mysql4/Pricecomparison.php +9 -0
  54. app/code/community/Manthan/Marketplace/Model/Mysql4/Pricecomparison/Collection.php +10 -0
  55. app/code/community/Manthan/Marketplace/Model/Mysql4/Rating.php +9 -0
  56. app/code/community/Manthan/Marketplace/Model/Mysql4/Rating/Collection.php +10 -0
  57. app/code/community/Manthan/Marketplace/Model/Mysql4/Review.php +9 -0
  58. app/code/community/Manthan/Marketplace/Model/Mysql4/Review/Collection.php +10 -0
  59. app/code/community/Manthan/Marketplace/Model/Mysql4/Seller.php +10 -0
  60. app/code/community/Manthan/Marketplace/Model/Mysql4/Seller/Collection.php +29 -0
  61. app/code/community/Manthan/Marketplace/Model/Mysql4/Sellerrate.php +9 -0
  62. app/code/community/Manthan/Marketplace/Model/Mysql4/Sellerrate/Collection.php +10 -0
  63. app/code/community/Manthan/Marketplace/Model/Mysql4/Vendorproduct.php +9 -0
  64. app/code/community/Manthan/Marketplace/Model/Mysql4/Vendorproduct/Collection.php +10 -0
  65. app/code/community/Manthan/Marketplace/Model/Observer.php +273 -0
  66. app/code/community/Manthan/Marketplace/Model/Payment.php +10 -0
  67. app/code/community/Manthan/Marketplace/Model/Pdf/Invoice.php +360 -0
  68. app/code/community/Manthan/Marketplace/Model/Pdf/Shipment/Packing.php +345 -0
  69. app/code/community/Manthan/Marketplace/Model/Rating.php +13 -0
  70. app/code/community/Manthan/Marketplace/Model/Review.php +12 -0
  71. app/code/community/Manthan/Marketplace/Model/Seller.php +163 -0
  72. app/code/community/Manthan/Marketplace/Model/Sellerrate.php +10 -0
  73. app/code/community/Manthan/Marketplace/Model/System/Config/Role.php +20 -0
  74. app/code/community/Manthan/Marketplace/Model/Vendorproduct.php +10 -0
  75. app/code/community/Manthan/Marketplace/controllers/Adminhtml/AccountController.php +174 -0
  76. app/code/community/Manthan/Marketplace/controllers/Adminhtml/Admin/IndexController.php +18 -0
  77. app/code/community/Manthan/Marketplace/controllers/Adminhtml/Admin/System/AccountController.php +105 -0
  78. app/code/community/Manthan/Marketplace/controllers/Adminhtml/DashboardController.php +21 -0
  79. app/code/community/Manthan/Marketplace/controllers/Adminhtml/OrderController.php +86 -0
  80. app/code/community/Manthan/Marketplace/controllers/Adminhtml/PaymentController.php +152 -0
  81. app/code/community/Manthan/Marketplace/controllers/Adminhtml/RatingController.php +92 -0
  82. app/code/community/Manthan/Marketplace/controllers/Adminhtml/ReviewController.php +120 -0
  83. app/code/community/Manthan/Marketplace/controllers/ReviewController.php +47 -0
  84. app/code/community/Manthan/Marketplace/controllers/SellerController.php +63 -0
  85. app/code/community/Manthan/Marketplace/etc/config.xml +389 -0
  86. app/code/community/Manthan/Marketplace/etc/system.xml +226 -0
  87. app/code/community/Manthan/Marketplace/sql/marketplace_setup/mysql4-install-1.0.0.php +285 -0
  88. app/code/community/Manthan/Marketplaceproductshipping/Helper/Data.php +8 -0
  89. app/code/community/Manthan/Marketplaceproductshipping/Model/Carrier/Marketplaceproductshipping.php +104 -0
  90. app/code/community/Manthan/Marketplaceproductshipping/etc/config.xml +60 -0
  91. app/code/community/Manthan/Marketplaceproductshipping/etc/system.xml +60 -0
  92. app/code/community/Manthan/Marketplaceproductshipping/sql/marketplaceproductshipping_setup/mysql4-install-1.0.0.php +51 -0
  93. app/design/adminhtml/default/default/layout/marketplace.xml +36 -0
  94. app/design/adminhtml/default/default/template/marketplace/catalog/product/edit.phtml +123 -0
  95. app/design/adminhtml/default/default/template/marketplace/page/header.phtml +43 -0
  96. app/design/adminhtml/default/default/template/marketplace/rating/detailed.phtml +8 -0
  97. app/design/adminhtml/default/default/template/marketplace/sales/order/form.phtml +70 -0
  98. app/design/adminhtml/default/default/template/marketplace/sales/order/view/info.phtml +125 -0
  99. app/design/adminhtml/default/default/template/marketplace/sales/order/view/items.phtml +53 -0
  100. app/design/adminhtml/default/default/template/marketplace/sales/order/view/items/renderer/default.phtml +40 -0
  101. app/design/adminhtml/default/default/template/marketplace/sales/order/view/totals.phtml +45 -0
  102. app/design/adminhtml/default/default/template/marketplace/seller/dashboard/info.phtml +54 -0
  103. app/design/adminhtml/default/default/template/marketplace/seller/order/tab/invoice.phtml +7 -0
  104. app/design/frontend/base/default/layout/marketplace.xml +61 -0
  105. app/design/frontend/base/default/template/marketplace/register.phtml +130 -0
  106. app/design/frontend/base/default/template/marketplace/sales/order/items/renderer/default.phtml +338 -0
  107. app/design/frontend/base/default/template/marketplace/seller/catalog/product/view.phtml +175 -0
  108. app/design/frontend/base/default/template/marketplace/seller/profile.phtml +86 -0
  109. app/design/frontend/base/default/template/marketplace/seller/profile/review.phtml +35 -0
  110. app/design/frontend/base/default/template/marketplace/seller/rating.phtml +43 -0
  111. app/design/frontend/base/default/template/marketplace/seller/review.phtml +36 -0
  112. app/etc/modules/Manthan_Marketplace.xml +8 -0
  113. app/etc/modules/Manthan_Marketplaceproductshipping.xml +8 -0
  114. app/locale/en_US/Manthan_Marketplace.csv +36 -0
  115. app/locale/en_US/template/email/marketplace/seller_activation_email.html +54 -0
  116. app/locale/en_US/template/email/marketplace/seller_confirmation_email.html +41 -0
  117. app/locale/en_US/template/email/marketplace/seller_new_registration_email.html +62 -0
  118. app/locale/en_US/template/email/sales/seller_new_order.html +77 -0
  119. media/marketplace/seller/images/default.jpg +0 -0
  120. package.xml +18 -0
  121. skin/adminhtml/default/default/marketplace/css/style.css +65 -0
  122. skin/adminhtml/default/default/marketplace/images/vendor-logo.png +0 -0
  123. skin/frontend/base/default/marketplace/css/images/blank_stars.png +0 -0
  124. skin/frontend/base/default/marketplace/css/images/blank_stars_copy.png +0 -0
  125. skin/frontend/base/default/marketplace/css/images/fill_stars.png +0 -0
  126. skin/frontend/base/default/marketplace/css/style.css +104 -0
  127. skin/frontend/base/default/marketplace/js/marketplace.js +18 -0
app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Grid.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
3
+ {
4
+ protected function _prepareColumns()
5
+ {
6
+ $this->addColumn('seller',
7
+ array(
8
+ 'header'=> Mage::helper('catalog')->__('Seller Name'),
9
+ 'width' => '150px',
10
+ 'index' => 'entity_id',
11
+ 'renderer'=>'Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Renderer_Seller',
12
+ 'filter_condition_callback' => array($this, '_sellerFilter'),
13
+ ));
14
+
15
+ $this->addColumnAfter('product_status',
16
+ array(
17
+ 'header' => Mage::helper('catalog')->__('Product Status'),
18
+ 'width' => '130px',
19
+ 'index' => 'entity_id',
20
+ 'type' => 'options',
21
+ 'column_css_class' => 'a-center',
22
+ 'options' => array(1 => 'Pending' ,2 => 'Approved' ,3=>'Not Approved'),
23
+ 'renderer'=>'Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Renderer_Status',
24
+ 'filter_condition_callback' => array($this, '_ProductStatusFilter'),
25
+ ),'qty');
26
+ parent::_prepareColumns();
27
+ }
28
+
29
+ protected function _sellerFilter($collection, $column)
30
+ {
31
+ if(!$value = $column->getFilter()->getValue()) {
32
+ return $this;
33
+ }
34
+ $user = Mage::getModel('admin/user')->getCollection()
35
+ ->addFieldToFilter('username',array('like'=>"%$value%"));
36
+ $userIds = $user->getColumnValues('user_id');
37
+ $seller = Mage::getModel('marketplace/vendorproduct')->getCollection();
38
+
39
+ if($value == "Admin" || $value == "admin" ){
40
+ $sellerProductIds = $seller->getColumnValues('product_id');
41
+ return $collection->addAttributeToFilter('entity_id',array('nin' => $sellerProductIds));
42
+ }
43
+
44
+ $seller->addFieldToFilter('user_id',array('in'=>$userIds));
45
+ $productIds = $seller->getColumnValues('product_id');
46
+ $collection->addAttributeToFilter('entity_id',array('in'=>$productIds));
47
+
48
+ return $collection;
49
+ }
50
+ protected function _ProductStatusFilter($collection, $column)
51
+ {
52
+ if(!$value = $column->getFilter()->getValue()) {
53
+ return $this;
54
+ }
55
+ $collection->addAttributeToSelect('*')->addAttributeToFilter('product_status',$value);
56
+ }
57
+ }
58
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Renderer/Seller.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Renderer_Seller extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ return $this->_getSeller($row);
7
+ }
8
+ protected function _getSeller(Varien_Object $row)
9
+ {
10
+ $seller = Mage::getModel('marketplace/vendorproduct')->getCollection()
11
+ ->addFieldToFilter('product_id',$row->getId());
12
+ $userId = $seller->getFirstItem()->getUserId();
13
+
14
+ if(!$userId)
15
+ return "Admin";
16
+
17
+ $seller = Mage::getModel('marketplace/seller')->getCollection()
18
+ ->addFieldToFilter('user_id',$userId);
19
+ $sellerId = $seller->getFirstItem()->getId();
20
+ $url = $this->getUrl('admin_marketplace/adminhtml_account/edit',array('id'=>$sellerId));
21
+ $user = Mage::getModel('admin/user')->load($userId);
22
+ if(Mage::getModel('marketplace/seller')->isSeller())
23
+ return "<span style='color:#ea7601;'>" . $user->getUsername() . '</span>';
24
+ else
25
+ return "<a href={$url} title={$url} target='_blank' style='color:#ea7601;'>" . $user->getUsername() . '</a>';
26
+ }
27
+
28
+ }
29
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Catalog/Product/Renderer/Status.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ return $this->_getStatus($row);
7
+ }
8
+ protected function _getStatus(Varien_Object $row)
9
+ {
10
+ $productObject = Mage::getModel('catalog/product')->load($row->getId());
11
+ if($productObject->getProductStatus() == 1)
12
+ return "<div style='border-radius:8px;color:#FFF;font-weight:bold;background:#E47449;'>Pending</div>";
13
+ else if($productObject->getProductStatus() == 2)
14
+ return "<div style='border-radius:8px;color:#FFF;font-weight:bold;background:#7EE47E;'>Approved</div>";
15
+ else if($productObject->getProductStatus() == 3)
16
+ return "<div style='border-radius:8px;color:#FFF;font-weight:bold;background:#E80000;'>Not Approved</div>";
17
+ }
18
+ }
19
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Login.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Login extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_review';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Reviews');
9
+ parent::__construct();
10
+ $this->_removeButton('add');
11
+ }
12
+
13
+ }
14
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct(){
5
+ $this->_controller = 'adminhtml_order';
6
+ $this->_blockGroup = 'marketplace';
7
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Orders');
8
+ parent::__construct();
9
+ $this->_removeButton('add');
10
+ }
11
+ }
12
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Order_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct(){
6
+ $this->_objectId = 'entity_id';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_controller = 'adminhtml_order';
9
+ $this->_mode = 'edit';
10
+ parent::__construct();
11
+ $this->_removeButton('save');
12
+ $this->_removeButton('reset');
13
+ if( $this->getRequest()->getActionName() == "invoice")
14
+ {
15
+ $this->_removeButton('back');
16
+
17
+ $this->_addButton('back', array(
18
+ 'label' => Mage::helper('adminhtml')->__('Back to Order'),
19
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/view',array('order_id'=>$this->getOrder()->getId())) . '\')',
20
+ 'class' => 'back',
21
+ ), 1);
22
+
23
+ $this->_addButton('print', array(
24
+ 'label' => Mage::helper('adminhtml')->__('Print'),
25
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/print',array('invoice_id'=>$this->getInvoice()->getId())) . '\')',
26
+ 'class' => 'scalable',
27
+ ), 1);
28
+ $this->_addButton('packingslip', array(
29
+ 'label' => Mage::helper('adminhtml')->__('Packing Slip'),
30
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/packingslip',array('invoice_id'=>$this->getInvoice()->getId())) . '\')',
31
+ 'class' => 'scalable',
32
+ ), 1);
33
+ }
34
+ else{
35
+
36
+ $this->_addButton('invoice', array(
37
+ 'label' => Mage::helper('adminhtml')->__('Invoice'),
38
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/invoice',array('order_id'=>$this->getOrder()->getId())) . '\')',
39
+ 'class' => 'scalable go',
40
+ ), 1);
41
+ }
42
+ }
43
+
44
+ protected function _prepareLayout()
45
+ {
46
+ parent::_prepareLayout();
47
+ if ($this->_blockGroup && $this->_controller && $this->_mode)
48
+ {
49
+ $childBlock = $this->getLayout()->createBlock('core/template')->setTemplate('marketplace/sales/order/view/totals.phtml');
50
+ $orderDetailsBlock = $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . '_' . $this->_mode . '_form');
51
+ $this->setChild('form',$orderDetailsBlock);
52
+ $orderDetailsBlock->setChild('seller.order.totals',$childBlock);
53
+ }
54
+
55
+ }
56
+ public function getHeaderCssClass()
57
+ {
58
+ return 'icon-head head-sales-order';
59
+ }
60
+
61
+ public function getHeaderHtml()
62
+ {
63
+ return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';
64
+ }
65
+
66
+ public function getHeaderText()
67
+ {
68
+ if (!is_null($this->getOrder()))
69
+ {
70
+ if( $this->getRequest()->getActionName() == "invoice")
71
+ {
72
+ return Mage::helper('sales')->__('Invoice #%1$s | %2$s | %3$s', $this->getInvoice()->getIncrementId(), $this->getInvoice()->getStateName(), $this->formatDate($this->getInvoice()->getCreatedAtDate(), 'medium', true));
73
+ }
74
+ return Mage::helper('marketplace')->__("Order #%s | %s", $this->getOrder()->getRealOrderId(), $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true));
75
+ }
76
+ }
77
+
78
+ public function getOrder()
79
+ {
80
+ return Mage::registry('current_order');
81
+ }
82
+
83
+ public function getInvoice()
84
+ {
85
+ return $this->getOrder()->getInvoiceCollection()->getFirstItem();
86
+ }
87
+
88
+ }
89
+
90
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Form.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Order_Edit_Form extends Mage_Adminhtml_Block_Template{
3
+
4
+ public function __construct()
5
+ {
6
+ $this->setTemplate('marketplace/sales/order/form.phtml');
7
+ parent::__construct();
8
+ }
9
+
10
+ public function getOrder()
11
+ {
12
+ return Mage::registry('current_order');
13
+ }
14
+
15
+ public function getPaymentInfo() {
16
+ return $this->getOrder()->getPayment()->getMethodInstance()->getTitle();
17
+ }
18
+
19
+ public function displayPriceAttribute($code, $strong = false, $separator = '<br/>')
20
+ {
21
+ if($this->getPriceDataObject()->getShippingMethod() == "marketplaceproductshipping_marketplaceproductshipping")
22
+ {
23
+ return Mage::helper('marketplace')->getSellerPriceFormatAttribute($this->getPriceDataObject(),$strong = false, $separator = '<br/>');
24
+ }
25
+ return Mage::helper('adminhtml/sales')->displayPriceAttribute($this->getPriceDataObject(), $code, $strong, $separator);
26
+ }
27
+
28
+ public function getPriceDataObject()
29
+ {
30
+ $obj = null;
31
+ if (is_null($obj))
32
+ {
33
+ return $this->getOrder();
34
+ }
35
+ return $obj;
36
+ }
37
+
38
+ public function displayShippingPriceInclTax($order)
39
+ {
40
+ $shipping = $order->getShippingInclTax();
41
+ if ($shipping) {
42
+ $baseShipping = $order->getBaseShippingInclTax();
43
+ } else {
44
+ $shipping = $order->getShippingAmount() + $order->getShippingTaxAmount();
45
+ $baseShipping = $order->getBaseShippingAmount() + $order->getBaseShippingTaxAmount();
46
+ }
47
+ return $this->displayPrices($baseShipping, $shipping, false, ' ');
48
+ }
49
+
50
+ public function displayPrices($basePrice, $price, $strong = false, $separator = '<br/>')
51
+ {
52
+ return Mage::helper('adminhtml/sales')->displayPrices($this->getPriceDataObject(), $basePrice, $price, $strong, $separator);
53
+ }
54
+
55
+ public function getBackUrl()
56
+ {
57
+ return Mage::helper('adminhtml')->getUrl('*/*/index');
58
+ }
59
+
60
+ }
61
+
62
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Info.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Order_Edit_Info extends Mage_Adminhtml_Block_Template {
3
+
4
+ public function __construct() {
5
+ $this->setTemplate('marketplace/sales/order/view/info.phtml');
6
+ parent::__construct();
7
+ }
8
+
9
+ public function getOrder() {
10
+ return Mage::registry('current_order');
11
+ }
12
+
13
+ public function shouldDisplayCustomerIp() {
14
+ return !Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $this->getOrder()->getStoreId());
15
+ }
16
+
17
+ public function getOrderStoreName() {
18
+ if ($this->getOrder()) {
19
+ $storeId = $this->getOrder()->getStoreId();
20
+ if (is_null($storeId)) {
21
+ $deleted = Mage::helper('adminhtml')->__(' [deleted]');
22
+ return nl2br($this->getOrder()->getStoreName()) . $deleted;
23
+ }
24
+ $store = Mage::app()->getStore($storeId);
25
+ $name = array(
26
+ $store->getWebsite()->getName(),
27
+ $store->getGroup()->getName(),
28
+ $store->getName()
29
+ );
30
+ return implode('<br/>', $name);
31
+ }
32
+ return null;
33
+ }
34
+
35
+ public function getCustomerGroupName() {
36
+ if ($this->getOrder()) {
37
+ return Mage::getModel('customer/group')->load((int) $this->getOrder()->getCustomerGroupId())->getCode();
38
+ }
39
+ return null;
40
+ }
41
+
42
+ public function getViewUrl($orderId){
43
+ return $this->getUrl('*/*/view', array('order_id'=>$orderId));
44
+ }
45
+ }
46
+
47
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Items.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Order_Edit_Items extends Mage_Adminhtml_Block_Template {
3
+
4
+ public function __construct()
5
+ {
6
+ $this->setTemplate('marketplace/sales/order/view/items.phtml');
7
+ parent::__construct();
8
+ }
9
+ public function getItemHtml($_item)
10
+ {
11
+ $items = Mage::app()->getLayout()->createBlock('marketplace/adminhtml_order_edit_items_renderer_default')
12
+ ->setItem($_item)
13
+ ->setAdminComission($this->getAdminCommission($_item))
14
+ ->setSellerItemAmount($this->getSellerItemAmount($_item))
15
+ ->toHtml();
16
+ return $items;
17
+ }
18
+
19
+ public function getCurrentOrder()
20
+ {
21
+ return Mage::registry('current_order');
22
+ }
23
+
24
+ public function getItemsCollection()
25
+ {
26
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
27
+ if(!is_null($isSeller))
28
+ {
29
+ return $itemCollection = Mage::getModel('sales/order_item')->getCollection()
30
+ ->addFieldToFilter('order_id',$this->getCurrentOrder()->getId())
31
+ ->addFieldToFilter('seller_id',$isSeller);
32
+ }
33
+
34
+ return null;
35
+ }
36
+ public function getAdminCommission($item) {
37
+ $commission_amount = 0;
38
+ if (!is_null($item))
39
+ {
40
+ $commission = $item->getAdminOrderCommission();
41
+ $rowTotal = $item->getPriceInclTax() * $item->getQtyOrdered();
42
+ $commission_amount = ($rowTotal * $commission) / 100;
43
+ }
44
+ return $commission_amount;
45
+ }
46
+
47
+ public function getSellerItemAmount($item)
48
+ {
49
+ if(!$item)
50
+ return 0;
51
+ $commission = $item->getAdminOrderCommission();
52
+ $total_price = ($item->getPriceInclTax() * $item->getQtyOrdered());
53
+ $sellerItemAmount = $total_price - $this->getAdminCommission($item);
54
+
55
+ return round($sellerItemAmount,2);
56
+
57
+ }
58
+ }
59
+
60
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Edit/Items/Renderer/Default.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Order_Edit_Items_Renderer_Default extends Mage_Adminhtml_Block_Template {
3
+
4
+ public function __construct()
5
+ {
6
+ $this->setTemplate('marketplace/sales/order/view/items/renderer/default.phtml');
7
+ parent::__construct();
8
+ }
9
+ }
10
+
11
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Order/Grid.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->setId('orderGrid');
8
+ $this->setDefaultSort('entity_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+ protected function _prepareCollection()
13
+ {
14
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
15
+ if($isSeller)
16
+ {
17
+ $userId = Mage::helper('marketplace')->getCurrentUserId();
18
+
19
+ $sellerCollection = Mage::getModel('marketplace/seller')->getCollection()->addFieldToFilter('user_id',$userId);
20
+ $sellerId = $sellerCollection->getFirstItem()->getId();
21
+ $orderItem = Mage::getModel('sales/order_item')->getCollection()->addFieldToFilter('seller_id',$sellerId);
22
+ $orderIds = $orderItem->getColumnValues('order_id');
23
+
24
+ $salesOrderGridCollection = Mage::getResourceModel($this->_getCollectionClass())
25
+ ->addFieldToFilter('entity_id',array('in'=>$orderIds))
26
+ ->setOrder('created_at','DESC');
27
+ }
28
+ else
29
+ {
30
+ $salesOrderGridCollection = Mage::getResourceModel($this->_getCollectionClass());
31
+ }
32
+ $this->setCollection($salesOrderGridCollection);
33
+ return parent::_prepareCollection();
34
+ }
35
+
36
+ protected function _getCollectionClass() {
37
+ return 'sales/order_grid_collection';
38
+ }
39
+
40
+ protected function _prepareColumns() {
41
+
42
+ $this->addColumn('increment_id', array(
43
+ 'header' => Mage::helper('adminhtml')->__('Order #'),
44
+ 'align' => 'right',
45
+ 'width' => '80px',
46
+ 'index' => 'increment_id',
47
+ ));
48
+
49
+ $this->addColumn('created_at', array(
50
+ 'header' => Mage::helper('adminhtml')->__('Purchased On'),
51
+ 'index' => 'created_at',
52
+ 'type' => 'datetime',
53
+ 'width' => '100px',
54
+ ));
55
+
56
+ $this->addColumn('billing_name', array(
57
+ 'header' => Mage::helper('adminhtml')->__('Bill to Name'),
58
+ 'index' => 'billing_name',
59
+ 'width' => '400px',
60
+ ));
61
+
62
+ $this->addColumn('shipping_name', array(
63
+ 'header' => Mage::helper('adminhtml')->__('Ship to Name'),
64
+ 'index' => 'shipping_name',
65
+ 'width' => '400px',
66
+ ));
67
+
68
+ $this->addColumn('status', array(
69
+ 'header' => Mage::helper('adminhtml')->__('Status'),
70
+ 'index' => 'status',
71
+ 'type' => 'options',
72
+ 'width' => '70px',
73
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
74
+ ));
75
+
76
+ $this->addColumn('action', array(
77
+ 'header' => Mage::helper('adminhtml')->__('Action'),
78
+ 'width' => '50px',
79
+ 'type' => 'action',
80
+ 'getter' => 'getId',
81
+ 'actions' => array(
82
+ array(
83
+ 'caption' => Mage::helper('adminhtml')->__('View'),
84
+ 'url' => array('base' => '*/*/view'),
85
+ 'field' => 'order_id'
86
+ )
87
+ ),
88
+ 'filter' => false,
89
+ 'sortable' => false,
90
+ 'is_system' => true,
91
+ ));
92
+
93
+ return parent::_prepareColumns();
94
+ }
95
+
96
+ public function getRowUrl($row) {
97
+ return $this->getUrl('*/*/view', array('order_id' => $row->getId()));
98
+ }
99
+ }
100
+
101
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_payment';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Seller Payment');
9
+ parent::__construct();
10
+ $this->_removeButton('add');
11
+ }
12
+
13
+ }
14
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Edit.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->_objectId = 'entity_id';
8
+ $this->_blockGroup = 'marketplace';
9
+ $this->_controller = 'adminhtml_payment';
10
+ $this->_mode = 'edit';
11
+
12
+ $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Pay Offline'));
13
+ $this->_removeButton('delete');
14
+ }
15
+ public function getHeaderText()
16
+ {
17
+ if( Mage::registry('payment_data')&&Mage::registry('payment_data')->getId())
18
+ {
19
+ return 'Edit Data<br />';
20
+ }
21
+ }
22
+ }
23
+
24
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Edit/Form.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form(
6
+ array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post'
10
+ )
11
+ );
12
+ $form->setUseContainer(true);
13
+ $this->setForm($form);
14
+ $fieldset = $form->addFieldset('payment_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Payment Information')));
15
+
16
+ $fieldset->addField('seller_amount', 'label', array(
17
+ 'label'=>Mage::helper('adminhtml')->__('Amount'),
18
+ 'after_element_html'=>"<b>" . Mage::registry('payment_data')->getAdminAmount() . "</b>"
19
+ ));
20
+
21
+ $fieldset->addField('payment_note', 'textarea', array(
22
+ 'name' => 'payment_note',
23
+ 'label' => Mage::helper('adminhtml')->__('Payment Note'),
24
+ 'title' => Mage::helper('adminhtml')->__('Payment Note'),
25
+ )
26
+ );
27
+
28
+ $fieldset->addField('admin_amount', 'hidden', array(
29
+ 'name' => 'admin_amount',
30
+ 'label' => Mage::helper('adminhtml')->__('Payment Note'),
31
+ 'title' => Mage::helper('adminhtml')->__('Payment Note'),
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('seller_id', 'hidden', array(
36
+ 'name' => 'seller_id',
37
+ 'label' => Mage::helper('adminhtml')->__('Payment Note'),
38
+ 'title' => Mage::helper('adminhtml')->__('Payment Note'),
39
+ )
40
+ );
41
+
42
+ $fieldset->addField('order_id', 'hidden', array(
43
+ 'name' => 'order_id',
44
+ 'label' => Mage::helper('adminhtml')->__('Payment Note'),
45
+ 'title' => Mage::helper('adminhtml')->__('Payment Note'),
46
+ )
47
+ );
48
+
49
+ $fieldset->addField('payment_date', 'date', array(
50
+ 'name' => 'payment_date',
51
+ 'label' => Mage::helper('adminhtml')->__('Payment Date'),
52
+ 'tabindex' => 1,
53
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
54
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ,
55
+ 'value' => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
56
+ strtotime('now') )
57
+ ));
58
+ if(Mage::registry('payment_data'))
59
+ {
60
+ $form->addValues(Mage::registry('payment_data')->getData());
61
+ }
62
+ return parent::_prepareForm();
63
+ }
64
+ }
65
+
66
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Grid.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ protected $_countTotals = true;
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('paymentGrid');
8
+ $this->setDefaultSort('entity_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ public function getTotals()
14
+ {
15
+ $totals = new Varien_Object();
16
+ $fields = array(
17
+ 'seller_paid_amount' => 0,
18
+ 'admin_amount'=> 0,
19
+ );
20
+
21
+ foreach ($this->getCollection() as $item) {
22
+ foreach($fields as $field=>$value){
23
+ $fields[$field] += $item->getData($field);
24
+ }
25
+ }
26
+ $fields['entity_id']='Totals';
27
+ $totals->setData($fields);
28
+ return $totals;
29
+ }
30
+
31
+ protected function _prepareCollection() {
32
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
33
+ $collection = Mage::getModel('marketplace/payment')->getCollection();
34
+ if($sellerId)
35
+ $collection = Mage::getModel('marketplace/payment')->getCollection()->addFieldToFilter('seller_id',$sellerId);
36
+
37
+ $this->setCollection($collection);
38
+ return parent::_prepareCollection();
39
+ }
40
+
41
+ protected function _prepareColumns() {
42
+ $this->addColumn('entity_id', array(
43
+ 'header' => Mage::helper('adminhtml')->__('ID'),
44
+ 'align' => 'right',
45
+ 'width' => '80px',
46
+ 'index' => 'entity_id',
47
+ ));
48
+
49
+ $this->addColumn('payment_date', array(
50
+ 'header' => Mage::helper('adminhtml')->__('Payment Date'),
51
+ 'index' => 'payment_date',
52
+ 'type' => 'datetime',
53
+ 'width' => '40px',
54
+ ));
55
+
56
+ $this->addColumn('seller_id', array(
57
+ 'header' => Mage::helper('adminhtml')->__('Seller'),
58
+ 'index' => 'seller_id',
59
+ 'width' => '100px',
60
+ 'renderer' => 'Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Seller',
61
+ 'filter_condition_callback' => array($this, '_sellerFilter'),
62
+ ));
63
+
64
+ $this->addColumn('order_id', array(
65
+ 'header' => Mage::helper('adminhtml')->__('Order #'),
66
+ 'index' => 'order_id',
67
+ 'width' => '100px',
68
+ ));
69
+
70
+ $this->addColumn('payment_note', array(
71
+ 'header' => Mage::helper('adminhtml')->__('Note'),
72
+ 'index' => 'payment_note',
73
+ 'width' => '400px',
74
+ ));
75
+
76
+ $this->addColumn('seller_paid_amount', array(
77
+ 'header' => Mage::helper('adminhtml')->__('Paid Amount to Seller By Admin'),
78
+ 'index' => 'seller_paid_amount',
79
+ 'width' => '100px',
80
+ 'renderer' => 'Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Sellerpaidamount'
81
+ ));
82
+
83
+ $this->addColumn('admin_amount', array(
84
+ 'header' => Mage::helper('adminhtml')->__('Admin has Amount'),
85
+ 'index' => 'admin_amount',
86
+ 'width' => '80px',
87
+ 'column_css_class' => 'a-center',
88
+ 'renderer' => 'Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Adminamount'
89
+ ));
90
+
91
+ if(!Mage::getModel('marketplace/seller')->isSeller())
92
+ {
93
+ $this->addColumn('action', array(
94
+ 'header' => Mage::helper('adminhtml')->__('Action'),
95
+ 'width' => '120px',
96
+ 'type' => 'action',
97
+ 'getter' => 'getId',
98
+ 'column_css_class' => 'a-last',
99
+ 'actions' => array(
100
+ array(
101
+ 'caption' => Mage::helper('adminhtml')->__('Pay Offline'),
102
+ 'url' => array('base' => '*/*/edit'),
103
+ 'field' => 'id',
104
+ )
105
+ ),
106
+ 'filter' => false,
107
+ 'sortable' => false,
108
+ 'is_system' => true,
109
+ 'totals_label' => ''
110
+ ));
111
+ }
112
+ return parent::_prepareColumns();
113
+ }
114
+
115
+ protected function _sellerFilter($collection, $column)
116
+ {
117
+ if(!$value = $column->getFilter()->getValue()) {
118
+ return $this;
119
+ }
120
+ $user = Mage::getModel('admin/user')->getCollection()
121
+ ->addFieldToFilter('username',array('like'=>"%$value%"));
122
+ $userIds = $user->getColumnValues('user_id');
123
+
124
+ $sellerCollection = Mage::getModel('marketplace/seller')->getCollection()
125
+ ->addFieldToFilter('user_id',array('in'=>$userIds));
126
+
127
+ $collection->addFieldToFilter('seller_id',array('in'=>$sellerCollection->getAllIds()));
128
+
129
+ return $collection;
130
+ }
131
+ }
132
+
133
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Adminamount.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Adminamount extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $adminAmount = $row->getData('admin_amount');
7
+ $order = Mage::getModel('sales/order')->loadByIncrementId($row->getData('order_id'));
8
+ if($adminAmount == 0)
9
+ {
10
+ return "<div style='border-radius:8px;color:#FFF;font-weight:bold;background:#038E03;'>{$order->formatPrice($adminAmount)}</div>";
11
+ }
12
+ else
13
+ {
14
+ return "<div style='border-radius:8px;color:#FFF;font-weight:bold;background:#E80000;'>{$order->formatPrice($adminAmount)}</div>";
15
+ }
16
+ }
17
+
18
+
19
+ }
20
+
21
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Seller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Seller extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ return $this->_getSeller($row);
7
+ }
8
+ protected function _getSeller(Varien_Object $row)
9
+ {
10
+ $seller = Mage::getModel('marketplace/seller')->load($row->getSellerId());
11
+ $sellerId = $seller->getId();
12
+ $url = $this->getUrl('admin_marketplace/adminhtml_account/edit',array('id'=>$sellerId));
13
+ $user = Mage::getModel('admin/user')->load($seller->getUserId());
14
+ if(Mage::getModel('marketplace/seller')->isSeller())
15
+ return "<span style='color:#ea7601;'>" . $user->getUsername() . '</span>';
16
+ else
17
+ return "<a href={$url} title={$url} target='_blank' style='color:#ea7601;'>" . $user->getUsername() . '</a>';
18
+ }
19
+
20
+ }
21
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Payment/Renderer/Sellerpaidamount.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Payment_Renderer_Sellerpaidamount extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $sellerPaidAmount = $row->getData('seller_paid_amount');
7
+ $order = Mage::getModel('sales/order')->loadByIncrementId($row->getData('order_id'));
8
+ return $order->formatPrice($sellerPaidAmount);
9
+ }
10
+
11
+
12
+ }
13
+
14
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Rating extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_rating';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Rating');
9
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Rating');
10
+
11
+ parent::__construct();
12
+ }
13
+
14
+ }
15
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Edit.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Rating_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->_objectId = 'entity_id';
9
+ $this->_blockGroup = 'marketplace';
10
+ $this->_controller = 'adminhtml_rating';
11
+ $this->_updateButton('save', 'label', 'Save');
12
+ $this->_removeButton('reset');
13
+ }
14
+
15
+ public function getHeaderText()
16
+ {
17
+ if( Mage::registry('rating_data')&&Mage::registry('rating_data')->getId())
18
+ {
19
+ return 'Edit '.$this->htmlEscape(
20
+ Mage::registry('rating_data')->getName()).'<br />';
21
+ }
22
+ else
23
+ {
24
+ return 'Add a Rating';
25
+ }
26
+ }
27
+
28
+ }
29
+
30
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Edit/Form.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Rating_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form(
6
+ array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post'
10
+ )
11
+ );
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('rating_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Rating Information')));
16
+
17
+
18
+ $fieldset->addField('name', 'text', array(
19
+ 'name' => 'name',
20
+ 'label' => Mage::helper('adminhtml')->__('Name'),
21
+ 'title' => Mage::helper('adminhtml')->__('Name'),
22
+ 'required' => true,
23
+ 'style' => 'width:150px',
24
+ )
25
+ );
26
+
27
+ $fieldset->addField('status', 'select', array(
28
+ 'label' => Mage::helper('adminhtml')->__('Select'),
29
+ 'class' => 'required-entry',
30
+ 'required' => true,
31
+ 'name' => 'status',
32
+ 'value' => '1',
33
+ 'style' => 'width:150px',
34
+ 'values' => array('1' => 'Enable','0' => 'Disable')
35
+ ));
36
+
37
+
38
+ if (Mage::registry('rating_data')) {
39
+ $form->addValues(Mage::registry('rating_data')->getData());
40
+ }
41
+ return parent::_prepareForm();
42
+ }
43
+ }
44
+
45
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Rating/Grid.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Rating_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('ratingGrid');
8
+ $this->setDefaultSort('id');
9
+ }
10
+
11
+ protected function _prepareCollection() {
12
+ $ratingCollection = Mage::getModel('marketplace/rating')->getCollection();
13
+ $this->setCollection($ratingCollection);
14
+ return parent::_prepareCollection();
15
+ }
16
+
17
+ protected function _prepareColumns() {
18
+
19
+ $this->addColumn('entity_id', array(
20
+ 'header' => Mage::helper('adminhtml')->__('ID'),
21
+ 'align' => 'right',
22
+ 'width' => '80px',
23
+ 'index' => 'entity_id',
24
+ ));
25
+
26
+ $this->addColumn('name', array(
27
+ 'header' => Mage::helper('adminhtml')->__('Name'),
28
+ 'index' => 'name',
29
+ 'width' => '400px',
30
+ ));
31
+
32
+ $this->addColumn('status', array(
33
+ 'header' => Mage::helper('adminhtml')->__('Status'),
34
+ 'index' => 'status',
35
+ 'width' => '200px',
36
+ 'type' => 'options',
37
+ 'options' => array(
38
+ 0 => Mage::helper('adminhtml')->__('Disabled'),
39
+ 1 => Mage::helper('adminhtml')->__('Enabled'),
40
+ ),
41
+ ));
42
+
43
+ return parent::_prepareColumns();
44
+ }
45
+
46
+ public function getRowUrl($row) {
47
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
48
+ }
49
+ }
50
+
51
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Review extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_review';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Reviews');
9
+ parent::__construct();
10
+ $this->_removeButton('add');
11
+ }
12
+
13
+ }
14
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Edit.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Review_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct(){
6
+ parent::__construct();
7
+ $this->_objectId = 'entity_id';
8
+ $this->_blockGroup = 'marketplace';
9
+ $this->_controller = 'adminhtml_review';
10
+ $this->_mode = 'edit';
11
+
12
+ $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
13
+ }
14
+ public function getHeaderText()
15
+ {
16
+ if( Mage::registry('review_data')&&Mage::registry('review_data')->getId())
17
+ {
18
+ return 'Edit '.$this->htmlEscape(
19
+ Mage::registry('review_data')->getSubject()).'<br />';
20
+ }
21
+ else
22
+ {
23
+ return 'Add a Review';
24
+ }
25
+ }
26
+ }
27
+
28
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Edit/Form.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Review_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
4
+
5
+ protected function _prepareForm() {
6
+
7
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
8
+
9
+ $form = new Varien_Data_Form(
10
+ array(
11
+ 'id' => 'edit_form',
12
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
13
+ 'method' => 'post'
14
+ )
15
+ );
16
+ $form->setUseContainer(true);
17
+ $this->setForm($form);
18
+ $fieldset = $form->addFieldset('review_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Review Information')));
19
+
20
+ $fieldset->addField('subject', 'text', array(
21
+ 'name' => 'subject',
22
+ 'label' => Mage::helper('adminhtml')->__('Subject'),
23
+ 'title' => Mage::helper('adminhtml')->__('Subject'),
24
+ 'required' => true,
25
+ 'disabled' => true,
26
+ 'readonly' => true
27
+ )
28
+ );
29
+
30
+ $fieldset->addField('description', 'textarea', array(
31
+ 'name' => 'description',
32
+ 'label' => Mage::helper('adminhtml')->__('Description'),
33
+ 'title' => Mage::helper('adminhtml')->__('Description'),
34
+ 'required' => true,
35
+ 'disabled' => true,
36
+ 'readonly' => true
37
+ )
38
+ );
39
+
40
+ $fieldset->addField('detailed_rating', 'note', array(
41
+ 'label' => Mage::helper('review')->__('Detailed Rating'),
42
+ 'required' => true,
43
+ 'text' => '<div id="rating_detail">'
44
+ . $this->getLayout()->createBlock('marketplace/adminhtml_review_rating_detailed')->setData('shipment_item_id', Mage::registry('review_data')->getShipmentItemId())->toHtml()
45
+ . '</div>',
46
+ ));
47
+
48
+ if(!$isSeller)
49
+ {
50
+ $fieldset->addField('status', 'select', array(
51
+ 'label' => Mage::helper('adminhtml')->__('Status'),
52
+ 'class' => 'required-entry',
53
+ 'required' => true,
54
+ 'name' => 'status',
55
+ 'values' => array('0' => 'Pending','1' => 'Approved','2' => 'Not Approved')
56
+ ));
57
+ }
58
+
59
+ if (Mage::registry('review_data')) {
60
+ $form->addValues(Mage::registry('review_data')->getData());
61
+ }
62
+ return parent::_prepareForm();
63
+ }
64
+ }
65
+
66
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Grid.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Review_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('reviewGrid');
8
+ $this->setDefaultSort('entity_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+ protected function _prepareMassaction()
13
+ {
14
+ $this->setMassactionIdField('id');
15
+ $this->getMassactionBlock()->setFormFieldName('id');
16
+
17
+ $statuses = array(
18
+ array('label'=>'Pending', 'value'=>0),
19
+ array('label'=>'Approved', 'value'=>1),
20
+ array('label'=>'Not Approved', 'value'=>2)
21
+ );
22
+ $this->getMassactionBlock()->addItem('mass_status', array(
23
+ 'label'=> Mage::helper('adminhtml')->__('Change status'),
24
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
25
+ 'width' => '150px',
26
+ 'additional' => array(
27
+ 'visibility' => array(
28
+ 'name' => 'review_status',
29
+ 'type' => 'select',
30
+ 'class' => 'required-entry',
31
+ 'label' => Mage::helper('adminhtml')->__('Status'),
32
+ 'values' => $statuses
33
+ )
34
+ )
35
+ ));
36
+ return $this;
37
+ }
38
+ protected function _prepareCollection() {
39
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
40
+ $seller = Mage::getModel('marketplace/sellerrate')->getCollection();
41
+ if($sellerId)
42
+ {
43
+ $seller = Mage::getModel('marketplace/sellerrate')->getCollection()
44
+ ->addFieldToFilter('seller_id',$sellerId);
45
+ }
46
+ $shipmentIds = array_unique($seller->getColumnValues('shipment_item_id'));
47
+
48
+ $review = Mage::getModel('marketplace/review')->getCollection()
49
+ ->addFieldToFilter('shipment_item_id',array('in'=>$shipmentIds));
50
+
51
+
52
+ $this->setCollection($review);
53
+ return parent::_prepareCollection();
54
+ }
55
+
56
+ protected function _prepareColumns() {
57
+ $this->addColumn('entity_id', array(
58
+ 'header' => Mage::helper('adminhtml')->__('ID'),
59
+ 'align' => 'right',
60
+ 'width' => '80px',
61
+ 'index' => 'entity_id',
62
+ ));
63
+
64
+ $this->addColumn('seller_name', array(
65
+ 'header' => Mage::helper('adminhtml')->__('Seller'),
66
+ 'index' => 'shipment_item_id',
67
+ 'width' => '100px',
68
+ 'renderer' => 'Manthan_Marketplace_Block_Adminhtml_Review_Renderer_Seller_Detail'
69
+ ));
70
+
71
+ $this->addColumn('product_name', array(
72
+ 'header' => Mage::helper('adminhtml')->__('Product Name'),
73
+ 'index' => 'shipment_item_id',
74
+ 'width' => '100px',
75
+ 'renderer' => 'Manthan_Marketplace_Block_Adminhtml_Review_Renderer_Product_Detail'
76
+ ));
77
+
78
+ $this->addColumn('subject', array(
79
+ 'header' => Mage::helper('adminhtml')->__('Subject'),
80
+ 'index' => 'subject',
81
+ 'width' => '100px',
82
+ ));
83
+
84
+ $this->addColumn('description', array(
85
+ 'header' => Mage::helper('adminhtml')->__('Comment'),
86
+ 'index' => 'description',
87
+ 'width' => '400px',
88
+ ));
89
+
90
+ $this->addColumn('created_date', array(
91
+ 'header' => Mage::helper('adminhtml')->__('Created At'),
92
+ 'index' => 'created_date',
93
+ 'type' => 'datetime',
94
+ 'width' => '70px',
95
+ ));
96
+
97
+ $this->addColumn('status', array(
98
+ 'header' => Mage::helper('adminhtml')->__('Status'),
99
+ 'index' => 'status',
100
+ 'type' => 'options',
101
+ 'width' => '70px',
102
+ 'options' => array(0=>'Pending',1=>'Approved',2=>'Not Approved'),
103
+ ));
104
+
105
+
106
+ return parent::_prepareColumns();
107
+ }
108
+
109
+ public function getRowUrl($row) {
110
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
111
+ }
112
+ }
113
+
114
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Rating/Detailed.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Review_Rating_Detailed extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate('marketplace/rating/detailed.phtml');
8
+ }
9
+ public function ratingCollection()
10
+ {
11
+ return Mage::getModel('marketplace/rating')->getCollection()->addFieldToFilter('status',1);
12
+ }
13
+ public function getValue($ratingId)
14
+ {
15
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')
16
+ ->getCollection()
17
+ ->addFieldToFilter('rating_id', $ratingId)
18
+ ->addFieldToFilter('shipment_item_id', $this->getShipmentItemId());
19
+
20
+ if($ratedCollection->count())
21
+ return $ratedCollection->getFirstItem()->getValue();
22
+ else
23
+ return 0;
24
+ }
25
+ }
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Renderer/Product/Detail.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Review_Renderer_Product_Detail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $shipmentItemId = $row->getData('shipment_item_id');
7
+
8
+ $shipment = Mage::getModel('sales/order_shipment_item')->load($shipmentItemId);
9
+ $productId = $shipment->getProductId();
10
+ $product = Mage::getModel('catalog/product')->load($productId);
11
+
12
+ //return "<a href=".$product->getProductUrl()." target='_blank'>".$product->getName().">";
13
+ return '<a href="' . $this->getUrl('adminhtml/catalog_product/edit', array('id' => $product->getId())) . '" onclick="this.target=\'blank\'">' . $product->getName() . '</a>';
14
+ }
15
+
16
+
17
+ }
18
+
19
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Review/Renderer/Seller/Detail.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Review_Renderer_Seller_Detail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $shipmentItemId = $row->getData('shipment_item_id');
7
+
8
+ $seller = Mage::getModel('marketplace/sellerrate')->getCollection()
9
+ ->addFieldToFilter('shipment_item_id',$shipmentItemId);
10
+ $sellerId = $seller->getFirstItem()->getSellerId();
11
+
12
+ $seller = Mage::getModel('marketplace/seller')->load($sellerId);
13
+ $userId = $seller->getUserId();
14
+ $user = Mage::getModel('admin/user')->load($userId);
15
+
16
+ return $user->getFirstname()."&nbsp;".$user->getLastname();
17
+
18
+ /*$seller->getSelect()
19
+ ->join(array('review' => $review),'review.shipment_item_id=`main_table`.shipment_item_id', array('shipment_item_id'))
20
+ ->where('review.status = ?',Manthan_Marketplace_Model_Review::STATUS_APPROVED);
21
+ $shipmentIds = array_unique($seller->getColumnValues('shipment_item_id'));*/
22
+ }
23
+
24
+
25
+ }
26
+
27
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_seller_account';
7
+ $this->_blockGroup = 'marketplace';
8
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage Sellers');
9
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Vendor');
10
+ parent::__construct();
11
+
12
+ }
13
+
14
+ }
15
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->_objectId = 'entity_id';
8
+ $this->_blockGroup = 'marketplace';
9
+ $this->_controller = 'adminhtml_seller_account';
10
+ $this->_updateButton('save', 'label', 'Save Seller');
11
+ $this->_removeButton('delete');
12
+ $this->_removeButton('reset');
13
+ }
14
+
15
+ public function getHeaderText()
16
+ {
17
+ if( Mage::registry('user_data')&&Mage::registry('user_data')->getId())
18
+ {
19
+ return 'Edit '.$this->htmlEscape(
20
+ " ' " . Mage::registry('user_data')->getFirstname() . " " . Mage::registry('user_data')->getLastname())." ' " .' Seller <br />';
21
+ }
22
+ }
23
+ protected function _prepareLayout()
24
+ {
25
+ parent::_prepareLayout();
26
+ if ($this->_blockGroup && $this->_controller && $this->_mode)
27
+ {
28
+ $orderDetailsBlock = $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . '_' . $this->_mode."_form" );
29
+
30
+ $this->setChild('form',$orderDetailsBlock);
31
+
32
+ }
33
+ }
34
+
35
+ }
36
+
37
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm(){
5
+ $form = new Varien_Data_Form(array(
6
+ 'id' => 'edit_form',
7
+ 'action' => $this->getUrl('*/*/save', array(
8
+ 'id' => $this->getRequest()->getParam('id'),
9
+ )),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ ));
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
18
+
19
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Tab/Form.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form(
6
+ array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post',
10
+ 'enctype' => 'multipart/form-data'
11
+ )
12
+ );
13
+ $this->setForm($form);
14
+
15
+ $userset = $form->addFieldset('seller_account_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information')));
16
+ $sellerModel = Mage::registry('seller_data');
17
+ $userModel = Mage::registry('user_data');
18
+
19
+ $userset->addField('username', 'text', array(
20
+ 'name' => 'username',
21
+ 'label' => Mage::helper('adminhtml')->__('User Name'),
22
+ 'title' => Mage::helper('adminhtml')->__('User Name'),
23
+ 'required' => true,
24
+ 'value' => $userModel->getUsername()
25
+ )
26
+ );
27
+
28
+ $userset->addField('firstname', 'text', array(
29
+ 'name' => 'firstname',
30
+ 'label' => Mage::helper('adminhtml')->__('First Name'),
31
+ 'title' => Mage::helper('adminhtml')->__('First Name'),
32
+ 'required' => true,
33
+ 'value' => $userModel->getFirstname()
34
+ )
35
+ );
36
+
37
+ $userset->addField('lastname', 'text', array(
38
+ 'name' => 'lastname',
39
+ 'label' => Mage::helper('adminhtml')->__('Last Name'),
40
+ 'title' => Mage::helper('adminhtml')->__('Last Name'),
41
+ 'required' => true,
42
+ 'value' => $userModel->getLastname()
43
+ ));
44
+
45
+ $userset->addField('email', 'text', array(
46
+ 'name' => 'email',
47
+ 'label' => Mage::helper('adminhtml')->__('Email'),
48
+ 'title' => Mage::helper('adminhtml')->__('Email'),
49
+ 'required' => true,
50
+ 'value' => $userModel->getEmail()
51
+ ));
52
+
53
+ $userset->addField('new_password', 'password', array(
54
+ 'label' => Mage::helper('adminhtml')->__('New Password'),
55
+ 'title' => Mage::helper('adminhtml')->__('New Password'),
56
+ 'name' => 'new_password',
57
+ 'required' => $userModel->getData() ? false : true,
58
+ 'value' => ''
59
+ ));
60
+
61
+ $userset->addField('password_confirmation', 'password', array(
62
+ 'label' => Mage::helper('adminhtml')->__('Confirm Password'),
63
+ 'name' => 'password_confirmation',
64
+ 'required' => $userModel->getData() ? false : true,
65
+ 'value' => ''
66
+ ));
67
+
68
+ $userset->addField('is_active', 'select', array(
69
+ 'label' => Mage::helper('adminhtml')->__('This Account is'),
70
+ 'name' => 'is_active',
71
+ 'style' =>'width:80px',
72
+ 'value' => $userModel->getIsActive(),
73
+ 'values' => array(0=>'Inacitve',1=>'Acitve')
74
+ ));
75
+
76
+
77
+ $fieldset = $form->addFieldset('shop_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Shop Information')));
78
+
79
+
80
+ $fieldset->addField('shop_name', 'text', array(
81
+ 'name' => 'shop_name',
82
+ 'label' => Mage::helper('adminhtml')->__('Shop Name'),
83
+ 'title' => Mage::helper('adminhtml')->__('Shop Name'),
84
+ 'required' => true,
85
+ 'value' => $sellerModel->getShopName(),
86
+ )
87
+ );
88
+ if($userModel->getData())
89
+ {
90
+ $fieldset->addField('link', 'link', array(
91
+ 'label' => Mage::helper('adminhtml')->__('Link'),
92
+ 'style' => "text-decoration:none",
93
+ 'href' => Mage::helper('marketplace')->getShopUrl($sellerModel->getUrlPath()),
94
+ 'value' => $sellerModel->getUrlPath(),
95
+ 'target' => '_blank'
96
+ ));
97
+ }
98
+ else
99
+ {
100
+ $fieldset->addField('shop_url', 'text', array(
101
+ 'label' => Mage::helper('adminhtml')->__('Shop Url'),
102
+ 'title' => Mage::helper('adminhtml')->__('Shop Url'),
103
+ 'required' => true,
104
+ 'name' => 'shop_url',
105
+ 'value' => ''
106
+ ));
107
+ }
108
+ $fieldset->addField('shop_description', 'textarea', array(
109
+ 'label' => Mage::helper('adminhtml')->__('Description'),
110
+ 'title' => Mage::helper('adminhtml')->__('Description'),
111
+ 'required' => true,
112
+ 'name' => 'shop_description',
113
+ 'value' => $sellerModel->getShopDescription()
114
+ ));
115
+
116
+ $fieldset->addField('telephone', 'text', array(
117
+ 'label' => Mage::helper('adminhtml')->__('Telephone'),
118
+ 'title' => Mage::helper('adminhtml')->__('Telephone'),
119
+ 'required' => true,
120
+ 'name' => 'telephone',
121
+ 'value' => $sellerModel->getTelephone()
122
+ ));
123
+
124
+ $fieldset->addField('country', 'select', array(
125
+ 'label' => Mage::helper('adminhtml')->__('Country'),
126
+ 'required' => true,
127
+ 'name' => 'country',
128
+ 'value' => $sellerModel->getCountry(),
129
+ 'options' => $this->getAllCountry()
130
+ ));
131
+
132
+ $fieldset->addField('postcode', 'text', array(
133
+ 'label' => Mage::helper('adminhtml')->__('Postcode'),
134
+ 'title' => Mage::helper('adminhtml')->__('Postcode'),
135
+ 'required' => true,
136
+ 'name' => 'postcode',
137
+ 'value' => $sellerModel->getPostcode()
138
+ ));
139
+
140
+ $fieldset->addField('seller_id', 'hidden', array(
141
+ 'name' => 'seller_id',
142
+ 'value' =>$sellerModel->getId()
143
+ ));
144
+
145
+ $fieldset->addField('image', 'image', array(
146
+ 'name' => 'image',
147
+ 'label' => Mage::helper('adminhtml')->__('Profile Image'),
148
+ 'value' =>$this->getProfileImage($sellerModel->getImage())
149
+ ));
150
+
151
+ $fieldset->addField('delete_profile_image', 'hidden', array(
152
+ 'name' => 'delete_profile_image',
153
+ 'value' =>$sellerModel->getImage()
154
+ ));
155
+
156
+ $fieldset->addField('admin_commission_by_percentage', 'text', array(
157
+ 'name' => 'admin_commission_by_percentage',
158
+ 'label' => Mage::helper('adminhtml')->__('Commission (in %)'),
159
+ 'title' => Mage::helper('adminhtml')->__('Commission (in %)'),
160
+ 'required' => true,
161
+ 'value' => $sellerModel->getAdminCommissionByPercentage(),
162
+ )
163
+ );
164
+ $fieldset->addField('admin_total_earn', 'label', array(
165
+ 'label' => Mage::helper('adminhtml')->__('Total Admin Earn From Your Sale'),
166
+ 'value' => Mage::helper('core')->currency($sellerModel->getAdminTotalEarn(), true, false)
167
+ ));
168
+ $fieldset->addField('total_vendor_earn', 'label', array(
169
+ 'label' => Mage::helper('adminhtml')->__('Total Vendor Earn'),
170
+ 'value' =>Mage::helper('core')->currency($sellerModel->getTotalVendorEarn(), true, false)
171
+ ));
172
+
173
+ if($data = Mage::getSingleton('adminhtml/session')->getSellerData())
174
+ {
175
+ $form->setValues($data);
176
+ Mage::getSingleton('adminhtml/session')->setSellerData(null);
177
+ }
178
+ return parent::_prepareForm();
179
+ }
180
+ public function getAllCountry()
181
+ {
182
+ $countryList = Mage::getResourceModel('directory/country_collection')
183
+ ->loadData()
184
+ ->toOptionArray(false);
185
+
186
+ foreach($countryList as $country)
187
+ $countryArray[$country['value']] = $country['label'];
188
+
189
+ return $countryArray;
190
+ }
191
+
192
+ public function getProfileImage($image)
193
+ {
194
+ if ($image == '')
195
+ return '';
196
+ $dir_path = Mage::getBaseUrl('media').'marketplace/seller/images/';
197
+ return $dir_path . $image;
198
+ }
199
+ }
200
+
201
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Edit/Tabs.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs{
3
+
4
+ /**
5
+ * Initializa the tab system
6
+ */
7
+ public function __construct(){
8
+ parent::__construct();
9
+ $this->setId('seller_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('adminhtml')->__('Seller View'));
12
+ }
13
+
14
+ protected function _beforeToHtml(){
15
+
16
+ $this->addTab('profile_section', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Account Settings'),
18
+ 'title' => Mage::helper('adminhtml')->__('Account Settings'),
19
+ 'content' => $this->getLayout()->createBlock('marketplace/adminhtml_seller_account_edit_tab_form')->toHtml(),
20
+ ));
21
+ $this->addTab('product_section', array(
22
+ 'label' => Mage::helper('adminhtml')->__('Products'),
23
+ 'title' => Mage::helper('adminhtml')->__('Products'),
24
+ 'url'=>$this->getUrl('admin_marketplace/adminhtml_account/grid',array('_current'=>true)),
25
+ 'class' => 'ajax'
26
+ ));
27
+ return parent::_beforeToHtml();
28
+ }
29
+
30
+ /**
31
+ * Generate the teab system to send tot he template.
32
+ */
33
+
34
+ /* $this->addTab('product_section', array(
35
+ 'label' => Mage::helper('adminhtml')->__('Product'),
36
+ 'title' => Mage::helper('adminhtml')->__('Product'),
37
+ 'url'=>$this->getUrl('admin_marketplace/adminhtml_account/grid'),
38
+ 'class' => 'ajax'
39
+ ));
40
+ $this->addTab('profile_section', array(
41
+ 'label' => Mage::helper('adminhtml')->__('Vendor Information'),
42
+ 'title' => Mage::helper('adminhtml')->__('Vendor Information'),
43
+ 'content'=>$this->getLayout()->createBlock('marketplace/adminhtml/seller/account/edit/tab/invoice')
44
+
45
+
46
+ // 'url'=>$this->getUrl('admin_marketplace/adminhtml_account/form'),
47
+ //'class' => 'ajax'
48
+ )); public function _beforeToHtml()
49
+ {
50
+ $this->addTab('general_section', array(
51
+ 'label' => Mage::helper('adminhtml')->__('Template information'),
52
+ 'title' => Mage::helper('adminhtml')->__('Template information'),
53
+ 'content' => $this->getLayout()->createBlock('marketplace/adminhtml_review_edit_tabs_general')->toHtml(),
54
+ ));
55
+ $this->addTab('main_section', array(
56
+ 'label' => Mage::helper('adminhtml')->__('Review'),
57
+ 'title' => Mage::helper('adminhtml')->__('Review'),
58
+ 'content' => $this->getLayout()->createBlock('marketplace/adminhtml_review_edit_tabs_form')->toHtml(),
59
+ ));
60
+
61
+ return parent::_beforeToHtml();
62
+ }*/
63
+ }
64
+
65
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Grid.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ protected $_countTotals = true;
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('vendorGrid');
8
+ $this->setDefaultSort('id');
9
+ }
10
+ public function getTotals()
11
+ {
12
+ $totals = new Varien_Object();
13
+ $fields = array(
14
+ 'admin_total_earn'=> 0,
15
+ );
16
+
17
+ foreach ($this->getCollection() as $item) {
18
+ foreach($fields as $field=>$value){
19
+ $fields[$field] += $item->getData($field);
20
+ }
21
+ }
22
+ $fields['entity_id']='Admin Total Earn';
23
+ $totals->setData($fields);
24
+ return $totals;
25
+ }
26
+ protected function _prepareCollection() {
27
+
28
+ $userTable = Mage::getSingleton('core/resource')->getTableName('admin_user');
29
+ $vendorProductCollection = Mage::getModel('marketplace/seller')->getCollection()->setOrder('created_date','DESC');
30
+
31
+ $vendorProductCollection->getSelect()
32
+ ->join(array('user' => $userTable),'`main_table`.user_id=user.user_id', array('user.*'));
33
+
34
+ $this->setCollection($vendorProductCollection);
35
+ return parent::_prepareCollection();
36
+
37
+ }
38
+ protected function _prepareColumns() {
39
+ $this->addColumn('entity_id', array(
40
+ 'header' => Mage::helper('adminhtml')->__('ID'),
41
+ 'align' => 'right',
42
+ 'width' => '80px',
43
+ 'index' => 'entity_id',
44
+ ));
45
+
46
+ $this->addColumn('username', array(
47
+ 'header' => Mage::helper('adminhtml')->__('Seller'),
48
+ 'index' => 'username',
49
+ 'width' => '100px',
50
+ ));
51
+
52
+ $this->addColumn('shop_name', array(
53
+ 'header' => Mage::helper('adminhtml')->__('Shop Name'),
54
+ 'index' => 'shop_name',
55
+ 'width' => '100px',
56
+ ));
57
+
58
+ $this->addColumn('shop_description', array(
59
+ 'header' => Mage::helper('adminhtml')->__('Shop Description'),
60
+ 'index' => 'shop_description',
61
+ 'width' => '400px',
62
+ ));
63
+
64
+ $this->addColumn('created_date', array(
65
+ 'header' => Mage::helper('adminhtml')->__('Seller Registration Date'),
66
+ 'index' => 'created_date',
67
+ 'type' => 'datetime',
68
+ 'width' => '50px',
69
+ ));
70
+
71
+ $this->addColumn('admin_commission_by_percentage', array(
72
+ 'header' => Mage::helper('adminhtml')->__('Admin Commision(%)'),
73
+ 'index' => 'admin_commission_by_percentage',
74
+ 'width' => '20px',
75
+ ));
76
+
77
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
78
+ $this->addColumnAfter('admin_total_earn', array(
79
+ 'header' => Mage::helper('adminhtml')->__('Admin Earn'),
80
+ 'type' => 'currency',
81
+ 'currency_code' => $currencyCode,
82
+ 'index' => 'admin_total_earn',
83
+ 'filter' => false,
84
+ 'width' => '100px',
85
+
86
+ ), 'admin_commission_by_percentage');
87
+
88
+ $this->addColumn('telephone', array(
89
+ 'header' => Mage::helper('adminhtml')->__('Telephone'),
90
+ 'index' => 'telephone',
91
+ 'width' => '100px',
92
+ ));
93
+
94
+ $this->addColumn('is_active', array(
95
+ 'header' => Mage::helper('adminhtml')->__('Is Active'),
96
+ 'index' => 'is_active',
97
+ 'type' => 'options',
98
+ 'width' => '70px',
99
+ 'options' => array(0=> 'Inactive',1=>'Active')
100
+ ));
101
+
102
+ return parent::_prepareColumns();
103
+ }
104
+
105
+ public function getRowUrl($row) {
106
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
107
+ }
108
+ }
109
+
110
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Account/Product/Grid.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Account_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('sellerProductGrid');
8
+ $this->setDefaultSort('entity_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setUseAjax(true);
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection() {
15
+ $entityId = $this->getRequest()->getParam('id');
16
+ $seller = Mage::getModel('marketplace/seller')->load($entityId);
17
+ $userId = $seller->getUserId();
18
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()->addFieldToFilter('user_id',$userId);
19
+ $productIds = $collection->getColumnValues('product_id');
20
+
21
+ $product = Mage::getModel('catalog/product')->getCollection()
22
+ ->addAttributeToSelect('*')
23
+ ->addAttributeToFilter('entity_id',array('in'=>$productIds));
24
+
25
+
26
+ $this->setCollection($product);
27
+ return parent::_prepareCollection();
28
+ }
29
+
30
+ protected function _prepareColumns() {
31
+ $this->addColumn('entity_id', array(
32
+ 'header' => Mage::helper('adminhtml')->__('ID'),
33
+ 'align' => 'right',
34
+ 'width' => '80px',
35
+ 'index' => 'entity_id',
36
+ ));
37
+
38
+ $this->addColumn('name', array(
39
+ 'header' => Mage::helper('adminhtml')->__('Product Name'),
40
+ 'index' => 'name',
41
+ 'width' => '100px',
42
+ ));
43
+
44
+ $this->addColumn('type_id', array(
45
+ 'header' => Mage::helper('adminhtml')->__('Product Type'),
46
+ 'index' => 'type_id',
47
+ 'width' => '100px',
48
+ ));
49
+
50
+ $this->addColumn('sku', array(
51
+ 'header' => Mage::helper('adminhtml')->__('SKU'),
52
+ 'index' => 'sku',
53
+ 'width' => '100px',
54
+ ));
55
+
56
+ $this->addColumn('created_at', array(
57
+ 'header' => Mage::helper('adminhtml')->__('Created At'),
58
+ 'index' => 'created_at',
59
+ 'type' => 'datetime',
60
+ 'width' => '70px',
61
+ ));
62
+
63
+
64
+ return parent::_prepareColumns();
65
+ }
66
+
67
+ public function getRowUrl($row) {
68
+ return '';
69
+ }
70
+ }
71
+
72
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/Seller/Dashboard/Info.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_Seller_Dashboard_Info extends Mage_Adminhtml_Block_Template {
3
+
4
+ public function __construct()
5
+ {
6
+ $this->setTemplate('marketplace/seller/dashboard/info.phtml');
7
+ }
8
+ public function lifetimeSales()
9
+ {
10
+ $sellerTotalEarn = 0;
11
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
12
+ if($sellerId)
13
+ {
14
+ $seller = Mage::getModel('marketplace/seller')->load($sellerId);
15
+ $sellerTotalEarn = round($seller->getTotalVendorEarn(),2);
16
+ }
17
+ return $sellerTotalEarn;
18
+ }
19
+ public function getSellerPendingAmount()
20
+ {
21
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
22
+ if($sellerId)
23
+ {
24
+ $collection = Mage::getModel('marketplace/payment')->getCollection()
25
+ ->addFieldToFilter('seller_id',$sellerId);
26
+ $collection->getSelect()
27
+ ->columns('SUM(admin_amount) as pending_amount')
28
+ ->group('seller_id');
29
+ $sellerArray = $collection->getData();
30
+ return round($sellerArray[0]['pending_amount'],2);
31
+ }
32
+ return 0;
33
+ }
34
+ public function weekSales()
35
+ {
36
+
37
+ $weekAgoDate = date('Y-m-d',strtotime(' -6 day'));
38
+ $weekSale = Mage::helper('marketplace')->getCurrentSellerSales($weekAgoDate);
39
+ return round($weekSale,2);
40
+ }
41
+ public function monthSales()
42
+ {
43
+ $monthAgoDate = date('Y-m-d', strtotime(' -30 day'));
44
+ $monthSale = Mage::helper('marketplace')->getCurrentSellerSales($monthAgoDate);
45
+ return round($monthSale,2);
46
+ }
47
+ }
48
+ ?>
app/code/community/Manthan/Marketplace/Block/Adminhtml/System/Account/Edit/Form.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Adminhtml_System_Account_Edit_Form extends Mage_Adminhtml_Block_System_Account_Edit_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $userId = Mage::getSingleton('admin/session')->getUser()->getId();
7
+ $user = Mage::getModel('admin/user')
8
+ ->load($userId);
9
+ $user->unsetData('password');
10
+
11
+ $form = new Varien_Data_Form(array(
12
+ 'id' => 'edit_form',
13
+ 'enctype' => 'multipart/form-data'
14
+ )
15
+ );
16
+
17
+ $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information')));
18
+
19
+ $fieldset->addField('username', 'text', array(
20
+ 'name' => 'username',
21
+ 'label' => Mage::helper('adminhtml')->__('User Name'),
22
+ 'title' => Mage::helper('adminhtml')->__('User Name'),
23
+ 'required' => true,
24
+ )
25
+ );
26
+
27
+ $fieldset->addField('firstname', 'text', array(
28
+ 'name' => 'firstname',
29
+ 'label' => Mage::helper('adminhtml')->__('First Name'),
30
+ 'title' => Mage::helper('adminhtml')->__('First Name'),
31
+ 'required' => true,
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('lastname', 'text', array(
36
+ 'name' => 'lastname',
37
+ 'label' => Mage::helper('adminhtml')->__('Last Name'),
38
+ 'title' => Mage::helper('adminhtml')->__('Last Name'),
39
+ 'required' => true,
40
+ )
41
+ );
42
+
43
+ $fieldset->addField('user_id', 'hidden', array(
44
+ 'name' => 'user_id',
45
+ )
46
+ );
47
+
48
+ $fieldset->addField('email', 'text', array(
49
+ 'name' => 'email',
50
+ 'label' => Mage::helper('adminhtml')->__('Email'),
51
+ 'title' => Mage::helper('adminhtml')->__('User Email'),
52
+ 'required' => true,
53
+ )
54
+ );
55
+
56
+ $fieldset->addField('password', 'password', array(
57
+ 'name' => 'new_password',
58
+ 'label' => Mage::helper('adminhtml')->__('New Password'),
59
+ 'title' => Mage::helper('adminhtml')->__('New Password'),
60
+ 'class' => 'input-text validate-admin-password',
61
+ )
62
+ );
63
+
64
+ $fieldset->addField('confirmation', 'password', array(
65
+ 'name' => 'password_confirmation',
66
+ 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
67
+ 'class' => 'input-text validate-cpassword',
68
+ )
69
+ );
70
+
71
+ $form->setValues($user->getData());
72
+
73
+ /************* START SHOP INFORMATION **************/
74
+
75
+ $seller = Mage::getModel('marketplace/seller')->isSeller();
76
+ if($seller)
77
+ {
78
+ $fieldset = $form->addFieldset('shop_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Shop Information')));
79
+ $sellerModel = Mage::getModel('marketplace/seller')->getCollection()->addFieldToFilter('user_id',$userId);
80
+ $fieldset->addField('shop_name', 'text', array(
81
+ 'name' => 'shop_name',
82
+ 'label' => Mage::helper('adminhtml')->__('Shop Name'),
83
+ 'title' => Mage::helper('adminhtml')->__('Shop Name'),
84
+ 'required' => true,
85
+ 'value' => $sellerModel->getFirstItem()->getShopName(),
86
+ )
87
+ );
88
+
89
+ $fieldset->addField('link', 'link', array(
90
+ 'label' => Mage::helper('adminhtml')->__('Link'),
91
+ 'style' => "text-decoration:none",
92
+ 'href' => Mage::helper('marketplace')->getShopUrl($sellerModel->getFirstItem()->getUrlPath()),
93
+ 'value' => $sellerModel->getFirstItem()->getUrlPath(),
94
+ 'target' => '_blank'
95
+ ));
96
+
97
+ $fieldset->addField('shop_description', 'textarea', array(
98
+ 'label' => Mage::helper('adminhtml')->__('Description'),
99
+ 'title' => Mage::helper('adminhtml')->__('Description'),
100
+ 'required' => true,
101
+ 'name' => 'shop_description',
102
+ 'value' => $sellerModel->getFirstItem()->getShopDescription()
103
+ ));
104
+
105
+ $fieldset->addField('telephone', 'text', array(
106
+ 'label' => Mage::helper('adminhtml')->__('Telephone'),
107
+ 'title' => Mage::helper('adminhtml')->__('Telephone'),
108
+ 'required' => true,
109
+ 'name' => 'telephone',
110
+ 'value' => $sellerModel->getFirstItem()->getTelephone()
111
+ ));
112
+
113
+ $fieldset->addField('country', 'select', array(
114
+ 'label' => Mage::helper('adminhtml')->__('Country'),
115
+ 'required' => true,
116
+ 'name' => 'country',
117
+ 'value' => $sellerModel->getFirstItem()->getCountry(),
118
+ 'values' => $this->getAllCountry()
119
+ ));
120
+
121
+ $fieldset->addField('postcode', 'text', array(
122
+ 'label' => Mage::helper('adminhtml')->__('Postcode'),
123
+ 'title' => Mage::helper('adminhtml')->__('Postcode'),
124
+ 'required' => true,
125
+ 'name' => 'postcode',
126
+ 'value' => $sellerModel->getFirstItem()->getPostcode()
127
+ ));
128
+
129
+ $fieldset->addField('seller_id', 'hidden', array(
130
+ 'name' => 'seller_id',
131
+ 'value' =>$sellerModel->getFirstItem()->getId()
132
+ ));
133
+
134
+ $fieldset->addField('image', 'image', array(
135
+ 'name' => 'image',
136
+ 'value' =>$this->getProfileImage($sellerModel->getFirstItem()->getImage())
137
+ ));
138
+
139
+ $fieldset->addField('delete_profile_image', 'hidden', array(
140
+ 'name' => 'delete_profile_image',
141
+ 'value' =>$sellerModel->getFirstItem()->getImage()
142
+ ));
143
+
144
+ $fieldset->addField('admin_commission_by_percentage', 'text', array(
145
+ 'name' => 'admin_commission_by_percentage',
146
+ 'label' => Mage::helper('adminhtml')->__('Commission (in %)'),
147
+ 'title' => Mage::helper('adminhtml')->__('Commission (in %)'),
148
+ 'required' => true,
149
+ 'style' => 'display:none',
150
+ 'value' => $sellerModel->getFirstItem()->getAdminCommissionByPercentage(),
151
+ 'after_element_html' => '<b>' . $sellerModel->getFirstItem()->getAdminCommissionByPercentage() . '</b>',
152
+ )
153
+ );
154
+
155
+ $fieldset->addField('admin_total_earn', 'text', array(
156
+ 'name' => 'admin_total_earn',
157
+ 'label' => Mage::helper('adminhtml')->__('Total Admin Earn From Your Sale '),
158
+ 'title' => Mage::helper('adminhtml')->__('Total Admin Earn From Your Sale'),
159
+ 'disabled' => true,
160
+ 'style' => 'display:none',
161
+ 'value' => $sellerModel->getFirstItem()->getAdminTotalEarn(),
162
+ 'after_element_html' => '<b>' . $sellerModel->getFirstItem()->getAdminTotalEarn() . '</b>',
163
+
164
+ )
165
+ );
166
+ }
167
+ /* END SHOP INFORMATION */
168
+
169
+ $form->setAction($this->getUrl('*/system_account/save'));
170
+ $form->setMethod('post');
171
+ $form->setUseContainer(true);
172
+ $form->setId('edit_form');
173
+
174
+ $this->setForm($form);
175
+ }
176
+
177
+ public function getAllCountry()
178
+ {
179
+ $countryList = Mage::getResourceModel('directory/country_collection')
180
+ ->loadData()
181
+ ->toOptionArray(true);
182
+
183
+ return $countryList;
184
+ }
185
+
186
+ public function getProfileImage($image)
187
+ {
188
+ if ($image == '')
189
+ return '';
190
+ $dir_path = Mage::getBaseUrl('media').'marketplace/seller/images/';
191
+ return $dir_path . $image;
192
+ }
193
+ }
194
+ ?>
app/code/community/Manthan/Marketplace/Block/Rating.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Rating extends Mage_Core_Block_Template {
3
+
4
+ public function __construct() {
5
+
6
+ $this->setTemplate('marketplace/seller/rating.phtml');
7
+ parent::__construct();
8
+ }
9
+ public function ratingCollection()
10
+ {
11
+ return Mage::getModel('marketplace/rating')->getCollection()
12
+ ->addFieldToFilter('status',Manthan_Marketplace_Model_Rating::STATUS_ENABLED);
13
+ }
14
+ public function getValue($ratingId)
15
+ {
16
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')
17
+ ->getCollection()
18
+ ->addFieldToFilter('rating_id', $ratingId)
19
+ ->addFieldToFilter('shipment_item_id', $this->getShipmentItemId());
20
+
21
+ if($ratedCollection->count())
22
+ return $ratedCollection->getFirstItem()->getValue();
23
+ else
24
+ return 0;
25
+ }
26
+ }
27
+
28
+ ?>
app/code/community/Manthan/Marketplace/Block/Register.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Register extends Mage_Core_Block_Template {
3
+
4
+ public function getCountryList()
5
+ {
6
+ $countries[''] = '';
7
+ $countryCollection = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
8
+ foreach($countryCollection as $country)
9
+ $countries[$country['value']] = $country['label'];
10
+ return $countries;
11
+ }
12
+ }
13
+
14
+ ?>
app/code/community/Manthan/Marketplace/Block/Review.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Review extends Mage_Core_Block_Template {
3
+
4
+ public function __construct() {
5
+ $this->setTemplate('marketplace/seller/review.phtml');
6
+ parent::__construct();
7
+ }
8
+ public function getProductId()
9
+ {
10
+ return $this->getItem()->getProductId();
11
+ }
12
+
13
+ public function ratingCollection()
14
+ {
15
+ return Mage::getModel('marketplace/rating')->getCollection()->addFieldToFilter('status',1);
16
+ }
17
+ public function getReview()
18
+ {
19
+
20
+ $reviewCollection = Mage::getModel('marketplace/review')->getCollection()
21
+ ->addFieldToFilter('shipment_item_id',$this->getShipmentItemId());
22
+ if($reviewCollection->count() > 0)
23
+ return $reviewCollection->getFirstItem();
24
+ else
25
+ return null;
26
+ }
27
+ }
28
+
29
+ ?>
app/code/community/Manthan/Marketplace/Block/Sales/Order/Item/Renderer/Default.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
3
+ {
4
+ public function sellerLink()
5
+ {
6
+ $productId = $this->getItem()->getProductId();
7
+ $sellerCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
8
+ ->addFieldToFilter('product_id',$productId);
9
+ $sellerProfile = Mage::getModel('marketplace/seller')->getCollection()
10
+ ->addFieldToFilter('user_id',$sellerCollection->getFirstItem()->getUserId());
11
+ return $sellerProfile->getFirstItem();
12
+ }
13
+ public function isSellerProduct()
14
+ {
15
+ $productId = $this->getItem()->getProductId();
16
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
17
+ ->addFieldToFilter('product_id',$productId);
18
+ return $collection->count() == 0 ? null : true ;
19
+ }
20
+ public function getReviewUrl()
21
+ {
22
+ return $this->getUrl('marketplace/review/save');
23
+ }
24
+
25
+ public function shipmentItemId()
26
+ {
27
+ $shipmentItemCollection = Mage::getModel('sales/order_shipment_item')->getCollection()
28
+ ->addFieldToFilter('order_item_id', $this->getItem()->getId());
29
+ $shipmentItemId = $shipmentItemCollection->getFirstItem()->getId();
30
+ if($shipmentItemId)
31
+ return $shipmentItemId;
32
+ else
33
+ return null;
34
+ }
35
+ public function isReviewItemRated()
36
+ {
37
+ $shipmentItemId = $this->shipmentItemId();
38
+ $reviewCollection = Mage::getModel('marketplace/review')->getCollection()
39
+ ->addFieldToFilter('shipment_item_id',$shipmentItemId);
40
+
41
+ $ratingIds = Mage::getModel('marketplace/rating')->getCollection()->getAllIds();
42
+ //print_r($ratingIds);
43
+ $sellerRateCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
44
+ ->addFieldToFilter('shipment_item_id',$shipmentItemId);
45
+ $ratesIds = array_diff($ratingIds,$sellerRateCollection->getColumnValues('rating_id'));
46
+ if($reviewCollection->count() > 0 && $sellerRateCollection->count() > 0 && !$ratesIds )
47
+ { return true;
48
+ }
49
+
50
+ else
51
+ return null;
52
+ }
53
+
54
+ public function getSellerUrl($sellerId)
55
+ {
56
+ $seller = Mage::getModel('marketplace/seller')->load($sellerId);
57
+ return Mage::helper('marketplace')->getShopUrl($seller->getUrlPath());
58
+ }
59
+ }
60
+ ?>
app/code/community/Manthan/Marketplace/Block/Sales/Order/Item/Renderer/Grouped.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Sales_Order_Item_Renderer_Grouped extends Mage_Sales_Block_Order_Item_Renderer_Grouped
3
+ {
4
+ public function sellerLink()
5
+ {
6
+ $productId = $this->getItem()->getProductId();
7
+ $sellerCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
8
+ ->addFieldToFilter('product_id',$productId);
9
+ $sellerProfile = Mage::getModel('marketplace/seller')->getCollection()
10
+ ->addFieldToFilter('user_id',$sellerCollection->getFirstItem()->getUserId());
11
+ return $sellerProfile->getFirstItem();
12
+ }
13
+ public function isSellerProduct()
14
+ {
15
+ $productId = $this->getItem()->getProductId();
16
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
17
+ ->addFieldToFilter('product_id',$productId);
18
+ return $collection->count() == 0 ? null : true ;
19
+ }
20
+ public function getReviewUrl()
21
+ {
22
+ return $this->getUrl('marketplace/review/save');
23
+ }
24
+
25
+ public function shipmentItemId()
26
+ {
27
+ $shipmentItemCollection = Mage::getModel('sales/order_shipment_item')->getCollection()
28
+ ->addFieldToFilter('order_item_id', $this->getItem()->getId());
29
+ $shipmentItemId = $shipmentItemCollection->getFirstItem()->getId();
30
+ if($shipmentItemId)
31
+ return $shipmentItemId;
32
+ else
33
+ return null;
34
+ }
35
+ public function isReviewItemRated()
36
+ {
37
+ $shipmentItemId = $this->shipmentItemId();
38
+ $reviewCollection = Mage::getModel('marketplace/review')->getCollection()
39
+ ->addFieldToFilter('shipment_item_id',$shipmentItemId);
40
+
41
+ $ratingIds = Mage::getModel('marketplace/rating')->getCollection()->getAllIds();
42
+ $sellerRateCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
43
+ ->addFieldToFilter('shipment_item_id',$shipmentItemId);
44
+ $ratesIds = array_diff($ratingIds,$sellerRateCollection->getColumnValues('rating_id'));
45
+ if($reviewCollection->count() > 0 && $sellerRateCollection->count() > 0 && !$ratesIds )
46
+ return true;
47
+ else
48
+ return null;
49
+ }
50
+
51
+ public function getSellerUrl($sellerId)
52
+ {
53
+ $seller = Mage::getModel('marketplace/seller')->load($sellerId);
54
+ return Mage::helper('marketplace')->getShopUrl($seller->getUrlPath());
55
+ }
56
+ }
57
+ ?>
app/code/community/Manthan/Marketplace/Block/Seller/Catalog/Product/List.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Seller_Catalog_Product_List extends Mage_Catalog_Block_Product_List {
3
+ protected function _getProductCollection()
4
+ {
5
+ $userCollection = Mage::getModel('admin/user')->getCollection()
6
+ ->addFieldToFilter('is_active',0);
7
+ $productList = null;
8
+ if($userCollection->count() > 0)
9
+ {
10
+ $inActiveUserList = $userCollection->getColumnValues('user_id');
11
+
12
+ $userCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
13
+ ->addFieldToFilter('user_id',array('in'=>$inActiveUserList));
14
+ if($userCollection->count() > 0)
15
+ {
16
+ $productList = $userCollection->getColumnValues('product_id');
17
+ }
18
+ }
19
+ parent::_getProductCollection();
20
+
21
+ $this->_productCollection->addAttributeToSelect('*')
22
+ ->addAttributeToFilter('entity_id',array('nin'=>$productList))
23
+ ->addAttributeToFilter('product_status',Manthan_Marketplace_Model_Catalog_Product_Attribute_Status::APPROVED);
24
+ return $this->_productCollection;
25
+ }
26
+
27
+ }
28
+
29
+ ?>
app/code/community/Manthan/Marketplace/Block/Seller/Profile.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Seller_Profile extends Mage_Core_Block_Template {
3
+
4
+ public function sellerProfile()
5
+ {
6
+ $seller = Mage::getModel('marketplace/seller')->getCollection()->addUserData($this->getCurrentSellerId());
7
+ if($seller->count() > 0)
8
+ {
9
+ $data = $seller->getFirstItem()->getData();
10
+ return $data;
11
+ }
12
+ else
13
+ {
14
+ $url = Mage::helper('core/url')->getHomeUrl();
15
+ echo Mage::helper('marketplace')->redirectUrl($url);
16
+ exit;
17
+ }
18
+ }
19
+ public function getCurrentSellerId()
20
+ {
21
+ return $this->getRequest()->getParam('id');
22
+ }
23
+ public function ratingOverview()
24
+ {
25
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
26
+ ->addFieldToSelect(array('seller_id','rating_id'))
27
+ ->addFieldToFilter('seller_id',$this->getCurrentSellerId());
28
+ $ratedCollection ->getSelect()
29
+ ->columns('SUM(value) as sub_total,COUNT(*) AS rating_count')
30
+ ->group('rating_id');
31
+
32
+ return $ratedCollection->getData();
33
+ }
34
+ public function getRatingName($id)
35
+ {
36
+ $rating = Mage::getModel('marketplace/rating')->load($id);
37
+ return $rating->getName();
38
+ }
39
+ public function getReviewStars()
40
+ {
41
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
42
+ ->addFieldToSelect('*')
43
+ ->addFieldToFilter('seller_id',$this->getCurrentSellerId())
44
+ ->setOrder('value','DESC');
45
+ $ratedCollection ->getSelect()
46
+ ->columns('SUM(value) as rating_total,COUNT(value) AS value_count')
47
+ ->group('value');
48
+
49
+ return $ratedCollection->getData();
50
+ }
51
+ public function getReviewStar($value)
52
+ {
53
+ /*$seller = Mage::getModel('marketplace/sellerrate')->getCollection()
54
+ ->addFieldToFilter('seller_id',$sellerId);
55
+ $review = Mage::getSingleton('core/resource')->getTableName('manthan_marketplace_review');
56
+
57
+ $seller->getSelect()
58
+ ->join(array('review' => $review),'review.shipment_item_id=`main_table`.shipment_item_id', array('shipment_item_id'))
59
+ ->where('review.status = ?',Manthan_Marketplace_Model_Review::STATUS_APPROVED);
60
+ $shipmentIds = array_unique($seller->getColumnValues('shipment_item_id'));*/
61
+
62
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
63
+ ->addFieldToFilter('value',$value)
64
+ ->addFieldToFilter('seller_id',$this->getCurrentSellerId());
65
+ $ratedCollection ->getSelect()
66
+ ->columns('COUNT(value) AS value_count')
67
+ ->group('value');
68
+ return $ratedCollection->getFirstItem()->getData();
69
+ }
70
+ public function getPositivePercentage($positiveVote)
71
+ {
72
+ $ratedCollection = Mage::getModel('marketplace/sellerrate')->getCollection()
73
+ ->addFieldToFilter('value',array('in'=>$positiveVote))
74
+ ->addFieldToFilter('seller_id',$this->getCurrentSellerId());
75
+ $ratedCollection ->getSelect()
76
+ ->columns('COUNT(value) AS positive_total')
77
+ ->group('seller_id');
78
+ return $ratedCollection->getFirstItem()->getData();
79
+ }
80
+ }
81
+
82
+ ?>
app/code/community/Manthan/Marketplace/Block/Seller/Profile/Review.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Seller_Profile_Review extends Mage_Core_Block_Template {
3
+
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $sellerId = $this->getRequest()->getParam('id');
8
+ $seller = Mage::getModel('marketplace/sellerrate')->getCollection()->addFieldToFilter('seller_id',$sellerId);
9
+ $seller->getSelect()->group('shipment_item_id');
10
+ $shipmentItemIds = $seller->getColumnValues('shipment_item_id');
11
+ $review = Mage::getModel('marketplace/review')->getCollection()
12
+ ->addFieldToFilter('status',Manthan_Marketplace_Model_Review::STATUS_APPROVED)
13
+ ->addFieldToFilter('shipment_item_id',array('in'=>$shipmentItemIds));
14
+ $this->setCollection($review);
15
+ }
16
+
17
+ protected function _prepareLayout()
18
+ {
19
+ parent::_prepareLayout();
20
+
21
+ $toolbar = $this->getToolbarBlock();
22
+
23
+ // called prepare sortable parameters
24
+ $collection = $this->getCollection();
25
+
26
+ // use sortable parameters
27
+ if ($orders = $this->getAvailableOrders()) {
28
+ $toolbar->setAvailableOrders($orders);
29
+ }
30
+ if ($sort = $this->getSortBy()) {
31
+ $toolbar->setDefaultOrder($sort);
32
+ }
33
+ if ($dir = $this->getDefaultDirection()) {
34
+ $toolbar->setDefaultDirection($dir);
35
+ }
36
+ $toolbar->setCollection($collection);
37
+
38
+ $this->setChild('toolbar', $toolbar);
39
+ $this->getCollection()->load();
40
+ return $this;
41
+ }
42
+ public function getDefaultDirection(){
43
+ return 'DESC';
44
+ }
45
+ public function getAvailableOrders(){
46
+ return array('created_date'=>'Newest to Oldest');
47
+ }
48
+ public function getSortBy(){
49
+ return 'entity_id';
50
+ }
51
+ public function getToolbarBlock()
52
+ {
53
+ $block = $this->getLayout()->createBlock('marketplace/seller_profile_toolbar', microtime());
54
+ return $block;
55
+ }
56
+ public function getMode()
57
+ {
58
+ return;
59
+ }
60
+ public function getRating($shipment_item_id)
61
+ {
62
+ $sellerId = $this->getRequest()->getParam('id');
63
+ $review = Mage::getModel('marketplace/review')->getCollection();
64
+ $collection = Mage::getModel('marketplace/sellerrate')->getCollection()
65
+ ->addFieldToFilter('seller_id',$sellerId)
66
+ ->addFieldToFilter('shipment_item_id',$shipment_item_id);
67
+ $rating = Mage::getSingleton('core/resource')->getTableName('manthan_marketplace_rating');
68
+
69
+ $collection->getSelect()
70
+ ->join(array('rate' => $rating),'rate.entity_id=`main_table`.rating_id', array('name'));
71
+ $collection->setOrder('name','ASC');
72
+ return $collection->getData();
73
+ }
74
+ public function getToolbarHtml()
75
+ {
76
+ return $this->getChildHtml('toolbar');
77
+ }
78
+ }
79
+
80
+ ?>
app/code/community/Manthan/Marketplace/Block/Seller/Profile/Toolbar.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Block_Seller_Profile_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar {
3
+
4
+ public function getPagerHtml()
5
+ {
6
+ $pagerBlock = $this->getLayout()->createBlock('page/html_pager');
7
+
8
+ if ($pagerBlock instanceof Varien_Object) {
9
+
10
+ /* @var $pagerBlock Mage_Page_Block_Html_Pager */
11
+ $pagerBlock->setAvailableLimit($this->getAvailableLimit());
12
+
13
+ $pagerBlock->setUseContainer(false)
14
+ ->setShowPerPage(false)
15
+ ->setShowAmounts(false)
16
+ ->setLimitVarName($this->getLimitVarName())
17
+ ->setPageVarName($this->getPageVarName())
18
+ ->setLimit($this->getLimit())
19
+ ->setCollection($this->getCollection());
20
+ return $pagerBlock->toHtml();
21
+ }
22
+ return '';
23
+ }
24
+ public function getModes()
25
+ {
26
+ return null;
27
+ }
28
+ public function setCollection($collection)
29
+ {
30
+ $this->_collection = $collection;
31
+ //$this->_collection = Mage::getModel('marketpace/review')->getCollection();
32
+
33
+ $this->_collection->setCurPage($this->getCurrentPage());
34
+
35
+ // we need to set pagination only if passed value integer and more that 0
36
+ $limit = (int)$this->getLimit();
37
+
38
+ if ($limit) {
39
+ $this->_collection->setPageSize($limit);
40
+ }
41
+ if ($this->getCurrentOrder()) {
42
+ $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
43
+ }
44
+ return $this;
45
+ }
46
+
47
+ /*protected function _getAvailableLimit($mode)
48
+ {
49
+ if (isset($this->_availableLimit[$mode])) {
50
+ return $this->_availableLimit[$mode];
51
+ }
52
+ $perPageValues = (string)Mage::helper('marketplace')->getConfig('review','per_page');
53
+ $perPageValues = explode(',', $perPageValues);
54
+ $perPageValues = array_combine($perPageValues, $perPageValues);
55
+ if (Mage::getStoreConfigFlag('catalog/frontend/list_allow_all')) {
56
+ return ($perPageValues + array('all'=>$this->__('All')));
57
+ } else {
58
+ return $perPageValues;
59
+ }
60
+ }*/
61
+ }
62
+
63
+ ?>
app/code/community/Manthan/Marketplace/Controller/Router.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard
3
+ {
4
+ public function match(Zend_Controller_Request_Http $request)
5
+ {
6
+ $identifier = trim(strtolower($request->getPathInfo()), '/');
7
+ $path = explode('/',$identifier);
8
+ if (count($path) > 2 && $path[0] != 'seller')
9
+ return false;
10
+
11
+ $condition = new Varien_Object(array(
12
+ 'identifier' => $identifier,
13
+ 'continue' => true
14
+ ));
15
+
16
+ $identifier = $condition->getIdentifier();
17
+
18
+ if ($condition->getRedirectUrl())
19
+ {
20
+ Mage::app()->getFrontController()->getResponse()
21
+ ->setRedirect($condition->getRedirectUrl())
22
+ ->sendResponse();
23
+ $request->setDispatched(true);
24
+ return true;
25
+ }
26
+
27
+ if (!$condition->getContinue())
28
+ {
29
+ return false;
30
+ }
31
+
32
+ $sellerCollection = Mage::getModel('marketplace/seller')->getCollection()
33
+ ->addFieldToSelect(array('url_path','entity_id'))
34
+ ->addFieldToFilter('url_path',$path[1]);
35
+
36
+ $sellerId = $sellerCollection->getFirstItem()->getId();
37
+ if(is_null($sellerId)){
38
+ $url = Mage::helper('core/url')->getHomeUrl();
39
+ echo Mage::helper('marketplace')->redirectUrl($url);
40
+ exit;
41
+ }
42
+ $request->setModuleName('marketplace')
43
+ ->setControllerName('seller')
44
+ ->setActionName('view')
45
+ ->setParam('id', $sellerId);
46
+
47
+ $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,$identifier);
48
+ return true;
49
+ }
50
+ }
51
+
52
+ ?>
app/code/community/Manthan/Marketplace/Helper/Data.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function getCurrentSellerSales($fromDate)
5
+ {
6
+ $sellerAmount = 0;
7
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
8
+ if(Mage::getModel('marketplace/seller')->isSeller())
9
+ {
10
+ $collection = Mage::getModel('marketplace/payment')->getCollection()
11
+ ->addFieldToFilter('seller_id',$sellerId)
12
+ ->addFieldToFilter('payment_date', array('from' => $fromDate));
13
+
14
+ if($collection->count() > 0)
15
+ {
16
+ $collection ->getSelect()
17
+ ->columns('SUM(seller_paid_amount) as seller_amount')
18
+ ->group('seller_id');
19
+ $sellerArray = $collection->getData();
20
+ $sellerAmount = $sellerArray[0]['seller_amount'];
21
+ }
22
+ }
23
+ return round($sellerAmount,2);
24
+ }
25
+ public function getImagePath($image)
26
+ {
27
+ if(is_null($image))
28
+ $image = 'default.jpg';
29
+ $imagePath = Mage::getBaseUrl('media').'marketplace'.DS.'seller'.DS.'images'.DS. $image;
30
+ return $imagePath;
31
+ }
32
+ public function redirectUrl()
33
+ {
34
+ return Mage::app()->getResponse()->setRedirect(Mage::helper('core/url')->getHomeUrl());
35
+ }
36
+
37
+ public function getCurrentUserId()
38
+ {
39
+ $userId = Mage::getSingleton('admin/session')->getUser()->getUserId();
40
+ $loggedInRole = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();
41
+ $roleId = Mage::getStoreConfig('marketplace/seller/role');
42
+ return $roleId == $loggedInRole ? $userId : false;
43
+ }
44
+ public function getShopUrl($url)
45
+ {
46
+ $shopUrl = Mage::helper('core/url')->getHomeUrl()."seller". DS . $url ;
47
+ return $shopUrl;
48
+ }
49
+ public function getSellerInfo($_product)
50
+ {
51
+ $sellerInfo = null;
52
+ $sellerProductCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
53
+ ->addFieldToFilter('product_id',$_product->getId());
54
+ if($sellerProductCollection->count() > 0)
55
+ {
56
+ $userId = $sellerProductCollection->getFirstItem()->getUserId();
57
+ $collection = Mage::getModel('marketplace/seller')->getCollection()
58
+ ->addFieldToFilter('user_id',$userId);
59
+ if($collection->count() > 0)
60
+ $sellerInfo = $collection->getFirstItem();
61
+ }
62
+ return $sellerInfo;
63
+ }
64
+ public function isSellerProduct()
65
+ {
66
+ $userId = Mage::getSingleton('admin/session')->getUser()->getUserId();
67
+ $loggedInRole = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();
68
+ $roleId = Mage::getStoreConfig('marketplace/seller/role');
69
+ $url = Mage::helper("adminhtml")->getUrl("adminhtml/catalog_product/index/");
70
+ if($roleId == $loggedInRole)
71
+ {
72
+ $productId = Mage::app()->getRequest()->getParam('id');
73
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
74
+ ->addFieldToFilter('user_id',$userId)
75
+ ->addFieldToFilter('product_id',$productId);
76
+ if($collection->count() == 0)
77
+ {
78
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
79
+ }
80
+ }
81
+ }
82
+ public function getSellerPriceAttribute($order)
83
+ {
84
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
85
+ if(!is_null($isSeller))
86
+ {
87
+ $itemsCollection = Mage::getModel('sales/order_item')->getCollection()
88
+ ->addFieldToFilter('order_id',$order->getId())
89
+ ->addFieldToFilter('parent_item_id',array('null'=>true))
90
+ ->addFieldToFilter('seller_id',$isSeller);
91
+ $itemsCollection ->getSelect()
92
+ ->columns('SUM(seller_per_product_shipping) as seller_shipping_total')
93
+ ->group('seller_id');
94
+
95
+ return $itemsCollection->getFirstItem()->getSellerShippingTotal();
96
+ }
97
+ }
98
+ public function getSellerPriceFormatAttribute($order,$strong = false, $separator = '<br/>')
99
+ {
100
+ $shippingAmount = $this->getSellerPriceAttribute($order);
101
+
102
+ if ($order && $order->isCurrencyDifferent())
103
+ {
104
+ $res = '<strong>';
105
+ $res.= $order->formatBasePrice($shippingAmount);
106
+ $res.= '</strong>'.$separator;
107
+ $res.= '['.$order->formatPrice($shippingAmount).']';
108
+ }
109
+ elseif ($order)
110
+ {
111
+ $res = $order->formatPrice($shippingAmount);
112
+ if ($strong) {
113
+ $res = '<strong>'.$res.'</strong>';
114
+ }
115
+ } else {
116
+ $res = Mage::app()->getStore()->formatPrice($shippingAmount);
117
+ if ($strong) {
118
+ $res = '<strong>'.$res.'</strong>';
119
+ }
120
+ }
121
+ return $res;
122
+ }
123
+ }
124
+
125
+ ?>
app/code/community/Manthan/Marketplace/Model/Catalog/Product/Attribute/Status.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Catalog_Product_Attribute_Status extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
3
+
4
+ const PENDING = 1;
5
+ const APPROVED = 2;
6
+ const DISAPPROVED = 3;
7
+
8
+ public function getAllOptions()
9
+ {
10
+ if (is_null($this->_options)) {
11
+ $this->_options = array(
12
+
13
+ array(
14
+ 'label' => Mage::helper('marketplace')->__('Pending'),
15
+ 'value' => self::PENDING
16
+ ),
17
+ array(
18
+ 'label' => Mage::helper('marketplace')->__('Approved'),
19
+ 'value' => self::APPROVED
20
+ ),
21
+ array(
22
+ 'label' => Mage::helper('marketplace')->__('Not Approved'),
23
+ 'value' => self::DISAPPROVED
24
+ ),
25
+ );
26
+ }
27
+ return $this->_options;
28
+ }
29
+
30
+ public function toOptionArray()
31
+ {
32
+ return $this->getAllOptions();
33
+ }
34
+
35
+
36
+ }
37
+
38
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Payment.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Mysql4_Payment extends Mage_Core_Model_Resource_Db_Abstract {
3
+ protected function _construct() {
4
+ $this->_init('marketplace/payment', 'entity_id');
5
+ }
6
+ }
7
+
8
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Payment/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Payment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/payment');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Pricecomparison.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Pricecomparison extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/pricecomparison', 'entity_id');
6
+ }
7
+ }
8
+
9
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Pricecomparison/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Pricecomparison_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/pricecomparison');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Rating.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Rating extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/rating', 'entity_id');
6
+ }
7
+ }
8
+
9
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Rating/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Rating_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/rating');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Review.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Review extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/review', 'entity_id');
6
+ }
7
+ }
8
+
9
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Review/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Review_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/review');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Seller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Seller extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/seller', 'entity_id');
6
+ }
7
+
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Seller/Collection.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Seller_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/seller');
7
+ }
8
+ public function addUserData($sellerId = null)
9
+ {
10
+ if(is_null($sellerId))
11
+ {
12
+ $user= Mage::getSingleton('core/resource')->getTableName('admin_user');
13
+ $this->getSelect()
14
+ ->join(array('user' => $user),'user.user_id =`main_table`.user_id',
15
+ array('main_table.*','user.*'));
16
+ }
17
+ else
18
+ {
19
+ $user = Mage::getSingleton('core/resource')->getTableName('admin_user');
20
+ $seller = Mage::getModel('marketplace/seller')->getCollection();
21
+ $this->getSelect()
22
+ ->join(array('user' => $user),'user.user_id =`main_table`.user_id',array('main_table.*','user.*'))
23
+ ->where('entity_id = ?',$sellerId);
24
+ }
25
+ return $this;
26
+ }
27
+ }
28
+
29
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Sellerrate.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Sellerrate extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/sellerrate', 'entity_id');
6
+ }
7
+ }
8
+
9
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Sellerrate/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Sellerrate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/sellerrate');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Vendorproduct.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Vendorproduct extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init('marketplace/vendorproduct', 'entity_id');
6
+ }
7
+ }
8
+
9
+ ?>
app/code/community/Manthan/Marketplace/Model/Mysql4/Vendorproduct/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Manthan_Marketplace_Model_Mysql4_Vendorproduct_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init('marketplace/vendorproduct');
7
+ }
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Observer.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Observer {
3
+
4
+ public function addSellerInfo(Varien_Event_Observer $observer)
5
+ {
6
+ $sellerInfo = Mage::helper('marketplace')->getSellerInfo($observer->getProduct());
7
+ if($sellerInfo)
8
+ {
9
+ $product = $observer->getProduct();
10
+ $additionalOptions = array();
11
+
12
+ $additionalOptions[] = array(
13
+ 'label'=> Mage::helper('core')->__('seller:'),
14
+ 'value' => $sellerInfo->getShopName(),
15
+ );
16
+ $observer->getProduct()->addCustomOption('additional_options', serialize($additionalOptions));
17
+ }
18
+ return $this;
19
+ }
20
+
21
+ public function dynamicSellerLink(Varien_Event_Observer $observer)
22
+ {
23
+ $layout = $observer->getEvent()->getLayout();
24
+ $update = $layout->getUpdate();
25
+ $sellerLink = Mage::getStoreConfig('marketplace/seller/link_label');
26
+ $xml = "<reference name='top.links'>
27
+ <action method='addLink' translate='label title'>
28
+ <label>{$sellerLink}</label>
29
+ <url>marketplace/seller/create</url>
30
+ <title>Connect As Seller</title>
31
+ <prepare>true</prepare>
32
+ <position>1</position>
33
+ </action>
34
+ </reference>";
35
+ $update->addUpdate($xml);
36
+ return;
37
+ }
38
+ public function saveSellerToOrderItem(Varien_Event_Observer $observer)
39
+ {
40
+ $quoteItem = $observer->getItem();
41
+ $orderItem = $observer->getOrderItem();
42
+
43
+ $productId = $quoteItem->getProductId();
44
+ $product = Mage::getModel('catalog/product')->load($productId);
45
+ $marketplacePerProductShippingMethod = $this->getCurrentShippingObject()->getShippingMethod();
46
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
47
+ ->addFieldToFilter('product_id',$productId);
48
+
49
+ if($collection->count() > 0 && !$quoteItem->getParentItemId())
50
+ {
51
+ if ($additionalOptions = $quoteItem->getOptionByCode('additional_options'))
52
+ {
53
+ $options = $orderItem->getProductOptions();
54
+ $options['additional_options'] = unserialize($additionalOptions->getValue());
55
+ $orderItem->setProductOptions($options);
56
+ }
57
+ $userId = $collection->getFirstItem()->getUserId();
58
+ $seller = Mage::getModel('marketplace/seller')->getCollection()
59
+ ->addFieldToFilter('user_id',$userId);
60
+ $seller_admin_comission = $seller->getFirstItem()->getAdminCommissionByPercentage();
61
+ $country = $seller->getFirstItem()->getCountry();
62
+
63
+ //IF Marketplace product shipping method set then assign shipping Value to order item
64
+
65
+ if($marketplacePerProductShippingMethod == 'marketplaceproductshipping_marketplaceproductshipping')
66
+ {
67
+ $shippingPrice = $product->getInternationalShippingCost() * $quoteItem->getQty();
68
+ if($country == $this->getCurrentShippingObject()->getCountryId())
69
+ $shippingPrice = $product->getDomesticShippingCost() * $quoteItem->getQty();
70
+ $orderItem->setSellerPerProductShipping($shippingPrice);
71
+ }
72
+
73
+ $orderItem->setAdminOrderCommission($seller_admin_comission);
74
+ $orderItem->setSellerId($seller->getFirstItem()->getId());
75
+ }
76
+ }
77
+
78
+ public function getCurrentShippingObject()
79
+ {
80
+ return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
81
+ }
82
+ public function checkPermissionRole($observer)
83
+ {
84
+ $action = $observer->getEvent()->getAction();
85
+ $fullActionName = $action->getFullActionName();
86
+ $url = Mage::helper("adminhtml")->getUrl("adminhtml/catalog_product/index/");
87
+
88
+ if($fullActionName == "adminhtml_catalog_product_edit")
89
+ {
90
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
91
+ if($isSeller)
92
+ {
93
+ $userId = Mage::helper('marketplace')->getCurrentUserId();
94
+ $productId = Mage::app()->getRequest()->getParam('id');
95
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
96
+ ->addFieldToFilter('user_id',$userId)
97
+ ->addFieldToFilter('product_id',$productId);
98
+ if($collection->count() == 0)
99
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
100
+ }
101
+ }
102
+ }
103
+ public function customFilterProductCollection(Varien_Event_Observer $observer)
104
+ {
105
+ $collection = $observer->getEvent()->getCollection();
106
+ if($product_status = Mage::app()->getRequest()->getParam('product_status'))
107
+ {
108
+ $collection->addAttributeToFilter('product_status',1);
109
+ return $this;
110
+ }
111
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
112
+ $currentUserId = Mage::helper('marketplace')->getCurrentUserId();
113
+ if(!is_null($isSeller) && !is_null($currentUserId))
114
+ {
115
+ $vendorProductCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
116
+ ->addFieldToFilter('user_id',$currentUserId);
117
+ $productIds = $vendorProductCollection->getColumnValues('product_id');
118
+
119
+ $collection->addAttributeToFilter('entity_id',array('in' => $productIds ));
120
+ return $this;
121
+ }
122
+ }
123
+ public function catalogProductSaveAfter(Varien_Event_Observer $observer)
124
+ {
125
+ $isSeller = Mage::getModel('marketplace/seller')->isSeller();
126
+ $currentUserId = Mage::helper('marketplace')->getCurrentUserId();
127
+ if(!is_null($isSeller) && !is_null($currentUserId))
128
+ {
129
+ $product = $observer->getProduct();
130
+ $id = null;
131
+
132
+ $vendorProductCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
133
+ ->addFieldToFilter('user_id',$currentUserId)
134
+ ->addFieldToFilter('product_id',$product->getId());
135
+
136
+ if($vendorProductCollection->count() > 0)
137
+ $id = $vendorProductCollection->getFirstItem()->getId();
138
+
139
+ $vendorProductCollection = Mage::getModel('marketplace/vendorproduct');
140
+ $vendorProductCollection->load($id);
141
+ $vendorProductCollection->setProductId($product->getId());
142
+ $vendorProductCollection->setUserId($currentUserId);
143
+ $vendorProductCollection->save();
144
+ }
145
+ }
146
+
147
+ public function catalogProductDeleteBefore(Varien_Event_Observer $observer)
148
+ {
149
+ $product = $observer->getProduct();
150
+
151
+ $sellerCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
152
+ ->addFieldToFilter('product_id',$product->getId());
153
+
154
+ if($sellerCollection->count() > 0)
155
+ {
156
+ $id = $sellerCollection->getFirstItem()->getId();
157
+
158
+ $seller = Mage::getModel('marketplace/vendorproduct');
159
+ $seller->load($id);
160
+ $seller->delete($id);
161
+ }
162
+ }
163
+ public function sellerOperationAfterOrderSuccess($observer)
164
+ {
165
+ $orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
166
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
167
+
168
+ $payment = Mage::getModel('marketplace/payment');
169
+
170
+ $vars['customer_name'] = $order->getBillingAddress()->getName();
171
+ $vars['billing_address'] = $order->getBillingAddress()->format('html');
172
+ $vars['shipping_address'] = $order->getShippingAddress()->format('html');
173
+ $vars['order_increment_id'] = $orderIncrementId;
174
+ $vars['not_virtual_order'] = $order->getIsNotVirtual();
175
+
176
+ $head = '<thead style="background:#f9f9f9;">
177
+ <tr>
178
+ <th align="left" bgcolor="#EAEAEA" style="font-size: 12px; padding: 3px 9px;"><strong>Product</strong></th>
179
+ <th align="left" bgcolor="#EAEAEA" style="font-size: 12px; padding: 3px 9px;"><strong><span>Original Price</span></strong></th>
180
+ <th align="left" bgcolor="#EAEAEA" style="font-size: 12px; padding: 3px 9px;"><strong>Price</strong></th>
181
+ <th align="left" bgcolor="#EAEAEA" style="font-size: 12px; padding: 3px 9px;"><strong>Qty</strong></th>
182
+ <th align="left" bgcolor="#EAEAEA" style="font-size: 12px; padding: 3px 9px;"><strong><span>Row Total</strong></span></th>
183
+ </tr>
184
+ </thead>';
185
+
186
+ $orderItemsArray = array();
187
+ $sellerArray = array();
188
+ $sum = 0;
189
+ foreach($order->getAllItems() as $_item)
190
+ {
191
+ if($_item->getParentItemId())
192
+ { continue;
193
+ }
194
+ $collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
195
+ ->addFieldToFilter('product_id',$_item->getProductId());
196
+ if($collection->count() > 0)
197
+ {
198
+ $seller = Mage::getModel('admin/user')->load($collection->getFirstItem()->getUserId());
199
+
200
+ $orderItemsArray[$seller->getUserId()]['seller_email'] = $seller->getEmail();
201
+ $orderItemsArray[$seller->getUserId()]['seller_name'] = $seller->getName();
202
+ if(!isset($orderItemsArray[$seller->getUserId()]['order_items']))
203
+ {
204
+ $orderItemsArray[$seller->getUserId()]['order_items']= '';
205
+ }
206
+ $orderItemsArray[$seller->getUserId()]['order_items'] .= '<tbody>
207
+ <tr>
208
+ <td align="left" valign="top" style="font-size: 11px; padding: 3px 9px; border-bottom: 1px dotted #CCCCCC;">
209
+ <p>' . $_item->getName() . '</p>
210
+ <strong>SKU:</strong> ' . $_item->getSku().
211
+ '</td>
212
+ <td align="left" valign="top" style="font-size: 11px; padding: 3px 9px; border-bottom: 1px dotted #CCCCCC;">' . $order->formatPrice($_item->getPriceInclTax()) . '</td>
213
+ <td align="left" valign="top" style="font-size: 11px; padding: 3px 9px; border-bottom: 1px dotted #CCCCCC;">' . $order->formatPrice($_item->getOriginalPrice()) . '</td>
214
+ <td align="left" valign="top" style="font-size: 11px; padding: 3px 9px; border-bottom: 1px dotted #CCCCCC;">' . $_item->getQtyOrdered() . '</td>
215
+ <td align="left" valign="top" style="font-size: 11px; padding: 3px 9px; border-bottom: 1px dotted #CCCCCC;">' . $order->formatPrice($_item->getRowTotalInclTax()) . '</td>
216
+ </tr>
217
+ </tbody>';
218
+ if(!isset($orderItemsArray[$seller->getUserId()]['seller_order_total']))
219
+ {
220
+ $orderItemsArray[$seller->getUserId()]['seller_order_total'] = 0;
221
+ }
222
+ $adminCommisionAmount = ($_item->getAdminOrderCommission() * $_item->getRowTotalInclTax())/100;
223
+ $sellerAmount = $_item->getRowTotalInclTax() - $adminCommisionAmount;
224
+ $sellerCollection = Mage::getModel('marketplace/seller')->getCollection()->addFieldToFilter('user_id',$seller->getUserId());
225
+ $sellerId = $sellerCollection->getFirstItem()->getId();
226
+ $orderItemsArray[$seller->getUserId()]['order_id'] = $orderIncrementId;
227
+ $orderItemsArray[$seller->getUserId()]['seller_id'] = $sellerId;
228
+
229
+ $orderItemsArray[$seller->getUserId()]['seller_order_total'] += $sellerAmount;
230
+ if($order->getShippingMethod() == 'marketplaceproductshipping_marketplaceproductshipping')
231
+ { $shippingPrice = Mage::getModel('marketplace/seller')->getSellerShippingPrice($order,$_item->getSellerId());
232
+ $orderItemsArray[$seller->getUserId()]['seller_order_total'] +=$shippingPrice;
233
+ }
234
+ }
235
+ }
236
+
237
+ foreach($orderItemsArray as $key => $value)
238
+ {
239
+ $payment = Mage::getModel('marketplace/payment');
240
+ $payment->setOrderId($value['order_id']);
241
+ $payment->setSellerId($value['seller_id']);
242
+ $payment->setSellerPaidAmount(0);
243
+ $payment->setAdminAmount($value['seller_order_total']);
244
+ $payment->save();
245
+ $seller_order = '<table cellspacing="0" cellpadding="0" border="0" width="700" style="border: 1px solid #EAEAEA;">';
246
+ $seller_order .= $head;
247
+ $seller_order .= $value['order_items'];
248
+ $seller_order .= $value['seller_order_total'];
249
+ $seller_order .= '</table>';
250
+ $vars['seller_order_items'] = $seller_order;
251
+ $vars['seller_name'] = $value['seller_name'];
252
+ $this->sendTransactionalEmail($value['seller_email'], $vars);
253
+ }
254
+ }
255
+
256
+ public function sendTransactionalEmail($email, $vars)
257
+ {
258
+ $templateId = Mage::getStoreConfig('marketplace/email/email_template');
259
+ $emailSender = Mage::getStoreConfig('marketplace/email/email_sender');
260
+ $identify_name = Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/name');
261
+ $identify_email = Mage::getStoreConfig('trans_email/ident_'.$emailSender.'/email');
262
+
263
+ $sender = array('name' => $identify_name, 'email' => $identify_email);
264
+ $recepientEmail = $email;
265
+ $storeId = Mage::app()->getStore()->getId();
266
+ $translate = Mage::getSingleton('core/translate');
267
+ Mage::getModel('core/email_template')
268
+ ->sendTransactional($templateId, $sender, $recepientEmail, $email,$vars, $storeId);
269
+ $translate->setTranslateInline(true);
270
+ }
271
+ }
272
+
273
+ ?>
app/code/community/Manthan/Marketplace/Model/Payment.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Payment extends Mage_Core_Model_Abstract {
3
+
4
+ protected function _construct() {
5
+ $this->_init('marketplace/payment');
6
+ }
7
+
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/Pdf/Invoice.php ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Pdf_Invoice extends Mage_Core_Model_Abstract {
3
+
4
+ protected function _construct() {
5
+ $this->_init('marketplace/pdf_invoice');
6
+ }
7
+ /**
8
+ * Insert logo to pdf page
9
+ *
10
+ * @param Zend_Pdf_Page $page
11
+ * @param null $store
12
+ */
13
+ protected function insertLogo(&$page, $store = null)
14
+ {
15
+ $this->y = $this->y ? $this->y : 815;
16
+ $image = Mage::getStoreConfig('sales/identity/logo', $store);
17
+
18
+ if ($image) {
19
+ $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
20
+
21
+ if (is_file($image)) {
22
+
23
+ $image = Zend_Pdf_Image::imageWithPath($image);
24
+ $top = 830; //top border of the page
25
+ $widthLimit = 270; //half of the page width
26
+ $heightLimit = 270; //assuming the image is not a "skyscraper"
27
+ $width = $image->getPixelWidth();
28
+ $height = $image->getPixelHeight();
29
+
30
+
31
+ //preserving aspect ratio (proportions)
32
+ $ratio = $width / $height;
33
+ if ($ratio > 1 && $width > $widthLimit) {
34
+ $width = $widthLimit;
35
+ $height = $width / $ratio;
36
+ } elseif ($ratio < 1 && $height > $heightLimit) {
37
+ $height = $heightLimit;
38
+ $width = $height * $ratio;
39
+ } elseif ($ratio == 1 && $height > $heightLimit) {
40
+ $height = $heightLimit;
41
+ $width = $widthLimit;
42
+ }
43
+
44
+ $y1 = $top - $height;
45
+ $y2 = $top;
46
+ $x1 = 25;
47
+ $x2 = $x1 + $width;
48
+ //coordinates after transformation are rounded by Zend
49
+ $page->drawImage($image, $x1, $y1, $x2, $y2);
50
+
51
+ $this->y = $y1 - 10;
52
+ }
53
+ }
54
+ }
55
+ public function getPdf($invoice){
56
+
57
+ $order = $invoice->getOrder();
58
+ $pdf = new Zend_Pdf();
59
+ $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
60
+
61
+ $this->insertLogo($page, $invoice->getStore());
62
+
63
+ $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_ROMAN);
64
+
65
+ define('FONT_SIZE' , 11);
66
+ define('MARGIN_LEFT' , 40);
67
+ define('MARGIN_TOP' , 40);
68
+ define('COL_WIDTH' , 100);
69
+ define('COL_LEFT_MARGIN', 10);
70
+ define('COL_SEPARATOR' , '|');
71
+ define('ROW_HEIGHT' , 20);
72
+
73
+ $row = 1;
74
+ $x = MARGIN_LEFT;
75
+ $top = $this->y;
76
+ $page->setFont($font, FONT_SIZE);
77
+
78
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
79
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
80
+ $page->drawRectangle(25, $top, 570, $top - 55);
81
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
82
+
83
+
84
+ $incrementId = $order->getInvoiceCollection()->getFirstItem()->getIncrementId();
85
+
86
+ $page->drawText(Mage::helper('sales')->__('Invoice #%1$s', $incrementId), 35, ($top -= 15), 'UTF-8');
87
+ $page->drawText(Mage::helper('sales')->__('Order #%1$s',$order->getRealOrderId()),35,($top -= 18),'UTF-8');
88
+ $page->drawText(
89
+ Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate(
90
+ $order->getCreatedAtStoreDate(), 'medium', false
91
+ )
92
+ ,35,($top -= 16),'UTF-8');
93
+
94
+ $top -= 10;
95
+ $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
96
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
97
+ $page->setLineWidth(0.5);
98
+ $page->drawRectangle(25, $top, 275, ($top - 25));
99
+ $page->drawRectangle(275, $top, 570, ($top - 25));
100
+
101
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
102
+ $page->drawText(Mage::helper('sales')->__('Sold to:'), 35, ($top - 15), 'UTF-8');
103
+
104
+
105
+ $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
106
+ ->setIsSecureMode(true)
107
+ ->toPdf();
108
+
109
+ $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
110
+ $payment = explode('{{pdf_row_separator}}', $paymentInfo);
111
+ foreach ($payment as $key=>$value){
112
+ if (strip_tags(trim($value)) == '') {
113
+ unset($payment[$key]);
114
+ }
115
+ }
116
+ reset($payment);
117
+
118
+ if (!$order->getIsVirtual()) {
119
+ $page->drawText(Mage::helper('sales')->__('Ship to:'), 285, ($top - 15), 'UTF-8');
120
+ }else{
121
+ $page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, ($top - 15), 'UTF-8');
122
+
123
+ }
124
+ $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
125
+
126
+ $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
127
+ $addressesHeight = $this->_calcAddressHeight($billingAddress);
128
+
129
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
130
+ $page->drawRectangle(25, ($top - 25), 570, $top - 33 - $addressesHeight);
131
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
132
+ $this->y = $top - 40;
133
+ $addressesStartY = $this->y;
134
+
135
+ if ($order->getIsVirtual()) {
136
+ foreach ($payment as $value){
137
+ if (trim($value) != '') {
138
+ //Printing "Payment Method" lines
139
+ $value = preg_replace('/<br[^>]*>/i', "\n", $value);
140
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
141
+ $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
142
+ // $top -= 15;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ foreach ($billingAddress as $value){
149
+ if ($value !== '') {
150
+ $text = array();
151
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
152
+ $text[] = $_value;
153
+ }
154
+ foreach ($text as $part) {
155
+ $page->drawText(strip_tags($part), 35, $this->y, 'UTF-8');
156
+ $this->y -= 15;
157
+ }
158
+ }
159
+ }
160
+
161
+ if (!$order->getIsVirtual()) {
162
+ $this->y = $addressesStartY;
163
+ foreach ($shippingAddress as $value){
164
+ if ($value!=='') {
165
+ $text = array();
166
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
167
+ $text[] = $_value;
168
+ }
169
+ foreach ($text as $part) {
170
+ $page->drawText(strip_tags(ltrim($part)), 285, $this->y, 'UTF-8');
171
+ $this->y -= 15;
172
+ }
173
+ }
174
+ }
175
+ $addressesEndY = $this->y;
176
+ $addressesEndY = min($addressesEndY, $this->y);
177
+ $this->y = $addressesEndY;
178
+ $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
179
+ $page->setLineWidth(0.5);
180
+ $page->drawRectangle(25, $this->y, 275, $this->y-25);
181
+ $page->drawRectangle(275, $this->y, 570, $this->y-25);
182
+ $this->y -= 15;
183
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
184
+
185
+ $page->drawText(Mage::helper('sales')->__('Payment Method'), 35, $this->y, 'UTF-8');
186
+ $page->drawText(Mage::helper('sales')->__('Shipping Method'), 285, $this->y , 'UTF-8');
187
+ $this->y -=10;
188
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
189
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
190
+ }
191
+ $paymentLeft = 35;
192
+ $yPayments = $this->y - 15;
193
+
194
+ if (!$order->getIsVirtual()) {
195
+ foreach ($payment as $value){
196
+ if (trim($value) != '') {
197
+ //Printing "Payment Method" lines
198
+ $value = preg_replace('/<br[^>]*>/i', "\n", $value);
199
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
200
+ $page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8');
201
+ $yPayments -= 15;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ $topMargin = 0;
207
+ $methodStartY = $this->y;
208
+ $this->y -= 15;
209
+
210
+ if (!$order->getIsVirtual())
211
+ {
212
+ /* Shipping Address */
213
+ $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
214
+ $shippingDescription = $order->getShippingDescription();
215
+ $totalShippingChargesText = Mage::helper('sales')->__($shippingDescription);
216
+ foreach (Mage::helper('core/string')->str_split($totalShippingChargesText, 55, true, true) as $_value)
217
+ {
218
+ $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
219
+ $this->y -= 15;
220
+ }
221
+ $this->y-=10;
222
+ $shippingPrice = null;
223
+ if($order->getShippingMethod() == 'marketplaceproductshipping_marketplaceproductshipping')
224
+ {
225
+ $shippingPrice = Mage::helper('marketplace')->getSellerPriceFormatAttribute($order,$strong = false, $separator = '<br/>');
226
+ $page->drawText( Mage::helper('sales')->__("(Total Shipping Charges %s )",strip_tags($shippingPrice)), 285, $this->y, 'UTF-8');
227
+ }
228
+ $yShipments = $this->y;
229
+ // $page->drawText($totalShippingChargesText, 285, $yShipments - $topMargin, 'UTF-8');
230
+ $yShipments -= $topMargin + 10;
231
+ $currentY = min($yPayments, $yShipments);
232
+
233
+ // replacement of Shipments-Payments rectangle block
234
+ $page->drawLine(25, $methodStartY, 25, $currentY); //left
235
+ $page->drawLine(25, $currentY, 570, $currentY); //bottom
236
+ $page->drawLine(570, $currentY, 570, $methodStartY); //right
237
+
238
+ $this->y = $currentY;
239
+ $this->y -= 15;
240
+ }
241
+
242
+ $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
243
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
244
+ $page->setLineWidth(0.5);
245
+ $page->drawRectangle(25, $this->y, 570, $this->y -25);
246
+ $this->y -= 10;
247
+ $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
248
+
249
+ $this->y -= 5;
250
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
251
+ $page->drawText(Mage::helper('sales')->__('Products'), 30, $this->y, 'UTF-8');
252
+ $page->drawText(Mage::helper('sales')->__('SKU'), 260, $this->y , 'UTF-8');
253
+ $page->drawText(Mage::helper('sales')->__('Price'), 375, $this->y , 'UTF-8');
254
+ $page->drawText(Mage::helper('sales')->__('Qty'), 450, $this->y , 'UTF-8');
255
+ $page->drawText(Mage::helper('sales')->__('Subtotal'), 520, $this->y , 'UTF-8');
256
+ $this->y -= 35;
257
+
258
+ $subTotal = 0;
259
+ foreach($invoice->getAllItems() as $invoice)
260
+ {
261
+ $items = $this->_getItemCollectionFilter($invoice);
262
+ if($items->count() > 0)
263
+ {
264
+ $price = Mage::helper('core')->currency($items->getFirstItem()->getPriceInclTax(), true, false);
265
+ $sub_total = $items->getFirstItem()->getRowTotalInclTax();
266
+ $priceFormatSubTotal = Mage::helper('core')->currency($sub_total, true, false);
267
+ $page->drawText($items->getFirstItem()->getName(), 30, $this->y, 'UTF-8');
268
+ $this->_getProductOptions($page,$items->getFirstItem()->getProductOptions(),$this->y,$font);
269
+
270
+ $page->setFont($font, FONT_SIZE);
271
+ $oldY = $this->y;
272
+
273
+ $this->y = $this->_calcWidthField($page,$items->getFirstItem()->getSku(),$this->y);
274
+ $page->drawText($price, 375, $oldY, 'UTF-8');
275
+ $page->drawText(round($invoice->getQty(),2), 450, $oldY, 'UTF-8');
276
+ $page->drawText($priceFormatSubTotal, 520, $oldY, 'UTF-8');
277
+ $subTotal +=$sub_total;
278
+ $this->y -= 35;
279
+ }
280
+ }
281
+
282
+ $this->y -= 10;
283
+ $page->drawText(Mage::helper('Sales')->__('Subtotal:'),360, $this->y, 'UTF-8');
284
+ $page->drawText(strip_tags($order->formatPrice($subTotal)),520, $this->y, 'UTF-8');
285
+ $grandTotal = $subTotal;
286
+ if($order->getShippingMethod() == 'marketplaceproductshipping_marketplaceproductshipping' && !is_null($shippingPrice))
287
+ {
288
+ $this->y -= 20;
289
+ $x = 515;
290
+ $grandTotal += Mage::helper('marketplace')->getSellerPriceAttribute($order);
291
+ $page->drawText(Mage::helper('Sales')->__('Total Shipping Charges:'),360, $this->y, 'UTF-8');
292
+ $page->drawText(strip_tags($shippingPrice),525, $this->y, 'UTF-8');
293
+ }
294
+ $this->y -= 20;
295
+ $page->drawText(Mage::helper('Sales')->__('Grand Total:'),360, $this->y, 'UTF-8');
296
+ $page->drawText(strip_tags($order->formatPrice($grandTotal)),520, $this->y, 'UTF-8');
297
+
298
+ $pdf->pages[] = $page;
299
+ return $pdf;
300
+ }
301
+
302
+ protected function _getItemCollectionFilter($invoice)
303
+ {
304
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
305
+ $itemCollection = Mage::getModel('sales/order_item')->getCollection()
306
+ ->addFieldToFilter('item_id',$invoice->getOrderItemId())
307
+ ->addFieldToFilter('parent_item_id',array('null'=>true))
308
+ ->addFieldToFilter('seller_id',$sellerId);
309
+ return $itemCollection;
310
+ }
311
+
312
+ protected function _getProductOptions($page,$options,$y,$font)
313
+ {
314
+ if($options['attributes_info']){
315
+ $page->setFont($font, 8);
316
+ foreach($options['attributes_info'] as $attribute)
317
+ $page->drawText( $attribute['label'] . ":" . $attribute['value'] , 35, $y-15, 'UTF-8');
318
+ }
319
+ }
320
+ protected function _calcWidthField($page,$productField,$y)
321
+ {
322
+ foreach (Mage::helper('core/string')->str_split($productField, 20, true, true) as $_value)
323
+ {
324
+ $page->drawText($_value, 250, $y, 'UTF-8');
325
+ $y-= 15;
326
+ }
327
+ return $y;
328
+ }
329
+ protected function _calcAddressHeight($address)
330
+ {
331
+ $y = 0;
332
+ foreach ($address as $value){
333
+ if ($value !== '') {
334
+ $text = array();
335
+ foreach (Mage::helper('core/string')->str_split($value, 55, true, true) as $_value) {
336
+ $text[] = $_value;
337
+ }
338
+ foreach ($text as $part) {
339
+ $y += 15;
340
+ }
341
+ }
342
+ }
343
+ return $y;
344
+ }
345
+ protected function _formatAddress($address)
346
+ {
347
+ $return = array();
348
+ foreach (explode('|', $address) as $str) {
349
+ foreach (Mage::helper('core/string')->str_split($str, 45, true, true) as $part) {
350
+ if (empty($part)) {
351
+ continue;
352
+ }
353
+ $return[] = $part;
354
+ }
355
+ }
356
+ return $return;
357
+ }
358
+ }
359
+
360
+ ?>
app/code/community/Manthan/Marketplace/Model/Pdf/Shipment/Packing.php ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Pdf_Shipment_Packing extends Mage_Core_Model_Abstract {
3
+
4
+ protected function _construct() {
5
+ $this->_init('marketplace/pdf_shipment_packing');
6
+ }
7
+ /**
8
+ * Insert logo to pdf page
9
+ *
10
+ * @param Zend_Pdf_Page $page
11
+ * @param null $store
12
+ */
13
+ protected function insertLogo(&$page, $store = null)
14
+ {
15
+ $this->y = $this->y ? $this->y : 815;
16
+ $image = Mage::getStoreConfig('sales/identity/logo', $store);
17
+
18
+ if ($image) {
19
+ $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
20
+
21
+ if (is_file($image)) {
22
+
23
+ $image = Zend_Pdf_Image::imageWithPath($image);
24
+ $top = 830; //top border of the page
25
+ $widthLimit = 270; //half of the page width
26
+ $heightLimit = 270; //assuming the image is not a "skyscraper"
27
+ $width = $image->getPixelWidth();
28
+ $height = $image->getPixelHeight();
29
+
30
+
31
+ //preserving aspect ratio (proportions)
32
+ $ratio = $width / $height;
33
+ if ($ratio > 1 && $width > $widthLimit) {
34
+ $width = $widthLimit;
35
+ $height = $width / $ratio;
36
+ } elseif ($ratio < 1 && $height > $heightLimit) {
37
+ $height = $heightLimit;
38
+ $width = $height * $ratio;
39
+ } elseif ($ratio == 1 && $height > $heightLimit) {
40
+ $height = $heightLimit;
41
+ $width = $widthLimit;
42
+ }
43
+
44
+ $y1 = $top - $height;
45
+ $y2 = $top;
46
+ $x1 = 25;
47
+ $x2 = $x1 + $width;
48
+ //coordinates after transformation are rounded by Zend
49
+ $page->drawImage($image, $x1, $y1, $x2, $y2);
50
+
51
+ $this->y = $y1 - 10;
52
+ }
53
+ }
54
+ }
55
+ public function getPdf($invoice){
56
+
57
+ $order = $invoice->getOrder();
58
+ $pdf = new Zend_Pdf();
59
+ $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
60
+
61
+ $this->insertLogo($page, $invoice->getStore());
62
+
63
+ $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_ROMAN);
64
+
65
+ define('FONT_SIZE' , 11);
66
+ define('MARGIN_LEFT' , 40);
67
+ define('MARGIN_TOP' , 40);
68
+ define('COL_WIDTH' , 100);
69
+ define('COL_LEFT_MARGIN', 10);
70
+ define('COL_SEPARATOR' , '|');
71
+ define('ROW_HEIGHT' , 20);
72
+
73
+ $row = 1;
74
+ $x = MARGIN_LEFT;
75
+ $top = $this->y;
76
+ $page->setFont($font, FONT_SIZE);
77
+
78
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
79
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
80
+ $page->drawRectangle(25, $top, 570, $top - 55);
81
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
82
+
83
+
84
+ $incrementId = $order->getInvoiceCollection()->getFirstItem()->getIncrementId();
85
+
86
+ $page->drawText(Mage::helper('sales')->__('Packingslip #%1$s', $incrementId), 35, ($top -= 15), 'UTF-8');
87
+ $page->drawText(Mage::helper('sales')->__('Order #%1$s',$order->getRealOrderId()),35,($top -= 18),'UTF-8');
88
+ $page->drawText(
89
+ Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate(
90
+ $order->getCreatedAtStoreDate(), 'medium', false
91
+ )
92
+ ,35,($top -= 16),'UTF-8');
93
+
94
+ $top -= 10;
95
+ $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
96
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
97
+ $page->setLineWidth(0.5);
98
+ $page->drawRectangle(25, $top, 275, ($top - 25));
99
+ $page->drawRectangle(275, $top, 570, ($top - 25));
100
+
101
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
102
+ $page->drawText(Mage::helper('sales')->__('Sold to:'), 35, ($top - 15), 'UTF-8');
103
+
104
+
105
+ $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
106
+ ->setIsSecureMode(true)
107
+ ->toPdf();
108
+
109
+ $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
110
+ $payment = explode('{{pdf_row_separator}}', $paymentInfo);
111
+ foreach ($payment as $key=>$value){
112
+ if (strip_tags(trim($value)) == '') {
113
+ unset($payment[$key]);
114
+ }
115
+ }
116
+ reset($payment);
117
+
118
+ if (!$order->getIsVirtual()) {
119
+ $page->drawText(Mage::helper('sales')->__('Ship to:'), 285, ($top - 15), 'UTF-8');
120
+ }else{
121
+ $page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, ($top - 15), 'UTF-8');
122
+
123
+ }
124
+ $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
125
+
126
+ $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
127
+ $addressesHeight = $this->_calcAddressHeight($billingAddress);
128
+
129
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
130
+ $page->drawRectangle(25, ($top - 25), 570, $top - 33 - $addressesHeight);
131
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
132
+ $this->y = $top - 40;
133
+ $addressesStartY = $this->y;
134
+
135
+ if ($order->getIsVirtual()) {
136
+ foreach ($payment as $value){
137
+ if (trim($value) != '') {
138
+ //Printing "Payment Method" lines
139
+ $value = preg_replace('/<br[^>]*>/i', "\n", $value);
140
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
141
+ $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
142
+ // $top -= 15;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ foreach ($billingAddress as $value){
149
+ if ($value !== '') {
150
+ $text = array();
151
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
152
+ $text[] = $_value;
153
+ }
154
+ foreach ($text as $part) {
155
+ $page->drawText(strip_tags($part), 35, $this->y, 'UTF-8');
156
+ $this->y -= 15;
157
+ }
158
+ }
159
+ }
160
+
161
+ if (!$order->getIsVirtual()) {
162
+ $this->y = $addressesStartY;
163
+ foreach ($shippingAddress as $value){
164
+ if ($value!=='') {
165
+ $text = array();
166
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
167
+ $text[] = $_value;
168
+ }
169
+ foreach ($text as $part) {
170
+ $page->drawText(strip_tags(ltrim($part)), 285, $this->y, 'UTF-8');
171
+ $this->y -= 15;
172
+ }
173
+ }
174
+ }
175
+
176
+ $addressesEndY = $this->y;
177
+ $addressesEndY = min($addressesEndY, $this->y);
178
+ $this->y = $addressesEndY;
179
+ $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
180
+ $page->setLineWidth(0.5);
181
+ $page->drawRectangle(25, $this->y, 275, $this->y-25);
182
+ $page->drawRectangle(275, $this->y, 570, $this->y-25);
183
+ $this->y -= 15;
184
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
185
+ }
186
+
187
+
188
+
189
+ if (!$order->getIsVirtual()) {
190
+ $page->drawText(Mage::helper('sales')->__('Payment Method'), 35, $this->y, 'UTF-8');
191
+ $page->drawText(Mage::helper('sales')->__('Shipping Method'), 285, $this->y , 'UTF-8');
192
+ $this->y -=10;
193
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
194
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
195
+ }
196
+ $paymentLeft = 35;
197
+ $yPayments = $this->y - 15;
198
+
199
+ if (!$order->getIsVirtual()) {
200
+ foreach ($payment as $value){
201
+ if (trim($value) != '') {
202
+ //Printing "Payment Method" lines
203
+ $value = preg_replace('/<br[^>]*>/i', "\n", $value);
204
+ foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
205
+ $page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8');
206
+ $yPayments -= 15;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ $topMargin = 0;
212
+ $methodStartY = $this->y;
213
+ $this->y -= 15;
214
+
215
+
216
+ if (!$order->getIsVirtual()) {
217
+ /* Shipping Address */
218
+ $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
219
+
220
+ $shippingMethod = $order->getShippingDescription();
221
+
222
+ $totalShippingChargesText = Mage::helper('sales')->__($shippingMethod);
223
+
224
+ foreach (Mage::helper('core/string')->str_split($totalShippingChargesText, 55, true, true) as $_value)
225
+ {
226
+ $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
227
+ $this->y -= 15;
228
+ }
229
+ $yShipments = $this->y;
230
+ $yShipments -= $topMargin + 10;
231
+ $currentY = min($yPayments, $yShipments);
232
+ $shippingText = Mage::helper('sales')->__("Total Shiping Charges (%s)", strip_tags($order->formatPrice($order->getShippingAmount())));
233
+ if($order->getShippingMethod() == 'marketplaceproductshipping_marketplaceproductshipping')
234
+ {
235
+ $shippingAmount = Mage::helper('marketplace')->getSellerPriceFormatAttribute($order,$strong = false, $separator = '<br/>');
236
+ $shippingText = Mage::helper('sales')->__("Total Shiping Charges (%s)",strip_tags($shippingAmount));
237
+ }
238
+ foreach (Mage::helper('core/string')->str_split($shippingText, 55, true, true) as $_value)
239
+ {
240
+ $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
241
+ $this->y -= 15;
242
+ }
243
+ $yShipments = $this->y;
244
+ $yShipments -= $topMargin + 10;
245
+ $currentY = min($yPayments, $yShipments);
246
+
247
+ // replacement of Shipments-Payments rectangle block
248
+ $page->drawLine(25, $methodStartY, 25, $currentY); //left
249
+ $page->drawLine(25, $currentY, 570, $currentY); //bottom
250
+ $page->drawLine(570, $currentY, 570, $methodStartY); //right
251
+
252
+ $this->y = $currentY;
253
+ $this->y -= 15;
254
+ }
255
+
256
+ $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
257
+ $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
258
+ $page->setLineWidth(0.5);
259
+ $page->drawRectangle(25, $this->y, 570, $this->y -25);
260
+ $this->y -= 10;
261
+ $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
262
+
263
+ $this->y -= 5;
264
+ $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
265
+ $page->drawText(Mage::helper('sales')->__('Qty'), 35, $this->y , 'UTF-8');
266
+ $page->drawText(Mage::helper('sales')->__('Products'), 150, $this->y, 'UTF-8');
267
+ $page->drawText(Mage::helper('sales')->__('SKU'), 450, $this->y , 'UTF-8');
268
+ $this->y -= 35;
269
+
270
+ foreach($invoice->getAllItems() as $invoice)
271
+ {
272
+ $items = $this->_getSellerItemsCollectionFilter($invoice);
273
+ if($items->count() > 0)
274
+ {
275
+ $page->drawText(round($invoice->getQty(),2), 35, $this->y, 'UTF-8'); // QTY
276
+ $oldY = $this->y;
277
+ $this->y = $this->_calcWidthFieldAndPrint($page,$items->getFirstItem()->getName(),$this->y); // Print Products
278
+ $this->_getProductOptions($page,$items->getFirstItem()->getProductOptions(),$this->y,$font);
279
+ $page->drawText($items->getFirstItem()->getSku(), 450, $oldY, 'UTF-8'); // Products
280
+ $this->y -= 35;
281
+ }
282
+ }
283
+ $pdf->pages[] = $page;
284
+ return $pdf;
285
+ }
286
+
287
+ protected function _getSellerItemsCollectionFilter($invoice)
288
+ {
289
+ $sellerId = Mage::getModel('marketplace/seller')->isSeller();
290
+ $itemCollection = Mage::getModel('sales/order_item')->getCollection()
291
+ ->addFieldToFilter('item_id',$invoice->getOrderItemId())
292
+ ->addFieldToFilter('parent_item_id',array('null'=>true))
293
+ ->addFieldToFilter('seller_id',$sellerId);
294
+ return $itemCollection;
295
+ }
296
+ protected function _getProductOptions($page,$options,$y,$font)
297
+ {
298
+ if($options['attributes_info']){
299
+ $page->setFont($font, 8);
300
+ foreach($options['attributes_info'] as $attribute)
301
+ $page->drawText( $attribute['label'] . ":" . $attribute['value'] , 35, $y-15, 'UTF-8');
302
+ }
303
+ }
304
+ protected function _calcWidthFieldAndPrint($page,$productField,$y)
305
+ {
306
+ foreach (Mage::helper('core/string')->str_split($productField, 20, true, true) as $_value)
307
+ {
308
+ $page->drawText($_value, 150, $y, 'UTF-8');
309
+ $y-= 15;
310
+ }
311
+ return $y;
312
+ }
313
+ protected function _calcAddressHeight($address)
314
+ {
315
+ $y = 0;
316
+ foreach ($address as $value){
317
+ if ($value !== '') {
318
+ $text = array();
319
+ foreach (Mage::helper('core/string')->str_split($value, 55, true, true) as $_value) {
320
+ $text[] = $_value;
321
+ }
322
+ foreach ($text as $part) {
323
+ $y += 15;
324
+ }
325
+ }
326
+ }
327
+ return $y;
328
+ }
329
+
330
+ protected function _formatAddress($address)
331
+ {
332
+ $return = array();
333
+ foreach (explode('|', $address) as $str) {
334
+ foreach (Mage::helper('core/string')->str_split($str, 45, true, true) as $part) {
335
+ if (empty($part)) {
336
+ continue;
337
+ }
338
+ $return[] = $part;
339
+ }
340
+ }
341
+ return $return;
342
+ }
343
+ }
344
+
345
+ ?>
app/code/community/Manthan/Marketplace/Model/Rating.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Rating extends Mage_Core_Model_Abstract {
3
+
4
+ const STATUS_ENABLED = 1;
5
+ const STATUS_DISABLED = 0;
6
+
7
+ protected function _construct() {
8
+ $this->_init('marketplace/rating');
9
+ }
10
+
11
+ }
12
+
13
+ ?>
app/code/community/Manthan/Marketplace/Model/Review.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Review extends Mage_Core_Model_Abstract {
3
+
4
+ const STATUS_PENDING = 0;
5
+ const STATUS_APPROVED = 1;
6
+
7
+ protected function _construct() {
8
+ $this->_init('marketplace/review');
9
+ }
10
+ }
11
+
12
+ ?>
app/code/community/Manthan/Marketplace/Model/Seller.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Seller extends Mage_Core_Model_Abstract {
3
+
4
+ const ROLE = 'SELLER';
5
+ const ROLE_TYPE = 'G';
6
+
7
+ protected function _construct() {
8
+ $this->_init('marketplace/seller');
9
+ }
10
+ public function isSeller()
11
+ {
12
+ $userId = Mage::getSingleton('admin/session')->getUser()->getUserId();
13
+ $loggedInRole = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();
14
+ $roleId = Mage::getStoreConfig('marketplace/seller/role');
15
+
16
+ $collection = Mage::getModel('marketplace/seller')->getCollection()
17
+ ->addFieldToFilter('user_id',$userId);
18
+ if($collection->count() > 0)
19
+ return $roleId == $loggedInRole ? $collection->getFirstItem()->getId() : false;
20
+ else
21
+ return null;
22
+
23
+ }
24
+ public function setRole($userModel)
25
+ { $role_id = Mage::getStoreConfig('marketplace/seller/role');
26
+ $userModel->setRoleIds(array($role_id))
27
+ ->setRoleUserId($userModel->getId())
28
+ ->saveRelations();
29
+ return $userModel;
30
+ }
31
+ public function passUserData()
32
+ {
33
+ $userModel = Mage::getModel('admin/user');
34
+ $userModel->setUsername(strtolower(Mage::app()->getRequest()->getPost('username')))
35
+ ->setFirstname(strtolower(Mage::app()->getRequest()->getPost('firstname')))
36
+ ->setLastname(strtolower(Mage::app()->getRequest()->getPost('lastname')))
37
+ ->setPassword(trim(Mage::app()->getRequest()->getPost('password')))
38
+ ->setEmail(strtolower(trim(Mage::app()->getRequest()->getPost('email'))))
39
+ ->setIsActive(0);
40
+ if (Mage::app()->getRequest()->getPost('password', false)) {
41
+ $userModel->setNewPassword(Mage::app()->getRequest()->getPost('password', false));
42
+ }
43
+ if (Mage::app()->getRequest()->getPost('confirmation', false)) {
44
+ $userModel->setPasswordConfirmation(Mage::app()->getRequest()->getPost('confirmation', false));
45
+ }
46
+ return $userModel;
47
+ }
48
+ public function saveData($user_id)
49
+ {
50
+ $data = Mage::app()->getRequest()->getPost();
51
+ $this->setShopName($data['shop_name']);
52
+ $this->setCreatedDate(Mage::getModel('core/date')->timestamp(time()));
53
+ $this->setShopDescription($data['shop_description']);
54
+ $this->setCountry($data['country']);
55
+ $this->setTelephone($data['telephone']);
56
+ $this->setUserId($user_id);
57
+ $this->setPostcode($data['postcode']);
58
+ $this->setUrlPath(str_replace(" ","-",strtolower(trim($data['shop_url']))));
59
+ $this->setTotalVendorEarn(0);
60
+ $this->save();
61
+ }
62
+ public function validate()
63
+ {
64
+ $errors = false;
65
+ if ($this->isShopUrlExist()) {
66
+ $errors = Mage::helper('marketplace')->__('Seller with this shop url already exist.');
67
+ }
68
+ return $errors;
69
+ }
70
+ public function isShopUrlExist()
71
+ {
72
+ $shop_url = strtolower(trim(Mage::app()->getRequest()->getPost('shop_url')));
73
+
74
+ $collection = Mage::getModel('marketplace/seller')->getCollection()
75
+ ->addFieldToFilter('url_path',str_replace(" ","-",$shop_url));
76
+ if($collection->count() > 0){
77
+ return true;
78
+ }
79
+ return false;
80
+ }
81
+ public function sendSellerActivationMail($data,$userId)
82
+ {
83
+ $templateId = Mage::getStoreConfig('marketplace/vendor_activation_email/email_template');
84
+ $identity = Mage::getStoreConfig('marketplace/vendor_activation_email/email_sender');
85
+ $this->sendSellerEmail($templateId, $identity, $data);
86
+ }
87
+ public function sendEmailToSeller($templateId, $identity, $vars)
88
+ {
89
+ $senderEmail = Mage::getStoreConfig('trans_email/ident_' . $identity . '/email');
90
+ $sender = array('name' => $_SERVER['HTTP_HOST'] , 'email' => $senderEmail);
91
+ $recepientEmail = $vars['email'];
92
+ $recepientName = $vars['firstname'] . ' ' . $vars['lastname'] ;
93
+ $storeId = Mage::app()->getStore()->getId();
94
+
95
+ $translate = Mage::getSingleton('core/translate');
96
+ Mage::getModel('core/email_template')->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
97
+ $translate->setTranslateInline(true);
98
+ }
99
+ public function sendSellerEmail($templateId, $identity, $vars)
100
+ {
101
+ $senderName = Mage::getStoreConfig('trans_email/ident_' . $identity . '/name');
102
+
103
+ $senderEmail = Mage::getStoreConfig('trans_email/ident_' . $identity . '/email');
104
+ $sender = array('name' => $_SERVER['HTTP_HOST'] , 'email' => $senderEmail);
105
+ $recepientEmail = $vars['email'];
106
+ $recepientName = $vars['firstname'] . ' ' . $vars['lastname'];
107
+ $storeId = Mage::app()->getStore()->getId();
108
+
109
+ $translate = Mage::getSingleton('core/translate');
110
+ Mage::getModel('core/email_template')->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
111
+
112
+ $translate->setTranslateInline(true);
113
+ }
114
+ public function sendSellerRegistrationConfirmationEmailToSeller($data,$sellerId)
115
+ {
116
+ $identity = Mage::getStoreConfig('marketplace/registration_confirmation_email/email_sender');
117
+ $templateId = Mage::getStoreConfig('marketplace/registration_confirmation_email/email_template');
118
+ $this->sendEmailToSeller($templateId, $identity, $data);
119
+ }
120
+ public function sendSellerRegistrationEmailToAdmin($data, $sellerId)
121
+ {
122
+ $templateId = Mage::getStoreConfig('marketplace/vendor_registration_email/email_template');
123
+ $identity = Mage::getStoreConfig('marketplace/vendor_registration_email/email_receiver');
124
+
125
+ $country = Mage::getModel('directory/country')->loadByCode($data['country']);
126
+
127
+ $data['country'] = $country->getName();
128
+ $data['telephone'] = $data['telephone'];
129
+ $data['seller_email_id'] = $data['email'];
130
+ $data['seller_url'] = Mage::helper('adminhtml')->getUrl('admin_marketplace/adminhtml_account/edit', array('id'=> $sellerId));
131
+
132
+ $this->sendEmail($templateId, $identity, $data);
133
+ }
134
+
135
+ public function sendEmail($templateId, $identity, $vars)
136
+ {
137
+ $recepientName = Mage::getStoreConfig('trans_email/ident_' . $identity . '/name');
138
+ $recepientEmail = Mage::getStoreConfig('trans_email/ident_' . $identity . '/email');
139
+ $sender = array('name' => $vars['firstname'] . ' ' . $vars['lastname'], 'email' => $vars['seller_email_id']);
140
+
141
+ $storeId = Mage::app()->getStore()->getId();
142
+
143
+ $translate = Mage::getSingleton('core/translate');
144
+ Mage::getModel('core/email_template')->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
145
+
146
+ $translate->setTranslateInline(true);
147
+ }
148
+
149
+ public function getSellerShippingPrice($order,$sellerId)
150
+ {
151
+ $itemsCollection = Mage::getModel('sales/order_item')->getCollection()
152
+ ->addFieldToFilter('order_id',$order->getId())
153
+ ->addFieldToFilter('parent_item_id',array('null'=>true))
154
+ ->addFieldToFilter('seller_id',$sellerId);
155
+ $itemsCollection ->getSelect()
156
+ ->columns('SUM(seller_per_product_shipping) as seller_shipping_total')
157
+ ->group('seller_id');
158
+
159
+ return $itemsCollection->getFirstItem()->getSellerShippingTotal();
160
+ }
161
+ }
162
+
163
+ ?>
app/code/community/Manthan/Marketplace/Model/Sellerrate.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Sellerrate extends Mage_Core_Model_Abstract {
3
+
4
+ protected function _construct() {
5
+ $this->_init('marketplace/sellerrate');
6
+ }
7
+
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/Model/System/Config/Role.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_System_Config_Role
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('marketplace/system_config_role');
7
+ }
8
+
9
+ public function toOptionArray()
10
+ {
11
+ $roleArray = array();
12
+ $roleCollection = Mage::getModel('admin/roles')->getCollection();
13
+
14
+ foreach($roleCollection as $role)
15
+ $roleArray[] = array('value' => $role->getId(), 'label' => $role->getRoleName());
16
+
17
+ return $roleArray;
18
+ }
19
+ }
20
+ ?>
app/code/community/Manthan/Marketplace/Model/Vendorproduct.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Model_Vendorproduct extends Mage_Core_Model_Abstract {
3
+
4
+ protected function _construct() {
5
+ $this->_init('marketplace/vendorproduct');
6
+ }
7
+
8
+ }
9
+
10
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/AccountController.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_AccountController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()->_setActiveMenu('manthan');
6
+ return $this;
7
+ }
8
+ public function indexAction()
9
+ {
10
+ $this->_initAction();
11
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Sellers/Marketplace'));
12
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_seller_account'));
13
+ $this->renderLayout();
14
+ }
15
+ public function gridAction()
16
+ {
17
+ $this->getResponse()->setBody(
18
+ Mage::app()->getLayout()->createBlock('marketplace/adminhtml_seller_account_product_grid')->toHtml()
19
+ );
20
+ }
21
+ public function editAction()
22
+ {
23
+ $id = $this->getRequest()->getParam('id');
24
+ $sellerObject = Mage::getModel('marketplace/seller')->load($id);
25
+ $userObject = Mage::getModel('admin/user')->load($sellerObject->getUserId());
26
+ if ($sellerObject->getId() || $id == 0)
27
+ {
28
+ Mage::register('seller_data', $sellerObject);
29
+ Mage::register('user_data', $userObject);
30
+ $this->_initAction();
31
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
32
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_seller_account_edit'))
33
+ ->_addLeft($this->getLayout()->createBlock('marketplace/adminhtml_seller_account_edit_tabs'));
34
+ $this->renderLayout();
35
+ }
36
+ else
37
+ {
38
+ Mage::getSingleton('adminhtml/session')
39
+ ->addError('Account does not exist');
40
+ $this->_redirect('*/*/');
41
+ }
42
+ }
43
+
44
+ public function newAction()
45
+ {
46
+ $this->_forward('edit');
47
+ }
48
+
49
+ public function saveAction() {
50
+ $sellerId = $this->getRequest()->getParam('id');
51
+ $seller = Mage::getModel('marketplace/seller')->load($sellerId);
52
+
53
+ $shop_url = strtolower(trim($this->getRequest()->getParam('shop_url')));
54
+
55
+ $userId = $seller->getUserId();
56
+ $user = Mage::getModel("admin/user")->load($userId);
57
+ $beforeSaveActiveStatus = $user->getIsActive();
58
+ if(!$sellerId)
59
+ {
60
+ $user = Mage::getModel("admin/user");
61
+ $userId = null;
62
+ $beforeSaveActiveStatus = null;
63
+ }
64
+
65
+ $user->setId($userId)
66
+ ->setUsername($this->getRequest()->getParam('username', false))
67
+ ->setFirstname($this->getRequest()->getParam('firstname', false))
68
+ ->setLastname($this->getRequest()->getParam('lastname', false))
69
+ ->setEmail(strtolower($this->getRequest()->getParam('email', false)))
70
+ ->setIsActive($this->getRequest()->getParam('is_active', false));
71
+ if ( $this->getRequest()->getParam('new_password', false) ) {
72
+ $user->setNewPassword($this->getRequest()->getParam('new_password', false));
73
+ }
74
+
75
+ if ($this->getRequest()->getParam('password_confirmation', false)) {
76
+ $user->setPasswordConfirmation($this->getRequest()->getParam('password_confirmation', false));
77
+ }
78
+ $data = $this->getRequest()->getPost();
79
+ $resultSeller = Mage::getModel('marketplace/seller')->validate();
80
+ if ($resultSeller) {
81
+ Mage::getSingleton('adminhtml/session')->setSellerData($data);
82
+ Mage::getSingleton('adminhtml/session')->addError($resultSeller);
83
+ $this->getResponse()->setRedirect($this->getUrl("*/*/edit"));
84
+ return $this;
85
+ }
86
+ $result = $user->validate();
87
+ if (is_array($result)) {
88
+ foreach($result as $error) {
89
+ Mage::getSingleton('adminhtml/session')->addError($error);
90
+ }
91
+ Mage::getSingleton('adminhtml/session')->setSellerData($data);
92
+ $this->getResponse()->setRedirect($this->getUrl("*/*/edit"));
93
+ return;
94
+ }
95
+
96
+ try {
97
+ $user->save();
98
+ $userId = $user->getId();
99
+ $user = Mage::getModel('marketplace/seller')->setRole($user);
100
+
101
+ $isActive = $this->getRequest()->getParam('is_active', false);
102
+
103
+ if($isActive != $beforeSaveActiveStatus && $isActive == 1)
104
+ {
105
+ if(Mage::getStoreConfig('marketplace/vendor_activation_email/active_vendor_email'))
106
+ Mage::getModel('marketplace/seller')->sendSellerActivationMail($this->getRequest()->getPost(),$userId);
107
+ }
108
+ if ($data)
109
+ {
110
+ $dir_path = Mage::getBaseDir('media') . DS . 'marketplace' . DS . 'seller' . DS . 'images' . DS;
111
+
112
+ if(isset($_FILES['image']['name']) && $_FILES['image']['name'] != '')
113
+ {
114
+ try
115
+ {
116
+ $uploader = new Varien_File_Uploader('image');
117
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
118
+ $uploader->setAllowRenameFiles(true);
119
+ $uploader->setFilesDispersion(false);
120
+
121
+ if(!is_dir($dir_path))
122
+ mkdir($dir_path, 0777, true);
123
+
124
+ $uploader->save($dir_path, $_FILES['image']['name']);
125
+ $image = $_FILES['image']['name'];
126
+ }
127
+ catch (Exception $e)
128
+ {
129
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
130
+ }
131
+ }
132
+
133
+
134
+
135
+ if(isset($data['image']['delete']) && $data['image']['delete'] == 1 && empty($_FILES['image']['name']) )
136
+ {
137
+ unlink($dir_path . $data['delete_profile_image']);
138
+ $seller->setImage(null);
139
+ }
140
+ else if(isset($data['image']['delete']) && $data['image']['delete'] == 1 && $_FILES['image']['name']!= '' )
141
+ {
142
+ unlink($dir_path . $data['delete_profile_image']);
143
+ $seller->setImage($image);
144
+ }
145
+ else if($_FILES['image']['name']!= '') {
146
+ $seller->setImage($image);
147
+ }
148
+
149
+ $seller->setShopName($data['shop_name']);
150
+ $seller ->setShopDescription($data['shop_description']);
151
+ $seller ->setCountry($data['country']);
152
+ $seller ->setPostcode($data['postcode']);
153
+ $seller ->setTelephone($data['telephone'],false);
154
+ $seller ->setUserId($user->getUserId());
155
+
156
+ if(isset($data['shop_url']))
157
+ $seller ->setUrlPath($data['shop_url']);
158
+
159
+ if(!$sellerId)
160
+ $seller ->setCreatedDate(Mage::getModel('core/date')->timestamp(time()));
161
+
162
+ $seller->setAdminCommissionByPercentage($data['admin_commission_by_percentage']);
163
+ $seller->save();
164
+ }
165
+
166
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The account has been saved.'));
167
+ }
168
+ catch (Mage_Core_Exception $e) {
169
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
170
+ }
171
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
172
+ }
173
+ }
174
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/Admin/IndexController.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/controllers/IndexController.php';
3
+ class Manthan_Marketplace_Adminhtml_Admin_IndexController extends Mage_Adminhtml_IndexController
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $session = Mage::getSingleton('admin/session');
9
+ $url = $session->getUser()->getStartupPageUrl();
10
+ if ($session->isFirstPageAfterLogin()) {
11
+ // retain the "first page after login" value in session (before redirect)
12
+ $session->setIsFirstPageAfterLogin(true);
13
+ }
14
+ if(Mage::getModel('marketplace/seller')->isSeller())
15
+ $url= 'admin_marketplace/adminhtml_dashboard/index';
16
+ $this->_redirect($url);
17
+ }
18
+ }
app/code/community/Manthan/Marketplace/controllers/Adminhtml/Admin/System/AccountController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/controllers/System/AccountController.php';
3
+
4
+ class Manthan_Marketplace_Adminhtml_Admin_System_AccountController extends Mage_Adminhtml_System_AccountController
5
+ {
6
+ public function saveAction()
7
+ {
8
+ $userId = Mage::getSingleton('admin/session')->getUser()->getId();
9
+ $pwd = null;
10
+
11
+ $user = Mage::getModel("admin/user")->load($userId);
12
+
13
+ $user->setId($userId)
14
+ ->setUsername($this->getRequest()->getParam('username', false))
15
+ ->setFirstname($this->getRequest()->getParam('firstname', false))
16
+ ->setLastname($this->getRequest()->getParam('lastname', false))
17
+ ->setEmail(strtolower($this->getRequest()->getParam('email', false)));
18
+ if ( $this->getRequest()->getParam('new_password', false) ) {
19
+ $user->setNewPassword($this->getRequest()->getParam('new_password', false));
20
+ }
21
+
22
+ if ($this->getRequest()->getParam('password_confirmation', false)) {
23
+ $user->setPasswordConfirmation($this->getRequest()->getParam('password_confirmation', false));
24
+ }
25
+
26
+ $result = $user->validate();
27
+ if (is_array($result)) {
28
+ foreach($result as $error) {
29
+ Mage::getSingleton('adminhtml/session')->addError($error);
30
+ }
31
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
32
+ return;
33
+ }
34
+
35
+ try {
36
+ $user->save();
37
+
38
+ $roleId = Mage::getStoreConfig('marketplace/seller/role');
39
+ $currentRoleId = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();
40
+
41
+ if($roleId == $currentRoleId)
42
+ {
43
+ if ($data = $this->getRequest()->getPost())
44
+ {
45
+ $dir_path = Mage::getBaseDir('media') . DS . 'marketplace' . DS . 'seller' . DS . 'images' . DS;
46
+
47
+ if(isset($_FILES['image']['name']) && $_FILES['image']['name'] != '')
48
+ {
49
+ try
50
+ {
51
+ $uploader = new Varien_File_Uploader('image');
52
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
53
+ $uploader->setAllowRenameFiles(true);
54
+ $uploader->setFilesDispersion(false);
55
+
56
+ if(!is_dir($dir_path))
57
+ mkdir($dir_path, 0777, true);
58
+
59
+ $uploader->save($dir_path, $_FILES['image']['name']);
60
+ $image = $_FILES['image']['name'];
61
+ }
62
+ catch (Exception $e)
63
+ {
64
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
65
+ }
66
+ }
67
+
68
+ $seller = Mage::getModel('marketplace/seller')->load($this->getRequest()->getParam('seller_id'));
69
+
70
+ if(isset($data['image']['delete']) && $data['image']['delete'] == 1 && empty($_FILES['image']['name']) )
71
+ {
72
+ unlink($dir_path . $data['delete_profile_image']);
73
+ $seller->setImage(null);
74
+ }
75
+ else if(isset($data['image']['delete']) && $data['image']['delete'] == 1 && $_FILES['image']['name']!= '' )
76
+ {
77
+ unlink($dir_path . $data['delete_profile_image']);
78
+ $seller->setImage($image);
79
+ }
80
+ else if($_FILES['image']['name']!= '') {
81
+ $seller->setImage($image);
82
+ }
83
+ $seller->setShopName($this->getRequest()->getParam('shop_name'))
84
+ ->setShopDescription($this->getRequest()->getParam('shop_description'))
85
+ ->setCountry($this->getRequest()->getParam('country'))
86
+ ->setpostcode($this->getRequest()->getParam('postcode'))
87
+ ->setTelephone($this->getRequest()->getParam('telephone'))
88
+ ->setUserId($userId)
89
+ ->setAdminCommissionByPercentage($this->getRequest()->getParam('admin_commission_by_percentage'))
90
+ ->save();
91
+ }
92
+ }
93
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The account has been saved.'));
94
+ }
95
+ catch (Mage_Core_Exception $e) {
96
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
97
+ }
98
+ catch (Exception $e) {
99
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('An error occurred while saving account.'));
100
+ }
101
+ $this->getResponse()->setRedirect($this->getUrl("*/*/"));
102
+ }
103
+
104
+ }
105
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/DashboardController.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_DashboardController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction()
5
+ {
6
+ $this->_title($this->__('Dashboard'));
7
+ $this->loadLayout()->_setActiveMenu('seller_dashboard');
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_initAction();
13
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_seller_dashboard_info'));
14
+ $this->renderLayout();
15
+ }
16
+ protected function _isAllowed()
17
+ {
18
+ return Mage::getSingleton('admin/session')->isAllowed('admin/seller');
19
+ }
20
+ }
21
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/OrderController.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()->_setActiveMenu('seller');
6
+ return $this;
7
+ }
8
+ public function indexAction()
9
+ {
10
+ $this->_initAction();
11
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order'));
12
+ $this->renderLayout();
13
+ }
14
+
15
+ public function viewAction() {
16
+ $id = $this->getRequest()->getParam('order_id');
17
+
18
+ if (!empty($id))
19
+ {
20
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
21
+ Mage::register('current_order', Mage::getModel('sales/order')->load($id));
22
+ $this->_initAction();
23
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order_edit'));
24
+ $this->renderLayout();
25
+ } else {
26
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('Item does not exist'));
27
+ $this->_redirect('*/*/');
28
+ }
29
+ }
30
+ public function invoiceAction()
31
+ {
32
+ $orderId = $this->getRequest()->getParam('order_id');
33
+ $order = Mage::getModel('sales/order')->load($orderId);
34
+ if(!$order->hasInvoices())
35
+ {
36
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('you can see invoice details after invoice created by Admin'));
37
+ $this->_redirect('*/*/view',array('order_id'=>$orderId));
38
+ return;
39
+ }
40
+
41
+ if (!empty($orderId))
42
+ {
43
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
44
+ Mage::register('current_order',$order);
45
+ $this->_initAction();
46
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_order_edit'));
47
+ $this->renderLayout();
48
+ } else {
49
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('Item does not exist'));
50
+ $this->_redirect('*/*/');
51
+ }
52
+ }
53
+ public function printAction()
54
+ {
55
+ if ($invoiceId = $this->getRequest()->getParam('invoice_id')) {
56
+ if ($invoice = Mage::getModel('sales/order_invoice')->load($invoiceId)) {
57
+ $pdf = Mage::getModel('marketplace/pdf_invoice')->getPdf($invoice);
58
+ $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
59
+ '.pdf', $pdf->render(), 'application/pdf');
60
+ }
61
+ }
62
+ else{
63
+ $this->_forward('noRoute');
64
+ }
65
+ }
66
+
67
+ public function PackingslipAction()
68
+ {
69
+ if ($invoiceId = $this->getRequest()->getParam('invoice_id')) {
70
+ if ($invoice = Mage::getModel('sales/order_invoice')->load($invoiceId)) {
71
+ $pdf = Mage::getModel('marketplace/pdf_shipment_packing')->getPdf($invoice);
72
+ $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
73
+ '.pdf', $pdf->render(), 'application/pdf');
74
+ }
75
+ }
76
+ else{
77
+ $this->_forward('noRoute');
78
+ }
79
+ }
80
+ protected function _isAllowed()
81
+ {
82
+ return true;
83
+ }
84
+
85
+ }
86
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/PaymentController.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_PaymentController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction() {
5
+ if(Mage::getModel('marketplace/seller')->isSeller())
6
+ $this->loadLayout()->_setActiveMenu('seller');
7
+ else
8
+ $this->loadLayout()->_setActiveMenu('manthan');
9
+ return $this;
10
+ } public function indexAction()
11
+ {
12
+ $this->_initAction();
13
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Transaction/Marketplace'));
14
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_payment'));
15
+ $this->renderLayout();
16
+ }
17
+ public function editAction()
18
+ {
19
+ $paymentId = $this->getRequest()->getParam('id');
20
+ $payment = Mage::getModel('marketplace/payment')->load($paymentId);
21
+
22
+ if ($payment->getId() || $paymentId == 0)
23
+ {
24
+ Mage::register('payment_data', $payment);
25
+ $this->_initAction();
26
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_payment_edit'));
27
+ $this->renderLayout();
28
+ }
29
+ else
30
+ {
31
+ Mage::getSingleton('adminhtml/session')->addError('Payment does not exist');
32
+ $this->_redirect('*/*/');
33
+ }
34
+ }
35
+
36
+ public function newAction()
37
+ {
38
+ $this->_forward('edit');
39
+ }
40
+
41
+ public function saveAction()
42
+ {
43
+ if ($postData = $this->getRequest()->getPost())
44
+ {
45
+ try
46
+ {
47
+ $payment = Mage::getModel('marketplace/Payment');
48
+ if($postData['admin_amount'] == 0)
49
+ {
50
+ $payment
51
+ ->setPaymentNote($postData['payment_note'])
52
+ ->setPaymentDate($postData['payment_date'])
53
+ ->setId($this->getRequest()->getParam('id'))
54
+ ->save();
55
+ Mage::getSingleton('adminhtml/session')->addSuccess('Payment has been successfully saved');
56
+ $this->_redirect('*/*/');
57
+ return;
58
+ }
59
+
60
+ $payment
61
+ ->setSellerPaidAmount($postData['admin_amount'])
62
+ ->setAdminAmount(0)
63
+ ->setPaymentNote($postData['payment_note'])
64
+ ->setPaymentDate($postData['payment_date'])
65
+ ->setId($this->getRequest()->getParam('id'))
66
+ ->save();
67
+ $seller = Mage::getModel('marketplace/seller')->load($postData['seller_id']);
68
+ $sellerAmount = $seller->getTotalVendorEarn();
69
+ $totalVendorEarn = $sellerAmount + $postData['admin_amount'];
70
+
71
+ $order = Mage::getModel('sales/order')->loadByIncrementId($postData['order_id']);
72
+ $collection = Mage::getModel('sales/order_item')->getCollection()
73
+ ->addFieldToFilter('order_id',$order->getId())
74
+ ->addFieldToFilter('seller_id',$postData['seller_id']);
75
+ $currentAdminCommissionAmount = 0;
76
+ foreach($collection as $_item)
77
+ {
78
+ $currentAdminCommissionAmount+=($_item->getAdminOrderCommission() * $_item->getRowTotalInclTax())/100;
79
+ }
80
+
81
+ $seller->setTotalVendorEarn($totalVendorEarn);
82
+
83
+ $adminAmount = $seller->getAdminTotalEarn();
84
+ $totalAdminEarn = $adminAmount + $currentAdminCommissionAmount;
85
+ $seller->setAdminTotalEarn($totalAdminEarn);
86
+ $seller->save();
87
+ Mage::getSingleton('adminhtml/session')->addSuccess('Payment has been successfully saved');
88
+ $this->_redirect('*/*/');
89
+ return;
90
+ }
91
+ catch (Exception $e)
92
+ {
93
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
94
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
95
+ return;
96
+ }
97
+ }
98
+ $this->_redirect('*/*/');
99
+ }
100
+
101
+ public function deleteAction()
102
+ {
103
+ if($this->getRequest()->getParam('id') > 0)
104
+ {
105
+ try
106
+ {
107
+ $ratingModel = Mage::getModel('marketplace/review');
108
+ $ratingModel->setId($this->getRequest()->getParam('id'))->delete();
109
+ Mage::getSingleton('adminhtml/session')->addSuccess('successfully deleted');
110
+ $this->_redirect('*/*/');
111
+ }
112
+ catch (Exception $e)
113
+ {
114
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
115
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
116
+ }
117
+ }
118
+ $this->_redirect('*/*/');
119
+ }
120
+ public function massStatusAction() {
121
+ $Ids = $this->getRequest()->getParam('id');
122
+ $status = $this->getRequest()->getParam('review_status');
123
+ if (!is_array($Ids) && empty($status))
124
+ {
125
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('Please select record(s).'));
126
+ }
127
+ else
128
+ {
129
+ try{
130
+ $review = Mage::getModel('marketplace/review');
131
+ foreach ($Ids as $id) {
132
+ $review->load($id);
133
+ $review->setStatus($status);
134
+ $review->save();
135
+ }
136
+ Mage::getSingleton('adminhtml/session')->addSuccess(
137
+ Mage::helper('adminhtml')->__(
138
+ 'Total of %d status(es) were changed.', count($Ids)
139
+ )
140
+ );
141
+ $this->_redirect('*/*/');
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ }
145
+ }
146
+ }
147
+ protected function _isAllowed()
148
+ {
149
+ return true;
150
+ }
151
+ }
152
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/RatingController.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_RatingController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()->_setActiveMenu('manthan');
6
+ return $this;
7
+ }
8
+ public function indexAction()
9
+ {
10
+ $this->_initAction();
11
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Ratings/Marketplace'));
12
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_rating'));
13
+ $this->renderLayout();
14
+ }
15
+ public function editAction()
16
+ {
17
+ $ratingId = $this->getRequest()->getParam('id');
18
+ $ratingModel = Mage::getModel('marketplace/rating')->load($ratingId);
19
+
20
+ if ($ratingModel->getId() || $ratingId == 0)
21
+ {
22
+ Mage::register('rating_data', $ratingModel);
23
+ $this->_initAction();
24
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_rating_edit'));
25
+ $this->renderLayout();
26
+ }
27
+
28
+ else
29
+ {
30
+ Mage::getSingleton('adminhtml/session')
31
+ ->addError('Rating does not exist');
32
+ $this->_redirect('*/*/');
33
+ }
34
+ }
35
+
36
+ public function newAction()
37
+ {
38
+ $this->_forward('edit');
39
+ }
40
+
41
+ public function saveAction()
42
+ {
43
+ if ($postData = $this->getRequest()->getPost())
44
+ {
45
+ try
46
+ {
47
+ $ratingModel = Mage::getModel('marketplace/rating');
48
+ $ratingModel
49
+ ->addData($postData)
50
+ ->setId($this->getRequest()->getParam('id'))
51
+ ->save();
52
+ Mage::getSingleton('adminhtml/session')->addSuccess('successfully saved');
53
+ Mage::getSingleton('adminhtml/session')->setratingData(false);
54
+ $this->_redirect('*/*/');
55
+ return;
56
+ }
57
+ catch (Exception $e)
58
+ {
59
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
60
+ Mage::getSingleton('adminhtml/session')->setratingData($this->getRequest()->getPost());
61
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
62
+ return;
63
+ }
64
+ }
65
+ $this->_redirect('*/*/');
66
+ }
67
+
68
+ public function deleteAction()
69
+ {
70
+ if($this->getRequest()->getParam('id') > 0)
71
+ {
72
+ try
73
+ {
74
+ $ratingModel = Mage::getModel('marketplace/rating');
75
+ $ratingModel->setId($this->getRequest()->getParam('id'))->delete();
76
+ Mage::getSingleton('adminhtml/session')->addSuccess('successfully deleted');
77
+ $this->_redirect('*/*/');
78
+ }
79
+ catch (Exception $e)
80
+ {
81
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
82
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
83
+ }
84
+ }
85
+ $this->_redirect('*/*/');
86
+ }
87
+ protected function _isAllowed()
88
+ {
89
+ return true;
90
+ }
91
+ }
92
+ ?>
app/code/community/Manthan/Marketplace/controllers/Adminhtml/ReviewController.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_Adminhtml_ReviewController extends Mage_Adminhtml_Controller_Action {
3
+
4
+ protected function _initAction() {
5
+ if(Mage::getModel('marketplace/seller')->isSeller())
6
+ $this->loadLayout()->_setActiveMenu('seller');
7
+ else
8
+ $this->loadLayout()->_setActiveMenu('manthan');
9
+ return $this;
10
+ }
11
+ public function indexAction()
12
+ {
13
+ $this->_initAction();
14
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Reviews/Marketplace'));
15
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review'));
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $reviewId = $this->getRequest()->getParam('id');
21
+ $reviewModel = Mage::getModel('marketplace/review')->load($reviewId);
22
+
23
+ if ($reviewModel->getId() || $reviewId == 0)
24
+ {
25
+ Mage::register('review_data', $reviewModel);
26
+ $this->_initAction();
27
+ $this->_addContent($this->getLayout()->createBlock('marketplace/adminhtml_review_edit'));
28
+ $this->renderLayout();
29
+ }
30
+ else
31
+ {
32
+ Mage::getSingleton('adminhtml/session')->addError('Review does not exist');
33
+ $this->_redirect('*/*/');
34
+ }
35
+ }
36
+
37
+ public function newAction()
38
+ {
39
+ $this->_forward('edit');
40
+ }
41
+
42
+ public function saveAction()
43
+ {
44
+ if ($postData = $this->getRequest()->getPost())
45
+ {
46
+ try
47
+ {
48
+ $ratingModel = Mage::getModel('marketplace/review');
49
+ $ratingModel
50
+ ->setStatus($postData['status'])
51
+ ->setId($this->getRequest()->getParam('id'))
52
+ ->save();
53
+ Mage::getSingleton('adminhtml/session')->addSuccess('Review has been successfully saved');
54
+ Mage::getSingleton('adminhtml/session')->setreviewData(false);
55
+ $this->_redirect('*/*/');
56
+ return;
57
+ }
58
+ catch (Exception $e)
59
+ {
60
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
61
+ Mage::getSingleton('adminhtml/session')->setreviewData($this->getRequest()->getPost());
62
+ $this->_redirect('*/*/edit',array('id' => $this->getRequest()->getParam('id')));
63
+ return;
64
+ }
65
+ }
66
+ $this->_redirect('*/*/');
67
+ }
68
+
69
+ public function deleteAction()
70
+ {
71
+ if($this->getRequest()->getParam('id') > 0)
72
+ {
73
+ try
74
+ {
75
+ $ratingModel = Mage::getModel('marketplace/review');
76
+ $ratingModel->setId($this->getRequest()->getParam('id'))->delete();
77
+ Mage::getSingleton('adminhtml/session')->addSuccess('successfully deleted');
78
+ $this->_redirect('*/*/');
79
+ }
80
+ catch (Exception $e)
81
+ {
82
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
83
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
84
+ }
85
+ }
86
+ $this->_redirect('*/*/');
87
+ }
88
+ public function massStatusAction() {
89
+ $Ids = $this->getRequest()->getParam('id');
90
+ $status = $this->getRequest()->getParam('review_status');
91
+ if (!is_array($Ids) && empty($status))
92
+ {
93
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('marketplace')->__('Please select record(s).'));
94
+ }
95
+ else
96
+ {
97
+ try{
98
+ $review = Mage::getModel('marketplace/review');
99
+ foreach ($Ids as $id) {
100
+ $review->load($id);
101
+ $review->setStatus($status);
102
+ $review->save();
103
+ }
104
+ Mage::getSingleton('adminhtml/session')->addSuccess(
105
+ Mage::helper('adminhtml')->__(
106
+ 'Total of %d status(es) were changed.', count($Ids)
107
+ )
108
+ );
109
+ $this->_redirect('*/*/');
110
+ } catch (Exception $e) {
111
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
112
+ }
113
+ }
114
+ }
115
+ protected function _isAllowed()
116
+ {
117
+ return true;
118
+ }
119
+ }
120
+ ?>
app/code/community/Manthan/Marketplace/controllers/ReviewController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_ReviewController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function saveAction()
5
+ {
6
+ try
7
+ {
8
+ if(is_null($this->getRequest()->getPost('review')) && is_null($this->getRequest()->getPost('rating')) )
9
+ {
10
+ Mage::getSingleton('core/session')->addError("Please enter valid values");
11
+ $this->_redirect('sales/order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
12
+ return;
13
+ }
14
+ if($review = $this->getRequest()->getPost('review'))
15
+ {
16
+ $reviewCollection = Mage::getModel("marketplace/review")
17
+ ->setSubject($review['subject'])
18
+ ->setDescription($review['description'])
19
+ ->setShipmentItemId($this->getRequest()->getParam('shipment_item_id'))
20
+ ->setStatus(0)
21
+ ->setCreatedDate(Mage::getModel('core/date')->timestamp(time()));
22
+ $reviewCollection->save();
23
+ }
24
+ if(count($this->getRequest()->getPost('rating')) > 0 )
25
+ {
26
+ foreach($this->getRequest()->getParam('rating') as $id => $value)
27
+ {
28
+ $rateCollection = Mage::getModel("marketplace/sellerrate")
29
+ ->setSellerId($this->getRequest()->getParam('seller_id'))
30
+ ->setShipmentItemId($this->getRequest()->getParam('shipment_item_id'))
31
+ ->setRatingId($id)
32
+ ->setValue($value);
33
+ $rateCollection->save();
34
+ }
35
+ }
36
+ Mage::getSingleton('core/session')->addSuccess('Review has been submitted successfully.');
37
+ $this->_redirect('sales/order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
38
+ }
39
+ catch (Mage_Core_Exception $e)
40
+ {
41
+ Mage::getSingleton('core/session')->addError($e->getMessage());
42
+ $this->_redirect('sales/order/view', array('order_id' => $this->getRequest()->getParam('order_id')));
43
+ }
44
+ }
45
+ }
46
+
47
+ ?>
app/code/community/Manthan/Marketplace/controllers/SellerController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplace_SellerController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function createAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Seller Registration'));
8
+ $this->renderLayout();
9
+ }
10
+ public function saveAction()
11
+ {
12
+ $data = $this->getRequest()->getPost();
13
+ $seller = Mage::getModel('marketplace/seller');
14
+ $userModel = Mage::getModel('admin/user');
15
+ $userModel = $seller->passUserData();
16
+ $resultSeller = Mage::getModel('marketplace/seller')->validate();
17
+ if ($resultSeller) {
18
+ Mage::getSingleton('core/session')->setSellerData($data);
19
+ Mage::getSingleton('core/session')->addError($resultSeller);
20
+ $this->_redirect('*/*/create', array('_current' => true));
21
+ return $this;
22
+ }
23
+ $result = $userModel->validate();
24
+
25
+ if (is_array($result)) {
26
+ Mage::getSingleton('core/session')->setSellerData($data);
27
+ foreach ($result as $message) {
28
+ Mage::getSingleton('core/session')->addError($message);
29
+ }
30
+ $this->_redirect('*/*/create', array('_current' => true));
31
+ return $this;
32
+ }
33
+ try {
34
+ $userModel->save();
35
+ $userModel = $seller->setRole($userModel);
36
+
37
+ $seller->saveData($userModel->getId());
38
+ if(Mage::getStoreConfig('marketplace/vendor_registration_email/enable_registration_email'))
39
+ $seller->sendSellerRegistrationEmailToAdmin($data, $seller->getId());
40
+ if(Mage::getStoreConfig('marketplace/registration_confirmation_email/enabled'))
41
+ $seller->sendSellerRegistrationConfirmationEmailToSeller($data,$seller->getId());
42
+
43
+ Mage::getSingleton('core/session')->addSuccess('Thank you for seller registration with us, we will contact you soon.');
44
+ Mage::getSingleton('core/session')->setSellerData(false);
45
+ $this->_redirect('*/*/create');
46
+ }
47
+ catch (Mage_Core_Exception $e) {
48
+ Mage::getSingleton('core/session')->addError($e->getMessage());
49
+ Mage::getSingleton('core/session')->setSellerData($data);
50
+ $this->_redirect('*/*/create');
51
+ return $this;
52
+ }
53
+ }
54
+
55
+ public function viewAction()
56
+ {
57
+ $this->loadLayout();
58
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Seller Page'));
59
+ $this->renderLayout();
60
+ }
61
+ }
62
+
63
+ ?>
app/code/community/Manthan/Marketplace/etc/config.xml ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Manthan_Marketplace>
4
+ <version>1.0.0</version>
5
+ </Manthan_Marketplace>
6
+ </modules>
7
+ <global>
8
+ <models>
9
+ <marketplace>
10
+ <class>Manthan_Marketplace_Model</class>
11
+ <resourceModel>marketplace_mysql4</resourceModel>
12
+ </marketplace>
13
+ <marketplace_mysql4>
14
+ <class>Manthan_Marketplace_Model_Mysql4</class>
15
+ <entities>
16
+ <seller>
17
+ <table>manthan_marketplace_seller</table>
18
+ </seller>
19
+ <vendorproduct>
20
+ <table>manthan_marketplace_vendorproduct</table>
21
+ </vendorproduct>
22
+ <review>
23
+ <table>manthan_marketplace_review</table>
24
+ </review>
25
+ <rating>
26
+ <table>manthan_marketplace_rating</table>
27
+ </rating>
28
+ <sellerrate>
29
+ <table>manthan_marketplace_seller_rated</table>
30
+ </sellerrate>
31
+ <payment>
32
+ <table>manthan_marketplace_payment</table>
33
+ </payment>
34
+ </entities>
35
+ </marketplace_mysql4>
36
+ </models>
37
+ <resources>
38
+ <marketplace_setup>
39
+ <setup>
40
+ <module>Manthan_Marketplace</module>
41
+ </setup>
42
+ <connection>
43
+ <use>core_setup</use>
44
+ </connection>
45
+ </marketplace_setup>
46
+ <marketplace_write>
47
+ <connection>
48
+ <use>core_write</use>
49
+ </connection>
50
+ </marketplace_write>
51
+ <marketplace_read>
52
+ <connection>
53
+ <use>core_read</use>
54
+ </connection>
55
+ </marketplace_read>
56
+ </resources>
57
+ <blocks>
58
+ <marketplace>
59
+ <class>Manthan_Marketplace_Block</class>
60
+ </marketplace>
61
+ <catalog>
62
+ <rewrite>
63
+ <product_list>Manthan_Marketplace_Block_Seller_Catalog_Product_List</product_list>
64
+ </rewrite>
65
+ </catalog>
66
+ <sales>
67
+ <rewrite>
68
+ <order_item_renderer_default>Manthan_Marketplace_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
69
+ <order_item_renderer_grouped>Manthan_Marketplace_Block_Sales_Order_Item_Renderer_Grouped</order_item_renderer_grouped>
70
+ </rewrite>
71
+ </sales>
72
+ <adminhtml>
73
+ <rewrite>
74
+ <system_account_edit_form>Manthan_Marketplace_Block_Adminhtml_System_Account_Edit_Form</system_account_edit_form>
75
+ </rewrite>
76
+ <rewrite>
77
+ <catalog_product_grid>Manthan_Marketplace_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
78
+ </rewrite>
79
+ </adminhtml>
80
+ </blocks>
81
+ <helpers>
82
+ <marketplace>
83
+ <class>Manthan_Marketplace_Helper</class>
84
+ </marketplace>
85
+ </helpers>
86
+ <events>
87
+ <checkout_onepage_controller_success_action>
88
+ <observers>
89
+ <checkout_onepage_controller_success_action>
90
+ <type>singleton</type>
91
+ <class>marketplace/observer</class>
92
+ <method>sellerOperationAfterOrderSuccess</method>
93
+ </checkout_onepage_controller_success_action>
94
+ </observers>
95
+ </checkout_onepage_controller_success_action>
96
+ <catalog_product_type_prepare_full_options>
97
+ <observers>
98
+ <manthan_marketplace_catalog_product_type_prepare_full_options>
99
+ <type>singleton</type>
100
+ <class>marketplace/observer</class>
101
+ <method>addSellerInfo</method>
102
+ </manthan_marketplace_catalog_product_type_prepare_full_options>
103
+ </observers>
104
+ </catalog_product_type_prepare_full_options>
105
+ <sales_convert_quote_item_to_order_item>
106
+ <observers>
107
+ <manthan_marketplace_sales_convert_quote_item_to_order_item>
108
+ <type>model</type>
109
+ <class>marketplace/observer</class>
110
+ <method>saveSellerToOrderItem</method>
111
+ </manthan_marketplace_sales_convert_quote_item_to_order_item>
112
+ </observers>
113
+ </sales_convert_quote_item_to_order_item>
114
+ <controller_action_layout_generate_xml_before>
115
+ <observers>
116
+ <manthan_marketplace_controller_action_layout_generate_xml_before>
117
+ <class>marketplace/observer</class>
118
+ <method>dynamicSellerLink</method>
119
+ </manthan_marketplace_controller_action_layout_generate_xml_before>
120
+ </observers>
121
+ </controller_action_layout_generate_xml_before>
122
+ </events>
123
+ <template>
124
+ <email>
125
+ <marketplace_vendor_registration_email_email_template module="marketplace">
126
+ <label>New Seller Register</label>
127
+ <file>marketplace/seller_new_registration_email.html</file>
128
+ <type>html</type>
129
+ </marketplace_vendor_registration_email_email_template>
130
+ <marketplace_vendor_activation_email_email_template module="marketplace">
131
+ <label>Seller Status Changed</label>
132
+ <file>marketplace/seller_activation_email.html</file>
133
+ <type>html</type>
134
+ </marketplace_vendor_activation_email_email_template>
135
+ <marketplace_email_email_template module="marketplace">
136
+ <label>Seller New Order</label>
137
+ <file>sales/seller_new_order.html</file>
138
+ <type>html</type>
139
+ </marketplace_email_email_template>
140
+ <marketplace_registration_confirmation_email_email_template module="marketplace">
141
+ <label>New Seller Confirmed</label>
142
+ <file>marketplace/seller_confirmation_email.html</file>
143
+ <type>html</type>
144
+ </marketplace_registration_confirmation_email_email_template>
145
+ </email>
146
+ </template>
147
+ </global>
148
+ <default>
149
+ <web>
150
+ <routers>
151
+ <seller>
152
+ <area>frontend</area>
153
+ <class>Manthan_Marketplace_Controller_Router</class>
154
+ </seller>
155
+ </routers>
156
+ </web>
157
+ </default>
158
+ <frontend>
159
+ <routers>
160
+ <marketplace>
161
+ <use>standard</use>
162
+ <args>
163
+ <module>Manthan_Marketplace</module>
164
+ <frontName>marketplace</frontName>
165
+ </args>
166
+ </marketplace>
167
+ </routers>
168
+ <layout>
169
+ <updates>
170
+ <marketplace>
171
+ <file>marketplace.xml</file>
172
+ </marketplace>
173
+ </updates>
174
+ </layout>
175
+ <translate>
176
+ <modules>
177
+ <marketplace>
178
+ <files>
179
+ <default>Manthan_Marketplace.csv</default>
180
+ </files>
181
+ </marketplace>
182
+ </modules>
183
+ </translate>
184
+ </frontend>
185
+ <admin>
186
+ <routers>
187
+ <admin_marketplace>
188
+ <use>admin</use>
189
+ <args>
190
+ <module>Manthan_Marketplace</module>
191
+ <frontName>admin_marketplace</frontName>
192
+ </args>
193
+ </admin_marketplace>
194
+ <adminhtml>
195
+ <args>
196
+ <modules>
197
+ <Manthan_Marketplace before="Mage_Adminhtml">Manthan_Marketplace_Adminhtml_Admin</Manthan_Marketplace>
198
+ </modules>
199
+ </args>
200
+ </adminhtml>
201
+ </routers>
202
+ </admin>
203
+ <adminhtml>
204
+ <layout>
205
+ <updates>
206
+ <marketplace>
207
+ <file>marketplace.xml</file>
208
+ </marketplace>
209
+ </updates>
210
+ </layout>
211
+ <translate>
212
+ <modules>
213
+ <marketplace>
214
+ <files>
215
+ <default>Manthan_Marketplace.csv</default>
216
+ </files>
217
+ </marketplace>
218
+ </modules>
219
+ </translate>
220
+ <events>
221
+ <catalog_product_save_after>
222
+ <observers>
223
+ <manthan_marketplace_catalog_product_save_after>
224
+ <type>singleton</type>
225
+ <class>marketplace/observer</class>
226
+ <method>catalogProductSaveAfter</method>
227
+ </manthan_marketplace_catalog_product_save_after>
228
+ </observers>
229
+ </catalog_product_save_after>
230
+ <catalog_product_collection_load_before>
231
+ <observers>
232
+ <manthan_marketplace_catalog_product_collection_load_before>
233
+ <type>singleton</type>
234
+ <class>marketplace/observer</class>
235
+ <method>customFilterProductCollection</method>
236
+ </manthan_marketplace_catalog_product_collection_load_before>
237
+ </observers>
238
+ </catalog_product_collection_load_before>
239
+ <controller_action_layout_generate_blocks_before>
240
+ <observers>
241
+ <module_block_observer>
242
+ <type>singleton</type>
243
+ <class>marketplace/observer</class>
244
+ <method>checkPermissionRole</method>
245
+ </module_block_observer>
246
+ </observers>
247
+ </controller_action_layout_generate_blocks_before>
248
+ <catalog_product_delete_before>
249
+ <observers>
250
+ <manthan_marketplace_catalog_product_delete_before>
251
+ <type>singleton</type>
252
+ <class>marketplace/observer</class>
253
+ <method>catalogProductDeleteBefore</method>
254
+ </manthan_marketplace_catalog_product_delete_before>
255
+ </observers>
256
+ </catalog_product_delete_before>
257
+ </events>
258
+ <menu>
259
+ <manthan translate="title" module="adminhtml">
260
+ <title>Manthan</title>
261
+ <sort_order>80</sort_order>
262
+ <children>
263
+ <marketplace>
264
+ <title>Marketplace</title>
265
+ <sort_order>10</sort_order>
266
+ <children>
267
+ <pending_product>
268
+ <title>Pending Products</title>
269
+ <sort_order>10</sort_order>
270
+ <action>adminhtml/catalog_product/index/product_status/1</action>
271
+ </pending_product>
272
+ <sellers>
273
+ <title>Manage Sellers</title>
274
+ <sort_order>20</sort_order>
275
+ <action>admin_marketplace/adminhtml_account</action>
276
+ </sellers>
277
+ <review>
278
+ <title>Manage Reviews</title>
279
+ <sort_order>30</sort_order>
280
+ <action>admin_marketplace/adminhtml_review</action>
281
+ </review>
282
+ <rating>
283
+ <title>Manage Ratings</title>
284
+ <sort_order>40</sort_order>
285
+ <action>admin_marketplace/adminhtml_rating</action>
286
+ </rating>
287
+ <payment>
288
+ <title>Seller Transaction</title>
289
+ <sort_order>50</sort_order>
290
+ <action>admin_marketplace/adminhtml_payment</action>
291
+ </payment>
292
+ <configuration>
293
+ <title>Configuration</title>
294
+ <sort_order>60</sort_order>
295
+ <action>adminhtml/system_config/edit/section/marketplace/</action>
296
+ </configuration>
297
+ </children>
298
+ </marketplace>
299
+ </children>
300
+ </manthan>
301
+ <seller_dashboard module="adminhtml">
302
+ <title>Dashboard</title>
303
+ <sort_order>10</sort_order>
304
+ <action>admin_marketplace/adminhtml_dashboard</action>
305
+ </seller_dashboard>
306
+ <seller translate="title" module="adminhtml">
307
+ <title>Sales</title>
308
+ <sort_order>20</sort_order>
309
+ <children>
310
+ <orders>
311
+ <title>Manage Orders</title>
312
+ <sort_order>10</sort_order>
313
+ <action>admin_marketplace/adminhtml_order</action>
314
+ </orders>
315
+ <review>
316
+ <title>Manage Reviews</title>
317
+ <sort_order>20</sort_order>
318
+ <action>admin_marketplace/adminhtml_review</action>
319
+ </review>
320
+ <payment>
321
+ <title>Seller Transaction</title>
322
+ <sort_order>40</sort_order>
323
+ <action>admin_marketplace/adminhtml_payment</action>
324
+ </payment>
325
+ </children>
326
+ </seller>
327
+ </menu>
328
+ <acl>
329
+ <resources>
330
+ <admin>
331
+ <children>
332
+ <seller_dashboard>
333
+ <title>Dashboard</title>
334
+ </seller_dashboard>
335
+ <seller>
336
+ <title>Seller</title>
337
+ <children>
338
+ <review>
339
+ <title>review</title>
340
+ </review>
341
+ <orders>
342
+ <title>Orders</title>
343
+ </orders>
344
+ <payment>
345
+ <title>Seller Transaction</title>
346
+ </payment>
347
+ </children>
348
+ </seller>
349
+ <system>
350
+ <children>
351
+ <config>
352
+ <children>
353
+ <marketplace>
354
+ <title>Market Place Section</title>
355
+ </marketplace>
356
+ </children>
357
+ </config>
358
+ </children>
359
+ </system>
360
+ </children>
361
+ </admin>
362
+ </resources>
363
+ </acl>
364
+ </adminhtml>
365
+ <default>
366
+ <marketplace>
367
+ <seller>
368
+ <product_status>1</product_status>
369
+ <link_label>Connect as Seller</link_label>
370
+ </seller>
371
+ <review>
372
+ <per_page>12,24,36</per_page>
373
+ </review>
374
+ <email>
375
+ <email_sender>sales</email_sender>
376
+ <email_template>marketplace_email_email_template</email_template>
377
+ </email>
378
+ <vendor_registration_email>
379
+ <email_template>marketplace_vendor_registration_email_email_template</email_template>
380
+ </vendor_registration_email>
381
+ <vendor_activation_email>
382
+ <email_template>marketplace_vendor_activation_email_email_template</email_template>
383
+ </vendor_activation_email>
384
+ <registration_confirmation_email>
385
+ <email_template>marketplace_registration_confirmation_email_email_template</email_template>
386
+ </registration_confirmation_email>
387
+ </marketplace>
388
+ </default>
389
+ </config>
app/code/community/Manthan/Marketplace/etc/system.xml ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <manthan translate="label" module="marketplace">
4
+ <label>Manthan</label>
5
+ <sort_order>100</sort_order>
6
+ <show_in_default>1</show_in_default>
7
+ <show_in_website>1</show_in_website>
8
+ <show_in_store>1</show_in_store>
9
+ </manthan>
10
+ </tabs>
11
+ <sections>
12
+ <marketplace translate="label" module="marketplace">
13
+ <label>Marketplace</label>
14
+ <tab>manthan</tab>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <seller translate="label">
21
+ <label>General Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>10</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <role translate="label">
29
+ <label>Seller Role</label>
30
+ <comment>Please select the role which will work as seller role.</comment>
31
+ <frontend_type>select</frontend_type>
32
+ <sort_order>10</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <source_model>marketplace/system_config_role</source_model>
37
+ </role>
38
+ <product_status translate="label">
39
+ <label>New Product Status</label>
40
+ <comment>Status of a Seller New Product</comment>
41
+ <frontend_type>select</frontend_type>
42
+ <sort_order>20</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <source_model>marketplace/catalog_product_attribute_status</source_model>
47
+ </product_status>
48
+ <link_label translate="label">
49
+ <label>Seller Registration Link Label</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>20</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </link_label>
56
+ </fields>
57
+ </seller>
58
+ <review translate="label">
59
+ <label>Seller Profile Settings</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>20</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <fields>
66
+ <per_page translate="label">
67
+ <label>Display Review per Page Allowed Values</label>
68
+ <comment>Comma-separated.</comment>
69
+ <validate>validate-per-page-value-list</validate>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>20</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </per_page>
76
+ </fields>
77
+ </review>
78
+ <email translate="label">
79
+ <label>Send New Order Email</label>
80
+ <frontend_type>select</frontend_type>
81
+ <sort_order>30</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <fields>
86
+ <email_sender translate="label" module="adminhtml">
87
+ <label>Email Sender</label>
88
+ <frontend_type>select</frontend_type>
89
+ <sort_order>10</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
94
+ </email_sender>
95
+ <email_template translate="label" module="adminhtml">
96
+ <label>Email Template</label>
97
+ <frontend_type>select</frontend_type>
98
+ <sort_order>20</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ <source_model>adminhtml/system_config_source_email_template</source_model>
103
+ </email_template>
104
+ </fields>
105
+ </email>
106
+ <vendor_registration_email>
107
+ <label>Seller Registration Email</label>
108
+ <frontend_type>select</frontend_type>
109
+ <sort_order>40</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <fields>
114
+ <enable_registration_email translate="label" module="adminhtml">
115
+ <label>Enabled</label>
116
+ <frontend_type>select</frontend_type>
117
+ <sort_order>10</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ </enable_registration_email>
123
+ <email_receiver translate="label">
124
+ <label>Receive Vendor Registration Notification Email On</label>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
127
+ <sort_order>20</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ <depends><enable_registration_email>1</enable_registration_email></depends>
132
+ </email_receiver>
133
+ <email_template translate="label" module="adminhtml">
134
+ <label>Email Template</label>
135
+ <frontend_type>select</frontend_type>
136
+ <sort_order>30</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ <depends><enable_registration_email>1</enable_registration_email></depends>
141
+ <source_model>adminhtml/system_config_source_email_template</source_model>
142
+ </email_template>
143
+ </fields>
144
+ </vendor_registration_email>
145
+ <vendor_activation_email>
146
+ <label>Seller Activation Email</label>
147
+ <frontend_type>select</frontend_type>
148
+ <sort_order>50</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ <fields>
153
+ <active_vendor_email translate="label" module="adminhtml">
154
+ <label>Enabled</label>
155
+ <frontend_type>select</frontend_type>
156
+ <sort_order>10</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ <source_model>adminhtml/system_config_source_yesno</source_model>
161
+ </active_vendor_email>
162
+ <email_sender translate="label">
163
+ <label>Email Sender</label>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
166
+ <sort_order>20</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ <depends><active_vendor_email>1</active_vendor_email></depends>
171
+ </email_sender>
172
+ <email_template translate="label" module="adminhtml">
173
+ <label>Email Template</label>
174
+ <frontend_type>select</frontend_type>
175
+ <sort_order>30</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ <depends><active_vendor_email>1</active_vendor_email></depends>
180
+ <source_model>adminhtml/system_config_source_email_template</source_model>
181
+ </email_template>
182
+ </fields>
183
+ </vendor_activation_email>
184
+ <registration_confirmation_email>
185
+ <label>Registration Confirmation Email to Seller</label>
186
+ <frontend_type>select</frontend_type>
187
+ <sort_order>60</sort_order>
188
+ <show_in_default>1</show_in_default>
189
+ <show_in_website>1</show_in_website>
190
+ <show_in_store>1</show_in_store>
191
+ <fields>
192
+ <enabled translate="label" module="adminhtml">
193
+ <label>Enabled</label>
194
+ <frontend_type>select</frontend_type>
195
+ <sort_order>10</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ <source_model>adminhtml/system_config_source_yesno</source_model>
200
+ </enabled>
201
+ <email_sender translate="label">
202
+ <label>Email Sender</label>
203
+ <frontend_type>select</frontend_type>
204
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
205
+ <sort_order>20</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ <depends><enabled>1</enabled></depends>
210
+ </email_sender>
211
+ <email_template translate="label" module="adminhtml">
212
+ <label>Email Template</label>
213
+ <frontend_type>select</frontend_type>
214
+ <sort_order>30</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <depends><enabled>1</enabled></depends>
219
+ <source_model>adminhtml/system_config_source_email_template</source_model>
220
+ </email_template>
221
+ </fields>
222
+ </registration_confirmation_email>
223
+ </groups>
224
+ </marketplace>
225
+ </sections>
226
+ </config>
app/code/community/Manthan/Marketplace/sql/marketplace_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $roleCollection = Mage::getModel('admin/role')
3
+ ->getCollection()
4
+ ->addFieldToFilter('role_name', Manthan_Marketplace_Model_Seller::ROLE);
5
+
6
+ if ($roleCollection->count() == 0) {
7
+ $role = Mage::getModel('admin/role')
8
+ ->setRoleName(Manthan_Marketplace_Model_Seller::ROLE)
9
+ ->setRoleType(Manthan_Marketplace_Model_Seller::ROLE_TYPE)
10
+ ->setTreeLevel(1)
11
+ ->save();
12
+
13
+ Mage::getModel('admin/rules')
14
+ ->setRoleId($role->getId())
15
+ ->setResources(array('admin/catalog','admin/catalog/products','admin/seller_dashboard','admin/system','admin/system/myaccount',
16
+ 'admin/seller','admin/seller/orders','admin/seller/review','admin/seller/payment'))
17
+ ->saveRel();
18
+
19
+ $parentId = 0;
20
+ $roles = Mage::getModel('admin/roles')->load(1);
21
+ $roleName = $roles->getRoleName();
22
+ $roles->setName($roleName)
23
+ ->setPid($parentId)
24
+ ->setRoleType('G');
25
+ $roles->save();
26
+
27
+ $resources = array('admin/seller_dashboard','admin/seller','admin/seller/orders','admin/seller/review');
28
+ foreach($resources as $resource)
29
+ {
30
+ $role = Mage::getModel('admin/rules');
31
+ $role->setRoleId($roles->getId());
32
+ $role->setResourceId($resource);
33
+ $role->setRoleType('G');
34
+ $role->setAssertId(0);
35
+ $role->setPermission('deny');
36
+ $role->save();
37
+
38
+ }
39
+ }
40
+
41
+ $installer = $this;
42
+ $installer->startSetup();
43
+
44
+ $tableName = $installer->getTable('marketplace/seller');
45
+
46
+ if ($installer->getConnection()->isTableExists($tableName) != true) {
47
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/seller'))
48
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
49
+ 'auto_increment' => true,
50
+ 'unsigned' => true,
51
+ 'nullable' => false,
52
+ 'primary' => true,
53
+ ), 'Id')
54
+ ->addColumn('shop_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
55
+ 'nullable' => true,
56
+ ), 'Shop Name')
57
+ ->addColumn('shop_description', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
58
+ 'nullable' => true,
59
+ ), 'Shop Description')
60
+ ->addColumn('url_path', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
61
+ 'nullable' => true,
62
+ ), 'Shop Url')
63
+ ->addColumn('telephone', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
64
+ 'nullable' => true,
65
+ ), 'Seller Contact Number')
66
+ ->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
67
+ 'nullable' => true,
68
+ ), 'Shop Image')
69
+ ->addColumn('country', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
70
+ 'nullable' => true,
71
+ ), 'Country Code')
72
+ ->addColumn('postcode', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
73
+ 'nullable' => true,
74
+ ), 'Postcode')
75
+ ->addColumn('admin_total_earn', Varien_Db_Ddl_Table::TYPE_DECIMAL, '10,2', array(
76
+ 'nullable' => true,
77
+ ), 'Admin Total Earn')
78
+ ->addColumn('admin_commission_by_percentage', Varien_Db_Ddl_Table::TYPE_DECIMAL, '10,2', array(
79
+ 'nullable' => true,
80
+ ), 'Admin Commission By Percentage')
81
+ ->addColumn('total_vendor_earn', Varien_Db_Ddl_Table::TYPE_DECIMAL, '10,2', array(
82
+ 'nullable' => true,
83
+ ), 'Total Vendor Earn')
84
+ ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
85
+ 'nullable' => true,
86
+ ), 'User Id')
87
+ ->addColumn('created_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
88
+ 'nullable' => true,
89
+ ), 'Created Date Of Seller Registration')
90
+ ->addIndex($installer->getIdxName('marketplace/seller', array('user_id')),
91
+ array('user_id'))
92
+ ->addForeignKey($installer->getFkName('marketplace/seller', 'user_id', 'admin/user', 'user_id'),
93
+ 'user_id', $installer->getTable('admin/user'), 'user_id',
94
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
95
+
96
+ $installer->getConnection()->createTable($table);
97
+ }
98
+
99
+ /***************** CREATE TABLE TO MANAGE PRODUCT FOR MULTIVENDOR *******************/
100
+
101
+ $tableName = $installer->getTable('marketplace/vendorproduct');
102
+ if ($installer->getConnection()->isTableExists($tableName) != true) {
103
+
104
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/vendorproduct'))
105
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
106
+ 'auto_increment' => true,
107
+ 'unsigned' => true,
108
+ 'nullable' => false,
109
+ 'primary' => true,
110
+ ), 'Id')
111
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
112
+ 'nullable' => true,
113
+ ), 'Product Entity Id')
114
+ ->addColumn('user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
115
+ 'nullable' => true,
116
+ ), 'User Id')
117
+ ->addIndex($installer->getIdxName('marketplace/vendorproduct', array('user_id')),
118
+ array('user_id'))
119
+ ->addForeignKey($installer->getFkName('marketplace/vendorproduct', 'user_id', 'admin/user', 'user_id'),
120
+ 'user_id', $installer->getTable('admin/user'), 'user_id',
121
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
122
+
123
+ $installer->getConnection()->createTable($table);
124
+ }
125
+ /***************** CREATE TABLE TO MANAGE SELLER RATINGS *******************/
126
+ $tableName = $installer->getTable('marketplace/rating');
127
+ if ($installer->getConnection()->isTableExists($tableName) != true) {
128
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/rating'))
129
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
130
+ 'auto_increment' => true,
131
+ 'unsigned' => true,
132
+ 'nullable' => false,
133
+ 'primary' => true,
134
+ ), 'Id')
135
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
136
+ 'nullable' => true,
137
+ ), 'Rating Name')
138
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
139
+ 'nullable' => true,
140
+ ), 'Status');
141
+ $installer->getConnection()->createTable($table);
142
+ }
143
+ /***************** CREATE TABLE TO MANAGE SELLER RATINGS *******************/
144
+ $tableName = $installer->getTable('marketplace/review');
145
+ if ($installer->getConnection()->isTableExists($tableName) != true)
146
+ {
147
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/review'))
148
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
149
+ 'auto_increment' => true,
150
+ 'unsigned' => true,
151
+ 'nullable' => false,
152
+ 'primary' => true,
153
+ ), 'Id')
154
+ ->addColumn('subject', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
155
+ 'nullable' => true,
156
+ ), 'Subject of Review')
157
+ ->addColumn('description', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
158
+ 'nullable' => true,
159
+ ), 'Review Description')
160
+ ->addColumn('shipment_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
161
+ 'nullable' => true,
162
+ ), 'Shipment Item ID')
163
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
164
+ 'nullable' => true,
165
+ ), 'Status')
166
+ ->addColumn('created_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
167
+ 'nullable' => true,
168
+ ), 'Created Date Of Rate');
169
+ $installer->getConnection()->createTable($table);
170
+ }
171
+
172
+ /***************** CREATE TABLE TO MANAGE SELLER RATED BY CUSTOMER *******************/
173
+ $tableName = $installer->getTable('marketplace/sellerrate');
174
+ if ($installer->getConnection()->isTableExists($tableName) != true)
175
+ {
176
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/sellerrate'))
177
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
178
+ 'auto_increment' => true,
179
+ 'unsigned' => true,
180
+ 'nullable' => false,
181
+ 'primary' => true,
182
+ ), 'Id')
183
+ ->addColumn('seller_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
184
+ 'nullable' => true,
185
+ ), 'Seller ID')
186
+ ->addColumn('shipment_item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
187
+ 'nullable' => true,
188
+ ), 'Shipment Item ID')
189
+ ->addColumn('rating_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
190
+ 'nullable' => true,
191
+ ), 'Rating ID')
192
+ ->addColumn('value', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
193
+ 'nullable' => true,
194
+ ), 'Rated Value');
195
+
196
+ $installer->getConnection()->createTable($table);
197
+ }
198
+ $createSetup = new Mage_Eav_Model_Entity_Setup('core_setup');
199
+
200
+ $createSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'product_status', array(
201
+ 'group' => 'General',
202
+ 'type' => 'int',
203
+ 'backend' => '',
204
+ 'frontend' => '',
205
+ 'label' => 'Product Status',
206
+ 'input' => 'select',
207
+ 'class' => 'product-status',
208
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
209
+ 'visible' => 1,
210
+ 'source' => 'marketplace/catalog_product_attribute_status',
211
+ 'required' => 1,
212
+ 'user_defined' => 0,
213
+ 'searchable' => 0,
214
+ 'filterable' => 0,
215
+ 'comparable' => 0,
216
+ 'visible_on_front' => 0,
217
+ 'unique' => 0,
218
+ 'apply_to' => 'simple,configurable,bundle,grouped,virtual,downloadable',
219
+ 'is_configurable' => 0
220
+ ));
221
+
222
+ $installer->getConnection()
223
+ ->addColumn($installer->getTable('sales/order_item'),'seller_id',array(
224
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
225
+ 'nullable' => false,
226
+ 'default' => 0,
227
+ 'comment' => 'Seller Id'
228
+ ));
229
+ $installer->getConnection()
230
+ ->addColumn($installer->getTable('sales/order_item'),'admin_order_commission',array(
231
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
232
+ 'nullable' => false,
233
+ 'default' => 0,
234
+ 'comment' => 'Commission of Order Item by Admin'
235
+ ));
236
+ /*$installer->getConnection()
237
+ ->addColumn($installer->getTable('sales/order_item'),'seller_payment_status',array(
238
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
239
+ 'nullable' => false,
240
+ 'default' => 0,
241
+ 'comment' => 'Seller Payment Status'
242
+ ));*/
243
+ $tableName = $installer->getTable('marketplace/payment');
244
+ if ($installer->getConnection()->isTableExists($tableName) != true)
245
+ {
246
+ $table = $installer->getConnection()->newTable($installer->getTable('marketplace/payment'))
247
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
248
+ 'identity' => true,
249
+ 'unsigned' => true,
250
+ 'nullable' => false,
251
+ 'primary' => true,
252
+ ), 'Entity Id')
253
+ ->addColumn('seller_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
254
+ 'nullable' => true,
255
+ ), 'Seller Id')
256
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
257
+ 'unsigned' => true,
258
+ 'nullable' => false,
259
+ 'default' => '0',
260
+ ), 'Order Id')
261
+ ->addColumn('payment_note', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
262
+ 'nullable' => true,
263
+ ), 'Information')
264
+ ->addColumn('admin_amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
265
+ 'nullable' => true,
266
+ ), 'Admin Amount')
267
+ ->addColumn('seller_paid_amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
268
+ 'nullable' => true,
269
+ ), 'Seller Paid Amount')
270
+ ->addColumn('payment_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
271
+ 'nullable' => true,
272
+ ), 'Payment Date');
273
+ $installer->getConnection()->createTable($table);
274
+ }
275
+
276
+ $installer->endSetup();
277
+
278
+ $roleModel = Mage::getModel('admin/role')->getCollection()
279
+ ->addFieldToFilter('role_name',Manthan_Marketplace_Model_Seller::ROLE);
280
+
281
+ Mage::getConfig()->saveConfig('marketplace/seller/role',$roleModel->getFirstItem()->getId());
282
+ Mage::app()->getStore()->resetConfig();
283
+
284
+
285
+ ?>
app/code/community/Manthan/Marketplaceproductshipping/Helper/Data.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Manthan_Marketplaceproductshipping_Helper_Data extends Mage_Core_Helper_Abstract
6
+ {
7
+
8
+ }
app/code/community/Manthan/Marketplaceproductshipping/Model/Carrier/Marketplaceproductshipping.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Manthan_Marketplaceproductshipping_Model_Carrier_Marketplaceproductshipping
3
+ extends Mage_Shipping_Model_Carrier_Abstract
4
+ implements Mage_Shipping_Model_Carrier_Interface {
5
+ protected $_code = 'marketplaceproductshipping';
6
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
+ {
8
+ if (!$this->getConfigFlag('active')) {
9
+ return false;
10
+ }
11
+ $shippingPrice = 0;
12
+ if ($request->getAllItems()) {
13
+
14
+ $destinationCountryCode = $request->getDestCountryId();
15
+
16
+ foreach ($request->getAllItems() as $item)
17
+ {
18
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
19
+
20
+ if ( $item->getParentItemId()) {
21
+ continue;
22
+ }
23
+ $sellerProductCollection = Mage::getModel('marketplace/vendorproduct')->getCollection()
24
+ ->addFieldToFilter('product_id',$product->getId());
25
+
26
+ if($sellerProductCollection->count() > 0 )
27
+ {
28
+ $userId = $sellerProductCollection->getFirstItem()->getUserId();
29
+ $sellerCollection = Mage::getModel('marketplace/seller')->getCollection()
30
+ ->addFieldToFilter('user_id',$userId);
31
+ $sellerCountryCode = $sellerCollection->getFirstItem()->getCountry();
32
+
33
+ if($sellerCountryCode == $destinationCountryCode)
34
+ {
35
+ $shippingPrice += $product->getDomesticShippingCost() * $item->getQty();
36
+ }
37
+ else if(empty(trim($product->getDomesticShippingCost()))&& empty(trim($product->getInternationalShippingCost())))
38
+ {
39
+ $shippingPrice += ($item->getQty() * $this->getConfigData('price'));
40
+ }
41
+ else if(empty(trim($product->getInternationalShippingCost()))&& ($product->getDomesticShippingCost() || $product->getDomesticShippingCost() == 0 ))
42
+ {
43
+ $shippingPrice += $product->getDomesticShippingCost() * $item->getQty();
44
+ }
45
+ else if(empty(trim($product->getDomesticShippingCost()))&& ($product->getInternationalShippingCost() || $product->getInternationalShippingCost() == 0 ))
46
+ {
47
+ $shippingPrice += $product->getInternationalShippingCost() * $item->getQty();
48
+ }
49
+ else
50
+ {
51
+ $shippingPrice += $product->getInternationalShippingCost() * $item->getQty();
52
+ }
53
+ }
54
+ else{
55
+ $countryCode = Mage::getStoreConfig('general/country/default');
56
+ if($destinationCountryCode == $countryCode)
57
+ {
58
+ $shippingPrice += $product->getDomesticShippingCost() * $item->getQty();
59
+ }
60
+ else if(empty(trim($product->getDomesticShippingCost()))&& empty(trim($product->getInternationalShippingCost())))
61
+ {
62
+ $shippingPrice += ($item->getQty() * $this->getConfigData('price'));
63
+ }
64
+ else if(empty(trim($product->getInternationalShippingCost()))&& ($product->getDomesticShippingCost() || $product->getDomesticShippingCost() == 0 ))
65
+ {
66
+ $shippingPrice += $product->getDomesticShippingCost() * $item->getQty();
67
+ }
68
+ else if(empty(trim($product->getDomesticShippingCost()))&& ($product->getInternationalShippingCost() || $product->getInternationalShippingCost() == 0 ))
69
+ {
70
+ $shippingPrice += $product->getInternationalShippingCost() * $item->getQty();
71
+ }
72
+ else
73
+ {
74
+ $shippingPrice += $product->getInternationalShippingCost() * $item->getQty();
75
+ }
76
+ }
77
+ }
78
+ $result = Mage::getModel('shipping/rate_result');
79
+ if ($shippingPrice !== false) {
80
+ $method = Mage::getModel('shipping/rate_result_method');
81
+ $method->setCarrier('marketplaceproductshipping');
82
+ $method->setCarrierTitle($this->getConfigData('title'));
83
+ $method->setMethod('marketplaceproductshipping');
84
+ $method->setMethodTitle($this->getConfigData('name'));
85
+ $method->setPrice($shippingPrice);
86
+ $method->setCost($shippingPrice);
87
+ $result->append($method);
88
+ }
89
+ return $result;
90
+ }
91
+ }
92
+ public function getAllowedMethods()
93
+ {
94
+ return array('marketplaceproductshipping'=>$this->getConfigData('name'));
95
+ }
96
+
97
+ }
98
+
99
+
100
+
101
+
102
+
103
+
104
+
app/code/community/Manthan/Marketplaceproductshipping/etc/config.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Manthan_Marketplaceproductshipping>
4
+ <version>1.0.0</version>
5
+ </Manthan_Marketplaceproductshipping>
6
+ </modules>
7
+ <global>
8
+ <models>
9
+ <marketplaceproductshipping>
10
+ <class>Manthan_Marketplaceproductshipping_Model</class>
11
+ <resourceModel>marketplaceproductshipping_mysql4</resourceModel>
12
+ </marketplaceproductshipping>
13
+ <marketplaceproductshipping_mysql4>
14
+ <class>Manthan_Marketplaceproductshipping_Model_Mysql4</class>
15
+ <entities>
16
+ <marketplaceproductshipping>
17
+ <table>marketplaceproductshipping</table>
18
+ </marketplaceproductshipping>
19
+ </entities>
20
+ </marketplaceproductshipping_mysql4>
21
+ </models>
22
+ <resources>
23
+ <marketplaceproductshipping_setup>
24
+ <setup>
25
+ <module>Manthan_Marketplaceproductshipping</module>
26
+ </setup>
27
+ <connection>
28
+ <use>core_setup</use>
29
+ </connection>
30
+ </marketplaceproductshipping_setup>
31
+ <marketplaceproductshipping_write>
32
+ <connection>
33
+ <use>core_write</use>
34
+ </connection>
35
+ </marketplaceproductshipping_write>
36
+ <marketplaceproductshipping_read>
37
+ <connection>
38
+ <use>core_read</use>
39
+ </connection>
40
+ </marketplaceproductshipping_read>
41
+ </resources>
42
+ <helpers>
43
+ <marketplaceproductshipping>
44
+ <class>Manthan_Marketplaceproductshipping_Helper</class>
45
+ </marketplaceproductshipping>
46
+ </helpers>
47
+ </global>
48
+ <default>
49
+ <carriers>
50
+ <marketplaceproductshipping>
51
+ <active>1</active>
52
+ <model>marketplaceproductshipping/carrier_marketplaceproductshipping</model>
53
+ <title>Carrier Title</title>
54
+ <name>Manthan Marketplace Shipping Per Product</name>
55
+ <price>5.00</price>
56
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
57
+ </marketplaceproductshipping>
58
+ </carriers>
59
+ </default>
60
+ </config>
app/code/community/Manthan/Marketplaceproductshipping/etc/system.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <carriers>
5
+ <groups>
6
+ <marketplaceproductshipping translate="label" module="marketplaceproductshipping">
7
+ <label>Manthan Marketplace Shipping Per Product</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>99</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <name translate="label">
32
+ <label>Method Name</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </name>
39
+ <price translate="label">
40
+ <label>Price</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>40</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ </price>
47
+ <specificerrmsg translate="label">
48
+ <label>Displayed Error Message</label>
49
+ <frontend_type>textarea</frontend_type>
50
+ <sort_order>50</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </specificerrmsg>
55
+ </fields>
56
+ </marketplaceproductshipping>
57
+ </groups>
58
+ </carriers>
59
+ </sections>
60
+ </config>
app/code/community/Manthan/Marketplaceproductshipping/sql/marketplaceproductshipping_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $createSetup = new Mage_Eav_Model_Entity_Setup('core_setup');
5
+
6
+ $createSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'domestic_shipping_cost', array(
7
+ 'group' => 'General',
8
+ 'type' => 'int',
9
+ 'backend' => '',
10
+ 'frontend' => '',
11
+ 'label' => 'Domestic Shipping Cost',
12
+ 'input' => 'text',
13
+ 'class' => 'domestic-shipping',
14
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
15
+ 'visible' => 1,
16
+ 'required' => 0,
17
+ 'user_defined' => 0,
18
+ 'searchable' => 0,
19
+ 'filterable' => 0,
20
+ 'comparable' => 0,
21
+ 'visible_on_front' => 0,
22
+ 'unique' => 0,
23
+ 'apply_to' => 'simple,configurable,grouped,bundle',
24
+ 'is_configurable' => 0
25
+ ));
26
+ $createSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'international_shipping_cost', array(
27
+ 'group' => 'General',
28
+ 'type' => 'int',
29
+ 'backend' => '',
30
+ 'frontend' => '',
31
+ 'label' => 'International Shipping Cost',
32
+ 'input' => 'text',
33
+ 'class' => 'international-shipping',
34
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
35
+ 'visible' => 1,
36
+ 'required' => 0,
37
+ 'user_defined' => 0,
38
+ 'searchable' => 0,
39
+ 'filterable' => 0,
40
+ 'comparable' => 0,
41
+ 'visible_on_front' => 0,
42
+ 'unique' => 0,
43
+ 'apply_to' => 'simple,configurable,grouped,bundle',
44
+ 'is_configurable' => 0
45
+ ));
46
+
47
+ $installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'seller_per_product_shipping',
48
+ 'decimal(12,2) default NULL');
49
+ $installer->endSetup();
50
+
51
+ ?>
app/design/adminhtml/default/default/layout/marketplace.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="1.0.0">
2
+ <default>
3
+ <reference name="head">
4
+ <action method="addItem"><type>skin_css</type><name>marketplace/css/style.css</name></action>
5
+ <reference name="header">
6
+ <action method="setTemplate">
7
+ <template>marketplace/page/header.phtml</template>
8
+ </action>
9
+ </reference>
10
+ </reference>
11
+ </default>
12
+ <admin_marketplace_adminhtml_login_index>
13
+ <block type="core/text_list" name="root" output="toHtml">
14
+ <block type="adminhtml/template" name="content" template="marketplace/login.phtml">
15
+ <block type="core/text_list" name="form.additional.info" />
16
+ </block>
17
+ </block>
18
+ </admin_marketplace_adminhtml_login_index>
19
+ <adminhtml_catalog_product_new>
20
+ <reference name="product_edit">
21
+ <action method="setTemplate">
22
+ <template>marketplace/catalog/product/edit.phtml</template>
23
+ </action>
24
+ </reference>
25
+ </adminhtml_catalog_product_new>
26
+ <adminhtml_catalog_product_edit>
27
+ <reference name="product_edit">
28
+ <action method="setTemplate">
29
+ <template>marketplace/catalog/product/edit.phtml</template>
30
+ </action>
31
+ </reference>
32
+ </adminhtml_catalog_product_edit>
33
+ <admin_marketplace_adminhtml_order_view>
34
+ <!-- for future work -->
35
+ </admin_marketplace_adminhtml_order_view>
36
+ </layout>
app/design/adminhtml/default/default/template/marketplace/catalog/product/edit.phtml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ /**
4
+ * Template for Mage_Adminhtml_Block_Catalog_Product_Edit
5
+ */
6
+ ?>
7
+ <div class="content-header">
8
+ <h3 class="icon-head head-products"><?php echo $this->getHeader() ?></h3>
9
+ <p class="content-buttons form-buttons"><?php echo $this->getBackButtonHtml() ?>
10
+ <?php echo $this->getCancelButtonHtml() ?>
11
+ <?php if($this->getProductId()): ?>
12
+ <?php echo $this->getDeleteButtonHtml() ?>
13
+ <?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
14
+ <?php echo $this->getDuplicateButtonHtml() ?>
15
+ <?php endif; ?>
16
+ <?php endif; ?>
17
+ <?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
18
+ <?php echo $this->getSaveButtonHtml() ?>
19
+ <?php echo $this->getSaveAndEditButtonHtml() ?>
20
+ <?php endif; ?>
21
+ </p>
22
+ </div>
23
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="product_edit_form" enctype="multipart/form-data">
24
+ <?php echo $this->getBlockHtml('formkey')?>
25
+ <div style="display:none"></div>
26
+ </form>
27
+ <script type="text/javascript">
28
+ <?php $seller = Mage::getModel('marketplace/seller')->isSeller(); ?>
29
+ <?php $type = Mage::app()->getRequest()->getParam('type'); ?>
30
+ <?php $product_state = Mage::app()->getRequest()->getActionName(); ?>
31
+ <?php $product_status = intval(Mage::getStoreConfig('marketplace/seller/product_status')) - 1; ?>
32
+ <?php if($seller) :?>
33
+ if($('product_status') != null)
34
+ {
35
+ <?php if( $product_state == 'new'): ?>
36
+ var options = $$('select#product_status option');
37
+ options[<?php echo $product_status ; ?>].selected = true;
38
+ <?php endif; ?>
39
+ $('product_status').up().up().hide();
40
+ }
41
+ <?php endif; ?>
42
+ <?php if(!Mage::getStoreConfig('carriers/marketplaceproductshipping/active') || ($type == 'virtual' || $type == 'downloadable') ): ?>
43
+ $('domestic_shipping_cost').up().up().hide();
44
+ $('international_shipping_cost').up().up().hide();
45
+ <?php endif; ?>
46
+ //<![CDATA[
47
+ var productTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
48
+ var productForm = new varienForm('product_edit_form', '<?php echo $this->getValidationUrl() ?>');
49
+ productForm._processValidationResult = function(transport) {
50
+ var response = transport.responseText.evalJSON();
51
+ if (response.error){
52
+ if (response.attribute && $(response.attribute)) {
53
+ $(response.attribute).setHasError(true, productForm);
54
+ Validation.ajaxError($(response.attribute), response.message);
55
+ if (!Prototype.Browser.IE){
56
+ $(response.attribute).focus();
57
+ }
58
+ }
59
+ else if ($('messages')) {
60
+ $('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
61
+ }
62
+ }
63
+ else{
64
+ productForm._submit();
65
+ }
66
+ };
67
+ function saveAndContinueEdit(urlTemplate) {
68
+ var template = new Template(urlTemplate, productTemplateSyntax);
69
+ var url = template.evaluate({tab_id:product_info_tabsJsTabs.activeTab.id});
70
+ productForm.submit(url);
71
+ }
72
+ function setSettings(urlTemplate, setElement, typeElement) {
73
+ var template = new Template(urlTemplate, productTemplateSyntax);
74
+ setLocation(template.evaluate({attribute_set:$F(setElement),type:$F(typeElement)}));
75
+ }
76
+
77
+ function setSuperSettings(urlTemplate, attributesClass, validateField) {
78
+ var attributesFields = $$('.' + attributesClass);
79
+ var attributes = Form.serializeElements(attributesFields, true).attribute;
80
+ if(typeof attributes == 'string') {
81
+ attributes = [attributes];
82
+ }
83
+
84
+ if(!attributes) {
85
+ $(validateField).value = 'no-attributes';
86
+ } else {
87
+ $(validateField).value = 'has-attributes';
88
+ }
89
+
90
+ if (productForm.validator.validate()) {
91
+ var template = new Template(urlTemplate, productTemplateSyntax);
92
+ var url = template.evaluate({
93
+ attributes: encode_base64(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D')
94
+ });
95
+ setLocation(url);
96
+ }
97
+ }
98
+
99
+ function checkMaxLength(Object, MaxLen)
100
+ {
101
+ if (Object.value.length > MaxLen-1) {
102
+ Object.value = Object.value.substr(0, MaxLen);
103
+ }
104
+ return 1;
105
+ }
106
+
107
+ Event.observe(window, 'load', function() {
108
+ var objName = '<?php echo $this->getSelectedTabId() ?>';
109
+ if (objName) {
110
+ obj = $(objName);
111
+ //IE fix (bubbling event model)
112
+ product_info_tabsJsTabs.setSkipDisplayFirstTab();
113
+ product_info_tabsJsTabs.showTabContent(obj);
114
+ }
115
+ Product.AttributesBridge.setTabsObject(product_info_tabsJsTabs);
116
+ });
117
+
118
+ Validation.addAllThese([
119
+ ['validate-super-product-attributes', '<?php echo Mage::helper('catalog')->__('Please select one or more attributes.') ?>', function(v) {
120
+ return (v != "no-attributes");
121
+ }]]);
122
+ //]]>
123
+ </script>
app/design/adminhtml/default/default/template/marketplace/page/header.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $logo = 'images/logo.gif';
3
+ if(Mage::getModel('marketplace/seller')->isSeller())
4
+ {
5
+ $logo = 'marketplace/images/vendor-logo.png';
6
+ }
7
+ ?>
8
+ <div class="header-top">
9
+ <a href="<?php echo $this->getHomeLink() ?>"><img src="<?php echo $this->getSkinUrl($logo) ?>" alt="<?php echo $this->__('Magento Logo') ?>" class="logo"/></a>
10
+ <div class="header-right">
11
+ <p class="super">
12
+ <?php echo $this->__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())) ?><span class="separator">|</span><?php echo $this->formatDate(null, 'full') ?><span class="separator">|</span><a href="http://golinks.magento.com/CE15" onclick="this.target='_blank'" class="go-try"><?php echo $this->__('Try Magento Go for Free') ?></a><span class="separator">|</span><a href="<?php echo $this->getLogoutLink() ?>" class="link-logout"><?php echo $this->__('Log Out') ?></a>
13
+ </p>
14
+ <?php if ( Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ): ?>
15
+ <fieldset>
16
+ <legend>Search</legend>
17
+ <span id="global_search_indicator" class="autocomplete-indicator" style="display: none">
18
+ <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading...') ?>" class="v-middle"/>
19
+ </span>
20
+ <?php $defSearch = $this->__('Global Record Search') ?>
21
+ <input id="global_search" name="query" type="text" class="input-text" value="<?php if(!empty($query)): ?><?php echo $query ?><?php else: ?><?php echo $defSearch ?><?php endif ?>" onfocus="if(this.value=='<?php echo $defSearch ?>')this.value=''; " onblur="if(this.value=='')this.value='<?php echo $defSearch ?>';" />
22
+ <div id="global_search_autocomplete" class="autocomplete"></div>
23
+ <script type="text/javascript">
24
+ new Ajax.Autocompleter(
25
+ 'global_search',
26
+ 'global_search_autocomplete',
27
+ '<?php echo $this->getUrl('adminhtml/index/globalSearch') ?>',
28
+ {
29
+ paramName:"query",
30
+ minChars:2,
31
+ indicator:"global_search_indicator",
32
+ updateElement:getSelectionId,
33
+ evalJSON:'force'
34
+ }
35
+ );
36
+ function getSelectionId(li) {
37
+ location.href = li.getAttribute('url');
38
+ }
39
+ </script>
40
+ </fieldset>
41
+ <?php endif; ?>
42
+ </div>
43
+ </div>
app/design/adminhtml/default/default/template/marketplace/rating/detailed.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+
2
+ <?php foreach($this->ratingCollection() as $rating): ?>
3
+ <strong class="rating-label"><?php echo $rating->getName(); ?></strong>
4
+ <div class="ratings">
5
+ <div class="empty-stars"></div>
6
+ <div class="full-stars" style="width:<?php echo $this->getValue($rating->getId()) * 20 ?>%"></div>
7
+ </div><br/>
8
+ <?php endforeach; ?>
app/design/adminhtml/default/default/template/marketplace/sales/order/form.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <div>
3
+ <div id="order-messages">
4
+ <?php echo $this->getChildHtml('order_messages') ?>
5
+ </div>
6
+ <?php echo $this->getLayout()->createBlock('marketplace/adminhtml_order_edit_info')->toHtml(); ?>
7
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
8
+ <?php if ($_order->getIsVirtual()): ?>
9
+ <div class="box-right">
10
+ <?php else: ?>
11
+ <div class="box-left">
12
+ <?php endif; ?>
13
+ <!--Payment Method-->
14
+ <div class="entry-edit">
15
+ <div class="entry-edit-head">
16
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
17
+ </div>
18
+ <fieldset>
19
+ <?php echo $this->getPaymentInfo(); ?>
20
+ <div><?php echo Mage::helper('marketplace')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
21
+ </fieldset>
22
+ </div>
23
+ </div>
24
+ <?php if (!$_order->getIsVirtual()): ?>
25
+ <div class="box-right">
26
+ <!--Shipping Method-->
27
+ <div class="entry-edit">
28
+ <div class="entry-edit-head">
29
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
30
+ </div>
31
+ <fieldset>
32
+ <?php if ($_order->getTracksCollection()->count()) : ?>
33
+ <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
34
+ <br/>
35
+ <?php endif; ?>
36
+ <?php if ($_order->getShippingDescription()): ?>
37
+ <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
38
+
39
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
40
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
41
+ <?php else: ?>
42
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
43
+ <?php endif; ?>
44
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
45
+
46
+ <?php echo $_excl; ?>
47
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
48
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
49
+ <?php endif; ?>
50
+ <?php else: ?>
51
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
52
+ <?php endif; ?>
53
+ </fieldset>
54
+ </div>
55
+ </div>
56
+ <?php endif; ?>
57
+ <div class="clear"></div>
58
+ <div class="entry-edit">
59
+ <div class="entry-edit-head">
60
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
61
+ </div>
62
+ </div>
63
+ <?php echo $this->getLayout()->createBlock('marketplace/adminhtml_order_edit_items')->toHtml(); ?>
64
+ <div class="clear"></div>
65
+ <div class="box-right entry-edit">
66
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
67
+ <div class="order-totals"><?php echo $this->getChildHtml('seller.order.totals') ?></div>
68
+ </div>
69
+ <div class="clear"></div>
70
+ </div>
app/design/adminhtml/default/default/template/marketplace/sales/order/view/info.phtml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php $_order = $this->getOrder() ?>
3
+ <?php
4
+ $orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
5
+ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
6
+ ?>
7
+ <div class="box-left">
8
+ <!--Order Information-->
9
+ <div class="entry-edit">
10
+ <?php if ($_order->getEmailSent()):
11
+ $_email = Mage::helper('sales')->__('the order confirmation email was sent');
12
+ else:
13
+ $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
14
+ endif; ?>
15
+ <div class="entry-edit-head">
16
+ <?php if ($this->getNoUseOrderLink()): ?>
17
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
18
+ <?php else: ?>
19
+ <a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
20
+ <strong>(<?php echo $_email ?>)</strong>
21
+ <?php endif; ?>
22
+ </div>
23
+ <div class="fieldset">
24
+ <table cellspacing="0" class="form-list">
25
+ <tr>
26
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
27
+ <td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
28
+ </tr>
29
+ <?php if ($orderAdminDate != $orderStoreDate):?>
30
+ <tr>
31
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
32
+ <td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
33
+ </tr>
34
+ <?php endif;?>
35
+ <tr>
36
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
37
+ <td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
38
+ </tr>
39
+ <tr>
40
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
41
+ <td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
42
+ </tr>
43
+ <?php if($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
44
+ <tr>
45
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
46
+ <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')':''; ?></strong></td>
47
+ </tr>
48
+ <?php endif; ?>
49
+ <?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
50
+ <tr>
51
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
52
+ <td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
53
+ </tr>
54
+ <?php endif; ?>
55
+ <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
56
+ <tr>
57
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
58
+ <td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
59
+ </tr>
60
+ <?php endif; ?>
61
+ </table>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ <div class="box-right">
66
+ <!--Account Information-->
67
+ <div class="entry-edit">
68
+ <div class="entry-edit-head">
69
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
70
+ </div>
71
+ <div class="fieldset">
72
+ <div class="hor-scroll">
73
+ <table cellspacing="0" class="form-list">
74
+ <tr>
75
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
76
+ <td class="value">
77
+ <?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
78
+ <a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong></a>
79
+ <?php else: ?>
80
+ <strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong>
81
+ <?php endif; ?>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
86
+ <td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
87
+ </tr>
88
+ <?php if ($groupName = $this->getCustomerGroupName()) : ?>
89
+ <tr>
90
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
91
+ <td class="value"><strong><?php echo $groupName ?></strong></td>
92
+ </tr>
93
+ <?php endif; ?>
94
+ </table>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ <div class="clear"></div>
100
+
101
+ <div class="box-left">
102
+ <!--Billing Address-->
103
+ <div class="entry-edit">
104
+ <div class="entry-edit-head">
105
+ <h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
106
+ </div>
107
+ <fieldset>
108
+ <address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
109
+ </fieldset>
110
+ </div>
111
+ </div>
112
+ <?php if (!$this->getOrder()->getIsVirtual()): ?>
113
+ <div class="box-right">
114
+ <!--Shipping Address-->
115
+ <div class="entry-edit">
116
+ <div class="entry-edit-head">
117
+ <h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
118
+ </div>
119
+ <fieldset>
120
+ <address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
121
+ </fieldset>
122
+ </div>
123
+ </div>
124
+ <div class="clear"></div>
125
+ <?php endif; ?>
app/design/adminhtml/default/default/template/marketplace/sales/order/view/items.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php $totalAdminCommission = 0; $grandTotal = 0;$sellerTotal = 0;?>
3
+
4
+ <div class="grid np">
5
+ <div class="hor-scroll">
6
+ <table cellspacing="0" class="data order-tables">
7
+ <col />
8
+ <col width="1" />
9
+ <col width="1" />
10
+ <col width="1" />
11
+ <col width="1" />
12
+ <col width="1" />
13
+ <col width="1" />
14
+ <col width="1" />
15
+ <thead>
16
+ <tr class="headings">
17
+ <th><?php echo $this->helper('marketplace')->__('Product') ?></th>
18
+ <th><?php echo $this->helper('marketplace')->__('Commission Amount of Admin') ?></th>
19
+ <th><?php echo $this->helper('marketplace')->__('Seller Amount') ?></th>
20
+ <th><span class="nobr"><?php echo $this->helper('marketplace')->__('Original Price') ?></span></th>
21
+ <th class="a-center"><?php echo $this->helper('marketplace')->__('Qty') ?></th>
22
+ <th class="last"><span class="nobr"><?php echo $this->helper('marketplace')->__('Row Total') ?></span></th>
23
+ </tr>
24
+ </thead>
25
+ <?php $_items = $this->getItemsCollection();?>
26
+ <?php $i = 0; foreach ($_items as $_item): ?>
27
+ <?php if ($_item->getParentItem()) continue; else $i++; ?>
28
+ <tbody class="<?php echo $i % 2 ? 'even' : 'odd'; ?>">
29
+ <?php echo $this->getItemHtml($_item); ?>
30
+ <?php
31
+ $totalAdminCommission += $this->getAdminCommission($_item);
32
+ $sellerTotal += $this->getSellerItemAmount($_item);
33
+ $grandTotal += round($_item->getRowTotalInclTax(), 2);
34
+ ?>
35
+ </tbody>
36
+ <?php endforeach; ?>
37
+ <?php
38
+
39
+ $order = Mage::registry('current_order');
40
+ if($order->getShippingMethod() == 'marketplaceproductshipping_marketplaceproductshipping')
41
+ {
42
+ Mage::register('marketplace_shipping_price', Mage::helper('marketplace')->getSellerPriceFormatAttribute($order,$strong = false, $separator = '<br/>'));
43
+ $shippingPrice = Mage::helper('marketplace')->getSellerPriceAttribute($order);
44
+ $grandTotal += $shippingPrice;
45
+ }
46
+ Mage::register('admin_commission',$order->formatPrice($totalAdminCommission));
47
+ Mage::register('seller_total_amount',$order->formatPrice($sellerTotal));
48
+ Mage::register('grand_total',$order->formatPrice($grandTotal));
49
+ ?>
50
+ </table>
51
+ </div>
52
+ </div>
53
+ <br />
app/design/adminhtml/default/default/template/marketplace/sales/order/view/items/renderer/default.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_item = $this->getItem();
3
+ $adminCommision = $this->getAdminComission();
4
+ $sellerItemAmount = $this->getSellerItemAmount();
5
+ ?>
6
+ <tr class="border">
7
+ <td>
8
+ <div id="order_item_<?php echo $_item->getId() ?>" class="item-container">
9
+ <div class="item-text">
10
+ <h5 class="title"><span id="order_item_<?php echo $_item->getId() ?>_title"><?php echo $_item->getName() ?></span></h5>
11
+ <div><strong>SKU:</strong> <?php echo $_item->getSku() ?></div>
12
+ </div>
13
+ </div>
14
+ </td>
15
+ <td class="a-right"><span class="price"><?php echo Mage::registry('current_order')->formatPrice($adminCommision); ?></span></td>
16
+ <td class="a-right"><span class="price"><?php echo Mage::registry('current_order')->formatPrice($sellerItemAmount) ?></span></td>
17
+ <td class="a-right"><span class="price"><?php echo Mage::registry('current_order')->formatPrice($_item->getOriginalPrice()) ?></span></td>
18
+ <td>
19
+ <table cellspacing="0" class="qty-table">
20
+ <tbody>
21
+ <?php
22
+ if ($_item->getQtyOrdered() > 0):
23
+ echo '<tr><td>Ordered </td><td><strong>' . intval($_item->getQtyOrdered()) . '</strong></td></tr>';
24
+ endif;
25
+ if ($_item->getQtyInvoiced() > 0):
26
+ echo '<tr><td>Invoiced </td><td><strong>' . intval($_item->getQtyInvoiced()) . '</strong></td></tr>';
27
+ endif;
28
+ if ($_item->getQtyShipped() > 0):
29
+ echo '<tr><td>Shipped </td><td><strong>' . intval($_item->getQtyShipped()) . '</strong></td></tr>';
30
+ endif;
31
+ ?>
32
+ </tbody>
33
+ </table>
34
+ </td>
35
+ <td class="a-right last">
36
+ <span class="price">
37
+ <?php echo Mage::registry('current_order')->formatPrice(($_item->getPriceInclTax() * $_item->getQtyOrdered())); ?>
38
+ </span>
39
+ </td>
40
+ </tr>
app/design/adminhtml/default/default/template/marketplace/sales/order/view/totals.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <table cellspacing="0" width="100%">
3
+ <col />
4
+ <col width="1" />
5
+ <tbody>
6
+ <!-- TOTAL SELLER AMOUNT -->
7
+ <tr>
8
+ <td class="label">
9
+ <strong><?php echo $this->escapeHtml("Total Seller Amount"); ?></strong>
10
+ </td>
11
+ <td class="emph">
12
+ <strong><?php echo Mage::registry('seller_total_amount'); ?></strong>
13
+ </td>
14
+ </tr>
15
+ <!-- TOTAL ADMIN COMISSION -->
16
+ <tr>
17
+ <td class="label">
18
+ <strong><?php echo $this->escapeHtml("Total Admin Commission"); ?></strong>
19
+ </td>
20
+ <td class="emph">
21
+ <strong><?php echo Mage::registry('admin_commission'); ?></strong>
22
+ </td>
23
+ </tr>
24
+ <!-- SHIPPING TOTAL -->
25
+ <?php if(Mage::registry('marketplace_shipping_price')): ?>
26
+ <tr>
27
+ <td class="label">
28
+ <span><?php echo $this->escapeHtml("Shipping & Handling"); ?></span>
29
+ </td>
30
+ <td class="emph">
31
+ <strong><?php echo Mage::registry('marketplace_shipping_price'); ?></strong>
32
+ </td>
33
+ </tr>
34
+ <?php endif; ?>
35
+ <!-- GRAND TOTAL -->
36
+ <tr>
37
+ <td class="label">
38
+ <strong><?php echo $this->escapeHtml("Grand Total"); ?></strong>
39
+ </td>
40
+ <td class="emph">
41
+ <strong><?php echo Mage::registry('grand_total'); ?></strong>
42
+ </td>
43
+ </tr>
44
+ </tbody>
45
+ </table>
app/design/adminhtml/default/default/template/marketplace/seller/dashboard/info.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <?php
4
+ $weekSales = $this->weekSales();
5
+ $monthSales = $this->monthSales();
6
+ $lifeTimeSales = $this->lifetimeSales();
7
+ $PendingAmount = $this->getSellerPendingAmount();
8
+ ?>
9
+ <div class="content-header">
10
+ <h3 class="head-system-account"><?php echo $this->__('Orders'); ?></h3>
11
+ </div>
12
+ <div class="entry-edit box-left">
13
+ <div class="entry-edit-head" style='background:#8CC343;'><h4>Lifetime Sales</h4></div>
14
+ <fieldset class="a-center bold">
15
+ <span style="font-size:18px;" class="nowrap">
16
+ <span class="price"><?php echo Mage::helper('core')->currency($lifeTimeSales); ?></span>
17
+ <span style="font-size:14px; color:#686868;"></span>
18
+ </span>
19
+ </fieldset>
20
+ </div>
21
+ <div class="box-right">
22
+ <div class="entry-edit">
23
+ <div class="entry-edit-head" style="background:#BF824D"><h4>Pending Amount</h4></div>
24
+ <fieldset class="a-center bold">
25
+ <span style="font-size:18px;" class="nowrap">
26
+ <span class="price"><?php echo Mage::helper('core')->currency($PendingAmount); ?></span>
27
+ <span style="font-size:14px; color:#686868;"></span>
28
+ </span>
29
+ </fieldset>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="box-left">
34
+ <div class="entry-edit">
35
+ <div class="entry-edit-head"><h4>Week Sales</h4></div>
36
+ <fieldset class="a-center bold">
37
+ <span style="font-size:18px;" class="nowrap">
38
+ <span class="price"><?php echo Mage::helper('core')->currency($weekSales);?></span>
39
+ <span style="font-size:14px; color:#686868;"></span>
40
+ </span>
41
+ </fieldset>
42
+ </div>
43
+ </div>
44
+ <div class="box-right">
45
+ <div class="entry-edit">
46
+ <div class="entry-edit-head"><h4>Month Sales</h4></div>
47
+ <fieldset class="a-center bold">
48
+ <span style="font-size:18px;" class="nowrap">
49
+ <span class="price"><?php echo Mage::helper('core')->currency($monthSales);?></span>
50
+ <span style="font-size:14px; color:#686868;"></span>
51
+ </span>
52
+ </fieldset>
53
+ </div>
54
+ </div>
app/design/adminhtml/default/default/template/marketplace/seller/order/tab/invoice.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ <div class="content-header">
5
+ <h3 class="head-system-account"><?php echo $this->__('Orders'); ?></h3>
6
+ </div>
7
+
app/design/frontend/base/default/layout/marketplace.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="1.0.0">
2
+ <default>
3
+ <reference name="head">
4
+ <action method="addCss">
5
+ <stylesheet>marketplace/css/style.css</stylesheet>
6
+ </action>
7
+ </reference>
8
+ </default>
9
+ <adminhtml>
10
+ <reference name="head">
11
+ <action method="addCss">
12
+ <stylesheet>marketplace/css/style.css</stylesheet>
13
+ </action>
14
+ </reference>
15
+ </adminhtml>
16
+ <catalog_product_view>
17
+ <reference name="product.info">
18
+ <action method="setTemplate">
19
+ <template>marketplace/seller/catalog/product/view.phtml</template>
20
+ </action>
21
+ </reference>
22
+ </catalog_product_view>
23
+ <marketplace_seller_create>
24
+ <reference name="root">
25
+ <action method="setTemplate">
26
+ <template>page/1column.phtml</template>
27
+ </action>
28
+ </reference>
29
+ <reference name="content">
30
+ <block type="marketplace/register" name="marketplace.seller.register" template="marketplace/register.phtml" />
31
+ </reference>
32
+ </marketplace_seller_create>
33
+ <sales_order_view>
34
+ <reference name="head">
35
+ <action method="addItem"><type>skin_js</type><name>marketplace/js/marketplace.js</name></action>
36
+ </reference>
37
+ <reference name="order_items">
38
+ <action method="addItemRender">
39
+ <type>default</type>
40
+ <block>sales/order_item_renderer_default</block>
41
+ <template>marketplace/sales/order/items/renderer/default.phtml</template>
42
+ </action>
43
+ <action method="addItemRender">
44
+ <type>grouped</type>
45
+ <block>sales/order_item_renderer_grouped</block>
46
+ <template>marketplace/sales/order/items/renderer/default.phtml</template>
47
+ </action>
48
+ </reference>
49
+ </sales_order_view>
50
+ <marketplace_seller_view>
51
+ <reference name="root">
52
+ <action method="setTemplate">
53
+ <template>page/1column.phtml</template>
54
+ </action>
55
+ </reference>
56
+ <reference name="content">
57
+ <block type="marketplace/seller_profile" name="marketplace.seller.profile" template="marketplace/seller/profile.phtml" />
58
+ <block type="marketplace/seller_profile_review" name="marketplace.seller.review" template="marketplace/seller/profile/review.phtml" />
59
+ </reference>
60
+ </marketplace_seller_view>
61
+ </layout>
app/design/frontend/base/default/template/marketplace/register.phtml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-create">
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Become Seller') ?></h1>
4
+ </div>
5
+ <?php $sellerData = Mage::getSingleton('core/session')->getSellerData(); ?>
6
+ <form action="<?php echo $this->getUrl('marketplace/seller/save') ?>" method="post" id="seller-register-form">
7
+ <div class="fieldset">
8
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
9
+ <ul class="form-list">
10
+ <li class="fields">
11
+ <div class="customer-name">
12
+ <div class="field name-firstname">
13
+ <label for="firstname" class="required"><em>*</em>First Name</label>
14
+ <div class="input-box">
15
+ <input type="text" id="firstname" name="firstname" value="<?php echo $sellerData['firstname'] ?>" title="First Name" maxlength="255" class="input-text required-entry">
16
+ </div>
17
+ </div>
18
+ <div class="field name-lastname">
19
+ <label for="lastname" class="required"><em>*</em>Last Name</label>
20
+ <div class="input-box">
21
+ <input type="text" id="lastname" name="lastname" value="<?php echo $sellerData['lastname']; ?>" title="Last Name" maxlength="255" class="input-text required-entry">
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </li>
26
+ <li>
27
+ <label for="email_address" class="required"><em>*</em>Email Address</label>
28
+ <div class="input-box">
29
+ <input type="text" name="email" id="email_address" value="<?php echo $sellerData['email']; ?>" title="Email Address" class="input-text validate-email required-entry">
30
+ </div>
31
+ </li>
32
+ </ul>
33
+ </div>
34
+ <div class="fieldset">
35
+ <h2 class="legend"><?php echo $this->__('Shop Information') ?></h2>
36
+ <ul class="form-list">
37
+ <li class="fields">
38
+ <div class="field">
39
+ <label for="shop_name" class="required"><em>*</em><?php echo $this->__('Shop name') ?></label>
40
+ <div class="input-box">
41
+ <input type="text" name="shop_name" id="shop_name" value="<?php echo $sellerData['shop_name']; ?>" title="<?php echo $this->__('Shop Name') ?>" class="input-text required-entry" />
42
+ </div>
43
+ </div>
44
+ </li>
45
+ <li class="fields">
46
+ <div class="field">
47
+ <label for="shop_description" class="required"><em>*</em><?php echo $this->__('Shop Description(about shop)') ?></label>
48
+ <div>
49
+ <textarea name="shop_description" class="input-text required-entry" id="shop_description" title="<?php echo $this->__('About Shop') ?>"><?php echo $sellerData['shop_description'] ?></textarea>
50
+ </div>
51
+ </div>
52
+ </li>
53
+ <li class="fields">
54
+ <div class="field">
55
+ <label for="shop_url" class="required"><em>*</em><?php echo $this->__('Shop Url') ?></label>
56
+ <div>
57
+ <input type="text" name="shop_url" id="shop_url" value="<?php echo $sellerData['shop_url']; ?>" title="<?php echo $this->__('Shop Url') ?>" class="input-text required-entry validate-xml-identifier" />
58
+ <small><?php echo $this->__('Example: shop1-url') ?></small>
59
+ </div>
60
+ </div>
61
+ </li>
62
+ <li class="fields">
63
+ <div class="field">
64
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
65
+ <div class="input-box">
66
+ <input type="text" name="telephone" id="telephone" title="<?php echo $this->__('Telephone') ?>" value="<?php echo $sellerData['telephone'] ?>" class="input-text required-entry" />
67
+ </div>
68
+ </div>
69
+ </li>
70
+ <li class="fields">
71
+ <div class="field name-country">
72
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country'); ?></label>
73
+ <div class="input-box">
74
+ <select id="country" name="country" title="<?php echo $this->__('Country'); ?>" class="input-text required-entry validate-select" >
75
+ <?php $countryList = $this->getCountryList(); ?>
76
+ <?php foreach($countryList as $key => $value): ?>
77
+ <option value="<?php echo $key; ?>" <?php echo ($sellerData['country'] == $key ? 'selected': ''); ?>><?php echo $value; ?></option>
78
+ <?php endforeach; ?>
79
+ </select>
80
+ </div>
81
+ </div>
82
+ </li>
83
+ <li class="fields">
84
+ <div class="field">
85
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Postcode') ?></label>
86
+ <div class="input-box">
87
+ <input class="input-text validate-postcode required-entry" type="text" id="postcode" name="postcode" value="<?php echo $sellerData['postcode'] ?>">
88
+ </div>
89
+ </div>
90
+ </li>
91
+ </ul>
92
+ </div>
93
+ <div class="fieldset">
94
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
95
+ <ul class="form-list">
96
+ <li class="fields">
97
+ <div class="field">
98
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
99
+ <div class="input-box">
100
+ <input type="text" name="username" title="<?php echo $this->__('Username') ?>" id="username" class="input-text required-entry" value="<?php echo $sellerData['username'] ?>" />
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <li class="fields">
105
+ <div class="field">
106
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
107
+ <div class="input-box">
108
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
109
+ </div>
110
+ </div>
111
+ <div class="field">
112
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
113
+ <div class="input-box">
114
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
115
+ </div>
116
+ </div>
117
+ </li>
118
+ </ul>
119
+ </div>
120
+ <div class="buttons-set">
121
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
122
+ <button type="submit" title="<?php echo $this->__('Register') ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
123
+ </div>
124
+ </form>
125
+ </div>
126
+ <script type="text/javascript">
127
+ //< ![CDATA[
128
+ var customForm = new VarienForm('seller-register-form');
129
+ //]]>
130
+ </script>
app/design/frontend/base/default/template/marketplace/sales/order/items/renderer/default.phtml ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php $_item = $this->getItem() ?>
3
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
4
+ <td><h3 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h3>
5
+ <?php if($_options = $this->getItemOptions()): ?>
6
+ <dl class="item-options">
7
+ <?php foreach ($_options as $_option) : ?>
8
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
9
+ <?php if (!$this->getPrintStatus()): ?>
10
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
11
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
12
+ <?php echo $_formatedOptionValue['value'] ?>
13
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
14
+ <div class="truncated_full_value">
15
+ <dl class="item-options">
16
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
17
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
18
+ </dl>
19
+ </div>
20
+ <?php endif; ?>
21
+ </dd>
22
+ <?php else: ?>
23
+ <dd>
24
+ <?php echo nl2br($this->escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) )) ?>
25
+ </dd>
26
+ <?php endif; ?>
27
+ <?php endforeach; ?>
28
+ </dl>
29
+ <?php endif; ?>
30
+ <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
31
+ <?php if ($addtInfoBlock) :?>
32
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml(); ?>
33
+ <?php endif; ?>
34
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
35
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
36
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
37
+ <?php endif; ?>
38
+ </td>
39
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
40
+ <td class="a-right">
41
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
42
+ <span class="price-excl-tax">
43
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
44
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
45
+ <span class="cart-price">
46
+ <?php endif; ?>
47
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
48
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
49
+ </span>
50
+ <?php endif; ?>
51
+ <?php endif; ?>
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
53
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
54
+ <?php else: ?>
55
+ <span class="cart-price">
56
+ <?php endif; ?>
57
+
58
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
59
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
60
+ <?php else: ?>
61
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
62
+ <?php endif; ?>
63
+
64
+ </span>
65
+
66
+
67
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
68
+
69
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
70
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
71
+ <small>
72
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
73
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
74
+ <?php endforeach; ?>
75
+ </small>
76
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
77
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
78
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
79
+ <?php endforeach; ?>
80
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
81
+ <small>
82
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
83
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
84
+ <?php endforeach; ?>
85
+ </small>
86
+ <?php endif; ?>
87
+ </span>
88
+
89
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
90
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
91
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?></span>
92
+ </span>
93
+ <?php endif; ?>
94
+ <?php endif; ?>
95
+ </span>
96
+ <br />
97
+ <?php endif; ?>
98
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
99
+ <span class="price-incl-tax">
100
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
101
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
102
+ <span class="cart-price">
103
+ <?php endif; ?>
104
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
105
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
106
+ </span>
107
+ <?php endif; ?>
108
+ <?php endif; ?>
109
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
110
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
111
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
112
+ <?php else: ?>
113
+ <span class="cart-price">
114
+ <?php endif; ?>
115
+
116
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
117
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
118
+ <?php else: ?>
119
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
120
+ <?php endif; ?>
121
+
122
+ </span>
123
+
124
+
125
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
126
+
127
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
128
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
129
+ <small>
130
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
131
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
132
+ <?php endforeach; ?>
133
+ </small>
134
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
135
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
136
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
137
+ <?php endforeach; ?>
138
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
139
+ <small>
140
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
141
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
142
+ <?php endforeach; ?>
143
+ </small>
144
+ <?php endif; ?>
145
+ </span>
146
+
147
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
148
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
149
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
150
+ </span>
151
+ <?php endif; ?>
152
+ <?php endif; ?>
153
+ </span>
154
+ <?php endif; ?>
155
+ </td>
156
+ <td class="a-right">
157
+ <span class="nobr">
158
+ <?php if ($this->getItem()->getQtyOrdered() > 0): ?>
159
+ <?php echo $this->__('Ordered'); ?>: <strong><?php echo $this->getItem()->getQtyOrdered()*1 ?></strong><br />
160
+ <?php endif; ?>
161
+ <?php if ($this->getItem()->getQtyShipped() > 0): ?>
162
+ <?php echo $this->__('Shipped'); ?>: <strong><?php echo $this->getItem()->getQtyShipped()*1 ?></strong><br />
163
+ <?php endif; ?>
164
+ <?php if ($this->getItem()->getQtyCanceled() > 0): ?>
165
+ <?php echo $this->__('Canceled'); ?>: <strong><?php echo $this->getItem()->getQtyCanceled()*1 ?></strong><br />
166
+ <?php endif; ?>
167
+ <?php if ($this->getItem()->getQtyRefunded() > 0): ?>
168
+ <?php echo $this->__('Refunded'); ?>: <strong><?php echo $this->getItem()->getQtyRefunded()*1 ?></strong><br />
169
+ <?php endif; ?>
170
+ </span>
171
+ </td>
172
+ <td class="a-right">
173
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
174
+ <span class="price-excl-tax">
175
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
176
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
177
+ <span class="cart-price">
178
+ <?php endif; ?>
179
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
180
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
181
+ </span>
182
+ <?php endif; ?>
183
+ <?php endif; ?>
184
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
185
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
186
+ <?php else: ?>
187
+ <span class="cart-price">
188
+ <?php endif; ?>
189
+
190
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
191
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
192
+ <?php else: ?>
193
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
194
+ <?php endif; ?>
195
+
196
+ </span>
197
+
198
+
199
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
200
+
201
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
202
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
203
+ <small>
204
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
205
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
206
+ <?php endforeach; ?>
207
+ </small>
208
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
209
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
210
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></small></span>
211
+ <?php endforeach; ?>
212
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
213
+ <small>
214
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
215
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
216
+ <?php endforeach; ?>
217
+ </small>
218
+ <?php endif; ?>
219
+ </span>
220
+
221
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
222
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
223
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?></span>
224
+ </span>
225
+ <?php endif; ?>
226
+ <?php endif; ?>
227
+ </span>
228
+ <br />
229
+ <?php endif; ?>
230
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
231
+ <span class="price-incl-tax">
232
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
233
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
234
+ <span class="cart-price">
235
+ <?php endif; ?>
236
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
237
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
238
+ </span>
239
+ <?php endif; ?>
240
+ <?php endif; ?>
241
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
242
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
243
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
244
+ <?php else: ?>
245
+ <span class="cart-price">
246
+ <?php endif; ?>
247
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
248
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
249
+ <?php else: ?>
250
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
251
+ <?php endif; ?>
252
+
253
+ </span>
254
+
255
+
256
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
257
+
258
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
259
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
260
+ <small>
261
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
262
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
263
+ <?php endforeach; ?>
264
+ </small>
265
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
266
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
267
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
268
+ <?php endforeach; ?>
269
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
270
+ <small>
271
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
272
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
273
+ <?php endforeach; ?>
274
+ </small>
275
+ <?php endif; ?>
276
+ </span>
277
+
278
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
279
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
280
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
281
+ </span>
282
+ <?php endif; ?>
283
+ <?php endif; ?>
284
+
285
+
286
+
287
+ </span>
288
+ <?php endif; ?>
289
+ </td>
290
+ <!--
291
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
292
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?></th>
293
+ <?php endif; ?>
294
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
295
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?></th>
296
+ <?php endif; ?>
297
+ -->
298
+ </tr>
299
+
300
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
301
+ <td colspan="5">
302
+ <span class="review-link" onclick="hideShowReview(this)"><?php echo $this->__('Make Review Product') ?></span>
303
+ <div class="seller-review">
304
+ <div class="box-collateral box-reviews" id="customer-reviews">
305
+ <div class="form-add">
306
+ <?php if(!is_null($this->isSellerProduct())):?>
307
+ <?php if($this->shipmentItemId()): ?>
308
+ <form action="<?php echo $this->getReviewUrl(); ?>" method="post" id="review-form<?php echo $_item->getId() ?>">
309
+ <h1><?php echo $this->__("Write Review of Seller's Product") ?></h1>
310
+ <h3><?php echo $this->__('Seller:') ?><a href="<?php echo $this->getSellerUrl($this->SellerLink()->getId()) ?>" target="_blank"><?php echo $this->SellerLink()->getShopName() ?></a></h3>
311
+ <input type="hidden" name="seller_id" value="<?php echo $this->SellerLink()->getId(); ?>">
312
+ <input type="hidden" name="order_id" value="<?php echo $this->getRequest()->getParam('order_id'); ?>">
313
+ <input type="hidden" name="shipment_item_id" value="<?php echo $this->shipmentItemId(); ?>">
314
+ <?php echo $this->getLayout()->createBlock('marketplace/review')->setData('shipment_item_id', $this->shipmentItemId())->toHtml();?>
315
+ <?php echo $this->getLayout()->createBlock('marketplace/rating')->setData('shipment_item_id', $this->shipmentItemId())->toHtml();?>
316
+ <?php if(!$this->isReviewItemRated()): ?>
317
+ <div class="buttons-set">
318
+ <button type="submit" title="Submit Review" class="button"><span><span>Submit Review</span></span></button>
319
+ </div>
320
+ <?php endif; ?>
321
+ </form>
322
+
323
+ <?php else: ?>
324
+ <span><?php echo $this->__('After Item shipped You can review of this product') ?></span>
325
+ <?php endif; ?>
326
+ <?php else: ?>
327
+ <p><?php echo $this->__('You can review only seller product.This is an <b>admin</b> product') ?></p>
328
+ <?php endif; ?>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ </td>
333
+ </tr>
334
+ <script type="text/javascript">
335
+ //<![CDATA[
336
+ var reviewForm= new VarienForm("review-form<?php echo $_item->getId() ?>", true);
337
+ //]]>
338
+ </script>
app/design/frontend/base/default/template/marketplace/seller/catalog/product/view.phtml ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product view template
29
+ *
30
+ * @see Mage_Catalog_Block_Product_View
31
+ * @see Mage_Review_Block_Product_View
32
+ */
33
+ ?>
34
+ <?php $_helper = $this->helper('catalog/output'); ?>
35
+ <?php $_product = $this->getProduct(); ?>
36
+ <script type="text/javascript">
37
+ var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
38
+ </script>
39
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
40
+ <div class="product-view">
41
+ <div class="product-essential">
42
+ <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
43
+ <?php echo $this->getBlockHtml('formkey') ?>
44
+ <div class="no-display">
45
+ <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
46
+ <input type="hidden" name="related_product" id="related-products-field" value="" />
47
+ </div>
48
+
49
+ <div class="product-shop">
50
+ <div class="product-name">
51
+ <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
52
+ </div>
53
+
54
+ <?php if ($this->canEmailToFriend()): ?>
55
+ <p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
56
+ <?php endif; ?>
57
+ <?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
58
+ <?php echo $this->getChildHtml('alert_urls') ?>
59
+ <?php echo $this->getChildHtml('product_type_data') ?>
60
+ <?php echo $this->getTierPriceHtml() ?>
61
+ <?php echo $this->getChildHtml('extrahint') ?>
62
+
63
+ <!-- Marketplace Seller Information Start -->
64
+ <?php $sellerInfo = Mage::helper('marketplace')->getSellerInfo($_product);
65
+ if($sellerInfo)
66
+ echo $this->__("seller: <a href=%s target='_blank'><b>%s</b></a>",Mage::helper('marketplace')->getShopUrl($sellerInfo->getUrlPath()),ucfirst($sellerInfo->getShopName())) ?>
67
+ <!-- Marketplace Seller Information End -->
68
+
69
+ <?php if (!$this->hasOptions()):?>
70
+ <div class="add-to-box">
71
+ <?php if($_product->isSaleable()): ?>
72
+ <?php echo $this->getChildHtml('addtocart') ?>
73
+ <?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
74
+ <span class="or"><?php echo $this->__('OR') ?></span>
75
+ <?php endif; ?>
76
+ <?php endif; ?>
77
+ <?php echo $this->getChildHtml('addto') ?>
78
+ </div>
79
+ <?php echo $this->getChildHtml('extra_buttons') ?>
80
+ <?php elseif (!$_product->isSaleable()): ?>
81
+ <div class="add-to-box">
82
+ <?php echo $this->getChildHtml('addto') ?>
83
+ </div>
84
+ <?php endif; ?>
85
+
86
+ <?php if ($_product->getShortDescription()):?>
87
+ <div class="short-description">
88
+ <h2><?php echo $this->__('Quick Overview') ?></h2>
89
+ <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
90
+ </div>
91
+ <?php endif;?>
92
+
93
+ <?php echo $this->getChildHtml('other');?>
94
+
95
+ <?php if ($_product->isSaleable() && $this->hasOptions()):?>
96
+ <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
97
+ <?php endif;?>
98
+
99
+ </div>
100
+
101
+ <div class="product-img-box">
102
+ <?php echo $this->getChildHtml('media') ?>
103
+ </div>
104
+
105
+ <div class="clearer"></div>
106
+ <?php if ($_product->isSaleable() && $this->hasOptions()):?>
107
+ <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
108
+ <?php endif;?>
109
+ </form>
110
+ <script type="text/javascript">
111
+ //<![CDATA[
112
+ var productAddToCartForm = new VarienForm('product_addtocart_form');
113
+ productAddToCartForm.submit = function(button, url) {
114
+ if (this.validator.validate()) {
115
+ var form = this.form;
116
+ var oldUrl = form.action;
117
+
118
+ if (url) {
119
+ form.action = url;
120
+ }
121
+ var e = null;
122
+ try {
123
+ this.form.submit();
124
+ } catch (e) {
125
+ }
126
+ this.form.action = oldUrl;
127
+ if (e) {
128
+ throw e;
129
+ }
130
+
131
+ if (button && button != 'undefined') {
132
+ button.disabled = true;
133
+ }
134
+ }
135
+ }.bind(productAddToCartForm);
136
+
137
+ productAddToCartForm.submitLight = function(button, url){
138
+ if(this.validator) {
139
+ var nv = Validation.methods;
140
+ delete Validation.methods['required-entry'];
141
+ delete Validation.methods['validate-one-required'];
142
+ delete Validation.methods['validate-one-required-by-name'];
143
+ // Remove custom datetime validators
144
+ for (var methodName in Validation.methods) {
145
+ if (methodName.match(/^validate-datetime-.*/i)) {
146
+ delete Validation.methods[methodName];
147
+ }
148
+ }
149
+
150
+ if (this.validator.validate()) {
151
+ if (url) {
152
+ this.form.action = url;
153
+ }
154
+ this.form.submit();
155
+ }
156
+ Object.extend(Validation.methods, nv);
157
+ }
158
+ }.bind(productAddToCartForm);
159
+ //]]>
160
+ </script>
161
+ </div>
162
+
163
+ <div class="product-collateral">
164
+ <?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
165
+ <div class="box-collateral <?php echo "box-{$alias}"?>">
166
+ <?php if ($title = $this->getChildData($alias, 'title')):?>
167
+ <h2><?php echo $this->escapeHtml($title); ?></h2>
168
+ <?php endif;?>
169
+ <?php echo $html; ?>
170
+ </div>
171
+ <?php endforeach;?>
172
+ <?php echo $this->getChildHtml('upsell_products') ?>
173
+ <?php echo $this->getChildHtml('product_additional_data') ?>
174
+ </div>
175
+ </div>
app/design/frontend/base/default/template/marketplace/seller/profile.phtml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $seller = $this->sellerProfile();
4
+ $country = Mage::getModel('directory/country')->loadByCode($seller['country']);
5
+ ?>
6
+
7
+ <div class="seller-profile">
8
+ <div class="seller-top-panel">
9
+ <ul>
10
+ <li>
11
+ <div class="seller-profile-image">
12
+ <img src="<?php echo Mage::helper('marketplace')->getImagePath($seller['image']); ?>" height="140" width="140">
13
+ </div>
14
+ </li>
15
+ <li class="shop-info">
16
+ <div class="shopname">
17
+ <h2><?php echo $seller['shop_name']; ?></h2>
18
+ </div>
19
+ <div class="shop-description">
20
+ <p><?php echo $seller['shop_description']; ?></p>
21
+ </div>
22
+ <div class="shop-contact">
23
+ <span><?php echo $this->__('<b>Phone</b>: %s',$seller['telephone']);?></span>
24
+ </div>
25
+ <div class="seller-profile-contact">
26
+ <span><?php echo $this->__('<b>Email</b>: %s',$seller['email']); ?></span>
27
+ </div>
28
+ <div class="shop-location">
29
+ <span><?php echo $this->__('<b>Country</b>: %s',$country->getName());?></span>
30
+ </div>
31
+ </li>
32
+ <li class="summary-overview">
33
+ <h3><?php echo $this->__('Rating Conclusion') ?></h3>
34
+ <?php foreach($this->ratingOverview() as $rate):?>
35
+ <div class="rating-list">
36
+ <?php $ratingName = $this->getRatingName($rate['rating_id']); ?>
37
+ <?php $avgPercentage = ($rate['sub_total']*100)/($rate['rating_count']*5); ?>
38
+ <?php $rating = $rate['sub_total']/$rate['rating_count'] ; ?>
39
+ <?php $ratingTitle = $this->__("Rating: ").round($rating,1)."of 5"; ?>
40
+ <div class="rating-stars">
41
+ <div class="blank-stars"></div>
42
+ <div title="<?php echo $ratingTitle; ?>"class="fill-stars" style="width:<?php echo round($avgPercentage,2); ?>%"></div>
43
+ </div>
44
+ <div class="rating-name"><?php echo $ratingName; ?></div>
45
+ </div>
46
+ <?php endforeach; ?>
47
+ </li>
48
+ <li>
49
+ <?php $sum = 0;foreach($this->getReviewStars() as $rate) $sum += $rate['value_count'];?>
50
+ <?php $positive = array(5,4); $rate = $this->getPositivePercentage($positive);?>
51
+ <div class="rating-linegraph">
52
+ <div class="avgRatingSection sellerrating">
53
+ <?php $positiveTotal = count($rate) == 0 ? 0 : ($rate['positive_total']/$sum)*100 ?>
54
+ <div class="rating-percentage">
55
+ <span class="positive-average"><?php echo round($positiveTotal)."%"; ?></span>
56
+ <span class="positve-label"><?php echo $this->__('Positive') ?></span>
57
+ </div>
58
+ <span><?php echo $this->__('Based on %d ratings',$sum) ?></span>
59
+ </div>
60
+ <div class="seller-rating-bar seller-rating">
61
+ <ul>
62
+ <?php $count=5;for($count=5;$count>=1;$count--):
63
+ $rate = $this->getReviewStar($count);
64
+
65
+ $avg = ($rate == null ? 0 : (($rate['value_count']/$sum)*100));
66
+ ?>
67
+ <li>
68
+ <span><?php echo $count.$this->__('star') ?> </span>
69
+ <div class="blank-ratingbar">
70
+ <div class="fill-bar" style="width:<?php echo $avg; ?>%"></div>
71
+ </div>
72
+ <span class="rate-vote"><?php echo $rate == NULL ? 0 : $rate['value_count']; ?></span>
73
+ </li>
74
+ <?php endfor; ?>
75
+
76
+ </ul>
77
+ </div>
78
+ <div class="seller-rate-type seller-rating">
79
+ <div class="border type-positive"><?php echo $this->__('Positive'); ?></div>
80
+ <div class="border type-neutral"><?php echo $this->__('Neutral');?></div>
81
+ <div class="border type-negative"><?php echo $this->__('Negative') ;?></div>
82
+ </div>
83
+ </div>
84
+ </li>
85
+ </div>
86
+ </div>
app/design/frontend/base/default/template/marketplace/seller/profile/review.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $collection = $this->getCollection();?>
2
+ <div class="seller-review-table">
3
+ <?php echo $this->getToolbarHtml(); ?>
4
+ <?php if($collection->getSize()): ?>
5
+ <div class="seller-comments">
6
+ <?php foreach($collection as $review): ?>
7
+ <div class="reviews-section">
8
+ <div class="review-float">
9
+ <div class="date-line"><?php echo $this->formatDate($review->getCreatedDate(),'medium', false) ?> </div>
10
+ <div class="rating-line-block">
11
+ <?php $rating = $this->getRating($review->getShipmentItemId()); ?>
12
+ <?php foreach($rating as $rate): ?>
13
+ <div class="rating-line">
14
+ <div class="rating-contain"><?php echo $rate['name']; ?></div>
15
+ <div class="rating-contain">
16
+ <div class="blank-rating-img"></div>
17
+ <div class="fill-rating-img" style="width: <?php echo ($rate['value']*10)*2; ?>%"></div>
18
+ </div>
19
+ </div>
20
+ <?php endforeach; ?>
21
+ </div>
22
+ </div>
23
+ <div class='review-float'>
24
+ <div class="subject-line"><h4><?php echo ucfirst($review->getSubject()); ?></h4></div>
25
+ <div class="description-line"><?php echo $review->getDescription(); ?></div>
26
+ </div>
27
+ </div>
28
+ <?php endforeach; ?>
29
+ </div>
30
+ <script type="text/javascript">//decorateTable('my-custom-table');</script>
31
+ <?php echo $this->getToolbarHtml(); ?>
32
+ <?php else: ?>
33
+ <p><?php echo $this->__('<h2>There are no reviews available for this seller<h2>.'); ?></p>
34
+ <?php endif ?>
35
+ </div>
app/design/frontend/base/default/template/marketplace/seller/rating.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="seller-review-container">
3
+ <?php if($this->ratingCollection()->count()): ?>
4
+ <table class="data-table">
5
+ <colgroup><col>
6
+ <col width="1">
7
+ <col width="1">
8
+ <col width="1">
9
+ <col width="1">
10
+ <col width="1">
11
+ </colgroup><thead>
12
+ <tr class="first last">
13
+ <th>&nbsp;</th>
14
+ <th><span class="nobr a-center"><?php echo $this->__('1 star'); ?></span></th>
15
+ <th><span class="nobr a-center"><?php echo $this->__('2 star'); ?></span></th>
16
+ <th><span class="nobr a-center"><?php echo $this->__('3 star'); ?></span></th>
17
+ <th><span class="nobr a-center"><?php echo $this->__('4 star'); ?></span></th>
18
+ <th><span class="nobr a-center"><?php echo $this->__('5 star'); ?></span></th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <?php $count = 0; foreach($this->ratingCollection() as $rating): $count++; ?>
23
+ <?php $rateValue = $this->getValue($rating->getId()); ?>
24
+ <tr class="<?php echo ($count % 2 == 0 ? 'even': 'odd'); ?>">
25
+
26
+ <?php if($rateValue): ?>
27
+ <th><?php echo $rating->getName(); ?></th>
28
+ <th class="rate-center" colspan="5"><?php echo $rateValue . $this->__(' star'); ?></th>
29
+ <?php else: ?>
30
+ <th><?php echo $rating->getName(); ?></th>
31
+ <td><input type="radio" name="rating[<?php echo $rating->getId(); ?>]" id="<?php echo $rating->getName() . '_1'; ?>" value="1" class="radio"></td>
32
+ <td><input type="radio" name="rating[<?php echo $rating->getId(); ?>]" id="<?php echo $rating->getName() . '_2'; ?>" value="2" class="radio"></td>
33
+ <td><input type="radio" name="rating[<?php echo $rating->getId(); ?>]" id="<?php echo $rating->getName() . '_3'; ?>" value="3" class="radio"></td>
34
+ <td><input type="radio" name="rating[<?php echo $rating->getId(); ?>]" id="<?php echo $rating->getName() . '_4'; ?>" value="4" class="radio"></td>
35
+ <td><input type="radio" name="rating[<?php echo $rating->getId(); ?>]" id="<?php echo $rating->getName() . '_5'; ?>" value="5" class="radio"></td>
36
+ <?php endif; ?>
37
+ </tr>
38
+
39
+ <?php endforeach; ?>
40
+ </tbody>
41
+ </table>
42
+ <?php endif; ?>
43
+ </div>
app/design/frontend/base/default/template/marketplace/seller/review.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $review = $this->getReview(); ?>
2
+ <?php if(is_null($review)): ?>
3
+ <fieldset class="">
4
+ <ul class="form-list">
5
+ <li>
6
+ <label for="nickname_field" class="required"><em>*</em><?php echo $this->__('Subject');?></label>
7
+ <div class="input-box">
8
+ <input type="text" name="review[subject]" id="subject_field" class="input-text required-entry">
9
+ </div>
10
+ </li>
11
+ <li>
12
+ <label for="review_field" class="required"><em>*</em><?php echo $this->__('Review');?></label>
13
+ <div class="input-box">
14
+ <textarea name="review[description]" id="description_field" cols="5" rows="3" class="required-entry"></textarea>
15
+ </div>
16
+ </li>
17
+ </ul>
18
+ </fieldset>
19
+ <?php else: ?>
20
+ <fieldset class="">
21
+ <ul class="form-list">
22
+ <li>
23
+ <p>&nbsp;</p>
24
+ <div class="input-box">
25
+ <span><b><?php echo $review->getSubject(); ?></b></span>
26
+ </div>
27
+ </li>
28
+ <li>
29
+ <div class="input-box">
30
+ <span><?php echo $review->getDescription(); ?></span>
31
+ </div>
32
+ <p>&nbsp;</p>
33
+ </li>
34
+ </ul>
35
+ </fieldset>
36
+ <?php endif; ?>
app/etc/modules/Manthan_Marketplace.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Manthan_Marketplace>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Manthan_Marketplace>
7
+ </modules>
8
+ </config>
app/etc/modules/Manthan_Marketplaceproductshipping.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Manthan_Marketplaceproductshipping>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Manthan_Marketplaceproductshipping>
7
+ </modules>
8
+ </config>
app/locale/en_US/Manthan_Marketplace.csv ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Become Seller,Become Seller
2
+ Personal Information,Personal Information
3
+ Shop Information,Shop Information
4
+ Shop name,Shop name
5
+ Shop Description(about shop),Shop Description(about shop)
6
+ About Shop,About Shop
7
+ Shop Url,Shop Url
8
+ Example: shop1-url,Example: shop1-url
9
+ Telephone,Telephone
10
+ Postcode,Postcode
11
+ Username,Username
12
+ Password,Password
13
+ Register,Register
14
+ Connect as Seller,Connect as Seller
15
+ Make Review Product,Make Review Product
16
+ Subject,Subject
17
+ Review,Review
18
+ Manage Seller Payment,Manage Seller Payment
19
+ Note,Note
20
+ Paid Amount to Seller By Admin,Paid Amount to Seller By Admin
21
+ Admin has Amount ,Admin has Amount
22
+ Payment Date,Payment Date
23
+ Order #,Order #
24
+ ID,ID
25
+ Week Sales,Week Sales
26
+ Pending Amount,Pending Amount
27
+ Lifetime Sales,Lifetime Sales
28
+ Month Sales,Month Sales
29
+ Rating Conclusion,Rating Conclusion
30
+ <b>Phone</b>,<b>Phone</b>
31
+ <b>Email</b>,<b>Email</b>
32
+ <b>Country</b>,<b>Country</b>
33
+ Based on %d ratings,Based on %d ratings
34
+ Positive,Positive
35
+ Neutral,Neutral
36
+ Negative,Negative
app/locale/en_US/template/email/marketplace/seller_activation_email.html ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Account Activated @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "var firstname":"First Name",
7
+ "var lastname":"Last Name",
8
+ "var store.getFrontendName()":"Store Name",
9
+ "store url=\"adminhtml/index/index/\"":"Admin Login Url"}
10
+ @-->
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <!-- [ header starts here] -->
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
25
+ </td>
26
+ </tr>
27
+ <!-- [ middle starts here] -->
28
+ <tr>
29
+ <td valign="top">
30
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{var firstname}} {{var lastname}},</h1>
31
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">We are delighted that your account has been activated. Login our site click <a href="{{store url="adminhtml/index/index/"}}" style="color:#1E7EC8;">Login</a></p>
32
+ <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;">
33
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Dashboard will be displayed Liftime Sales,Month Sales,Week Sales and Pending Amount</li>
34
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; You can add,edit and delete products</li>
35
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Add domestic and an international shipping cost per product</li>
36
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Check the status of orders</li>
37
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; List of all orders</li>
38
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Update your account information</li>
39
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Manage product reviews and ratings</li>
40
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Print pdf of packing slip</li>
41
+ <li style="list-style:none inside; padding:0 0 0 10px;">&ndash; Print pdf of order</li>
42
+ </ul>
43
+ <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
48
+ </tr>
49
+ </table>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+ </div>
54
+ </body>
app/locale/en_US/template/email/marketplace/seller_confirmation_email.html ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Welcome {{var firstname}} {{var lastname}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "var firstname":"First Name",
7
+ "var lastname":"Last Name",
8
+ "var store.getFrontendName()":"Store Name",
9
+ "store url=\"adminhtml/index/index/\"":"Admin Login Url"}
10
+ @-->
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
21
+ <tr>
22
+ <td valign="top">
23
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <td valign="top">
28
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{var firstname}} {{var lastname}},</h1>
29
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Welcome to {{var store.getFrontendName()}}. We are delighted that you have registered successfully. Your account will be activated after verification. You will get a notification email after your account will be activated.</p>
30
+ <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
35
+ </tr>
36
+ </table>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </div>
41
+ </body>
app/locale/en_US/template/email/marketplace/seller_new_registration_email.html ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject New Seller Registered @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "var seller_url":"Activate URL",
7
+ "var firstname":"First Name",
8
+ "var lastname":"Last Name",
9
+ "var seller_email_id":"Seller Email Id",
10
+ "var shop_name":"Shop Name",
11
+ "var telephone":"telephone",
12
+ "var country":"Country Name",
13
+ "var username":"Username",
14
+ "var store.getFrontendName()":"Store Name"}
15
+ @-->
16
+ <!--@styles
17
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
18
+ @-->
19
+
20
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
21
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
22
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
23
+ <tr>
24
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
25
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
26
+ <!-- [ header starts here] -->
27
+ <tr>
28
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
29
+ </tr>
30
+ <!-- [ middle starts here] -->
31
+ <tr>
32
+ <td valign="top">
33
+ <h3 style="font-size:16px; font-weight:normal; line-height:18px; margin:0 0 11px 0;"">Dear Admin,</h3>
34
+ <p style="font-size:12px; margin:0; line-height:18px; ">
35
+ Congratulations, New seller has been registered on {{var store.getFrontendName()}}. Click <a href="{{var seller_url}}">here</a> to activate seller.
36
+ <h1> New Seller Shop Information:</h1>
37
+ </p>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <td>
42
+ <p style="font-size:14px; line-height:18px; margin:0; padding:5px 16px;border:1px solid #CECBCB; ">
43
+ <strong>Fistname: </strong>{{var firstname}}<br />
44
+ <strong>Lastname: </strong>{{var lastname}}<br />
45
+ <strong>Email: </strong>{{var seller_email_id}}<br />
46
+ <strong>Shop Name: </strong>{{var shop_name}}<br />
47
+ <strong>Contact No.: </strong>{{var telephone}}<br />
48
+ <strong>Country : </strong>{{var country}}<br />
49
+ <strong>UserName : </strong>{{var username}}<br />
50
+ </p>
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
55
+ </tr>
56
+ </table>
57
+ </td>
58
+ </tr>
59
+ </table>
60
+ </div>
61
+ </body>
62
+
app/locale/en_US/template/email/sales/seller_new_order.html ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Order Details @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "var seller_name":"Vendor Name",
7
+ "var customer_name":"Customer Name",
8
+ "var order_increment_id":"Order Increment Id.",
9
+ "var store.getFrontendName()":"Store Name",
10
+ "store url=\"customer/account/\"":"Customer Account Url",
11
+ "var billing_address":"Billing Address",
12
+ "var shipping_address":"Shipping Address",
13
+ "var seller_order_items":"Order Items Grid"}
14
+ @-->
15
+ <!--@styles
16
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
17
+ @-->
18
+
19
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
20
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
21
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
22
+ <tr>
23
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
24
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
25
+ <!-- [ header starts here] -->
26
+ <tr>
27
+ <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
28
+ </tr>
29
+ <!-- [ middle starts here] -->
30
+ <tr>
31
+ <td valign="top">
32
+ <h5 style="font-size:16px; font-weight:normal; line-height:18px; margin:0 0 11px 0;"">Dear, {{var seller_name}}</h5>
33
+ </tr>
34
+ <tr>
35
+ <td>
36
+ <h3 style="font-size:14px; font-weight:normal; margin:0;">Your item has been ordered by {{var customer_name}}, Order # {{var order_increment_id}}</h3>
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <td>
41
+ <table cellspacing="0" cellpadding="0" border="0" width="650" >
42
+ <thead>
43
+ <tr>
44
+ <th align="left" width="340" bgcolor="#EAEAEA" style="font-size:12px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
45
+ {{depend not_virtual_order}}
46
+ <th width="10"></th>
47
+ <th align="left" width="340" bgcolor="#EAEAEA" style="font-size:12px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
48
+ {{/depend}}
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+ <tr>
53
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
54
+ {{var billing_address}}
55
+ </td>
56
+ {{depend not_virtual_order}}
57
+ <td></td>
58
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
59
+ {{var shipping_address}}
60
+ </td>
61
+ {{/depend}}
62
+ </tr>
63
+ </tbody>
64
+ </table>
65
+ <br/>
66
+ {{var seller_order_items}}
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
71
+ </tr>
72
+ </table>
73
+ </td>
74
+ </tr>
75
+ </table>
76
+ </div>
77
+ </body>
media/marketplace/seller/images/default.jpg ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Manthan_Multi_Seller_Marketplace</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Manthan Marketplace will convert your Magento Store into multi seller marketplace.</summary>
10
+ <description>Manthan Multi seller Marketplace will convert your Magento store into multi seller website.Multiple seller can register and sell own products in a website.Seller can add all types of products.Individual Seller shop profile page at frontend.Individual dashboard of seller.Seller can see its payment status and sales details.Customer can make reviews of sellers.Seller can generate print of invoice and packing slip.Seller can add international and domestic shipping cost per product.</description>
11
+ <notes>This is first release.</notes>
12
+ <authors><author><name>Manthan Soni</name><user>Manthan</user><email>sonimanthan0@gmail.com</email></author></authors>
13
+ <date>2016-01-28</date>
14
+ <time>20:41:03</time>
15
+ <contents><target name="magecommunity"><dir name="Manthan"><dir name="Marketplace"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="16cd6668035b5bf955e3208eb944c69a"/><dir name="Renderer"><file name="Seller.php" hash="f8a62f61d4aeab8f54f118e498c54d29"/><file name="Status.php" hash="eadce8c0586f184fa0fde590d75bc20a"/></dir></dir></dir><file name="Login.php" hash="4a4498e3d6d1f7305a0876e21fde06f6"/><dir name="Order"><dir name="Edit"><file name="Form.php" hash="e815ae17e213b55b3d4a6d6277e4f913"/><file name="Info.php" hash="2ae9e743623bb849917072e05898c40b"/><dir name="Items"><dir name="Renderer"><file name="Default.php" hash="7df73c2aba7035b0b73f7043e0010e77"/></dir></dir><file name="Items.php" hash="5201a735a43c1619b3b6eaab0eabc3e9"/></dir><file name="Edit.php" hash="b4599ad07d0d30bb9b191d8541eb4de7"/><file name="Grid.php" hash="620da82768ba892e0cfa93ea34a01093"/></dir><file name="Order.php" hash="5ae6d6a610e39afe9082335dd753d61f"/><dir name="Payment"><dir name="Edit"><file name="Form.php" hash="f65eeccdcdf3111da9cd904a4a2adb4d"/></dir><file name="Edit.php" hash="19bd7b056709bc37429711596e071d9a"/><file name="Grid.php" hash="663369eff8fdb3ab717bf64053902b7a"/><dir name="Renderer"><file name="Adminamount.php" hash="b7efd2c0e6178811b6261689580b8a6c"/><file name="Seller.php" hash="1d470953110cac4e268b9d86d8d29b49"/><file name="Sellerpaidamount.php" hash="3bb18f8fd7d61bc358f507878bafed98"/></dir></dir><file name="Payment.php" hash="8bcda1200b1c71ca32b9b7d254115476"/><dir name="Rating"><dir name="Edit"><file name="Form.php" hash="2917f1d27d2bae6c1fbd63956c62ae94"/></dir><file name="Edit.php" hash="895ba8eec87a1af79345af849c81de77"/><file name="Grid.php" hash="7694d74c8d0caa9fcfd2705983cdde60"/></dir><file name="Rating.php" hash="b378d38f73938c3293bf97de36ff98fd"/><dir name="Review"><dir name="Edit"><file name="Form.php" hash="15b882dbe32df04b49eef4ae5ac181fb"/></dir><file name="Edit.php" hash="39b17eec900465eb4a3ea95a5d07958d"/><file name="Grid.php" hash="1eaf8ed4f2234099b307de02598e75d5"/><dir name="Rating"><file name="Detailed.php" hash="1fd2694845307aae59defc34c8bd9e74"/></dir><dir name="Renderer"><dir name="Product"><file name="Detail.php" hash="340a0169b73cd0834237cb8b02960bb0"/></dir><dir name="Seller"><file name="Detail.php" hash="073402752c1bcc3ed7816213f942e94c"/></dir></dir></dir><file name="Review.php" hash="4ccff2a526e529c968e58503677775fe"/><dir name="Seller"><dir name="Account"><dir name="Edit"><file name="Form.php" hash="3de50399ffcc7e326a66a84a18dbbeb9"/><dir name="Tab"><file name="Form.php" hash="47818d7c4aa2fc71b9351ff22e48e4bf"/></dir><file name="Tabs.php" hash="e2aeb7d269193e4750689798167eb1db"/></dir><file name="Edit.php" hash="05c9791b35db53f4491f8df77097fe76"/><file name="Grid.php" hash="758762023fd25a0453718837b0d08f6a"/><dir name="Product"><file name="Grid.php" hash="a642537c904e5ee5ba1477755de44ada"/></dir></dir><file name="Account.php" hash="ccbae34c1bbf9189f77e9a76e1f03edf"/><dir name="Dashboard"><file name="Info.php" hash="0a9f750694fd0b3e9949659e37992167"/></dir></dir><dir name="System"><dir name="Account"><dir name="Edit"><file name="Form.php" hash="b247dacc3ee5506f4827f331b19b9284"/></dir></dir></dir></dir><file name="Rating.php" hash="ddde0cf4374eff80c21dd31424fc2010"/><file name="Register.php" hash="76c7fd2948571294c33d304440ae65ae"/><file name="Review.php" hash="db577fc5c4453267cdc32fefebc42fbd"/><dir name="Sales"><dir name="Order"><dir name="Item"><dir name="Renderer"><file name="Default.php" hash="a5bf1848e95648d26cf677790d147324"/><file name="Grouped.php" hash="0e81fb944f47ba3c6400f13b8ba164ee"/></dir></dir></dir></dir><dir name="Seller"><dir name="Catalog"><dir name="Product"><file name="List.php" hash="7107bb48a70e1e10c93683a7eb736661"/></dir></dir><dir name="Profile"><file name="Review.php" hash="1853267313ff94d779d02cb609d429c8"/><file name="Toolbar.php" hash="ad00c7841f9a9b1c8cf1233662940606"/></dir><file name="Profile.php" hash="89c3b0c19c40d33b4ee8c7a5d46a2556"/></dir></dir><dir name="Controller"><file name="Router.php" hash="99f7860a41e545f3fee1a068cd644a82"/></dir><dir name="Helper"><file name="Data.php" hash="7f5f3e9850059c9cb5bb33a4cbd1734c"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><file name="Status.php" hash="59bf9bdd30d21b23b3dc7c269be75a5c"/></dir></dir></dir><dir name="Mysql4"><dir name="Payment"><file name="Collection.php" hash="b63e0eae3c17a1e2176a73f3e894b683"/></dir><file name="Payment.php" hash="451e378721b51a8a780802bfb5a628b8"/><dir name="Pricecomparison"><file name="Collection.php" hash="8ec0dc581344a521351c0938ae8b08d2"/></dir><file name="Pricecomparison.php" hash="9579f1047ec3520c0c93a57eb0e79dd4"/><dir name="Rating"><file name="Collection.php" hash="11d2b712d07582a89fa02f3d3e6196bc"/></dir><file name="Rating.php" hash="757355dfe8267ab89537cce222f88f19"/><dir name="Review"><file name="Collection.php" hash="884fd3f5d90f8e3200f9d1c63d4eaa68"/></dir><file name="Review.php" hash="9c3c07ee0423e3d1e1406935b21b3e08"/><dir name="Seller"><file name="Collection.php" hash="972576b7d2d1029b2b96240ce0400be7"/></dir><file name="Seller.php" hash="9805d365588f0213c91c1ae70f2bb68f"/><dir name="Sellerrate"><file name="Collection.php" hash="b8b666adf97532eae04b8bbe392453f7"/></dir><file name="Sellerrate.php" hash="7ea738747b8be85d94254a003d8012ab"/><dir name="Vendorproduct"><file name="Collection.php" hash="194a2d7aaf3c4468433f0009ed7b06e5"/></dir><file name="Vendorproduct.php" hash="825fc9f4d39c21a4e398c1758d32085a"/></dir><file name="Observer.php" hash="7acf13e98fe2378d71b0704173bc80df"/><file name="Payment.php" hash="727dcb8be0295fdeb92886e866a6f717"/><dir name="Pdf"><file name="Invoice.php" hash="b61d7968aaf7ba49ed3f2cf25b262242"/><dir name="Shipment"><file name="Packing.php" hash="68f1fcf570ccdbe3a4cceb2c12b05b12"/></dir></dir><file name="Rating.php" hash="90a7ba052b73c950986edaaae237f993"/><file name="Review.php" hash="46a6396e106ccd970cf07d0f552fca50"/><file name="Seller.php" hash="84cf130abbdc6256162812eb6fa710f9"/><file name="Sellerrate.php" hash="632ceb143ecf26b3db976b1cd70cc627"/><dir name="System"><dir name="Config"><file name="Role.php" hash="131d3d846811f0a190b39c9541d5a95e"/></dir></dir><file name="Vendorproduct.php" hash="de2b26453ca01e878698941a944099f7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AccountController.php" hash="954238fcce5b5c61d6bfd4961b83b980"/><dir name="Admin"><file name="IndexController.php" hash="c50136d9a452ef00068cd4bbcbce25bb"/><dir name="System"><file name="AccountController.php" hash="27e133827229e28582a9b5b5fec65a58"/></dir></dir><file name="DashboardController.php" hash="1bcb729877ab135e54c5448c2b70d1fe"/><file name="OrderController.php" hash="5529da83ba8148b3f4ce7c0c34f4ec20"/><file name="PaymentController.php" hash="daa938576a343f7aca7cd8724705077f"/><file name="RatingController.php" hash="c7483e081fde3da4620d8175c8c074de"/><file name="ReviewController.php" hash="fd952916eeeb7633bfe5bad762209c95"/></dir><file name="ReviewController.php" hash="fe2927aeaddd933bc5cf62c4aad609f2"/><file name="SellerController.php" hash="4094f75c259cb92651c678eadab97038"/></dir><dir name="etc"><file name="config.xml" hash="42b21ba97680bdbaeec5a5b0698cdd67"/><file name="system.xml" hash="2401317c7f8b846d9ea7e0ad2093deec"/></dir><dir name="sql"><dir name="marketplace_setup"><file name="mysql4-install-1.0.0.php" hash="bc3a3581e91c670094f80491f79c78ba"/></dir></dir></dir><dir name="Marketplaceproductshipping"><dir name="Helper"><file name="Data.php" hash="e8f79106f2933fbc4b9fe98be8f4f432"/></dir><dir name="Model"><dir name="Carrier"><file name="Marketplaceproductshipping.php" hash="2e555f3ce3fba5cb95313a4cf7db09ce"/></dir></dir><dir name="etc"><file name="config.xml" hash="2d938a9765fd37ecf24aec5e4bb2f2b1"/><file name="system.xml" hash="b3f215092bf0ebcf356ad2f7173283a3"/></dir><dir name="sql"><dir name="marketplaceproductshipping_setup"><file name="mysql4-install-1.0.0.php" hash="31da71b2ac86a41cfe321a69c89acf48"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="marketplace"><file name="register.phtml" hash="15e4f0bbde98c9ac9ab421dd774e0c3a"/><dir name="sales"><dir name="order"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="76bfa2fe5c1666b67bd9b2887a9f48a6"/></dir></dir></dir></dir><dir name="seller"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="e0900f10e8e91f8251cff27bfad6acfb"/></dir></dir><dir name="profile"><file name="review.phtml" hash="47f549428f1662c5cd315ec562cbc6c8"/></dir><file name="profile.phtml" hash="50205d1ae6dad8be87ec6ca436e3844c"/><file name="rating.phtml" hash="7162bb9b6185a8b09f23f10d35586afa"/><file name="review.phtml" hash="f461a680ff08789ce5b568c2d1e932a8"/></dir></dir></dir><dir name="layout"><file name="marketplace.xml" hash="671333e8de34ce6080a21a7649d1d5ab"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="marketplace"><dir name="catalog"><dir name="product"><file name="edit.phtml" hash="08832349f6d48a502c99e762a1db3a06"/></dir></dir><dir name="page"><file name="header.phtml" hash="db0ca276b2bd73777297bbfcf53086a6"/></dir><dir name="rating"><file name="detailed.phtml" hash="7f5bf25fafb994e58ac2a3f75dbbd2a6"/></dir><dir name="sales"><dir name="order"><file name="form.phtml" hash="aae135cab4a543856a4f2256582e1ba5"/><dir name="view"><file name="info.phtml" hash="636814f490fd35dbdf69f1c2273eec0c"/><dir name="items"><dir name="renderer"><file name="default.phtml" hash="1f30d982602a3370f676ca17f1271dd3"/></dir></dir><file name="items.phtml" hash="2beae8ef5c1e05ac26c5f7f66fd2ed7f"/><file name="totals.phtml" hash="0b2d740f99a55cf1248c98e86f253413"/></dir></dir></dir><dir name="seller"><dir name="dashboard"><file name="info.phtml" hash="4b8097f25c6937687ab09113fea2ee01"/></dir><dir name="order"><dir name="tab"><file name="invoice.phtml" hash="3fa049af82b9719abec73f49828aad3d"/></dir></dir></dir></dir></dir><dir name="layout"><file name="marketplace.xml" hash="42393779a22fc8dd9c8114fe26141d0f"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Manthan_Marketplace.csv" hash="b119955e91ff694a0ad02018b8ab34c6"/><dir name="template"><dir name="email"><dir name="marketplace"><file name="seller_activation_email.html" hash="604386f6502f11f0cd1d806e766149ac"/><file name="seller_confirmation_email.html" hash="0bcd6b11cbb8679bd2e3e1e506ddf083"/><file name="seller_new_registration_email.html" hash="029625cc6886d6c602476fa5b1bb3edd"/></dir><dir name="sales"><file name="seller_new_order.html" hash="ce7dd59941ca6ec9e5b481280be2ebe9"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="marketplace"><dir name="seller"><dir name="images"><file name="default.jpg" hash="ab63eeb237243d90f8bd18c8bea5a220"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="marketplace"><dir name="css"><dir name="images"><file name="blank_stars.png" hash="59d979f7be39455e99e205627c0bbb24"/><file name="blank_stars_copy.png" hash="15bd16d374523a80ef819fb72d9960c8"/><file name="fill_stars.png" hash="2d13b5e144a9a3dbaf0bb8ce09c6f8da"/></dir><file name="style.css" hash="19c4da08fe99a6a0602878693893c821"/></dir><dir name="js"><file name="marketplace.js" hash="9a9207a0de454edb1b381d761f20d199"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="marketplace"><dir name="css"><file name="style.css" hash="fb3919ff90bbab57287b02fc16710f0a"/></dir><dir name="images"><file name="vendor-logo.png" hash="2da029a2b50d822d57632ed6a04422f3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Manthan_Marketplace.xml" hash="137310844b4c03e0808f24549038e2d1"/><file name="Manthan_Marketplaceproductshipping.xml" hash="44d3ee8c261003e2e50e8e5b8ad5970d"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.4.0</min><max>5.5.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/marketplace/css/style.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .rating-label{ display:inline-block; width:80px; }
3
+ .review-link
4
+ {
5
+ border:1px solid #FFF;
6
+ padding:5px;
7
+ text-transform:uppercase;
8
+ padding: 5px 15px;
9
+ text-decoration: none;
10
+ font-size: 11px;
11
+ color: #FFF;
12
+ background-color:#0a263c;
13
+ display:block;
14
+ font-weight: bold;
15
+ text-transform: uppercase;
16
+ width:150px;
17
+ margin:5px 0;
18
+ }
19
+ .rate-center { text-align:center; }
20
+ .ratings {
21
+ position: relative;
22
+ vertical-align: middle;
23
+ display: inline-block;
24
+ color: #b1b1b1;
25
+ overflow: hidden;
26
+ }
27
+ .ratings {
28
+ position: relative;
29
+ vertical-align: middle;
30
+ display: inline-block;
31
+ color: #b1b1b1;
32
+ overflow: hidden;
33
+ }
34
+ .full-stars {
35
+ position: absolute;
36
+ left: 0;
37
+ top: 0;
38
+ white-space: nowrap;
39
+ overflow: hidden;
40
+ color: #fde16d;
41
+ }
42
+ .empty-stars:before, .full-stars:before {
43
+ content:"\2605\2605\2605\2605\2605";
44
+ font-size: 19pt;
45
+ }
46
+ .empty-stars:before {
47
+ -webkit-text-stroke: 1px #848484;
48
+ }
49
+ .full-stars:before {
50
+ -webkit-text-stroke: 1px orange;
51
+ }
52
+ .rating-detail .row { float:left; width:106px; }
53
+ /* Webkit-text-stroke is not supported on firefox or IE */
54
+
55
+ /* Firefox */
56
+ @-moz-document url-prefix() {
57
+ .full-stars {
58
+ color: #ECBE24;
59
+ }
60
+ }
61
+ /* IE */
62
+ <!--[if IE]> .full-stars {
63
+ color: #ECBE24;
64
+ }
65
+ <![endif]-->
skin/adminhtml/default/default/marketplace/images/vendor-logo.png ADDED
Binary file
skin/frontend/base/default/marketplace/css/images/blank_stars.png ADDED
Binary file
skin/frontend/base/default/marketplace/css/images/blank_stars_copy.png ADDED
Binary file
skin/frontend/base/default/marketplace/css/images/fill_stars.png ADDED
Binary file
skin/frontend/base/default/marketplace/css/style.css ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .review-link
2
+ {
3
+ border:1px solid #FFF;
4
+ padding:5px;
5
+ text-transform:uppercase;
6
+ padding: 5px 15px;
7
+ text-decoration: none;
8
+ font-size: 11px;
9
+ color: #FFF;
10
+ background-color:#0a263c;
11
+ display:block;
12
+ font-weight: bold;
13
+ text-transform: uppercase;
14
+ width:150px;
15
+ margin:5px 0;
16
+ }
17
+ .review-link:hover { cursor:pointer; }
18
+ .seller-review { display:none; }
19
+ .active-review { display:block; }
20
+ .seller-review h1 { color:#e26703; }
21
+ .seller-review .buttons-set button.button { float:left; }
22
+ .seller-review-container { width:65%; }
23
+ .seller-review .buttons-set { margin:1em 0px 3em;border-top:0px;}
24
+ .rate-center { text-align:center; }
25
+ .seller-top-panel { width:902px; box-shadow:1px 1px 8px 1px #888888; background-color:#FFF; height:auto;overflow:auto; }
26
+ .seller-top-panel ul li { list-style:none; }
27
+ .seller-top-panel ul li { margin:20px 5px; float:left; }
28
+ .seller-top-panel .shopname h2 { color: #3572A0; text-decoration:underline; font-weight:bold; }
29
+ .seller-top-panel ul .shop-info { width:200px; text-align: justify; }
30
+ .rating-stars { position:relative; display:block; margin-left:5px; overflow:hidden; width:100px; }
31
+ .blank-stars { background: url("images/blank_stars.png") no-repeat; width:100%; height:30px;background-size: 100px; }
32
+ .summary-overview{ width:260px; }
33
+ .fill-stars
34
+ {
35
+ background: url("images/fill_stars.png") no-repeat;
36
+ position:absolute;
37
+ top:0;
38
+ left: 0;
39
+ width: 100%;
40
+ height: 100%;
41
+ z-index: 10;
42
+ background-size: 100px;
43
+ }
44
+ .rating-list { width:200px; margin-left:25px; overflow: hidden;}
45
+ .rating-name { color:#4CA24C; font-weight:bold; margin:1px 0 0 10px; font-size:15px; min-width:58px; overflow:hidden; }
46
+ .rating-list div { float: left; display:block; }
47
+ .rating-count{ margin:0; font-weight:bold; font-size:15px; }
48
+ .seller-profile h3 { text-align:center; font-weight:500; }
49
+ .rating-linegraph { width:250px; overflow:hidden; }
50
+ .rating-linegraph ul li { float:none; }
51
+ .blank-ratingbar{
52
+ background: #f2f2f2;
53
+ width: 100px;
54
+ display: inline-block;
55
+ height: 10px;
56
+ border: 1px solid #f2f2f2;
57
+ vertical-align: bottom;
58
+ zoom: 1;
59
+ }
60
+ .fill-bar
61
+ {
62
+ background: #2271b2;
63
+ border-color: #2271b2;
64
+ height: 9px;
65
+ }
66
+ .seller-rating-bar ul li { margin:5px 0; }
67
+ .rating-linegraph .seller-rating { float:left;}
68
+ .seller-rating .type-positive { height: 37px;margin-top: 10px;line-height: 38px; }
69
+ .seller-rating .type-neutral { height: 18px; line-height: 21px; }
70
+ .seller-rating .type-negative { height: 39px; line-height: 40px; }
71
+ .rate-vote { vertical-align: middle; height:14px; display: inline-block; margin-left:2px; }
72
+ .seller-rating .border
73
+ {
74
+ border: 1px solid #848484;
75
+ border-left: none;
76
+ margin-left: 5px;
77
+ margin-bottom: 4px;
78
+ text-indent: 15px;
79
+ width: 8px;
80
+ }
81
+ .rating-percentage { margin-top:-9px; }
82
+ .rating-percentage .positive-average{ font-size:28px;}
83
+ .positve-label { line-height:13px; display:inline-block; overflow:hidden; font-size:17px; text-indent:8px; color: #827A7A; }
84
+ .seller-review-table { margin-top:50px; }
85
+ .seller-comments { padding: 15px;overflow: auto; }
86
+ .seller-comments > .review-float { width:150px; }
87
+ .seller-comments .review-float { float:left; }
88
+ .seller-comments .review-float:not(:first-child) { margin-left:80px; width:500px; }
89
+ .reviews-section { overflow:auto; width:800px; margin-bottom:10px; padding: 14px 0; border-bottom:1px solid #EAEAEA; }
90
+ .rating-line{display: block;overflow: hidden; width: 157px;}
91
+ .blank-rating-img { background: url("images/blank_stars.png") no-repeat;
92
+ width: 100%;
93
+ height: 30px;
94
+ background-size: 65px;}
95
+ .fill-rating-img {background: url("images/fill_stars.png") no-repeat;
96
+ position: absolute;
97
+ top: 0;
98
+ left: 0;
99
+ width: 100%;
100
+ height: 100%;
101
+ z-index: 5;
102
+ background-size: 65px;}
103
+ .rating-contain { float:left;position:relative; width:65px; display:block;overflow:hidden;}
104
+
skin/frontend/base/default/marketplace/js/marketplace.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function removeAllClass()
2
+ {
3
+ $$('.seller-review').each(function (e) {
4
+ e.removeClassName('active-review');
5
+ });
6
+ }
7
+ function hideShowReview(element)
8
+ {
9
+ if(element.next().hasClassName('active-review'))
10
+ {
11
+ removeAllClass();
12
+ }
13
+ else
14
+ {
15
+ removeAllClass();
16
+ element.next().addClassName('active-review');
17
+ }
18
+ }