nypwidget - Version 2.5.2

Version Notes

PHP 5.3 compatibility fixes.

Download this release

Release Info

Developer PriceWaiter
Extension nypwidget
Version 2.5.2
Comparing to
See all releases


Code changes from version 2.5.1 to 2.5.2

app/code/community/PriceWaiter/NYPWidget/Model/Callback.php CHANGED
@@ -248,7 +248,7 @@ class PriceWaiter_NYPWidget_Model_Callback
248
  * @param Array $request
249
  * @return Array
250
  */
251
- public function calculateOrderAmounts(Array $request, $productPrice, Callable $rounder)
252
  {
253
  $amountPerItem = $request['unit_price'];
254
  $qty = $request['quantity'];
@@ -259,18 +259,18 @@ class PriceWaiter_NYPWidget_Model_Callback
259
  $regularSubtotal = $productPrice * $qty;
260
  $discountAmount = $regularSubtotal - $subtotal;
261
 
262
- $total = $rounder($subtotal + $shipping + $tax);
263
 
264
  return array(
265
- 'discount_amount' => $rounder(-$discountAmount),
266
  'grand_total' => $total,
267
  'shipping_amount' => $shipping,
268
  'shipping_discount_amount' => 0,
269
  'shipping_incl_tax' => $shipping,
270
  'shipping_tax_amount' => 0,
271
- 'subtotal' => $rounder($regularSubtotal),
272
- 'subtotal_incl_tax' => $rounder($regularSubtotal + $tax),
273
- 'tax_amount' => $rounder($tax),
274
  );
275
  }
276
 
@@ -279,7 +279,7 @@ class PriceWaiter_NYPWidget_Model_Callback
279
  * @param Array $request
280
  * @param Mage_Catalog_Model_Product $product
281
  */
282
- public function calculateOrderItemAmounts(Array $request, $productPrice, Callable $rounder)
283
  {
284
  $amountPerItem = $request['unit_price'];
285
  $qty = $request['quantity'];
@@ -294,16 +294,16 @@ class PriceWaiter_NYPWidget_Model_Callback
294
  $discountPercent = $discountAmount / $regularSubtotal * 100;
295
 
296
  return array(
297
- 'discount_amount' => $rounder($discountAmount),
298
- 'discount_percent' => $rounder($discountPercent),
299
  'original_price' => $productPrice,
300
  'price' => $productPrice,
301
- 'price_incl_tax' => $rounder($productPrice + ($tax / $qty)),
302
- 'row_total' => $rounder($regularSubtotal),
303
- 'row_total_incl_tax' => $rounder($regularSubtotal + $tax),
304
  'tax_amount' => $tax,
305
- 'tax_before_discount' => $rounder($taxBeforeDiscount),
306
- 'tax_percent' => $rounder($taxPercent * 100),
307
  );
308
  }
309
 
@@ -604,13 +604,12 @@ class PriceWaiter_NYPWidget_Model_Callback
604
 
605
  // NOTE: Building $postFields string manually to avoid multipart/form-data content type
606
  // assigned by default when using Array.
607
- $postFields = http_build_query(
608
- $request,
609
- '',
610
- '&',
611
- // NOTE: PHP_QUERY_RFC1738 added in PHP 5.4
612
- defined('PHP_QUERY_RFC1738') ? PHP_QUERY_RFC1738 : 0
613
- );
614
 
615
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
616
  curl_setopt($ch, CURLOPT_POST, true);
248
  * @param Array $request
249
  * @return Array
250
  */
251
+ public function calculateOrderAmounts(Array $request, $productPrice, $rounder)
252
  {
253
  $amountPerItem = $request['unit_price'];
254
  $qty = $request['quantity'];
259
  $regularSubtotal = $productPrice * $qty;
260
  $discountAmount = $regularSubtotal - $subtotal;
261
 
262
+ $total = call_user_func($rounder, $subtotal + $shipping + $tax);
263
 
264
  return array(
265
+ 'discount_amount' => call_user_func($rounder, -$discountAmount),
266
  'grand_total' => $total,
267
  'shipping_amount' => $shipping,
268
  'shipping_discount_amount' => 0,
269
  'shipping_incl_tax' => $shipping,
270
  'shipping_tax_amount' => 0,
271
+ 'subtotal' => call_user_func($rounder, $regularSubtotal),
272
+ 'subtotal_incl_tax' => call_user_func($rounder, $regularSubtotal + $tax),
273
+ 'tax_amount' => call_user_func($rounder, $tax),
274
  );
275
  }
