Version Notes
Use discounted amounts for order totals.
Download this release
Release Info
Developer | Michael A. Smith |
Extension | eBay_Enterprise_Affiliate_Extension |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
app/code/community/EbayEnterprise/Affiliate/Block/Beacon.php
CHANGED
@@ -92,7 +92,7 @@ class EbayEnterprise_Affiliate_Block_Beacon extends Mage_Core_Block_Template
|
|
92 |
protected function _buildBasicParams(Mage_Sales_Model_Order $order)
|
93 |
{
|
94 |
return array_merge($this->_buildCommonParams($order), array(
|
95 |
-
static::KEY_AMOUNT =>
|
96 |
static::KEY_TYPE => Mage::helper('eems_affiliate/config')->getTransactionType()
|
97 |
));
|
98 |
}
|
@@ -105,21 +105,31 @@ class EbayEnterprise_Affiliate_Block_Beacon extends Mage_Core_Block_Template
|
|
105 |
{
|
106 |
$params = array(static::KEY_INT => Mage::helper('eems_affiliate/config')->getInt());
|
107 |
$increment = 1; // incrementer for the unique item keys
|
108 |
-
foreach ($order->
|
|
|
|
|
109 |
$position = $this->_getDupePosition($params, $item);
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
if ($position) {
|
113 |
// we detected that the current item already exist in the params array
|
114 |
// and have the key increment position let's simply adjust
|
115 |
// the qty and total amount
|
116 |
$params[static::KEY_QTY . $position] += $quantity;
|
117 |
-
$
|
|
|
118 |
} else {
|
119 |
$params = array_merge($params, array(
|
120 |
static::KEY_ITEM . $increment => $item->getSku(),
|
121 |
static::KEY_QTY . $increment => $quantity,
|
122 |
-
static::KEY_TOTALAMOUNT . $increment => $total
|
123 |
));
|
124 |
$increment++; // only get incremented when a unique key have been appended
|
125 |
}
|
92 |
protected function _buildBasicParams(Mage_Sales_Model_Order $order)
|
93 |
{
|
94 |
return array_merge($this->_buildCommonParams($order), array(
|
95 |
+
static::KEY_AMOUNT => number_format($order->getSubtotal() + $order->getDiscountAmount() + $order->getShippingDiscountAmount(), 2, '.', ''),
|
96 |
static::KEY_TYPE => Mage::helper('eems_affiliate/config')->getTransactionType()
|
97 |
));
|
98 |
}
|
105 |
{
|
106 |
$params = array(static::KEY_INT => Mage::helper('eems_affiliate/config')->getInt());
|
107 |
$increment = 1; // incrementer for the unique item keys
|
108 |
+
foreach ($order->getAllItems() as $item) {
|
109 |
+
// need to ignore the bundle parent as it will contain collected total
|
110 |
+
// for children but not discounts
|
111 |
$position = $this->_getDupePosition($params, $item);
|
112 |
+
// ignore the parent configurable quantity - quantity of config products
|
113 |
+
// will come from the simple used product with the same SKU
|
114 |
+
$quantity = $item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE ?
|
115 |
+
0 : (int) $item->getQtyOrdered();
|
116 |
+
// consider parent bundle products to be 0.00 total - total of the bundle
|
117 |
+
// is the sum of all child products which are also included in the beacon
|
118 |
+
// so including both totals would effectively double the price of the bundle
|
119 |
+
$total = $item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ?
|
120 |
+
0.00 : $item->getRowTotal() - $item->getDiscountAmount();
|
121 |
if ($position) {
|
122 |
// we detected that the current item already exist in the params array
|
123 |
// and have the key increment position let's simply adjust
|
124 |
// the qty and total amount
|
125 |
$params[static::KEY_QTY . $position] += $quantity;
|
126 |
+
$amtKey = static::KEY_TOTALAMOUNT . $position;
|
127 |
+
$params[$amtKey] = number_format($params[$amtKey] + $total, 2, '.', '');
|
128 |
} else {
|
129 |
$params = array_merge($params, array(
|
130 |
static::KEY_ITEM . $increment => $item->getSku(),
|
131 |
static::KEY_QTY . $increment => $quantity,
|
132 |
+
static::KEY_TOTALAMOUNT . $increment => number_format($total, 2, '.', ''),
|
133 |
));
|
134 |
$increment++; // only get incremented when a unique key have been appended
|
135 |
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Map/Order.php
CHANGED
@@ -32,6 +32,25 @@ class EbayEnterprise_Affiliate_Helper_Map_Order
|
|
32 |
// field limit doesn't allow this to go above 99
|
33 |
return (int) ($item->getQtyOrdered() - $item->getQtyRefunded() - $item->getQtyCanceled());
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* Get the corrected total for the row - price * corrected qty. Expects the
|
37 |
* "item" to be a Mage_Sales_Model_Order_Item, "format" to be a valid
|
@@ -49,7 +68,7 @@ class EbayEnterprise_Affiliate_Helper_Map_Order
|
|
49 |
}
|
50 |
return sprintf(
|
51 |
$params['format'],
|
52 |
-
$
|
53 |
);
|
54 |
}
|
55 |
/**
|
@@ -69,7 +88,13 @@ class EbayEnterprise_Affiliate_Helper_Map_Order
|
|
69 |
$order = $params['item'];
|
70 |
return sprintf(
|
71 |
$params['format'],
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
);
|
74 |
}
|
75 |
/**
|
32 |
// field limit doesn't allow this to go above 99
|
33 |
return (int) ($item->getQtyOrdered() - $item->getQtyRefunded() - $item->getQtyCanceled());
|
34 |
}
|
35 |
+
/**
|
36 |
+
* Calculate a row total including discounts.
|
37 |
+
* @param array $params
|
38 |
+
* @return float
|
39 |
+
*/
|
40 |
+
private function _calculateDiscountedRowTotal($params)
|
41 |
+
{
|
42 |
+
$item = $params['item'];
|
43 |
+
// tread bundle items as 0.00 total as their total will be represented by
|
44 |
+
// the total of their children products
|
45 |
+
if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
46 |
+
return 0.00;
|
47 |
+
}
|
48 |
+
// don't allow negative amounts - could happen if a discounted item was cancelled
|
49 |
+
return max(
|
50 |
+
0,
|
51 |
+
$item->getBasePrice() * $this->getItemQuantity($params) - ($item->getBaseDiscountAmount() - $item->getbaseDiscountRefunded())
|
52 |
+
);
|
53 |
+
}
|
54 |
/**
|
55 |
* Get the corrected total for the row - price * corrected qty. Expects the
|
56 |
* "item" to be a Mage_Sales_Model_Order_Item, "format" to be a valid
|
68 |
}
|
69 |
return sprintf(
|
70 |
$params['format'],
|
71 |
+
$this->_calculateDiscountedRowTotal($params)
|
72 |
);
|
73 |
}
|
74 |
/**
|
88 |
$order = $params['item'];
|
89 |
return sprintf(
|
90 |
$params['format'],
|
91 |
+
// prevent sub-zero amounts for canceled orders with discounts
|
92 |
+
max(
|
93 |
+
0,
|
94 |
+
($order->getBaseSubtotal() + $order->getBaseDiscountAmount()) -
|
95 |
+
($order->getBaseSubtotalRefunded() + $order->getBaseDiscountRefunded()) -
|
96 |
+
($order->getBaseSubtotalCanceled() + $order->getBaseDiscountCanceled())
|
97 |
+
)
|
98 |
);
|
99 |
}
|
100 |
/**
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Itemized.php
CHANGED
@@ -28,7 +28,9 @@ class EbayEnterprise_Affiliate_Model_Feed_Order_Itemized
|
|
28 |
// this is far more pure SQL than should be here but I don't see a way to
|
29 |
// get the proper groupings of where clauses without doing this
|
30 |
->where(
|
31 |
-
|
|
|
|
|
32 |
)
|
33 |
->where(
|
34 |
"(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
|
28 |
// this is far more pure SQL than should be here but I don't see a way to
|
29 |
// get the proper groupings of where clauses without doing this
|
30 |
->where(
|
31 |
+
// get only items within the correct store scope and filter out any
|
32 |
+
// configurable used simple products
|
33 |
+
'main_table.store_id IN (?) AND NOT (main_table.product_type="simple" AND main_table.parent_item_id IS NOT NULL AND main_table.row_total=0)', $storeIds
|
34 |
)
|
35 |
->where(
|
36 |
"(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
|
package.xml
CHANGED
@@ -1,50 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eBay_Enterprise_Affiliate_Extension</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<li>Product feed export automated nightly in eBay Enterprise Affiliate format</li>
|
17 |
-
<li>Correction feed automated nightly in eBay Enterprise Affiliate format</li>
|
18 |
-
</ol>
|
19 |
-
<p />With the eBay Enterprise Affiliate Extension tracking in place, you’ll gain instant access to the program’s user-friendly interface—along with the tracking technology, informative analytics, and innovative applications you need to expand your online presence.</p>
|
20 |
-
<p>What makes eBay’s affiliate program different from all the others? Good question. Here are some of our program’s exclusive features:</p>
|
21 |
-
<h2>Do it all in one place</h2>
|
22 |
-
<p>With eBay Enterprise Affiliate, you can access and recruit over 200,000 active network publishers across 20+ promotional categories and 30+ verticals. Plus, you can manage your publisher’s terms, commissions, corrections, and bonuses—without reloading the page.</p>
|
23 |
-
<h2>Banners for your benefit</h2>
|
24 |
-
<p>You can easily upload banners and text links to drive traffic to new product lines. Plus, you can promote offers like free shipping, coupons, and percentage-off discounts.</p>
|
25 |
-
<h2>Stay in touch, easily</h2>
|
26 |
-
<p>Communication is key, so we’ve made reaching out to affiliates as simple as possible. Our affiliate program comes complete with a newsletter subscription and a built-in email feature. You’ll enjoy easy, effective communication with your top publishers.</p>
|
27 |
-
<h2>Track your progress</h2>
|
28 |
-
<p>eBay Enterprise Affiliate really works—and you can track it yourself. Monitor robust reports, including transaction summaries, commission totals, and link performances. Then use the data to optimize your program.</p>
|
29 |
-
<h2>Stay socially connected</h2>
|
30 |
-
<p>Leverage your most loyal customers and brand advocates while driving commerce. Our program’s private-label peer platform makes it easy to share products and special promotions via Facebook, Twitter, and email.</p>
|
31 |
-
<h2>Enjoy unparalleled support</h2>
|
32 |
-
<p>If you have questions, problems, or difficulties with your account, simply click the customer support tab to submit a ticket. The request will be sent straight to qualified eBay Enterprise Affiliate customer service representatives, and they’ll respond immediately.</p>
|
33 |
-
<h2>How to get started:</h2>
|
34 |
-
<ol>
|
35 |
-
<li>Install extension from the Magento Connect store</li>
|
36 |
-
<li>Under System Configuration, you’ll find eBay Enterprise Marketing Solutions on the left hand navigation pane. Click to begin Affiliate installation.</li>
|
37 |
-
<li>Select “Yes” to enable Affiliate tracking.</li>
|
38 |
-
<li>Insert your unique Program ID (PID) into the extension. If you do not yet have a PID, click on the “Register Now” link to register for an account.</li>
|
39 |
-
<li>Select “Yes” for itemized orders, unless otherwise instructed.</li>
|
40 |
-
<li>Set export path to a directory accessible via FTP.</li>
|
41 |
-
<li>Place test transaction to confirm installation.</li>
|
42 |
-
</ol></description>
|
43 |
-
<notes>First Release</notes>
|
44 |
-
<authors><author><name>Michael A. Smith</name><user>kojiro</user><email>msmith3@ebay.com</email></author><author><name>Scott van Brug</name><user>scottvanbrug</user><email>svanbrug@ebay.com</email></author><author><name>Michael West</name><user>MikeWest</user><email>micwest@ebay.com</email></author><author><name>Michael Phang</name><user>mphang6432</user><email>mphang@ebay.com</email></author><author><name>Adam Hobson</name><user>adhobson</user><email>adhobson@ebay.com</email></author><author><name>Reginald Gabriel</name><user>rgabriel</user><email>rgabriel@ebay.com</email></author></authors>
|
45 |
-
<date>2014-05-09</date>
|
46 |
-
<time>19:30:37</time>
|
47 |
-
<contents><target name="mageetc"><dir name="modules"><file name="EbayEnterprise_Affiliate.xml" hash="c3a7b9a2113ad859d20cea7e452a3982"/></dir></target><target name="magecommunity"><dir name="EbayEnterprise"><dir name="Affiliate"><dir name="Block"><file name="Beacon.php" hash="e14207b9ce4aceec578d6be1b929e1fe"/></dir><dir name="Exception"><file name="Configuration.php" hash="65542b125d2ead6007353db0ee1c6885"/></dir><dir name="Helper"><file name="Config.php" hash="ac3fc4ad23d9eb7c643b9fa03470df92"/><file name="Data.php" hash="49e35c3ef95dcc1abc0082569a559c70"/><dir name="Map"><file name="Order.php" hash="edd9946b73e0fbe21b6715748334d0de"/><file name="Product.php" hash="97444501356a60bcc423cba6c457337c"/></dir><file name="Map.php" hash="d266381ad5dff9c4d774afc3a6bb14d9"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="ed4bcacbc43af20d68f9aa66d055de2c"/><dir name="Order"><file name="Abstract.php" hash="842e746eb3d049d2112b130dc3e465da"/><file name="Basic.php" hash="4cdd308dd1209052934be1c1cf5bb8ed"/><file name="Itemized.php" hash="f6c510a28381cfdb9760fdddb7581b0f"/></dir><file name="Product.php" hash="9828991bccc6ec34a6c4632dd47ea70c"/></dir><file name="Observer.php" hash="3e7022180266d5e6c54b9945d1f3a7a3"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="4bf9ee9194e49a5a5790f9e319afd4fa"/><file name="Categories.php" hash="4d7ce8590af1007d0478166268953628"/><file name="Stockquantity.php" hash="e0ae4a9f912c54e0e031d1787c01a082"/><file name="Stockyesno.php" hash="951ce3efa1d8c665a57b888b8aaced52"/><file name="Transactiontype.php" hash="c5e692ee61ae43b4ba4906dba8882286"/><file name="Visibilityyesno.php" hash="fd36e0f36e740ade056d3bab6798cdab"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d0477ee491b0d801bec3776a9d973b53"/><file name="config.xml" hash="7285f83ecd87c5964c993812d8ad05a0"/><file name="system.xml" hash="81cddbe43ec09285b07bde7e5a215130"/></dir><dir name="sql"><dir name="eems_affiliate_setup"><file name="install-1.0.0.1.php" hash="2c49a4637831affbce446f997e07efe7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="eems_affiliate"><file name="beacon.phtml" hash="73aabddbd2bf4cb81927e69290abc59f"/></dir></dir><dir name="layout"><file name="eems_affiliate.xml" hash="db291e14f3ddf8e9364357b477627d67"/></dir></dir></dir></dir></target></contents>
|
48 |
<compatible/>
|
49 |
<dependencies><required><php><min>5.3.0</min><max>5.3.99</max></php></required></dependencies>
|
50 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eBay_Enterprise_Affiliate_Extension</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>EULA</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>eBay Enterprise Affiliate Extension.</summary>
|
10 |
+
<description>eBay Enterprise Affiliate Extension.</description>
|
11 |
+
<notes>Use discounted amounts for order totals.</notes>
|
12 |
+
<authors><author><name>Michael A. Smith</name><user>msmith3</user><email>msmith3@ebay.com</email></author><author><name>Michael Phang</name><user>mphang</user><email>mphang@ebay.com</email></author><author><name>Scott van Brug</name><user>svanbrug</user><email>svanbrug@ebay.com</email></author><author><name>Mike West</name><user>micwest</user><email>micwest@ebay.com</email></author><author><name>Reginald Gabriel</name><user>rgabriel</user><email>rgabriel@ebay.com</email></author></authors>
|
13 |
+
<date>2014-05-20</date>
|
14 |
+
<time>20:16:10</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="EbayEnterprise"><dir name="Affiliate"><dir name="Block"><file name="Beacon.php" hash="71e559204118de2d2cd865ed3066901e"/></dir><dir name="Exception"><file name="Configuration.php" hash="65542b125d2ead6007353db0ee1c6885"/></dir><dir name="Helper"><file name="Config.php" hash="ac3fc4ad23d9eb7c643b9fa03470df92"/><file name="Data.php" hash="49e35c3ef95dcc1abc0082569a559c70"/><dir name="Map"><file name="Order.php" hash="e22c43240fe1b9a4acce75c356c07ce2"/><file name="Product.php" hash="97444501356a60bcc423cba6c457337c"/></dir><file name="Map.php" hash="d266381ad5dff9c4d774afc3a6bb14d9"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="ed4bcacbc43af20d68f9aa66d055de2c"/><dir name="Order"><file name="Abstract.php" hash="842e746eb3d049d2112b130dc3e465da"/><file name="Basic.php" hash="4cdd308dd1209052934be1c1cf5bb8ed"/><file name="Itemized.php" hash="a546060ab5fbbafc1091d64578e25e99"/></dir><file name="Product.php" hash="9828991bccc6ec34a6c4632dd47ea70c"/></dir><file name="Observer.php" hash="3e7022180266d5e6c54b9945d1f3a7a3"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="4bf9ee9194e49a5a5790f9e319afd4fa"/><file name="Categories.php" hash="4d7ce8590af1007d0478166268953628"/><file name="Stockquantity.php" hash="e0ae4a9f912c54e0e031d1787c01a082"/><file name="Stockyesno.php" hash="951ce3efa1d8c665a57b888b8aaced52"/><file name="Transactiontype.php" hash="c5e692ee61ae43b4ba4906dba8882286"/><file name="Visibilityyesno.php" hash="fd36e0f36e740ade056d3bab6798cdab"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d0477ee491b0d801bec3776a9d973b53"/><file name="config.xml" hash="7285f83ecd87c5964c993812d8ad05a0"/><file name="system.xml" hash="81cddbe43ec09285b07bde7e5a215130"/></dir><dir name="sql"><dir name="eems_affiliate_setup"><file name="install-1.0.0.1.php" hash="2c49a4637831affbce446f997e07efe7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="eems_affiliate.xml" hash="db291e14f3ddf8e9364357b477627d67"/></dir><dir name="template"><dir name="eems_affiliate"><file name="beacon.phtml" hash="73aabddbd2bf4cb81927e69290abc59f"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EbayEnterprise_Affiliate.xml" hash="c3a7b9a2113ad859d20cea7e452a3982"/></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>5.3.99</max></php></required></dependencies>
|
18 |
</package>
|