Version Notes
This is a first release.
Download this release
Release Info
Developer | Manthan Soni |
Extension | Manthan_Advance_Commission_Marketplace |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Manthan/Advancecommission/Block/Adminhtml/Catalog/Product/Categorycommission.php +52 -0
- app/code/community/Manthan/Advancecommission/Helper/Data.php +5 -0
- app/code/community/Manthan/Advancecommission/Model/Observer.php +67 -0
- app/code/community/Manthan/Advancecommission/etc/config.xml +100 -0
- app/code/community/Manthan/Advancecommission/etc/system.xml +35 -0
- app/code/community/Manthan/Advancecommission/sql/advancecommission_setup/mysql4-install-1.0.0.php +43 -0
- app/design/adminhtml/default/default/layout/advancecommission.xml +29 -0
- app/design/adminhtml/default/default/template/advancecommission/catalog/product/categorycommission.phtml +36 -0
- app/design/adminhtml/default/default/template/advancecommission/catalog/product/edit.phtml +122 -0
- app/etc/modules/Manthan_Advancecommission.xml +11 -0
- package.xml +18 -0
app/code/community/Manthan/Advancecommission/Block/Adminhtml/Catalog/Product/Categorycommission.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Manthan_Advancecommission_Block_Adminhtml_Catalog_Product_Categorycommission extends Mage_Adminhtml_Block_Template
|
3 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface {
|
4 |
+
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
|
9 |
+
$this->setTemplate('advancecommission/catalog/product/categorycommission.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getTabLabel()
|
13 |
+
{
|
14 |
+
return $this->__('Category Commission in(%)');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getTabTitle()
|
18 |
+
{
|
19 |
+
return $this->__('Category Commission Set By Admin in(%)');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function canShowTab()
|
23 |
+
{
|
24 |
+
return true;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function isHidden()
|
28 |
+
{
|
29 |
+
if(Mage::app()->getRequest()->getParam('type') || Mage::app()->getRequest()->getParam('id')){
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getTabClass()
|
36 |
+
{
|
37 |
+
return 'category-commission-tab';
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getSkipGenerateContent()
|
41 |
+
{
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getTabUrl()
|
46 |
+
{
|
47 |
+
return '#';
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
?>
|
app/code/community/Manthan/Advancecommission/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Manthan_Advancecommission_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/community/Manthan/Advancecommission/Model/Observer.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Manthan_Advancecommission_Model_Observer extends Manthan_Marketplace_Model_Observer {
|
3 |
+
|
4 |
+
public function saveSellerToOrderItem(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
if (!Mage::getStoreConfig('advancecommission/commission/active')) {
|
7 |
+
return false;
|
8 |
+
}
|
9 |
+
$quoteItem = $observer->getItem();
|
10 |
+
$orderItem = $observer->getOrderItem();
|
11 |
+
|
12 |
+
$productId = $quoteItem->getProductId();
|
13 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
14 |
+
$marketplacePerProductShippingMethod = $this->getCurrentShippingObject()->getShippingMethod();
|
15 |
+
$collection = Mage::getModel('marketplace/vendorproduct')->getCollection()
|
16 |
+
->addFieldToFilter('product_id',$productId);
|
17 |
+
|
18 |
+
if($collection->count() > 0 && !$quoteItem->getParentItemId())
|
19 |
+
{
|
20 |
+
if ($additionalOptions = $quoteItem->getOptionByCode('additional_options'))
|
21 |
+
{
|
22 |
+
$options = $orderItem->getProductOptions();
|
23 |
+
$options['additional_options'] = unserialize($additionalOptions->getValue());
|
24 |
+
$orderItem->setProductOptions($options);
|
25 |
+
}
|
26 |
+
$userId = $collection->getFirstItem()->getUserId();
|
27 |
+
$seller = Mage::getModel('marketplace/seller')->getCollection()
|
28 |
+
->addFieldToFilter('user_id',$userId);
|
29 |
+
|
30 |
+
$seller_admin_comission = $seller->getFirstItem()->getAdminCommissionByPercentage();
|
31 |
+
|
32 |
+
if($product->getAdminProductCommission())
|
33 |
+
{
|
34 |
+
$seller_admin_comission = $product->getAdminProductCommission();
|
35 |
+
}
|
36 |
+
else if(!$product->getAdminProductCommission())
|
37 |
+
{
|
38 |
+
$categoryIds = $product->getCategoryIds();
|
39 |
+
$ids = array_reverse($categoryIds);
|
40 |
+
foreach($ids as $id)
|
41 |
+
{
|
42 |
+
$category = Mage::getModel('catalog/category')->load($id);
|
43 |
+
if($category->getAdminCategoryCommission()){
|
44 |
+
$seller_admin_comission = $category->getAdminCategoryCommission();
|
45 |
+
break;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
$country = $seller->getFirstItem()->getCountry();
|
50 |
+
|
51 |
+
if($marketplacePerProductShippingMethod == 'marketplaceproductshipping_marketplaceproductshipping')
|
52 |
+
{
|
53 |
+
$shippingPrice = Mage::getStoreConfig('carriers/marketplaceproductshipping/price') * $quoteItem->getQty();
|
54 |
+
if($country == $this->getCurrentShippingObject()->getCountryId() && $product->getDomesticShippingCost()){
|
55 |
+
$shippingPrice = $product->getDomesticShippingCost() * $quoteItem->getQty();
|
56 |
+
}else if($country != $this->getCurrentShippingObject()->getCountryId() && $product->getInternationalShippingCost()){
|
57 |
+
$shippingPrice = $product->getInternationalShippingCost() * $quoteItem->getQty();
|
58 |
+
}
|
59 |
+
$orderItem->setSellerPerProductShipping($shippingPrice);
|
60 |
+
}
|
61 |
+
$orderItem->setAdminOrderCommission($seller_admin_comission);
|
62 |
+
$orderItem->setSellerId($seller->getFirstItem()->getId());
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
?>
|
app/code/community/Manthan/Advancecommission/etc/config.xml
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Manthan_Advancecommission>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
</Manthan_Advancecommission>
|
6 |
+
</modules>
|
7 |
+
<global>
|
8 |
+
<models>
|
9 |
+
<advancecommission>
|
10 |
+
<class>Manthan_Advancecommission_Model</class>
|
11 |
+
<resourceModel>advancecommission_mysql4</resourceModel>
|
12 |
+
</advancecommission>
|
13 |
+
<advancecommission_mysql4>
|
14 |
+
<class>Manthan_Advancecommission_Model_Mysql4</class>
|
15 |
+
<entities>
|
16 |
+
<advancecommission>
|
17 |
+
<table>advancecommission</table>
|
18 |
+
</advancecommission>
|
19 |
+
</entities>
|
20 |
+
</advancecommission_mysql4>
|
21 |
+
</models>
|
22 |
+
<resources>
|
23 |
+
<advancecommission_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Manthan_Advancecommission</module>
|
26 |
+
</setup>
|
27 |
+
<connection>
|
28 |
+
<use>core_setup</use>
|
29 |
+
</connection>
|
30 |
+
</advancecommission_setup>
|
31 |
+
<advancecommission_write>
|
32 |
+
<connection>
|
33 |
+
<use>core_write</use>
|
34 |
+
</connection>
|
35 |
+
</advancecommission_write>
|
36 |
+
<advancecommission_read>
|
37 |
+
<connection>
|
38 |
+
<use>core_read</use>
|
39 |
+
</connection>
|
40 |
+
</advancecommission_read>
|
41 |
+
</resources>
|
42 |
+
<helpers>
|
43 |
+
<advancecommission>
|
44 |
+
<class>Manthan_Advancecommission_Helper</class>
|
45 |
+
</advancecommission>
|
46 |
+
</helpers>
|
47 |
+
<blocks>
|
48 |
+
<advancecommission>
|
49 |
+
<class>Manthan_Advancecommission_Block</class>
|
50 |
+
</advancecommission>
|
51 |
+
</blocks>
|
52 |
+
<events>
|
53 |
+
<sales_convert_quote_item_to_order_item>
|
54 |
+
<observers>
|
55 |
+
<manthan_advance_commission_sales_convert_quote_item_to_order_item>
|
56 |
+
<type>model</type>
|
57 |
+
<class>advancecommission/observer</class>
|
58 |
+
<method>saveSellerToOrderItem</method>
|
59 |
+
</manthan_advance_commission_sales_convert_quote_item_to_order_item>
|
60 |
+
</observers>
|
61 |
+
</sales_convert_quote_item_to_order_item>
|
62 |
+
</events>
|
63 |
+
</global>
|
64 |
+
<adminhtml>
|
65 |
+
<layout>
|
66 |
+
<updates>
|
67 |
+
<advancecommission>
|
68 |
+
<file>advancecommission.xml</file>
|
69 |
+
</advancecommission>
|
70 |
+
</updates>
|
71 |
+
</layout>
|
72 |
+
<acl>
|
73 |
+
<resources>
|
74 |
+
<admin>
|
75 |
+
<children>
|
76 |
+
<system>
|
77 |
+
<children>
|
78 |
+
<config>
|
79 |
+
<children>
|
80 |
+
<advancecommission translate="title" module="marketplace">
|
81 |
+
<title>Advance Commission Section</title>
|
82 |
+
<sort_order>200</sort_order>
|
83 |
+
</advancecommission>
|
84 |
+
</children>
|
85 |
+
</config>
|
86 |
+
</children>
|
87 |
+
</system>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
</adminhtml>
|
93 |
+
<default>
|
94 |
+
<advancecommission>
|
95 |
+
<commission>
|
96 |
+
<active>0</active>
|
97 |
+
</commission>
|
98 |
+
</advancecommission>
|
99 |
+
</default>
|
100 |
+
</config>
|
app/code/community/Manthan/Advancecommission/etc/system.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<advancecommission translate="label" module="advancecommission">
|
5 |
+
<label>Advance Commission</label>
|
6 |
+
<tab>manthan</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>20</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<commission translate="label" module="advancecommission">
|
14 |
+
<label>General Settings</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>10</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<active translate="label">
|
22 |
+
<label>Advance Commission Module</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>10</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</active>
|
30 |
+
</fields>
|
31 |
+
</commission>
|
32 |
+
</groups>
|
33 |
+
</advancecommission>
|
34 |
+
</sections>
|
35 |
+
</config>
|
app/code/community/Manthan/Advancecommission/sql/advancecommission_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$createSetup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
5 |
+
$createSetup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'admin_category_commission', array(
|
6 |
+
'group' => 'General Information',
|
7 |
+
'input' => 'text',
|
8 |
+
'type' => 'int',
|
9 |
+
'label' => 'Commission of Admin(%)',
|
10 |
+
'backend' => '',
|
11 |
+
'searchable' => false,
|
12 |
+
'filterable' => false,
|
13 |
+
'unique' => true,
|
14 |
+
'visible' => true,
|
15 |
+
'required' => false,
|
16 |
+
'visible_on_front' => false,
|
17 |
+
'user_defined' => true,
|
18 |
+
'sort_order' => 2,
|
19 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
20 |
+
));
|
21 |
+
$createSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'admin_product_commission', array(
|
22 |
+
'group' => 'Prices',
|
23 |
+
'type' => 'int',
|
24 |
+
'backend' => '',
|
25 |
+
'frontend' => '',
|
26 |
+
'label' => 'Product Commission(%)',
|
27 |
+
'input' => 'text',
|
28 |
+
'class' => 'product-commission',
|
29 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
30 |
+
'visible' => 1,
|
31 |
+
'required' => 0,
|
32 |
+
'user_defined' => 0,
|
33 |
+
'searchable' => 0,
|
34 |
+
'filterable' => 0,
|
35 |
+
'comparable' => 0,
|
36 |
+
'visible_on_front' => 0,
|
37 |
+
'unique' => 0,
|
38 |
+
'sort_order' => 3,
|
39 |
+
'apply_to' => 'simple,configurable,grouped,bundle,virtual,downloadable',
|
40 |
+
'is_configurable' => 0
|
41 |
+
));
|
42 |
+
$installer->endSetup();
|
43 |
+
?>
|
app/design/adminhtml/default/default/layout/advancecommission.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout>
|
2 |
+
<adminhtml_catalog_product_new>
|
3 |
+
<reference name="product_tabs">
|
4 |
+
<action method="addTab">
|
5 |
+
<name>my_custom_tab</name>
|
6 |
+
<block>advancecommission/adminhtml_catalog_product_categorycommission</block>
|
7 |
+
</action>
|
8 |
+
</reference>
|
9 |
+
<reference name="product_edit">
|
10 |
+
<action method="setTemplate">
|
11 |
+
<template>advancecommission/catalog/product/edit.phtml</template>
|
12 |
+
</action>
|
13 |
+
</reference>
|
14 |
+
|
15 |
+
</adminhtml_catalog_product_new>
|
16 |
+
<adminhtml_catalog_product_edit>
|
17 |
+
<reference name="product_tabs">
|
18 |
+
<action method="addTab">
|
19 |
+
<name>my_custom_tab</name>
|
20 |
+
<block>advancecommission/adminhtml_catalog_product_categorycommission</block>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
<reference name="product_edit">
|
24 |
+
<action method="setTemplate">
|
25 |
+
<template>advancecommission/catalog/product/edit.phtml</template>
|
26 |
+
</action>
|
27 |
+
</reference>
|
28 |
+
</adminhtml_catalog_product_edit>
|
29 |
+
</layout>
|
app/design/adminhtml/default/default/template/advancecommission/catalog/product/categorycommission.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="customer_info_tabs_customer_edit_tab_action_content">
|
2 |
+
<div class="entry-edit">
|
3 |
+
<div class="entry-edit-head">
|
4 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Category Commission in(%)'); ?></h4>
|
5 |
+
</div>
|
6 |
+
<div id="group_fields4" class="fieldset fieldset-wide">
|
7 |
+
<div class="hor-scroll">
|
8 |
+
<?php $category = Mage::getModel('catalog/category');
|
9 |
+
$tree = $category->getTreeModel();
|
10 |
+
$tree->load();
|
11 |
+
$ids = $tree->getCollection()->getAllIds();
|
12 |
+
$base_path = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
|
13 |
+
$folder_path = $base_path ."extjs". DS ."resources". DS . "images" . DS . "magento" . DS . "tree" . DS . "folder.gif";
|
14 |
+
if ($ids) {
|
15 |
+
echo "<ul>";
|
16 |
+
foreach ($ids as $id) {
|
17 |
+
$cat = Mage::getModel('catalog/category');
|
18 |
+
$cat->load($id);
|
19 |
+
$cat_id_hidden = array('1','2');//set category id hidden
|
20 |
+
if(in_array($id,$cat_id_hidden)){
|
21 |
+
continue;
|
22 |
+
}
|
23 |
+
$commission = "not set commission";
|
24 |
+
if($cat->getAdminCategoryCommission())
|
25 |
+
$commission = $cat->getAdminCategoryCommission();
|
26 |
+
|
27 |
+
echo "<li><img src={$folder_path} class='x-tree-node-icon' unselectable='on' id='ext-gen19'>
|
28 |
+
<span><a href='#'>".$cat->getName()."</a>-(". $commission."%)</span></li>";
|
29 |
+
}
|
30 |
+
echo "<ul>";
|
31 |
+
}
|
32 |
+
?>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
app/design/adminhtml/default/default/template/advancecommission/catalog/product/edit.phtml
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template for Mage_Adminhtml_Block_Catalog_Product_Edit
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<div class="content-header">
|
7 |
+
<h3 class="icon-head head-products"><?php echo $this->getHeader() ?></h3>
|
8 |
+
<p class="content-buttons form-buttons"><?php echo $this->getBackButtonHtml() ?>
|
9 |
+
<?php echo $this->getCancelButtonHtml() ?>
|
10 |
+
<?php if($this->getProductId()): ?>
|
11 |
+
<?php echo $this->getDeleteButtonHtml() ?>
|
12 |
+
<?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
|
13 |
+
<?php echo $this->getDuplicateButtonHtml() ?>
|
14 |
+
<?php endif; ?>
|
15 |
+
<?php endif; ?>
|
16 |
+
<?php if($this->getProductSetId() && $this->getIsConfigured()): ?>
|
17 |
+
<?php echo $this->getSaveButtonHtml() ?>
|
18 |
+
<?php echo $this->getSaveAndEditButtonHtml() ?>
|
19 |
+
<?php endif; ?>
|
20 |
+
</p>
|
21 |
+
</div>
|
22 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="product_edit_form" enctype="multipart/form-data">
|
23 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
24 |
+
<div style="display:none"></div>
|
25 |
+
</form>
|
26 |
+
<script type="text/javascript">
|
27 |
+
<?php $seller = Mage::getModel('marketplace/seller')->isSeller(); ?>
|
28 |
+
<?php $type = Mage::app()->getRequest()->getParam('type'); ?>
|
29 |
+
<?php $product_state = Mage::app()->getRequest()->getActionName(); ?>
|
30 |
+
<?php $product_status = intval(Mage::getStoreConfig('marketplace/seller/product_status')); ?>
|
31 |
+
|
32 |
+
<?php if($seller) :?>
|
33 |
+
if($('product_status') != null)
|
34 |
+
{
|
35 |
+
<?php if( $product_state == 'new'): ?>
|
36 |
+
document.getElementById("product_status").value= <?php echo $product_status ?>;
|
37 |
+
<?php endif; ?>
|
38 |
+
$('product_status').up().up().hide();
|
39 |
+
}
|
40 |
+
<?php endif; ?>
|
41 |
+
<?php if(!Mage::getStoreConfig('carriers/marketplaceproductshipping/active') || ($type == 'virtual' || $type == 'downloadable') ): ?>
|
42 |
+
$('domestic_shipping_cost').up().up().hide();
|
43 |
+
$('international_shipping_cost').up().up().hide();
|
44 |
+
<?php endif; ?>
|
45 |
+
//<![CDATA[
|
46 |
+
var productTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
|
47 |
+
var productForm = new varienForm('product_edit_form', '<?php echo $this->getValidationUrl() ?>');
|
48 |
+
productForm._processValidationResult = function(transport) {
|
49 |
+
var response = transport.responseText.evalJSON();
|
50 |
+
if (response.error){
|
51 |
+
if (response.attribute && $(response.attribute)) {
|
52 |
+
$(response.attribute).setHasError(true, productForm);
|
53 |
+
Validation.ajaxError($(response.attribute), response.message);
|
54 |
+
if (!Prototype.Browser.IE){
|
55 |
+
$(response.attribute).focus();
|
56 |
+
}
|
57 |
+
}
|
58 |
+
else if ($('messages')) {
|
59 |
+
$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
|
60 |
+
}
|
61 |
+
}
|
62 |
+
else{
|
63 |
+
productForm._submit();
|
64 |
+
}
|
65 |
+
};
|
66 |
+
function saveAndContinueEdit(urlTemplate) {
|
67 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
68 |
+
var url = template.evaluate({tab_id:product_info_tabsJsTabs.activeTab.id});
|
69 |
+
productForm.submit(url);
|
70 |
+
}
|
71 |
+
function setSettings(urlTemplate, setElement, typeElement) {
|
72 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
73 |
+
setLocation(template.evaluate({attribute_set:$F(setElement),type:$F(typeElement)}));
|
74 |
+
}
|
75 |
+
|
76 |
+
function setSuperSettings(urlTemplate, attributesClass, validateField) {
|
77 |
+
var attributesFields = $$('.' + attributesClass);
|
78 |
+
var attributes = Form.serializeElements(attributesFields, true).attribute;
|
79 |
+
if(typeof attributes == 'string') {
|
80 |
+
attributes = [attributes];
|
81 |
+
}
|
82 |
+
|
83 |
+
if(!attributes) {
|
84 |
+
$(validateField).value = 'no-attributes';
|
85 |
+
} else {
|
86 |
+
$(validateField).value = 'has-attributes';
|
87 |
+
}
|
88 |
+
|
89 |
+
if (productForm.validator.validate()) {
|
90 |
+
var template = new Template(urlTemplate, productTemplateSyntax);
|
91 |
+
var url = template.evaluate({
|
92 |
+
attributes: encode_base64(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D')
|
93 |
+
});
|
94 |
+
setLocation(url);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
function checkMaxLength(Object, MaxLen)
|
99 |
+
{
|
100 |
+
if (Object.value.length > MaxLen-1) {
|
101 |
+
Object.value = Object.value.substr(0, MaxLen);
|
102 |
+
}
|
103 |
+
return 1;
|
104 |
+
}
|
105 |
+
|
106 |
+
Event.observe(window, 'load', function() {
|
107 |
+
var objName = '<?php echo $this->getSelectedTabId() ?>';
|
108 |
+
if (objName) {
|
109 |
+
obj = $(objName);
|
110 |
+
//IE fix (bubbling event model)
|
111 |
+
product_info_tabsJsTabs.setSkipDisplayFirstTab();
|
112 |
+
product_info_tabsJsTabs.showTabContent(obj);
|
113 |
+
}
|
114 |
+
Product.AttributesBridge.setTabsObject(product_info_tabsJsTabs);
|
115 |
+
});
|
116 |
+
|
117 |
+
Validation.addAllThese([
|
118 |
+
['validate-super-product-attributes', '<?php echo Mage::helper('catalog')->__('Please select one or more attributes.') ?>', function(v) {
|
119 |
+
return (v != "no-attributes");
|
120 |
+
}]]);
|
121 |
+
//]]>
|
122 |
+
</script>
|
app/etc/modules/Manthan_Advancecommission.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Manthan_Advancecommission>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
<depends>
|
7 |
+
<Manthan_Marketplace/>
|
8 |
+
</depends>
|
9 |
+
</Manthan_Advancecommission>
|
10 |
+
</modules>
|
11 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Manthan_Advance_Commission_Marketplace</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Admin can be set commission on products or categories with the help of this extension.</summary>
|
10 |
+
<description>Admin can be set commission on products or categories with the help of this extension.Highest priority will be product.Both are not set it will get default commission value from seller profile.</description>
|
11 |
+
<notes>This is a first release.</notes>
|
12 |
+
<authors><author><name>Manthan Soni</name><user>Manthan</user><email>sonimanthan0@gmail.com</email></author></authors>
|
13 |
+
<date>2016-02-12</date>
|
14 |
+
<time>19:18:46</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Manthan"><dir name="Advancecommission"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Categorycommission.php" hash="1eaf3fc86c38a3582a44427c8fa3b003"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="cadba54631d1154b51e79814f83a8387"/></dir><dir name="Model"><file name="Observer.php" hash="ce74f3326433a5fbdabec0c88775642a"/></dir><dir name="etc"><file name="config.xml" hash="fe1cf61b70a364ad182ed03a068ca68c"/><file name="system.xml" hash="69dc2be75e4a72a5cb5d5ec8b2fbd83a"/></dir><dir name="sql"><dir name="advancecommission_setup"><file name="mysql4-install-1.0.0.php" hash="dac8cfea66371b94d72145671c64a7b2"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Manthan_Advancecommission.xml" hash="8088f042681134446a8bb0377d7d843d"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="advancecommission.xml" hash="942bd39ba25d1c3f1059e05b54724423"/></dir><dir name="template"><dir name="advancecommission"><dir name="catalog"><dir name="product"><file name="categorycommission.phtml" hash="ce068f61d4eac58152fdf1366f8fcdf7"/><file name="edit.phtml" hash="183963b7b9e6dc3411cf24685cef843b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.4.0</min><max>5.6.0</max></php><package><name>Manthan_Marketplace</name><channel>community</channel><min>1.7</min><max>1.9.2</max></package></required></dependencies>
|
18 |
+
</package>
|