276
 
279
  * @param Array $request
280
  * @param Mage_Catalog_Model_Product $product
281
  */
282
+ public function calculateOrderItemAmounts(Array $request, $productPrice, $rounder)
283
  {
284
  $amountPerItem = $request['unit_price'];
285
  $qty = $request['quantity'];
294
  $discountPercent = $discountAmount / $regularSubtotal * 100;
295
 
296
  return array(
297
+ 'discount_amount' => call_user_func($rounder, $discountAmount),
298
+ 'discount_percent' => call_user_func($rounder, $discountPercent),
299
  'original_price' => $productPrice,
300
  'price' => $productPrice,
301
+ 'price_incl_tax' => call_user_func($rounder, $productPrice + ($tax / $qty)),
302
+ 'row_total' => call_user_func($rounder, $regularSubtotal),
303
+ 'row_total_incl_tax' => call_user_func($rounder, $regularSubtotal + $tax),
304
  'tax_amount' => $tax,
305
+ 'tax_before_discount' => call_user_func($rounder, $taxBeforeDiscount),
306
+ 'tax_percent' => call_user_func($rounder, $taxPercent * 100),
307
  );
308
  }
309
 
604
 
605
  // NOTE: Building $postFields string manually to avoid multipart/form-data content type
606
  // assigned by default when using Array.
607
+ // PHP 5.4 Added a 4th arg, which we want to use if available to us.
608
+ $buildQueryArgs = array($request, '', '&');
609
+ if (defined('PHP_QUERY_RFC1738')) {
610
+ $buildQueryArgs[] = PHP_QUERY_RFC1738;
611
+ }
612
+ $postFields = call_user_func_array('http_build_query', $buildQueryArgs);
 
613
 
614
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
615
  curl_setopt($ch, CURLOPT_POST, true);
app/code/community/PriceWaiter/NYPWidget/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
 
4
  <modules>
5
  <PriceWaiter_NYPWidget>
6
- <version>2.5.1</version>
7
  </PriceWaiter_NYPWidget>
8
  </modules>
9
 
3
 
4
  <modules>
5
  <PriceWaiter_NYPWidget>
6
+ <version>2.5.2</version>
7
  </PriceWaiter_NYPWidget>
8
  </modules>
9
 
package.xml CHANGED
@@ -1,14 +1,14 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>nypwidget</name>
4
- <version>2.5.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, Version 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>PriceWaiter lets buyers make offers on your products that you can easily accept, counter offer or reject.</summary>
10
  <description>Sell more, immediately, with the PriceWaiter widget. Convert comparison shoppers you might have lost, increase sales and conversions, and stop "minimum advertised price" from preventing sales before they even start.&#xD;&#xD; PriceWaiter lets customers make offers on products you sell-- offers you can accept, reject or counter. The widget embeds a simple Name Your Price button on any product page or category that you choose. Simply install the extension and you'll have full control over PriceWaiter in your Magento admin control panel.</description>
11
- <notes>PHP version compatibility fixes.</notes>
12
  <authors>
13
  <author>
14
  <name>PriceWaiter</name>
@@ -16,9 +16,9 @@
16
  <email>extensions@pricewaiter.com</email>
17
  </author>
18
  </authors>
19
- <date>2016-06-09</date>
20
- <time>17:23:34</time>
21
- <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="PriceWaiter"><dir name="NYPWidget"><dir name="Block"><dir name="Adminhtml"><file name="Link.php" hash="f17d6461e82c76a3a49266aa6a6b23e4"/><file name="Signup.php" hash="f3464994c972a3f0dcc7747ed011bbff"/><file name="Widget.php" hash="a5a15261dae201aca09a8249fe7e8a81"/></dir><file name="Category.php" hash="1047b4af8b7e438964dff8d82e7d8cf6"/><file name="Widget.php" hash="b6b1d0eab14ccb31a06971d6b824ed45"/><dir name="Payment"><dir name="Info"><file name="Pricewaiter.php" hash="ea9b94211a536552689d95c1664894e7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PricewaiterController.php" hash="29d6f14dc97fde5c5d1c5bb969692b9a"/></dir><file name="CallbackController.php" hash="efedef40a3b35220216eeabbd3ae3567"/><file name="ProductinfoController.php" hash="e5a7fcef7d4e4025c9e56268f5fe2dbe"/></dir><dir name="etc"><file name="adminhtml.xml" hash="57af207c7a6966d365ed41ebe6d88ecb"/><file name="config.xml" hash="753ad1a95ac67002871d9b261a5a0126"/><file name="system.xml" hash="3d83e0edf292b6e653d30f05382f1d9b"/></dir><dir name="Exception"><file name="Abstract.php" hash="d19b842ccbefffb2132c957b7feaf3e1"/><file name="ApiKey.php" hash="0cb0715d3242092d5e1fbecb8d978f59"/><file name="DuplicateOrder.php" hash="91eb14444c1bb6e01ddf2a78b92419c9"/><file name="InvalidOrderData.php" hash="6bbb8a438f1464acae9077b7d00f197c"/><file name="InvalidRegion.php" hash="02b69fca49a6584999d979816afca19d"/><file name="OutOfStock.php" hash="767b26a3d548ad92d86048f42910af6f"/><file name="Signature.php" hash="5244f5902f9141a189df78f696814a63"/><dir name="Product"><file name="Abstract.php" hash="1cb077cd79f7185657efb09ff285c7e9"/><file name="NotFound.php" hash="8e1507ab1798d85ce722705c913da441"/></dir></dir><dir name="Helper"><file name="Data.php" hash="69ef8411e6f6b3ef2d5424c24b893fb8"/></dir><dir name="Model"><dir name="Callback"><file name="Inventory.php" hash="0be9afd71ec20b87ba29321f9fdc3cb8"/></dir><file name="Callback.php" hash="11c928bcc942464839d03faaa7b5e051"/><file name="Category.php" hash="18826308eba00faaeffea8b473198ca4"/><file name="Observer.php" hash="0acd80de4ceb912ed8e7d48b017644a8"/><file name="Order.php" hash="86206e5678929e57b833f7ea4bc6bf96"/><file name="PaymentMethod.php" hash="0fa5e9a67512f578226e916b319052b7"/><dir name="Carrier"><file name="ShippingMethod.php" hash="93baf3d128481be22154b103cdf5d627"/></dir><dir name="Display"><file name="Phrase.php" hash="54339c37d5d88f0b2e68dfbe814af2e2"/><file name="Size.php" hash="2a70f37e54202f4a8de5a3f0b376f090"/></dir><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="a5113a9db28d82cedcc8eb2c9b609a88"/></dir><file name="Category.php" hash="656c556879e61bbb20733ffc1dbe38d0"/><file name="Order.php" hash="ebecab2ef597171207ae787b0ddb68df"/><dir name="Order"><file name="Collection.php" hash="07773d6ca5bdf74d14e2d3290466b28f"/></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="c23a03f23524957235bb3cbd1363551b"/></dir></dir></dir></dir><dir name="sql"><dir name="nypwidget_setup"><file name="mysql4-install-1.0.0.php" hash="b977c3a62af93441d115650b543ff858"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="df453265b32071329de809aa750dd31f"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="9b18e12698cbdc6896666b26362a7ddb"/><file name="mysql4-upgrade-1.2.4-1.2.5.php" hash="5e501f27bf223c34e19443923e998021"/><file name="mysql4-upgrade-1.3.0-1.3.1.php" hash="4cd7633a027696aa74668c61c58a83e2"/><file name="mysql4-upgrade-2.1.5-2.2.0.php" hash="be3f748105ff6bf61d4329b967c09c94"/><file name="mysql4-upgrade-2.2.0-2.5.0.php" hash="c02dacf91e070d7274daeda881e68f2a"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pricewaiter.xml" hash="646560535c94bf42ed75438ec9cc6b9f"/></dir><dir name="template"><dir name="pricewaiter"><file name="categorytab.phtml" hash="703fcf0daa0fb71bef23987a9896bd29"/><file name="signup.phtml" hash="fc18c669c18c55cccdf2c66c96199dec"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pricewaiter.xml" hash="d578d936a726cca4837d5f2e58c5ca45"/></dir><dir name="template"><dir name="pricewaiter"><file name="widget.phtml" hash="1035d7df739b2a80a581b13684f95b39"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="PriceWaiter_NYPWidget.xml" hash="7649918eb71009656f956a077f0cf6a8"/></dir></dir></dir><dir name="js"><dir name="pricewaiter"><file name="product-pages.js" hash="775a2c04db1f58c50f204ed7e15aef76"/><file name="token.js" hash="79ce2bdf4d9ae33fb4ef38c298f2dffe"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="pricewaiter_logo.png" hash="becb9713a561131ff69eabb7503d3e74"/><file name="pricewaiter_tab.png" hash="1bab71be6b1a93aee2ae7aeae3807484"/><file name="pricewaiter_logo.png" hash="becb9713a561131ff69eabb7503d3e74"/><file name="pricewaiter_tab.png" hash="1bab71be6b1a93aee2ae7aeae3807484"/></dir><file name="pricewaiter.css" hash="cbda20d51ec4c1505962c1e79007d7f7"/></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>nypwidget</name>
4
+ <version>2.5.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, Version 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>PriceWaiter lets buyers make offers on your products that you can easily accept, counter offer or reject.</summary>
10
  <description>Sell more, immediately, with the PriceWaiter widget. Convert comparison shoppers you might have lost, increase sales and conversions, and stop "minimum advertised price" from preventing sales before they even start.&#xD;&#xD; PriceWaiter lets customers make offers on products you sell-- offers you can accept, reject or counter. The widget embeds a simple Name Your Price button on any product page or category that you choose. Simply install the extension and you'll have full control over PriceWaiter in your Magento admin control panel.</description>
11
+ <notes>PHP 5.3 compatibility fixes.</notes>
12
  <authors>
13
  <author>
14
  <name>PriceWaiter</name>
16
  <email>extensions@pricewaiter.com</email>
17
  </author>
18
  </authors>
19
+ <date>2016-06-16</date>
20
+ <time>18:56:35</time>
21
+ <contents><target name="mageweb"><dir name="app"><dir name="code"><dir name="community"><dir name="PriceWaiter"><dir name="NYPWidget"><dir name="Block"><dir name="Adminhtml"><file name="Link.php" hash="f17d6461e82c76a3a49266aa6a6b23e4"/><file name="Signup.php" hash="f3464994c972a3f0dcc7747ed011bbff"/><file name="Widget.php" hash="a5a15261dae201aca09a8249fe7e8a81"/></dir><file name="Category.php" hash="1047b4af8b7e438964dff8d82e7d8cf6"/><file name="Widget.php" hash="b6b1d0eab14ccb31a06971d6b824ed45"/><dir name="Payment"><dir name="Info"><file name="Pricewaiter.php" hash="ea9b94211a536552689d95c1664894e7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PricewaiterController.php" hash="29d6f14dc97fde5c5d1c5bb969692b9a"/></dir><file name="CallbackController.php" hash="efedef40a3b35220216eeabbd3ae3567"/><file name="ProductinfoController.php" hash="e5a7fcef7d4e4025c9e56268f5fe2dbe"/></dir><dir name="etc"><file name="adminhtml.xml" hash="57af207c7a6966d365ed41ebe6d88ecb"/><file name="config.xml" hash="9801d31b9d8e8d026c08faec3d5e36b0"/><file name="system.xml" hash="3d83e0edf292b6e653d30f05382f1d9b"/></dir><dir name="Exception"><file name="Abstract.php" hash="d19b842ccbefffb2132c957b7feaf3e1"/><file name="ApiKey.php" hash="0cb0715d3242092d5e1fbecb8d978f59"/><file name="DuplicateOrder.php" hash="91eb14444c1bb6e01ddf2a78b92419c9"/><file name="InvalidOrderData.php" hash="6bbb8a438f1464acae9077b7d00f197c"/><file name="InvalidRegion.php" hash="02b69fca49a6584999d979816afca19d"/><file name="OutOfStock.php" hash="767b26a3d548ad92d86048f42910af6f"/><file name="Signature.php" hash="5244f5902f9141a189df78f696814a63"/><dir name="Product"><file name="Abstract.php" hash="1cb077cd79f7185657efb09ff285c7e9"/><file name="NotFound.php" hash="8e1507ab1798d85ce722705c913da441"/></dir></dir><dir name="Helper"><file name="Data.php" hash="69ef8411e6f6b3ef2d5424c24b893fb8"/></dir><dir name="Model"><dir name="Callback"><file name="Inventory.php" hash="0be9afd71ec20b87ba29321f9fdc3cb8"/></dir><file name="Callback.php" hash="a48645e50356737d1a1371f77c99c882"/><file name="Category.php" hash="18826308eba00faaeffea8b473198ca4"/><file name="Observer.php" hash="0acd80de4ceb912ed8e7d48b017644a8"/><file name="Order.php" hash="86206e5678929e57b833f7ea4bc6bf96"/><file name="PaymentMethod.php" hash="0fa5e9a67512f578226e916b319052b7"/><dir name="Carrier"><file name="ShippingMethod.php" hash="93baf3d128481be22154b103cdf5d627"/></dir><dir name="Display"><file name="Phrase.php" hash="54339c37d5d88f0b2e68dfbe814af2e2"/><file name="Size.php" hash="2a70f37e54202f4a8de5a3f0b376f090"/></dir><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="a5113a9db28d82cedcc8eb2c9b609a88"/></dir><file name="Category.php" hash="656c556879e61bbb20733ffc1dbe38d0"/><file name="Order.php" hash="ebecab2ef597171207ae787b0ddb68df"/><dir name="Order"><file name="Collection.php" hash="07773d6ca5bdf74d14e2d3290466b28f"/></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="c23a03f23524957235bb3cbd1363551b"/></dir></dir></dir></dir><dir name="sql"><dir name="nypwidget_setup"><file name="mysql4-install-1.0.0.php" hash="b977c3a62af93441d115650b543ff858"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="df453265b32071329de809aa750dd31f"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="9b18e12698cbdc6896666b26362a7ddb"/><file name="mysql4-upgrade-1.2.4-1.2.5.php" hash="5e501f27bf223c34e19443923e998021"/><file name="mysql4-upgrade-1.3.0-1.3.1.php" hash="4cd7633a027696aa74668c61c58a83e2"/><file name="mysql4-upgrade-2.1.5-2.2.0.php" hash="be3f748105ff6bf61d4329b967c09c94"/><file name="mysql4-upgrade-2.2.0-2.5.0.php" hash="c02dacf91e070d7274daeda881e68f2a"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pricewaiter.xml" hash="646560535c94bf42ed75438ec9cc6b9f"/></dir><dir name="template"><dir name="pricewaiter"><file name="categorytab.phtml" hash="703fcf0daa0fb71bef23987a9896bd29"/><file name="signup.phtml" hash="fc18c669c18c55cccdf2c66c96199dec"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pricewaiter.xml" hash="d578d936a726cca4837d5f2e58c5ca45"/></dir><dir name="template"><dir name="pricewaiter"><file name="widget.phtml" hash="1035d7df739b2a80a581b13684f95b39"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="PriceWaiter_NYPWidget.xml" hash="7649918eb71009656f956a077f0cf6a8"/></dir></dir></dir><dir name="js"><dir name="pricewaiter"><file name="product-pages.js" hash="775a2c04db1f58c50f204ed7e15aef76"/><file name="token.js" hash="79ce2bdf4d9ae33fb4ef38c298f2dffe"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="pricewaiter_logo.png" hash="becb9713a561131ff69eabb7503d3e74"/><file name="pricewaiter_tab.png" hash="1bab71be6b1a93aee2ae7aeae3807484"/><file name="pricewaiter_logo.png" hash="becb9713a561131ff69eabb7503d3e74"/><file name="pricewaiter_tab.png" hash="1bab71be6b1a93aee2ae7aeae3807484"/></dir><file name="pricewaiter.css" hash="cbda20d51ec4c1505962c1e79007d7f7"/></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies>
24
  <required>