Version Notes
Initial release
Download this release
Release Info
| Developer | CornerDrop |
| Extension | CornerDrop_Collect |
| Version | 1.2.0 |
| Comparing to | |
| See all releases | |
Version 1.2.0
- app/code/community/CornerDrop/Collect/Block/Adminhtml/Form/Field/Account/Balance.php +22 -0
- app/code/community/CornerDrop/Collect/Block/Checkout/Success.php +52 -0
- app/code/community/CornerDrop/Collect/Block/Checkout/Switch.php +79 -0
- app/code/community/CornerDrop/Collect/Block/Sales/Order/Totals.php +31 -0
- app/code/community/CornerDrop/Collect/Helper/Api.php +45 -0
- app/code/community/CornerDrop/Collect/Helper/Config.php +250 -0
- app/code/community/CornerDrop/Collect/Helper/Data.php +212 -0
- app/code/community/CornerDrop/Collect/Helper/Order.php +280 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action.php +157 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/OrderCancel.php +7 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/OrderCreate.php +7 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/OrderDispatch.php +7 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/OrderReserve.php +7 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/Search.php +8 -0
- app/code/community/CornerDrop/Collect/Model/Api/Action/Status.php +7 -0
- app/code/community/CornerDrop/Collect/Model/Api/Request.php +205 -0
- app/code/community/CornerDrop/Collect/Model/Api/Response.php +138 -0
- app/code/community/CornerDrop/Collect/Model/Api/Response/Empty.php +24 -0
- app/code/community/CornerDrop/Collect/Model/Cron.php +126 -0
- app/code/community/CornerDrop/Collect/Model/Observer.php +219 -0
- app/code/community/CornerDrop/Collect/Model/Resource/Setup.php +5 -0
- app/code/community/CornerDrop/Collect/Model/Sales/Order/Creditmemo/Total/CornerDrop/Fee.php +39 -0
- app/code/community/CornerDrop/Collect/Model/Sales/Order/Invoice/Total/CornerDrop/Fee.php +46 -0
- app/code/community/CornerDrop/Collect/Model/Sales/Quote/Address/Total/CornerDrop/Fee.php +111 -0
- app/code/community/CornerDrop/Collect/Test/.DS_Store +0 -0
- app/code/community/CornerDrop/Collect/Test/Config/Base.php +14 -0
- app/code/community/CornerDrop/Collect/Test/Helper/Data.php +115 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Action.php +52 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Action/fixtures/testExecute.yaml +2 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Request.php +64 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Response.php +19 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Response/providers/response_testIsSuccessful.yaml +16 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/Test/Case.php +19 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/data/data_response_success.json +7 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_failed.json +5 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_nojson.json +1 -0
- app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_valid.json +7 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/Fee.php +73 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/fixtures/testCornerDropFeeAddedWithNoTax.yaml +356 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/fixtures/testCornerDropFeeAddedWithTax.yaml +356 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/fixtures/testCornerDropFeeNotAdded.yaml +356 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee.php +54 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithNoTax.yaml +382 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithTax.yaml +382 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeNotAdded.yaml +382 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee.php +94 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithNoTax.yaml +438 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithTax.yaml +438 -0
- app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeNotAdded.yaml +273 -0
- app/code/community/CornerDrop/Collect/controllers/Adminhtml/Cornerdrop/Collect/SearchController.php +68 -0
- app/code/community/CornerDrop/Collect/controllers/SearchController.php +70 -0
- app/code/community/CornerDrop/Collect/data/cornerdrop_collect_setup/data-install-1.0.0.php +74 -0
- app/code/community/CornerDrop/Collect/etc/adminhtml.xml +22 -0
- app/code/community/CornerDrop/Collect/etc/config.xml +232 -0
- app/code/community/CornerDrop/Collect/etc/system.xml +172 -0
- app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/install-1.0.0.php +75 -0
- app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/upgrade-1.0.0-1.1.0.php +33 -0
- app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/upgrade-1.1.0-1.2.0.php +36 -0
- app/design/adminhtml/default/default/layout/cornerdrop/collect.xml +99 -0
- app/design/adminhtml/default/default/template/cornerdrop/collect/order/create/form/address/shipping.phtml +175 -0
- app/design/frontend/base/default/layout/cornerdrop/collect.xml +126 -0
- app/design/frontend/base/default/template/cornerdrop/collect/checkout/success.phtml +4 -0
- app/design/frontend/base/default/template/cornerdrop/collect/checkout/switch.phtml +31 -0
- app/design/frontend/base/default/template/cornerdrop/collect/email/shipment.phtml +6 -0
- app/design/frontend/base/default/template/cornerdrop/collect/search.phtml +38 -0
- app/etc/modules/CornerDrop_Collect.xml +12 -0
- app/locale/en_US/template/email/cornerdrop/collect/code.html +73 -0
- js/cornerdrop/collect/adminhtml.js +222 -0
- js/cornerdrop/collect/adminhtml_search.js +15 -0
- js/cornerdrop/collect/adminhtml_ui.js +15 -0
- js/cornerdrop/collect/event.simulate.js +64 -0
- js/cornerdrop/collect/geolocationAPI.js +89 -0
- js/cornerdrop/collect/gmaps.js +171 -0
- js/cornerdrop/collect/search.js +211 -0
- js/cornerdrop/collect/switch.js +185 -0
- js/cornerdrop/collect/ui.js +558 -0
- package.xml +36 -0
- skin/adminhtml/default/default/cornerdrop/collect/css/collect.css +136 -0
- skin/adminhtml/default/default/cornerdrop/collect/images/ajax-loader.gif +0 -0
- skin/adminhtml/default/default/cornerdrop/collect/images/geolocation.png +0 -0
- skin/adminhtml/default/default/cornerdrop/collect/images/reset.png +0 -0
- skin/adminhtml/default/default/cornerdrop/collect/images/search.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/.DS_Store +0 -0
- skin/frontend/base/default/cornerdrop/collect/css/collect.css +198 -0
- skin/frontend/base/default/cornerdrop/collect/images/ajax-loader.gif +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/droppoint_active.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/droppoint_inactive.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/droppoint_muted.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/geolocation.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/logo_125.jpg +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/logo_250.jpg +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/logo_500.jpg +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/reset.png +0 -0
- skin/frontend/base/default/cornerdrop/collect/images/search.png +0 -0
app/code/community/CornerDrop/Collect/Block/Adminhtml/Form/Field/Account/Balance.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Block_Adminhtml_Form_Field_Account_Balance extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Return the account balance or "Unknown" if it's not known.
|
| 8 |
+
*
|
| 9 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
| 10 |
+
*
|
| 11 |
+
* @return string
|
| 12 |
+
*/
|
| 13 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 14 |
+
{
|
| 15 |
+
if (is_numeric($element->getEscapedValue())) {
|
| 16 |
+
return $element->getEscapedValue();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
return "Unknown";
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
}
|
app/code/community/CornerDrop/Collect/Block/Checkout/Success.php
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Block_Checkout_Success extends Mage_Core_Block_Template
|
| 4 |
+
{
|
| 5 |
+
protected $order;
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Get the current order model.
|
| 9 |
+
*
|
| 10 |
+
* @return Mage_Sales_Model_Order
|
| 11 |
+
*/
|
| 12 |
+
public function getOrder()
|
| 13 |
+
{
|
| 14 |
+
if (!$this->order) {
|
| 15 |
+
if ($orderId = Mage::getSingleton("checkout/session")->getLastOrderId()) {
|
| 16 |
+
$this->order = Mage::getModel("sales/order")->load($orderId);
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
return $this->order;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Check if CornerDrop was selected for the current order.
|
| 25 |
+
*
|
| 26 |
+
* @return bool
|
| 27 |
+
*/
|
| 28 |
+
public function isCornerDropOrder()
|
| 29 |
+
{
|
| 30 |
+
return $this->getModuleHelper()->isOrderCornerDrop($this->getOrder());
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Get CornerDrop logo HTML.
|
| 35 |
+
*
|
| 36 |
+
* @return string
|
| 37 |
+
*/
|
| 38 |
+
public function getLogoHtml()
|
| 39 |
+
{
|
| 40 |
+
return $this->getModuleHelper()->getLogoHtml();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Get the module helper.
|
| 45 |
+
*
|
| 46 |
+
* @return CornerDrop_Collect_Helper_Data
|
| 47 |
+
*/
|
| 48 |
+
protected function getModuleHelper()
|
| 49 |
+
{
|
| 50 |
+
return Mage::helper("cornerdrop_collect");
|
| 51 |
+
}
|
| 52 |
+
}
|
app/code/community/CornerDrop/Collect/Block/Checkout/Switch.php
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Block_Checkout_Switch extends Mage_Checkout_Block_Onepage_Abstract
|
| 4 |
+
{
|
| 5 |
+
const SKIN_IMAGE_PATH = 'cornerdrop/collect/images/';
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Check if CornerDrop Collect is enabled for this checkout.
|
| 9 |
+
*
|
| 10 |
+
* @return bool
|
| 11 |
+
*/
|
| 12 |
+
public function isEnabled()
|
| 13 |
+
{
|
| 14 |
+
return !$this->getQuote()->isVirtual() && $this->getConfig()->isExtensionEnabled();
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Get the switch checkbox label.
|
| 19 |
+
*
|
| 20 |
+
* @return string
|
| 21 |
+
*/
|
| 22 |
+
public function getCheckboxLabel()
|
| 23 |
+
{
|
| 24 |
+
if ($this->getConfig()->getAdditionalFee()) {
|
| 25 |
+
return $this->getModuleHelper()->__("Click & Collect with %s (+%s)", $this->getModuleHelper()->getLogoHtml(), $this->getConfig()->getFormattedFee());
|
| 26 |
+
} else {
|
| 27 |
+
return $this->getModuleHelper()->__("Click & Collect with %s", $this->getModuleHelper()->getLogoHtml());
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Check if CornerDrop Collect is selected for the current quote.
|
| 33 |
+
*
|
| 34 |
+
* @return bool
|
| 35 |
+
*/
|
| 36 |
+
public function getValue()
|
| 37 |
+
{
|
| 38 |
+
return $this->getModuleHelper()->isCornerDropAddress($this->getQuote()->getShippingAddress());
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Get search template HTML.
|
| 43 |
+
*
|
| 44 |
+
* @return string
|
| 45 |
+
*/
|
| 46 |
+
public function getSearchTemplateHtml()
|
| 47 |
+
{
|
| 48 |
+
return $this->getChildHtml('search_template');
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Get the URL for the given image in skin.
|
| 53 |
+
*
|
| 54 |
+
* @return string
|
| 55 |
+
*/
|
| 56 |
+
public function getImageUrl($filename) {
|
| 57 |
+
return $this->getSkinUrl(static::SKIN_IMAGE_PATH . $filename);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Get the module helper.
|
| 62 |
+
*
|
| 63 |
+
* @return CornerDrop_Collect_Helper_Data
|
| 64 |
+
*/
|
| 65 |
+
protected function getModuleHelper()
|
| 66 |
+
{
|
| 67 |
+
return Mage::helper("cornerdrop_collect");
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Get the config helper.
|
| 72 |
+
*
|
| 73 |
+
* @return CornerDrop_Collect_Helper_Config
|
| 74 |
+
*/
|
| 75 |
+
protected function getConfig()
|
| 76 |
+
{
|
| 77 |
+
return Mage::helper("cornerdrop_collect/config");
|
| 78 |
+
}
|
| 79 |
+
}
|
app/code/community/CornerDrop/Collect/Block/Sales/Order/Totals.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Block_Sales_Order_Totals extends Mage_Core_Block_Abstract {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Add the CornerDrop Fee Total to Totals
|
| 7 |
+
*
|
| 8 |
+
* @Return void
|
| 9 |
+
*/
|
| 10 |
+
public function initTotals() {
|
| 11 |
+
$helper = Mage::helper('cornerdrop_collect');
|
| 12 |
+
|
| 13 |
+
/** @var Mage_Sales_Block_Order_Totals $parent */
|
| 14 |
+
$parent = $this->getParentBlock();
|
| 15 |
+
$source = $parent->getSource();
|
| 16 |
+
$shipping_address = $source->getShippingAddress();
|
| 17 |
+
if($shipping_address && $helper->isCornerDropAddress($source->getShippingAddress())) {
|
| 18 |
+
$parent->addTotalBefore(
|
| 19 |
+
new Varien_Object(array(
|
| 20 |
+
'code' => CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT,
|
| 21 |
+
'value' => $source->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT),
|
| 22 |
+
'base_value'=> $source->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT),
|
| 23 |
+
'label' => $helper->getCornerDropFeeLabel()
|
| 24 |
+
)
|
| 25 |
+
),
|
| 26 |
+
'shipping'
|
| 27 |
+
);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
}
|
app/code/community/CornerDrop/Collect/Helper/Api.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Helper_Api extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
const DEFAULT_API_IDENTIFIER = 'MAGENTO';
|
| 7 |
+
|
| 8 |
+
const STATUS_CODE_SUCCESS = "2000";
|
| 9 |
+
const STATUS_CODE_INVALID_HEADER_INFORMATION = "4001";
|
| 10 |
+
const STATUS_CODE_API_KEY_NOT_SUPPLIED = "4010";
|
| 11 |
+
const STATUS_CODE_API_KEY_INVALID = "4011";
|
| 12 |
+
const STATUS_CODE_AUTHORIZATION_DENIED = "4030";
|
| 13 |
+
const STATUS_CODE_PACKAGE_ACTIVATION_NO_CREDITS = "4020";
|
| 14 |
+
const STATUS_CODE_PACKAGE_ACTIVATION_DROP_POINT_NO_CAPACITY = "4021";
|
| 15 |
+
const STATUS_CODE_PACKAGE_ACTIVATION_DROP_POINT_DAILY_LIMIT_EXCEEDED = "4022";
|
| 16 |
+
const STATUS_CODE_REFERENCE_NOT_FOUND = "4041";
|
| 17 |
+
const STATUS_CODE_TERMINATE = "4100";
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Return the current version of the module
|
| 21 |
+
*
|
| 22 |
+
* @return string
|
| 23 |
+
*/
|
| 24 |
+
public function getVersion()
|
| 25 |
+
{
|
| 26 |
+
return Mage::getConfig()->getModuleConfig('CornerDrop_Collect')->version;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getApiIdentifier()
|
| 30 |
+
{
|
| 31 |
+
return self::DEFAULT_API_IDENTIFIER . '-' . $this->getVersion();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Build & prepare API endpoint url.
|
| 36 |
+
* @param string $endpoint
|
| 37 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 38 |
+
* @return string
|
| 39 |
+
*/
|
| 40 |
+
public function buildEndpoint($endpoint, $store_id)
|
| 41 |
+
{
|
| 42 |
+
$uri = Mage::helper('cornerdrop_collect/config')->getApiUri($store_id);
|
| 43 |
+
return rtrim($uri, '/') . $endpoint;
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/community/CornerDrop/Collect/Helper/Config.php
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Helper_Config extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
const XML_PATH_STATUS_BALANCE = 'cornerdrop_collect/status/balance';
|
| 7 |
+
const XML_PATH_STATUS_LAST_CHECKED = 'cornerdrop_collect/status/last_checked';
|
| 8 |
+
|
| 9 |
+
const XML_PATH_SETTINGS_ENABLED = 'cornerdrop_collect/settings/enable';
|
| 10 |
+
const XML_PATH_SETTINGS_API_KEY = 'cornerdrop_collect/settings/api_key';
|
| 11 |
+
const XML_PATH_SETTINGS_API_URI = 'cornerdrop_collect/settings/api_uri';
|
| 12 |
+
const XML_PATH_SETTINGS_CODE_EMAIL_TEMPLATE = 'cornerdrop_collect/settings/code_email_template';
|
| 13 |
+
const XML_PATH_FEE_SETTINGS_ADDITIONAL_FEE = 'cornerdrop_collect/fee_settings/additional_fee';
|
| 14 |
+
const XML_PATH_FEE_SETTINGS_INCLUDE_TAX = 'cornerdrop_collect/fee_settings/include_tax';
|
| 15 |
+
const XML_PATH_FEE_SETTINGS_TAX_CLASS = 'cornerdrop_collect/fee_settings/tax_class';
|
| 16 |
+
|
| 17 |
+
const XML_PATH_PREFIX_ADDRESS_TEMPLATE = 'cornerdrop_collect/address_templates/';
|
| 18 |
+
|
| 19 |
+
const DATETIME_FORMAT = "Y-m-d H:i:s T";
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Set the account credit balance.
|
| 23 |
+
*
|
| 24 |
+
* @param int $value
|
| 25 |
+
*
|
| 26 |
+
* @return $this
|
| 27 |
+
*/
|
| 28 |
+
public function setAccountBalance($value)
|
| 29 |
+
{
|
| 30 |
+
$this->setGlobalConfig(static::XML_PATH_STATUS_BALANCE, $value);
|
| 31 |
+
|
| 32 |
+
return $this;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Get the account credit balance.
|
| 37 |
+
*
|
| 38 |
+
* @return int
|
| 39 |
+
*/
|
| 40 |
+
public function getAccountBalance()
|
| 41 |
+
{
|
| 42 |
+
$balance = Mage::getStoreConfig(static::XML_PATH_STATUS_BALANCE);
|
| 43 |
+
|
| 44 |
+
$balance = (is_numeric($balance)) ? intval($balance) : null;
|
| 45 |
+
|
| 46 |
+
return $balance;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Get the account credit balance after taking into account
|
| 51 |
+
* any CornerDrop orders that the API has not been notified about
|
| 52 |
+
* yet.
|
| 53 |
+
*
|
| 54 |
+
* @return int
|
| 55 |
+
*/
|
| 56 |
+
public function getAvailableAccountBalance()
|
| 57 |
+
{
|
| 58 |
+
$api_balance = $this->getAccountBalance();
|
| 59 |
+
|
| 60 |
+
$pending_orders = Mage::helper("cornerdrop_collect/order")->getCornerDropOrderCollection()
|
| 61 |
+
->addFieldToFilter(CornerDrop_Collect_Helper_Data::ORDERED_NOTIFICATION_COLUMN, array("neq" => 1))
|
| 62 |
+
->getSize();
|
| 63 |
+
|
| 64 |
+
$balance = $api_balance - $pending_orders;
|
| 65 |
+
|
| 66 |
+
return ($balance > 0) ? $balance : 0;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Set the time when the account status was last checked.
|
| 71 |
+
* Uses admin store timezone.
|
| 72 |
+
*
|
| 73 |
+
* @param DateTime|string $datetime
|
| 74 |
+
*
|
| 75 |
+
* @return $this
|
| 76 |
+
*/
|
| 77 |
+
public function setStatusLastChecked($datetime = "now")
|
| 78 |
+
{
|
| 79 |
+
if (!$datetime instanceof DateTime) {
|
| 80 |
+
$datetime = new DateTime($datetime, $this->getAdminTimezone());
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
$this->setGlobalConfig(static::XML_PATH_STATUS_LAST_CHECKED, $datetime->format(static::DATETIME_FORMAT));
|
| 84 |
+
|
| 85 |
+
return $this;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Get the time when the account status was last checked.
|
| 90 |
+
* Uses admin store timezone.
|
| 91 |
+
*
|
| 92 |
+
* @return DateTime|null
|
| 93 |
+
*/
|
| 94 |
+
public function getStatusLastChecked()
|
| 95 |
+
{
|
| 96 |
+
$value = Mage::getStoreConfig(static::XML_PATH_STATUS_LAST_CHECKED);
|
| 97 |
+
|
| 98 |
+
return ($value) ? DateTime::createFromFormat(static::DATETIME_FORMAT, $value, $this->getAdminTimezone()) : null;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Get the System Configuration setting to enable the module.
|
| 103 |
+
*
|
| 104 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 105 |
+
*
|
| 106 |
+
* @return bool
|
| 107 |
+
*/
|
| 108 |
+
public function getEnabledFlag($store_id = null)
|
| 109 |
+
{
|
| 110 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_SETTINGS_ENABLED, $store_id);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* Check if the extension functionality is enabled.
|
| 115 |
+
* Includes checking the enabled flag in the configuration and
|
| 116 |
+
* the available account balance.
|
| 117 |
+
*
|
| 118 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 119 |
+
*
|
| 120 |
+
* @return bool
|
| 121 |
+
*/
|
| 122 |
+
public function isExtensionEnabled($store_id = null)
|
| 123 |
+
{
|
| 124 |
+
return $this->getEnabledFlag($store_id) && $this->getAvailableAccountBalance() > 0;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 129 |
+
*
|
| 130 |
+
* @return string
|
| 131 |
+
*/
|
| 132 |
+
public function getApiKey($store_id = null)
|
| 133 |
+
{
|
| 134 |
+
return Mage::getStoreConfig(self::XML_PATH_SETTINGS_API_KEY, $store_id);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* Get the email template to use for the package collection
|
| 139 |
+
* code email.
|
| 140 |
+
*
|
| 141 |
+
* @param Mage_Core_Model_Store|int|null $store
|
| 142 |
+
*
|
| 143 |
+
* @return string
|
| 144 |
+
*/
|
| 145 |
+
public function getCodeEmailTemplate($store = null)
|
| 146 |
+
{
|
| 147 |
+
return Mage::getStoreConfig(static::XML_PATH_SETTINGS_CODE_EMAIL_TEMPLATE, $store);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 152 |
+
*
|
| 153 |
+
* @return string
|
| 154 |
+
*/
|
| 155 |
+
public function getAdditionalFee($store_id = null)
|
| 156 |
+
{
|
| 157 |
+
return Mage::getStoreConfig(self::XML_PATH_FEE_SETTINGS_ADDITIONAL_FEE, $store_id);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* Get the configured additional fee for the given store, formatted for printing.
|
| 162 |
+
*
|
| 163 |
+
* @param Mage_Core_Model_Store|int|null $store
|
| 164 |
+
*
|
| 165 |
+
* @return string
|
| 166 |
+
*/
|
| 167 |
+
public function getFormattedFee($store = null)
|
| 168 |
+
{
|
| 169 |
+
$store = Mage::app()->getStore($store);
|
| 170 |
+
|
| 171 |
+
return $store->formatPrice($this->getAdditionalFee($store), false);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 176 |
+
*
|
| 177 |
+
* @return bool
|
| 178 |
+
*/
|
| 179 |
+
public function isIncludeTax($store_id = null)
|
| 180 |
+
{
|
| 181 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_FEE_SETTINGS_INCLUDE_TAX, $store_id);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 186 |
+
*
|
| 187 |
+
* @return string
|
| 188 |
+
*/
|
| 189 |
+
public function getTaxClass($store_id = null)
|
| 190 |
+
{
|
| 191 |
+
return Mage::getStoreConfig(self::XML_PATH_FEE_SETTINGS_TAX_CLASS, $store_id);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* Fetch the URI used API calls.
|
| 196 |
+
*
|
| 197 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 198 |
+
*
|
| 199 |
+
* @return string
|
| 200 |
+
*/
|
| 201 |
+
public function getApiUri($store_id = null)
|
| 202 |
+
{
|
| 203 |
+
return Mage::getStoreConfig(self::XML_PATH_SETTINGS_API_URI, $store_id);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
/**
|
| 207 |
+
* Get the customer address template suffix for the specified address format.
|
| 208 |
+
*
|
| 209 |
+
* @param string $type_code
|
| 210 |
+
* @param Mage_Core_Model_Store|int|null $store_id
|
| 211 |
+
*
|
| 212 |
+
* @return mixed
|
| 213 |
+
*/
|
| 214 |
+
public function getAddressTemplate($type_code, $store_id = null)
|
| 215 |
+
{
|
| 216 |
+
return Mage::getStoreConfig(sprintf("%s%s", static::XML_PATH_PREFIX_ADDRESS_TEMPLATE, $type_code), $store_id);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Set the value of the given System Configuraiton path in the global scope.
|
| 221 |
+
*
|
| 222 |
+
* @param string $path
|
| 223 |
+
* @param string $value
|
| 224 |
+
*
|
| 225 |
+
* @return $this
|
| 226 |
+
*/
|
| 227 |
+
protected function setGlobalConfig($path, $value)
|
| 228 |
+
{
|
| 229 |
+
Mage::getConfig()
|
| 230 |
+
->saveConfig($path, $value, "default")
|
| 231 |
+
->reinit();
|
| 232 |
+
|
| 233 |
+
return $this;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* Get the timezone for the admin store.
|
| 238 |
+
*
|
| 239 |
+
* @return DateTimeZone
|
| 240 |
+
*/
|
| 241 |
+
protected function getAdminTimezone()
|
| 242 |
+
{
|
| 243 |
+
return new DateTimeZone(
|
| 244 |
+
Mage::app()
|
| 245 |
+
->getStore(Mage_Core_Model_Store::ADMIN_CODE)
|
| 246 |
+
->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE)
|
| 247 |
+
);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
}
|
app/code/community/CornerDrop/Collect/Helper/Data.php
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
const CORNERDROP_FEE_AMOUNT = 'cornerdrop_fee_amount';
|
| 7 |
+
const BASE_CORNERDROP_FEE_AMOUNT = 'base_cornerdrop_fee_amount';
|
| 8 |
+
const CORNERDROP_TAX = 'cornerdrop_tax_amount';
|
| 9 |
+
const BASE_CORNERDROP_TAX = 'base_cornerdrop_tax_amount';
|
| 10 |
+
const ORDERED_NOTIFICATION_COLUMN = 'cornerdrop_notification_ordered';
|
| 11 |
+
const SHIPPED_NOTIFICATION_COLUMN = 'cornerdrop_notification_shipped';
|
| 12 |
+
const CANCELLED_NOTIFICATION_COLUMN = 'cornerdrop_notification_cancelled';
|
| 13 |
+
|
| 14 |
+
const IS_CORNERDROP_COLLECT = 'is_cornerdrop_collect';
|
| 15 |
+
const CORNERDROP_STORE_ID_COLUMN = 'cornerdrop_store_id';
|
| 16 |
+
const CORNERDROP_FEE_CODE = 'cornerdrop_fee';
|
| 17 |
+
const CORNERDROP_RESERVATION_CODE = 'cornerdrop_reservation_code';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Log a message to a log file.
|
| 21 |
+
*
|
| 22 |
+
* @param $message
|
| 23 |
+
* @param int $level
|
| 24 |
+
*/
|
| 25 |
+
public function log($message, $level = Zend_Log::DEBUG)
|
| 26 |
+
{
|
| 27 |
+
Mage::log($message, $level, 'cornerdrop.log');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Check if the given address is a CornerDrop Collect address.
|
| 32 |
+
*
|
| 33 |
+
* @param Mage_Sales_Model_Quote_Address|Mage_Sales_Model_Order_Address $address
|
| 34 |
+
*
|
| 35 |
+
* @return bool
|
| 36 |
+
*/
|
| 37 |
+
public function isCornerDropAddress($address) {
|
| 38 |
+
return $address->getData(static::IS_CORNERDROP_COLLECT) == 1;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Check if the quote is using CornerDrop
|
| 43 |
+
*
|
| 44 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 45 |
+
*
|
| 46 |
+
* @return bool
|
| 47 |
+
*/
|
| 48 |
+
public function isQuoteCornerDrop(Mage_Sales_Model_Quote $quote)
|
| 49 |
+
{
|
| 50 |
+
return !$quote->isVirtual() && $this->isCornerDropAddress($quote->getShippingAddress());
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Check if the order is using CornerDrop, the check can be done by the Invoice and Creditmemo blocks too.
|
| 55 |
+
*
|
| 56 |
+
* @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
|
| 57 |
+
*
|
| 58 |
+
* @return bool
|
| 59 |
+
*/
|
| 60 |
+
public function isOrderCornerDrop($source)
|
| 61 |
+
{
|
| 62 |
+
return !$source->getIsVirtual() && $this->isCornerDropAddress($source->getShippingAddress());
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Get the Label for CornerDrop
|
| 67 |
+
*
|
| 68 |
+
* @return string
|
| 69 |
+
*/
|
| 70 |
+
public function getCornerDropFeeLabel()
|
| 71 |
+
{
|
| 72 |
+
return $this->__('CornerDrop Fee');
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Get the HTML to print a CornerDrop logo for the current theme.
|
| 77 |
+
*
|
| 78 |
+
* @return string
|
| 79 |
+
*/
|
| 80 |
+
public function getLogoHtml()
|
| 81 |
+
{
|
| 82 |
+
$sources = array(
|
| 83 |
+
"1x" => "cornerdrop/collect/images/logo_125.jpg",
|
| 84 |
+
"2x" => "cornerdrop/collect/images/logo_250.jpg",
|
| 85 |
+
"4x" => "cornerdrop/collect/images/logo_500.jpg"
|
| 86 |
+
);
|
| 87 |
+
|
| 88 |
+
return sprintf('<img src="%s" srcset="%s" width="125" alt="CornerDrop" class="cdc-logo" />',
|
| 89 |
+
Mage::getDesign()->getSkinUrl($sources["1x"]),
|
| 90 |
+
implode(",", array_map(function ($path, $cond) {
|
| 91 |
+
return sprintf("%s %s", Mage::getDesign()->getSkinUrl($path), $cond);
|
| 92 |
+
}, $sources, array_keys($sources)))
|
| 93 |
+
);
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Perform a search for CornerDrop Collect locations using the API
|
| 98 |
+
* and return the results as an array. Returns null if the search
|
| 99 |
+
* failed.
|
| 100 |
+
*
|
| 101 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 102 |
+
* @param string $query
|
| 103 |
+
* @param string $lat
|
| 104 |
+
* @param string $long
|
| 105 |
+
*
|
| 106 |
+
* @return array|null
|
| 107 |
+
*/
|
| 108 |
+
public function search($quote, $query, $lat, $long)
|
| 109 |
+
{
|
| 110 |
+
try {
|
| 111 |
+
$response = Mage::getModel("cornerdrop_collect/api_action_search")->execute(
|
| 112 |
+
$quote->getId(),
|
| 113 |
+
$quote->getRemoteIp(),
|
| 114 |
+
array(
|
| 115 |
+
"searchString" => $query,
|
| 116 |
+
"latitude" => $lat,
|
| 117 |
+
"longitude" => $long
|
| 118 |
+
)
|
| 119 |
+
);
|
| 120 |
+
} catch (Exception $e) {
|
| 121 |
+
Mage::logException($e);
|
| 122 |
+
|
| 123 |
+
return null;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
if ($response->isSuccessful()) {
|
| 127 |
+
$results = array();
|
| 128 |
+
|
| 129 |
+
$data = $response->getResult();
|
| 130 |
+
|
| 131 |
+
if ($data && array_key_exists("results", $data) && is_array($data["results"])) {
|
| 132 |
+
$default_address = $this->getCustomerAddress($quote);
|
| 133 |
+
|
| 134 |
+
foreach ($data["results"] as $result) {
|
| 135 |
+
$results[] = $this->buildResult($result, $default_address);
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
return $results;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
return null;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* Get the customer billing address fields as an array from the given quote.
|
| 147 |
+
*
|
| 148 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 149 |
+
*
|
| 150 |
+
* @return array
|
| 151 |
+
*/
|
| 152 |
+
protected function getCustomerAddress($quote)
|
| 153 |
+
{
|
| 154 |
+
$address = $quote->getBillingAddress()->exportCustomerAddress()->toArray();
|
| 155 |
+
|
| 156 |
+
// Remove internal VAT fields
|
| 157 |
+
unset($address["vat_is_valid"]);
|
| 158 |
+
unset($address["vat_request_id"]);
|
| 159 |
+
unset($address["vat_request_date"]);
|
| 160 |
+
unset($address["vat_request_success"]);
|
| 161 |
+
|
| 162 |
+
unset($address["region_id"]);
|
| 163 |
+
|
| 164 |
+
return $address;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Build a result array out of the raw data returned by the API.
|
| 169 |
+
*
|
| 170 |
+
* @param array $data
|
| 171 |
+
* @param array $default_address
|
| 172 |
+
*
|
| 173 |
+
* @return array
|
| 174 |
+
*/
|
| 175 |
+
protected function buildResult($data, $default_address) {
|
| 176 |
+
$result = array(
|
| 177 |
+
"id" => $data["id"],
|
| 178 |
+
"name" => $data["displayName"],
|
| 179 |
+
"description" => $data["siteMarketing"],
|
| 180 |
+
"address" => $default_address,
|
| 181 |
+
"addressHtml" => $data["fullAddressHtml"],
|
| 182 |
+
"location" => array(
|
| 183 |
+
"distance" => $data["distance"],
|
| 184 |
+
"latitude" => $data["latitude"],
|
| 185 |
+
"longitude" => $data["longitude"]
|
| 186 |
+
),
|
| 187 |
+
"availability" => array(
|
| 188 |
+
"available" => $data["availableSlots"],
|
| 189 |
+
"total" => $data["totalSlots"]
|
| 190 |
+
),
|
| 191 |
+
"openingHoursHtml" => $data["openingHoursHtml"]
|
| 192 |
+
);
|
| 193 |
+
|
| 194 |
+
foreach (array(
|
| 195 |
+
"displayName" => "company",
|
| 196 |
+
"city" => "city",
|
| 197 |
+
"contactPhone" => "telephone",
|
| 198 |
+
"countryCode" => "country_id",
|
| 199 |
+
"county" => "region",
|
| 200 |
+
"postCode" => "postcode"
|
| 201 |
+
) as $source => $destination) {
|
| 202 |
+
$result["address"][$destination] = $data[$source];
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
$result["address"]["firstname"] = "CornerDrop";
|
| 206 |
+
$result["address"]["lastname"] = "code";
|
| 207 |
+
$result["address"]["street"] = array($data["address1"], $data["address2"], $data["address3"]);
|
| 208 |
+
|
| 209 |
+
return $result;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
}
|
app/code/community/CornerDrop/Collect/Helper/Order.php
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Helper_Order extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
const RESULT_SUCCESS = 1;
|
| 6 |
+
const RESULT_FAILED = 2;
|
| 7 |
+
const RESULT_TERMINATE = 3;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Get an order collection filtered to only include CornerDrop orders.
|
| 11 |
+
*
|
| 12 |
+
* @return Mage_Sales_Model_Resource_Order_Collection
|
| 13 |
+
*/
|
| 14 |
+
public function getCornerDropOrderCollection()
|
| 15 |
+
{
|
| 16 |
+
$collection = Mage::getModel("sales/order")->getCollection()
|
| 17 |
+
->addAddressFields()
|
| 18 |
+
->addFieldToFilter("shipping_o_a." . CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT, 1);
|
| 19 |
+
|
| 20 |
+
return $collection;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Place a reservation for our quote against the CornerDrop API. If successful, assign
|
| 25 |
+
* the returned `addressCodeId` to the quote for submission during the order creation
|
| 26 |
+
* call.
|
| 27 |
+
*
|
| 28 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 29 |
+
* @param $drop_point_node_id
|
| 30 |
+
*
|
| 31 |
+
* @return int
|
| 32 |
+
*/
|
| 33 |
+
public function reserve(Mage_Sales_Model_Quote $quote, $drop_point_node_id)
|
| 34 |
+
{
|
| 35 |
+
try {
|
| 36 |
+
$response = Mage::getModel('cornerdrop_collect/api_action_orderReserve')->execute(
|
| 37 |
+
$quote->getId(),
|
| 38 |
+
$quote->getRemoteIp(),
|
| 39 |
+
array(
|
| 40 |
+
"dropPointNodeId" => $drop_point_node_id
|
| 41 |
+
)
|
| 42 |
+
);
|
| 43 |
+
} catch (Exception $e) {
|
| 44 |
+
Mage::logException($e);
|
| 45 |
+
|
| 46 |
+
return static::RESULT_FAILED;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
if ($response->isSuccessful()) {
|
| 50 |
+
$response_data = $response->getResult();
|
| 51 |
+
$address_code_id = $response_data['addressCodeId'];
|
| 52 |
+
|
| 53 |
+
$quote->getShippingAddress()->setData(
|
| 54 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_RESERVATION_CODE,
|
| 55 |
+
$address_code_id
|
| 56 |
+
);
|
| 57 |
+
|
| 58 |
+
$quote->save();
|
| 59 |
+
|
| 60 |
+
return static::RESULT_SUCCESS;
|
| 61 |
+
} else if ($response->getCode() == CornerDrop_Collect_Helper_Api::STATUS_CODE_TERMINATE) {
|
| 62 |
+
return static::RESULT_TERMINATE;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return static::RESULT_FAILED;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Submit a new order to the CornerDrop API and, if successful, update the order
|
| 70 |
+
* shipping address with a CornerDrop reference and notify the customer of their
|
| 71 |
+
* tracking code.
|
| 72 |
+
*
|
| 73 |
+
* @param Mage_Sales_Model_Order $order
|
| 74 |
+
* @param bool $save Save the order model after setting the CornerDrop reference.
|
| 75 |
+
* @param bool $notify Email the secret PIN to the customer.
|
| 76 |
+
*
|
| 77 |
+
* @return int
|
| 78 |
+
*/
|
| 79 |
+
public function create($order, $save = true, $notify = true)
|
| 80 |
+
{
|
| 81 |
+
$orderData = $this->getOrderData($order);
|
| 82 |
+
|
| 83 |
+
try {
|
| 84 |
+
$response = Mage::getModel("cornerdrop_collect/api_action_orderCreate")->execute(
|
| 85 |
+
$order->getQuoteId(),
|
| 86 |
+
$order->getRemoteIp(),
|
| 87 |
+
$orderData
|
| 88 |
+
);
|
| 89 |
+
} catch (Exception $e) {
|
| 90 |
+
Mage::logException($e);
|
| 91 |
+
|
| 92 |
+
return static::RESULT_FAILED;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
if ($response->isSuccessful()) {
|
| 96 |
+
$result = $response->getResult();
|
| 97 |
+
|
| 98 |
+
if ($result["addressCodePublic"]) {
|
| 99 |
+
// Set reference as the lastname and reset all other optional name fields
|
| 100 |
+
$order->getShippingAddress()->addData(array(
|
| 101 |
+
"prefix" => "",
|
| 102 |
+
"firstname" => "Ref.",
|
| 103 |
+
"middlename" => "",
|
| 104 |
+
"lastname" => $result["addressCodePublic"],
|
| 105 |
+
"suffix" => ""
|
| 106 |
+
));
|
| 107 |
+
|
| 108 |
+
if ($save) {
|
| 109 |
+
$order->save();
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
if ($notify && $result["secretPin"]) {
|
| 113 |
+
$store_id = $order->getStore()->getId();
|
| 114 |
+
|
| 115 |
+
try {
|
| 116 |
+
Mage::getModel("core/email_template")->sendTransactional(
|
| 117 |
+
Mage::helper("cornerdrop_collect/config")->getCodeEmailTemplate($store_id),
|
| 118 |
+
"sales",
|
| 119 |
+
$order->getCustomerEmail(),
|
| 120 |
+
$order->getCustomerName(),
|
| 121 |
+
array(
|
| 122 |
+
"order" => $order,
|
| 123 |
+
"cornerdrop_ref" => $result["addressCodePublic"],
|
| 124 |
+
"cornerdrop_pin" => $result["secretPin"]
|
| 125 |
+
),
|
| 126 |
+
$store_id
|
| 127 |
+
);
|
| 128 |
+
} catch (Exception $e) {
|
| 129 |
+
Mage::logException($e);
|
| 130 |
+
|
| 131 |
+
Mage::helper("cornerdrop_collect")->log(sprintf(
|
| 132 |
+
"Failed to notify the customer about the CornerDrop Code (Reference: %s, Code: %s): %s",
|
| 133 |
+
$result["addressCodePublic"],
|
| 134 |
+
$result["secretPin"],
|
| 135 |
+
$e->getMessage()
|
| 136 |
+
));
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
return static::RESULT_SUCCESS;
|
| 142 |
+
} else if ($response->getCode() == CornerDrop_Collect_Helper_Api::STATUS_CODE_TERMINATE) {
|
| 143 |
+
return static::RESULT_TERMINATE;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
return static::RESULT_FAILED;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Send an order dispatch notification to the CornerDrop API.
|
| 151 |
+
*
|
| 152 |
+
* @param Mage_Sales_Model_Order $order
|
| 153 |
+
*
|
| 154 |
+
* @return int
|
| 155 |
+
*/
|
| 156 |
+
public function dispatch($order)
|
| 157 |
+
{
|
| 158 |
+
try {
|
| 159 |
+
$response = Mage::getModel("cornerdrop_collect/api_action_orderDispatch")->execute(
|
| 160 |
+
$order->getQuoteId(),
|
| 161 |
+
$order->getRemoteIp(),
|
| 162 |
+
array(
|
| 163 |
+
"externalOrderReference" => $order->getId()
|
| 164 |
+
)
|
| 165 |
+
);
|
| 166 |
+
} catch (Exception $e) {
|
| 167 |
+
Mage::logException($e);
|
| 168 |
+
|
| 169 |
+
return static::RESULT_FAILED;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
if ($response->isSuccessful()) {
|
| 173 |
+
return static::RESULT_SUCCESS;
|
| 174 |
+
} else if ($response->getCode() == CornerDrop_Collect_Helper_Api::STATUS_CODE_TERMINATE) {
|
| 175 |
+
return static::RESULT_TERMINATE;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
return static::RESULT_FAILED;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Send a cancelled order notification to the CornerDrop API.
|
| 183 |
+
*
|
| 184 |
+
* @param Mage_Sales_Model_Order $order
|
| 185 |
+
*
|
| 186 |
+
* @return int
|
| 187 |
+
*/
|
| 188 |
+
public function cancel($order)
|
| 189 |
+
{
|
| 190 |
+
try {
|
| 191 |
+
$response = Mage::getModel("cornerdrop_collect/api_action_orderCancel")->execute(
|
| 192 |
+
$order->getQuoteId(),
|
| 193 |
+
$order->getRemoteIp(),
|
| 194 |
+
array(
|
| 195 |
+
"externalOrderReference" => $order->getId(),
|
| 196 |
+
"cancellationReason" => "Not available"
|
| 197 |
+
)
|
| 198 |
+
);
|
| 199 |
+
} catch (Exception $e) {
|
| 200 |
+
Mage::logException($e);
|
| 201 |
+
|
| 202 |
+
return static::RESULT_FAILED;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
if ($response->isSuccessful()) {
|
| 206 |
+
return static::RESULT_SUCCESS;
|
| 207 |
+
} else if ($response->getCode() == CornerDrop_Collect_Helper_Api::STATUS_CODE_TERMINATE) {
|
| 208 |
+
return static::RESULT_TERMINATE;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
return static::RESULT_FAILED;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* Get an array of order data used by CornerDrop for the given order.
|
| 216 |
+
*
|
| 217 |
+
* @param Mage_Sales_Model_Order $order
|
| 218 |
+
*
|
| 219 |
+
* @return array
|
| 220 |
+
*/
|
| 221 |
+
protected function getOrderData($order)
|
| 222 |
+
{
|
| 223 |
+
$address = $order->getBillingAddress();
|
| 224 |
+
$shipping_address = $order->getShippingAddress();
|
| 225 |
+
|
| 226 |
+
$cornerdrop_store_id = $shipping_address
|
| 227 |
+
->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN);
|
| 228 |
+
|
| 229 |
+
$cornerdrop_reservation_code = $shipping_address
|
| 230 |
+
->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_RESERVATION_CODE);
|
| 231 |
+
|
| 232 |
+
$data = array(
|
| 233 |
+
"dropPointNodeId" => $cornerdrop_store_id,
|
| 234 |
+
"addressCodeId" => $cornerdrop_reservation_code,
|
| 235 |
+
"externalOrderReference" => $order->getId(),
|
| 236 |
+
"prefix" => $order->getCustomerPrefix(),
|
| 237 |
+
"firstName" => $order->getCustomerFirstname(),
|
| 238 |
+
"middleName" => $order->getCustomerMiddlename(),
|
| 239 |
+
"lastName" => $order->getCustomerLastname(),
|
| 240 |
+
"suffix" => $order->getCustomerSuffix(),
|
| 241 |
+
"company" => $address->getCompany(),
|
| 242 |
+
"address1" => $address->getStreet1(),
|
| 243 |
+
"address2" => $address->getStreet2(),
|
| 244 |
+
"address3" => $address->getStreet3(),
|
| 245 |
+
"city" => $address->getCity(),
|
| 246 |
+
"state" => $address->getRegion(),
|
| 247 |
+
"country" => $address->getCountry(),
|
| 248 |
+
"postCode" => $address->getPostcode(),
|
| 249 |
+
"email" => $order->getCustomerEmail(),
|
| 250 |
+
"phone" => $address->getTelephone(),
|
| 251 |
+
"fax" => $address->getFax(),
|
| 252 |
+
"vatNumber" => $order->getCustomerTaxvat(),
|
| 253 |
+
"orderDate" => $order->getCreatedAtDate()->getIso(),
|
| 254 |
+
"paymentMethod" => $order->getPayment()->getMethod(),
|
| 255 |
+
"subTotalAmount" => $order->getSubtotal(),
|
| 256 |
+
"discountAmount" => $order->getDiscountAmount(),
|
| 257 |
+
"taxAmount" => $order->getTaxAmount(),
|
| 258 |
+
"totalAmount" => $order->getGrandTotal(),
|
| 259 |
+
"shippingMethod" => $order->getShippingMethod(),
|
| 260 |
+
"shippingAmount" => $order->getShippingAmount(),
|
| 261 |
+
"couponCode" => $order->getCouponCode(),
|
| 262 |
+
"items" => array()
|
| 263 |
+
);
|
| 264 |
+
|
| 265 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
| 266 |
+
/** @var Mage_Sales_Model_Order_Item $item */
|
| 267 |
+
$data["items"][] = array(
|
| 268 |
+
"itemName" => $item->getName(),
|
| 269 |
+
"itemDescription" => $item->getDescription(),
|
| 270 |
+
"itemSku" => $item->getSku(),
|
| 271 |
+
"itemPrice" => $item->getPriceInclTax(),
|
| 272 |
+
"itemWeight" => $item->getWeight(),
|
| 273 |
+
"itemQuantity" => $item->getQtyOrdered(),
|
| 274 |
+
"itemRowTotal" => $item->getRowTotalInclTax()
|
| 275 |
+
);
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
return $data;
|
| 279 |
+
}
|
| 280 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action.php
ADDED
|
@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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "";
|
| 6 |
+
const METHOD = "GET";
|
| 7 |
+
|
| 8 |
+
const DEFAULT_REQUEST_MODEL = 'cornerdrop_collect/api_request';
|
| 9 |
+
const DEFAULT_RESPONSE_MODEL = 'cornerdrop_collect/api_response';
|
| 10 |
+
|
| 11 |
+
/** @var CornerDrop_Collect_Model_Api_Request $request */
|
| 12 |
+
protected $request;
|
| 13 |
+
|
| 14 |
+
/** @var CornerDrop_Collect_Model_Api_Response $response */
|
| 15 |
+
protected $response;
|
| 16 |
+
|
| 17 |
+
/** @var Mage_Core_Model_Store|int|null $store */
|
| 18 |
+
protected $store;
|
| 19 |
+
|
| 20 |
+
/** @var CornerDrop_Collect_Helper_Api */
|
| 21 |
+
protected $apiHelper;
|
| 22 |
+
|
| 23 |
+
protected $apiIdentifier;
|
| 24 |
+
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
|
| 29 |
+
$this->apiHelper = Mage::helper('cornerdrop_collect/api');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Set the request model to use for the API action
|
| 34 |
+
*
|
| 35 |
+
* @param CornerDrop_Collect_Model_Api_Request $request
|
| 36 |
+
* @return $this
|
| 37 |
+
*/
|
| 38 |
+
public function setRequest(CornerDrop_Collect_Model_Api_Request $request)
|
| 39 |
+
{
|
| 40 |
+
$this->request = $request;
|
| 41 |
+
|
| 42 |
+
return $this;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Returns the request model used for this API action
|
| 47 |
+
*
|
| 48 |
+
* @return CornerDrop_Collect_Model_Api_Request
|
| 49 |
+
*/
|
| 50 |
+
public function getRequest()
|
| 51 |
+
{
|
| 52 |
+
if (!$this->request) {
|
| 53 |
+
$this->request = Mage::getModel(static::DEFAULT_REQUEST_MODEL);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return $this->request;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Set the response model to use for the API action
|
| 61 |
+
*
|
| 62 |
+
* @param CornerDrop_Collect_Model_Api_Response $response
|
| 63 |
+
* @return $this
|
| 64 |
+
*/
|
| 65 |
+
public function setResponse(CornerDrop_Collect_Model_Api_Response $response)
|
| 66 |
+
{
|
| 67 |
+
$this->response = $response;
|
| 68 |
+
|
| 69 |
+
return $this;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Returns the response model used for this API action
|
| 74 |
+
*
|
| 75 |
+
* @return CornerDrop_Collect_Model_Api_Response
|
| 76 |
+
*/
|
| 77 |
+
public function getResponse()
|
| 78 |
+
{
|
| 79 |
+
if (!$this->response) {
|
| 80 |
+
$this->response = Mage::getModel(static::DEFAULT_RESPONSE_MODEL);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
return $this->response;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Set the store to use for the API action
|
| 88 |
+
*
|
| 89 |
+
* @param Mage_Core_Model_Store|int|null $store
|
| 90 |
+
* @return $this
|
| 91 |
+
*/
|
| 92 |
+
public function setStore($store)
|
| 93 |
+
{
|
| 94 |
+
$this->store = $store;
|
| 95 |
+
|
| 96 |
+
return $this;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Return a store used for the API action
|
| 101 |
+
*
|
| 102 |
+
* @return int|Mage_Core_Model_Store
|
| 103 |
+
*/
|
| 104 |
+
public function getStore()
|
| 105 |
+
{
|
| 106 |
+
if (!$this->store) {
|
| 107 |
+
$this->store = Mage::app()->getStore();
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
return $this->store;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* Execute the API call, and return the response
|
| 115 |
+
* $session_id = quote id
|
| 116 |
+
* $user_host_address = remote ip from quote.
|
| 117 |
+
*
|
| 118 |
+
* @param string $session_id
|
| 119 |
+
* @param string $user_host_address
|
| 120 |
+
* @param array $parameters
|
| 121 |
+
* @return CornerDrop_Collect_Model_Api_Response
|
| 122 |
+
*/
|
| 123 |
+
public function execute($session_id, $user_host_address, $parameters = array())
|
| 124 |
+
{
|
| 125 |
+
$request = $this->getRequest();
|
| 126 |
+
$store = $this->getStore();
|
| 127 |
+
$api_key = Mage::helper('cornerdrop_collect/config')->getApiKey($store);
|
| 128 |
+
|
| 129 |
+
$request
|
| 130 |
+
->setResponseModel($this->getResponse())
|
| 131 |
+
->setEndpoint($this->apiHelper->buildEndpoint(static::ENDPOINT, $store))
|
| 132 |
+
->setMethod(static::METHOD)
|
| 133 |
+
->setHeader('ApiKey', $api_key)
|
| 134 |
+
->setHeader('Identifier', $this->getApiIdentifier())
|
| 135 |
+
->setHeader('SessionId', $session_id)
|
| 136 |
+
->setHeader('UserHostAddress', $user_host_address)
|
| 137 |
+
->setData($parameters);
|
| 138 |
+
|
| 139 |
+
return $request->send();
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
public function getApiIdentifier()
|
| 143 |
+
{
|
| 144 |
+
if (!$this->apiIdentifier) {
|
| 145 |
+
$this->apiIdentifier = $this->apiHelper->getApiIdentifier();
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
return $this->apiIdentifier;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
public function setApiIdentifier($api_identifier)
|
| 152 |
+
{
|
| 153 |
+
$this->apiIdentifier = $api_identifier;
|
| 154 |
+
|
| 155 |
+
return $this;
|
| 156 |
+
}
|
| 157 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/OrderCancel.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_OrderCancel extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/order/cancel";
|
| 6 |
+
const METHOD = "POST";
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/OrderCreate.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_OrderCreate extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/order/create";
|
| 6 |
+
const METHOD = "POST";
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/OrderDispatch.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_OrderDispatch extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/order/dispatch";
|
| 6 |
+
const METHOD = "POST";
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/OrderReserve.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_OrderReserve extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/order/reserve";
|
| 6 |
+
const METHOD = "POST";
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/Search.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_Search extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/search";
|
| 6 |
+
const METHOD = "GET";
|
| 7 |
+
|
| 8 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Action/Status.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Action_Status extends CornerDrop_Collect_Model_Api_Action
|
| 4 |
+
{
|
| 5 |
+
const ENDPOINT = "/status";
|
| 6 |
+
const METHOD = "GET";
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Request.php
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Request extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
protected $endpoint;
|
| 6 |
+
|
| 7 |
+
protected $method;
|
| 8 |
+
|
| 9 |
+
protected $headers;
|
| 10 |
+
|
| 11 |
+
protected $responseModel;
|
| 12 |
+
|
| 13 |
+
protected $client;
|
| 14 |
+
|
| 15 |
+
/** @var CornerDrop_Collect_Helper_Data $_helper */
|
| 16 |
+
protected $_helper;
|
| 17 |
+
|
| 18 |
+
public function _construct()
|
| 19 |
+
{
|
| 20 |
+
parent::_construct();
|
| 21 |
+
|
| 22 |
+
$this->method = Zend_Http_Client::GET;
|
| 23 |
+
$this->headers = array();
|
| 24 |
+
$this->responseModel = Mage::getModel('cornerdrop_collect/api_response');
|
| 25 |
+
$this->_helper = Mage::helper('cornerdrop_collect');
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* @param string $url
|
| 30 |
+
* @return $this
|
| 31 |
+
*/
|
| 32 |
+
public function setEndpoint($url)
|
| 33 |
+
{
|
| 34 |
+
$this->endpoint = $url;
|
| 35 |
+
|
| 36 |
+
return $this;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* @return string
|
| 41 |
+
*/
|
| 42 |
+
public function getEndpoint()
|
| 43 |
+
{
|
| 44 |
+
return $this->endpoint;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* @param string $method
|
| 49 |
+
* @return $this
|
| 50 |
+
*/
|
| 51 |
+
public function setMethod($method)
|
| 52 |
+
{
|
| 53 |
+
$this->method = $method;
|
| 54 |
+
|
| 55 |
+
return $this;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* @return string
|
| 60 |
+
*/
|
| 61 |
+
public function getMethod()
|
| 62 |
+
{
|
| 63 |
+
return $this->method;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* @param string $name
|
| 68 |
+
* @param string $value
|
| 69 |
+
* @return $this
|
| 70 |
+
*/
|
| 71 |
+
public function setHeader($name, $value)
|
| 72 |
+
{
|
| 73 |
+
$this->headers[$name] = $value;
|
| 74 |
+
|
| 75 |
+
return $this;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* @return array
|
| 80 |
+
*/
|
| 81 |
+
public function getHeaders()
|
| 82 |
+
{
|
| 83 |
+
return $this->headers;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* @param CornerDrop_Collect_Model_Api_Response $response
|
| 89 |
+
* @return $this
|
| 90 |
+
*/
|
| 91 |
+
public function setResponseModel(CornerDrop_Collect_Model_Api_Response $response)
|
| 92 |
+
{
|
| 93 |
+
$this->responseModel = $response;
|
| 94 |
+
|
| 95 |
+
return $this;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* @return CornerDrop_Collect_Model_Api_Response
|
| 100 |
+
*/
|
| 101 |
+
public function getResponseModel()
|
| 102 |
+
{
|
| 103 |
+
return $this->responseModel;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
public function setClient($client)
|
| 107 |
+
{
|
| 108 |
+
$this->client = $client;
|
| 109 |
+
|
| 110 |
+
return $this;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
public function getClient()
|
| 114 |
+
{
|
| 115 |
+
if (!$this->client) {
|
| 116 |
+
$this->client = new Zend_Http_Client();
|
| 117 |
+
}
|
| 118 |
+
return $this->client;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* @return CornerDrop_Collect_Model_Api_Response
|
| 123 |
+
* @throws Mage_Core_Exception
|
| 124 |
+
* @throws Zend_Http_Client_Exception
|
| 125 |
+
*/
|
| 126 |
+
public function send()
|
| 127 |
+
{
|
| 128 |
+
if (!$this->getEndpoint()) {
|
| 129 |
+
// Can't make a request without a URL
|
| 130 |
+
Mage::throwException("Unable to send a CornerDrop API request: No URL specified.");
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
$client = $this->getClient();
|
| 134 |
+
|
| 135 |
+
$raw_request = $client
|
| 136 |
+
->setUri($this->getEndpoint())
|
| 137 |
+
->setMethod($this->getMethod())
|
| 138 |
+
->setHeaders($this->getHeaders());
|
| 139 |
+
|
| 140 |
+
if ($this->getMethod() == Zend_Http_Client::GET) {
|
| 141 |
+
$raw_request->setParameterGet($this->getData());
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
if ($this->getMethod() == Zend_Http_Client::POST) {
|
| 145 |
+
$raw_request->setHeaders("Content-Type", "application/json");
|
| 146 |
+
$raw_request->setRawData(json_encode($this->getData()));
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
$this->_helper->log(sprintf("API request:\n%s", $this->__toString()));
|
| 150 |
+
|
| 151 |
+
try {
|
| 152 |
+
$raw_response = $raw_request->request();
|
| 153 |
+
} catch (Zend_Http_Client_Exception $e) {
|
| 154 |
+
$this->_helper->log(sprintf('HTTP error: %s', $e->getMessage()));
|
| 155 |
+
Mage::logException($e);
|
| 156 |
+
return Mage::getModel('cornerdrop_collect/api_response_empty');
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
$response = $this->getResponseModel();
|
| 160 |
+
$response->setRawResponse($raw_response);
|
| 161 |
+
$this->_helper->log(sprintf(
|
| 162 |
+
"API response:\n%s",
|
| 163 |
+
$response->__toString()
|
| 164 |
+
), Zend_Log::DEBUG);
|
| 165 |
+
|
| 166 |
+
return $response;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Return the string representation of the API request.
|
| 171 |
+
*
|
| 172 |
+
* @return string
|
| 173 |
+
*/
|
| 174 |
+
public function __toString()
|
| 175 |
+
{
|
| 176 |
+
$endpoint = $this->getEndpoint();
|
| 177 |
+
if ($this->getMethod() == Zend_Http_Client::GET) {
|
| 178 |
+
if ($params = $this->getData()) {
|
| 179 |
+
array_walk($params, function (&$value, $key) {
|
| 180 |
+
$value = sprintf("%s=%s", $key, $value);
|
| 181 |
+
});
|
| 182 |
+
$endpoint = sprintf("%s?%s", $endpoint, implode("&", $params));
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
$headers = $this->getHeaders();
|
| 187 |
+
if (count($headers) > 0) {
|
| 188 |
+
array_walk($headers, function (&$value, $key) {
|
| 189 |
+
$value = ($value !== null && $value !== false) ? sprintf("%s: %s", $key, $value) : null;
|
| 190 |
+
});
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
$body = "";
|
| 194 |
+
if ($this->getMethod() == Zend_Http_Client::POST) {
|
| 195 |
+
$body = json_encode($this->getData());
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
return sprintf("%s %s\n%s%s\n",
|
| 199 |
+
$this->getMethod(),
|
| 200 |
+
$endpoint,
|
| 201 |
+
implode("\n", array_filter($headers)),
|
| 202 |
+
($body) ? sprintf("\n%s", $body) : ""
|
| 203 |
+
);
|
| 204 |
+
}
|
| 205 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Response.php
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Class CornerDrop_Collect_Model_Api_Response
|
| 5 |
+
*
|
| 6 |
+
* @method int getCode()
|
| 7 |
+
*/
|
| 8 |
+
class CornerDrop_Collect_Model_Api_Response extends Varien_Object
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* @var Zend_Http_Response
|
| 12 |
+
*/
|
| 13 |
+
protected $rawResponse;
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* @var bool
|
| 17 |
+
*/
|
| 18 |
+
protected $successful;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* @var array
|
| 22 |
+
*/
|
| 23 |
+
protected $headers;
|
| 24 |
+
|
| 25 |
+
/** @var CornerDrop_Collect_Helper_Data $_helper */
|
| 26 |
+
protected $_helper;
|
| 27 |
+
|
| 28 |
+
public function _construct()
|
| 29 |
+
{
|
| 30 |
+
parent::_construct();
|
| 31 |
+
$this->_helper = Mage::helper('cornerdrop_collect');
|
| 32 |
+
$this->successful = false;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Set response object
|
| 37 |
+
*
|
| 38 |
+
* @param Zend_Http_Response $response
|
| 39 |
+
* @return $this
|
| 40 |
+
*/
|
| 41 |
+
public function setRawResponse(Zend_Http_Response $response)
|
| 42 |
+
{
|
| 43 |
+
$this->rawResponse = $response;
|
| 44 |
+
|
| 45 |
+
$this->parseRawResponse($response);
|
| 46 |
+
|
| 47 |
+
return $this;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function getRawResponse()
|
| 51 |
+
{
|
| 52 |
+
return $this->rawResponse;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Bool check if the response was successful
|
| 57 |
+
*
|
| 58 |
+
* @return bool
|
| 59 |
+
*/
|
| 60 |
+
public function isSuccessful()
|
| 61 |
+
{
|
| 62 |
+
return $this->successful;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Set Response Headers
|
| 67 |
+
*
|
| 68 |
+
* @param array $headers
|
| 69 |
+
* @return $this
|
| 70 |
+
*/
|
| 71 |
+
public function setHeaders($headers)
|
| 72 |
+
{
|
| 73 |
+
$this->headers = $headers;
|
| 74 |
+
|
| 75 |
+
return $this;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Return the response headers as an array.
|
| 80 |
+
*
|
| 81 |
+
* @return array
|
| 82 |
+
*/
|
| 83 |
+
public function getHeaders()
|
| 84 |
+
{
|
| 85 |
+
return $this->headers;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Process the response and handle errors
|
| 90 |
+
*
|
| 91 |
+
* @param Zend_Http_Response $response
|
| 92 |
+
* @return $this
|
| 93 |
+
*/
|
| 94 |
+
protected function parseRawResponse(Zend_Http_Response $response)
|
| 95 |
+
{
|
| 96 |
+
$this->successful = false;
|
| 97 |
+
|
| 98 |
+
$this->setHeaders($response->getHeaders());
|
| 99 |
+
|
| 100 |
+
$json = json_decode($response->getBody(), true);
|
| 101 |
+
if (is_array($json)) {
|
| 102 |
+
$this->setData($json);
|
| 103 |
+
} else {
|
| 104 |
+
$this->setData('message', 'Response body is empty');
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
if ($response->isSuccessful()) {
|
| 108 |
+
if ($this->getCode() == CornerDrop_Collect_Helper_Api::STATUS_CODE_SUCCESS) {
|
| 109 |
+
$this->successful = true;
|
| 110 |
+
}
|
| 111 |
+
} else {
|
| 112 |
+
$this->_helper->log(
|
| 113 |
+
sprintf(
|
| 114 |
+
"Unsuccessful HTTP response: %s %s",
|
| 115 |
+
$response->getStatus(),
|
| 116 |
+
$response->responseCodeAsText($response->getStatus())
|
| 117 |
+
),
|
| 118 |
+
Zend_Log::ERR
|
| 119 |
+
);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
return $this;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Return the raw response as a string.
|
| 127 |
+
*
|
| 128 |
+
* @return string
|
| 129 |
+
*/
|
| 130 |
+
public function __toString()
|
| 131 |
+
{
|
| 132 |
+
return sprintf("%s\n%s",
|
| 133 |
+
$this->getRawResponse()->getHeadersAsString(true, "\n"),
|
| 134 |
+
$this->getRawResponse()->getBody()
|
| 135 |
+
);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Api/Response/Empty.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Api_Response_Empty extends CornerDrop_Collect_Model_Api_Response {
|
| 4 |
+
|
| 5 |
+
public function _construct() {
|
| 6 |
+
$this->successful = false;
|
| 7 |
+
$this->addData(array(
|
| 8 |
+
'message' => "No HTTP response received. If you are using PHP version 5.4, please make sure to enable the php_openssl.dll module in your php.ini file."
|
| 9 |
+
));
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Override the parse response method, this API response is static.
|
| 14 |
+
*
|
| 15 |
+
* @param Zend_Http_Response $response
|
| 16 |
+
*
|
| 17 |
+
* @return $this
|
| 18 |
+
*/
|
| 19 |
+
protected function parseRawResponse(Zend_Http_Response $response) {
|
| 20 |
+
// Do nothing
|
| 21 |
+
return $this;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Cron.php
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Cron extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
const STATUS_NOT_NOTIFIED = 0;
|
| 6 |
+
const STATUS_NOTIFICATION_SUCCESSFUL = 1;
|
| 7 |
+
const STATUS_NOTIFICATION_TERMINATED = 99;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Send all pending order notifications to the CornerDrop API.
|
| 11 |
+
*/
|
| 12 |
+
public function sendNotifications()
|
| 13 |
+
{
|
| 14 |
+
$this->sendNewOrderNotifications();
|
| 15 |
+
$this->sendShippedOrderNotifications();
|
| 16 |
+
$this->sendCancelledOrderNotifications();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Send notifications to CornerDrop API for all new CornerDrop orders.
|
| 21 |
+
*/
|
| 22 |
+
public function sendNewOrderNotifications()
|
| 23 |
+
{
|
| 24 |
+
$collection = $this->getOrderHelper()->getCornerDropOrderCollection()
|
| 25 |
+
->addFieldToFilter(
|
| 26 |
+
CornerDrop_Collect_Helper_Data::ORDERED_NOTIFICATION_COLUMN,
|
| 27 |
+
array("eq" => static::STATUS_NOT_NOTIFIED)
|
| 28 |
+
);
|
| 29 |
+
|
| 30 |
+
foreach ($collection as $order) {
|
| 31 |
+
$status = null;
|
| 32 |
+
switch ($this->getOrderHelper()->create($order, false)) {
|
| 33 |
+
case CornerDrop_Collect_Helper_Order::RESULT_SUCCESS:
|
| 34 |
+
$status = static::STATUS_NOTIFICATION_SUCCESSFUL;
|
| 35 |
+
break;
|
| 36 |
+
case CornerDrop_Collect_Helper_Order::RESULT_TERMINATE:
|
| 37 |
+
$status = static::STATUS_NOTIFICATION_TERMINATED;
|
| 38 |
+
break;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if ($status !== null) {
|
| 42 |
+
$order
|
| 43 |
+
->setData(CornerDrop_Collect_Helper_Data::ORDERED_NOTIFICATION_COLUMN, $status)
|
| 44 |
+
->save();
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Send notifications to CornerDrop API for all dispatched CornerDrop orders.
|
| 51 |
+
*/
|
| 52 |
+
public function sendShippedOrderNotifications()
|
| 53 |
+
{
|
| 54 |
+
$collection = $this->getOrderHelper()->getCornerDropOrderCollection();
|
| 55 |
+
$collection
|
| 56 |
+
->addFieldToFilter(
|
| 57 |
+
CornerDrop_Collect_Helper_Data::SHIPPED_NOTIFICATION_COLUMN,
|
| 58 |
+
array("eq" => static::STATUS_NOT_NOTIFIED)
|
| 59 |
+
)
|
| 60 |
+
->join(
|
| 61 |
+
array("shipment" => "sales/shipment"),
|
| 62 |
+
"shipment.order_id = main_table.entity_id",
|
| 63 |
+
null
|
| 64 |
+
)
|
| 65 |
+
->getSelect()->group("main_table.entity_id");
|
| 66 |
+
|
| 67 |
+
foreach ($collection as $order) {
|
| 68 |
+
$status = null;
|
| 69 |
+
switch ($this->getOrderHelper()->dispatch($order)) {
|
| 70 |
+
case CornerDrop_Collect_Helper_Order::RESULT_SUCCESS:
|
| 71 |
+
$status = static::STATUS_NOTIFICATION_SUCCESSFUL;
|
| 72 |
+
break;
|
| 73 |
+
case CornerDrop_Collect_Helper_Order::RESULT_TERMINATE:
|
| 74 |
+
$status = static::STATUS_NOTIFICATION_TERMINATED;
|
| 75 |
+
break;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if ($status !== null) {
|
| 79 |
+
$order
|
| 80 |
+
->setData(CornerDrop_Collect_Helper_Data::SHIPPED_NOTIFICATION_COLUMN, $status)
|
| 81 |
+
->save();
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Send notifications to CornerDrop API for all cancelled CornerDrop orders.
|
| 88 |
+
*/
|
| 89 |
+
public function sendCancelledOrderNotifications()
|
| 90 |
+
{
|
| 91 |
+
$collection = $this->getOrderHelper()->getCornerDropOrderCollection()
|
| 92 |
+
->addFieldToFilter("state", Mage_Sales_Model_Order::STATE_CANCELED)
|
| 93 |
+
->addFieldToFilter(
|
| 94 |
+
CornerDrop_Collect_Helper_Data::CANCELLED_NOTIFICATION_COLUMN,
|
| 95 |
+
array("eq" => static::STATUS_NOT_NOTIFIED)
|
| 96 |
+
);
|
| 97 |
+
|
| 98 |
+
foreach ($collection as $order) {
|
| 99 |
+
$status = null;
|
| 100 |
+
switch ($this->getOrderHelper()->cancel($order)) {
|
| 101 |
+
case CornerDrop_Collect_Helper_Order::RESULT_SUCCESS:
|
| 102 |
+
$status = static::STATUS_NOTIFICATION_SUCCESSFUL;
|
| 103 |
+
break;
|
| 104 |
+
case CornerDrop_Collect_Helper_Order::RESULT_TERMINATE:
|
| 105 |
+
$status = static::STATUS_NOTIFICATION_TERMINATED;
|
| 106 |
+
break;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
if ($status !== null) {
|
| 110 |
+
$order
|
| 111 |
+
->setData(CornerDrop_Collect_Helper_Data::CANCELLED_NOTIFICATION_COLUMN, $status)
|
| 112 |
+
->save();
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Get the order helper.
|
| 119 |
+
*
|
| 120 |
+
* @return CornerDrop_Collect_Helper_Order
|
| 121 |
+
*/
|
| 122 |
+
protected function getOrderHelper()
|
| 123 |
+
{
|
| 124 |
+
return Mage::helper("cornerdrop_collect/order");
|
| 125 |
+
}
|
| 126 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Observer.php
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Observer extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Perform the account status check through the API and, if
|
| 8 |
+
* successful, save the result to system configuration.
|
| 9 |
+
*
|
| 10 |
+
* @event admin_system_config_changed_section_cornerdrop_collect
|
| 11 |
+
*
|
| 12 |
+
* @param Varien_Event_Observer|null $observer
|
| 13 |
+
*
|
| 14 |
+
* @return $this
|
| 15 |
+
*/
|
| 16 |
+
public function checkAccountStatus(Varien_Event_Observer $observer = null)
|
| 17 |
+
{
|
| 18 |
+
try {
|
| 19 |
+
$response = Mage::getModel("cornerdrop_collect/api_action_status")->execute(null, null);
|
| 20 |
+
} catch (Exception $e) {
|
| 21 |
+
Mage::logException($e);
|
| 22 |
+
|
| 23 |
+
if ($observer instanceof Varien_Event_Observer
|
| 24 |
+
&& preg_match("/admin/", $observer->getEvent()->getName())
|
| 25 |
+
) {
|
| 26 |
+
Mage::getSingleton("adminhtml/session")
|
| 27 |
+
->addWarning($this->getHelper()->__("Account status check failed!"));
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
return $this;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
if ($response->isSuccessful()) {
|
| 34 |
+
$result = $response->getData("result");
|
| 35 |
+
if (isset($result["creditBalance"]) && is_numeric($result["creditBalance"])) {
|
| 36 |
+
$this->getConfig()
|
| 37 |
+
->setAccountBalance($result["creditBalance"])
|
| 38 |
+
->setStatusLastChecked("now");
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return $this;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Set the CornerDrop Collect flag on the shipping address if
|
| 47 |
+
* CornerDrop was selected as a destination on the billing step
|
| 48 |
+
* of the checkout.
|
| 49 |
+
*
|
| 50 |
+
* @event controller_action_predispatch_checkout_onepage_saveBilling
|
| 51 |
+
*
|
| 52 |
+
* @param Varien_Event_Observer $observer
|
| 53 |
+
*/
|
| 54 |
+
public function setCornerDropCollectFlag(Varien_Event_Observer $observer)
|
| 55 |
+
{
|
| 56 |
+
/** @var Mage_Checkout_OnepageController $controller */
|
| 57 |
+
$controller = $observer->getControllerAction();
|
| 58 |
+
|
| 59 |
+
if ($controller->getRequest()->isPost()) {
|
| 60 |
+
$data = $controller->getRequest()->getPost("billing", array());
|
| 61 |
+
$flag = array_key_exists("ship_to_cornerdrop", $data) ? $data["ship_to_cornerdrop"] : null;
|
| 62 |
+
|
| 63 |
+
if (!is_null($flag)) {
|
| 64 |
+
$address = $controller->getOnepage()->getQuote()->getShippingAddress();
|
| 65 |
+
|
| 66 |
+
$address
|
| 67 |
+
->setData(CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT, $flag ? 1 : 0)
|
| 68 |
+
->save();
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Process incoming JSON refreshes on the admin order creation page, setting the
|
| 75 |
+
* cornerdrop flag, and reserving the place, if we detect a store id on the address
|
| 76 |
+
*
|
| 77 |
+
* @event adminhtml_sales_order_create_process_data
|
| 78 |
+
*
|
| 79 |
+
* @param Varien_Event_Observer $observer
|
| 80 |
+
* @throws Exception
|
| 81 |
+
*/
|
| 82 |
+
public function setAdminCornerDropCollectFlagAndReserve(Varien_Event_Observer $observer)
|
| 83 |
+
{
|
| 84 |
+
/** @var Mage_Adminhtml_Model_Sales_Order_Create $order_create_model */
|
| 85 |
+
$order_create_model = $observer->getData('order_create_model');
|
| 86 |
+
|
| 87 |
+
$quote = $order_create_model->getQuote();
|
| 88 |
+
$shipping_address = $quote->getShippingAddress();
|
| 89 |
+
$cornerdrop_store_id = $shipping_address->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN);
|
| 90 |
+
|
| 91 |
+
$is_cornerdrop_collect = $cornerdrop_store_id && is_numeric($cornerdrop_store_id);
|
| 92 |
+
|
| 93 |
+
$shipping_address
|
| 94 |
+
->setData(CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT, ($is_cornerdrop_collect) ? 1 : 0)
|
| 95 |
+
->save();
|
| 96 |
+
|
| 97 |
+
$order_create_model->setRecollect(true)->recollectCart();
|
| 98 |
+
|
| 99 |
+
if ($is_cornerdrop_collect) {
|
| 100 |
+
$reservation_result = Mage::helper('cornerdrop_collect/order')->reserve($quote, $cornerdrop_store_id);
|
| 101 |
+
|
| 102 |
+
if ($reservation_result !== CornerDrop_Collect_Helper_Order::RESULT_SUCCESS) {
|
| 103 |
+
Mage::throwException(Mage::helper('cornerdrop_collect')->__(
|
| 104 |
+
"Unable to reserve collection at this location. Please try select another location, or try again later."
|
| 105 |
+
));
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* If the CornerDrop flag is set then make a reservation for the selected
|
| 112 |
+
* drop point.
|
| 113 |
+
*
|
| 114 |
+
* @event controller_action_predispatch_checkout_onepage_saveShipping
|
| 115 |
+
*
|
| 116 |
+
* @param Varien_Event_Observer $observer
|
| 117 |
+
*/
|
| 118 |
+
public function makeCornerDropCollectReservation(Varien_Event_Observer $observer) {
|
| 119 |
+
/** @var Mage_Checkout_OnepageController $controller */
|
| 120 |
+
$controller = $observer->getControllerAction();
|
| 121 |
+
|
| 122 |
+
if ($controller->getRequest()->isPost()) {
|
| 123 |
+
$data = $controller->getRequest()->getPost("shipping", array());
|
| 124 |
+
|
| 125 |
+
$is_cornerdrop = array_key_exists("is_cornerdrop_collect", $data) ? $data["is_cornerdrop_collect"] == '1' : false;
|
| 126 |
+
$store_id = array_key_exists("cornerdrop_store_id", $data) ? intval($data["cornerdrop_store_id"]) : null;
|
| 127 |
+
|
| 128 |
+
if ($is_cornerdrop) {
|
| 129 |
+
$quote = $controller->getOnepage()->getQuote();
|
| 130 |
+
|
| 131 |
+
$reservation_result = Mage::helper('cornerdrop_collect/order')->reserve($quote, $store_id);
|
| 132 |
+
|
| 133 |
+
if ($reservation_result !== CornerDrop_Collect_Helper_Order::RESULT_SUCCESS) {
|
| 134 |
+
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
|
| 135 |
+
$controller->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
|
| 136 |
+
"error" => 1,
|
| 137 |
+
"message" => Mage::helper('cornerdrop_collect')->__(
|
| 138 |
+
"Unable to reserve collection at this location. Please try select another location, or try again later."
|
| 139 |
+
)
|
| 140 |
+
)));
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Convert total to line order for Paypal.
|
| 148 |
+
*
|
| 149 |
+
* @event paypal_prepare_line_items
|
| 150 |
+
*
|
| 151 |
+
* @param Varien_Event_Observer $observer
|
| 152 |
+
*
|
| 153 |
+
* @return void
|
| 154 |
+
*/
|
| 155 |
+
public function addTotalToPaypal(Varien_Event_Observer $observer)
|
| 156 |
+
{
|
| 157 |
+
/** @var Mage_Paypal_Model_Cart $paypal_cart */
|
| 158 |
+
$paypal_cart = $observer->getPaypalCart();
|
| 159 |
+
|
| 160 |
+
$sales_entity = $paypal_cart->getSalesEntity();
|
| 161 |
+
if ($sales_entity instanceof Mage_Sales_Model_Quote) {
|
| 162 |
+
if ($sales_entity->isVirtual()) {
|
| 163 |
+
return;
|
| 164 |
+
}
|
| 165 |
+
} else {
|
| 166 |
+
if ($sales_entity->getIsVirtual() || !$sales_entity->getShippingAddress()) {
|
| 167 |
+
return;
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
if ($this->getHelper()->isCornerDropAddress($sales_entity->getShippingAddress())) {
|
| 172 |
+
$paypal_cart->addItem(
|
| 173 |
+
$this->getHelper()->getCornerDropFeeLabel(),
|
| 174 |
+
1,
|
| 175 |
+
$sales_entity->getCornerdropFeeAmount(),
|
| 176 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_CODE
|
| 177 |
+
);
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Append the CornerDrop address template to the customer
|
| 183 |
+
* address template if the address is a CornerDrop address.
|
| 184 |
+
*
|
| 185 |
+
* @event customer_address_format
|
| 186 |
+
* @param Varien_Event_Observer $observer
|
| 187 |
+
*/
|
| 188 |
+
public function addCustomerAddressTemplate(Varien_Event_Observer $observer)
|
| 189 |
+
{
|
| 190 |
+
if ($this->getHelper()->isCornerDropAddress($observer->getAddress())) {
|
| 191 |
+
$formatType = $observer->getType();
|
| 192 |
+
|
| 193 |
+
$formatType->setDefaultFormat(sprintf("%s%s",
|
| 194 |
+
$formatType->getDefaultFormat(),
|
| 195 |
+
$this->getConfig()->getAddressTemplate($formatType->getCode())
|
| 196 |
+
));
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
* Get the config helper.
|
| 202 |
+
*
|
| 203 |
+
* @return CornerDrop_Collect_Helper_Config
|
| 204 |
+
*/
|
| 205 |
+
protected function getConfig()
|
| 206 |
+
{
|
| 207 |
+
return Mage::helper("cornerdrop_collect/config");
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
/**
|
| 211 |
+
* Get the module helper.
|
| 212 |
+
*
|
| 213 |
+
* @return CornerDrop_Collect_Helper_Data
|
| 214 |
+
*/
|
| 215 |
+
protected function getHelper()
|
| 216 |
+
{
|
| 217 |
+
return Mage::helper("cornerdrop_collect");
|
| 218 |
+
}
|
| 219 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Resource/Setup.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
|
| 4 |
+
|
| 5 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Sales/Order/Creditmemo/Total/CornerDrop/Fee.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Sales_Order_Creditmemo_Total_CornerDrop_Fee extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Set the CornerDrop Fee total.
|
| 8 |
+
*
|
| 9 |
+
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
| 10 |
+
*
|
| 11 |
+
* @return $this
|
| 12 |
+
*/
|
| 13 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
| 14 |
+
{
|
| 15 |
+
$order = $creditmemo->getOrder();
|
| 16 |
+
|
| 17 |
+
$cornerdrop_fee = $order->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT);
|
| 18 |
+
$base_cornerdrop_fee = $order->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT);
|
| 19 |
+
$cornerdrop_tax = $order->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX);
|
| 20 |
+
$base_cornerdrop_tax = $order->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX);
|
| 21 |
+
|
| 22 |
+
if ($cornerdrop_fee) {
|
| 23 |
+
$creditmemo->addData(array(
|
| 24 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $cornerdrop_fee,
|
| 25 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $base_cornerdrop_fee,
|
| 26 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $cornerdrop_tax,
|
| 27 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $base_cornerdrop_tax
|
| 28 |
+
));
|
| 29 |
+
|
| 30 |
+
$creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $cornerdrop_tax);
|
| 31 |
+
$creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $base_cornerdrop_tax);
|
| 32 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $cornerdrop_fee + $cornerdrop_tax);
|
| 33 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $base_cornerdrop_fee + $base_cornerdrop_tax);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
return $this;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
app/code/community/CornerDrop/Collect/Model/Sales/Order/Invoice/Total/CornerDrop/Fee.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Sales_Order_Invoice_Total_CornerDrop_Fee extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Set the CornerDrop Fee total.
|
| 7 |
+
*
|
| 8 |
+
* @param Mage_Sales_Model_Order_Invoice $invoice
|
| 9 |
+
* @return $this
|
| 10 |
+
*/
|
| 11 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
|
| 12 |
+
$order = $invoice->getOrder();
|
| 13 |
+
|
| 14 |
+
$cornerdrop_fee = $order->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT);
|
| 15 |
+
$base_cornerdrop_fee = $order->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT);
|
| 16 |
+
$cornerdrop_tax = $order->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX);
|
| 17 |
+
$base_cornerdrop_tax = $order->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX);
|
| 18 |
+
|
| 19 |
+
if ($cornerdrop_fee) {
|
| 20 |
+
// Only add CornerDrop Collect fee to the first invoice
|
| 21 |
+
foreach ($invoice->getOrder()->getInvoiceCollection() as $previous_invoice) {
|
| 22 |
+
if (
|
| 23 |
+
$previous_invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT)
|
| 24 |
+
&& !$previous_invoice->isCanceled()
|
| 25 |
+
) {
|
| 26 |
+
return $this;
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
$invoice->addData(array(
|
| 31 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $cornerdrop_fee,
|
| 32 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $base_cornerdrop_fee,
|
| 33 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $cornerdrop_tax,
|
| 34 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $base_cornerdrop_tax
|
| 35 |
+
));
|
| 36 |
+
|
| 37 |
+
$invoice->setTaxAmount($invoice->getTaxAmount() + $cornerdrop_tax);
|
| 38 |
+
$invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $base_cornerdrop_tax);
|
| 39 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $cornerdrop_fee + $cornerdrop_tax);
|
| 40 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $base_cornerdrop_fee + $base_cornerdrop_tax);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
return $this;
|
| 44 |
+
}
|
| 45 |
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|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Model_Sales_Quote_Address_Total_CornerDrop_Fee extends Mage_Sales_Model_Quote_Address_Total_Abstract {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Total Code name
|
| 7 |
+
*
|
| 8 |
+
* @var string
|
| 9 |
+
*/
|
| 10 |
+
protected $_code = CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_CODE;
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Set the CornerDrop Fee total.
|
| 14 |
+
*
|
| 15 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
| 16 |
+
* @return $this
|
| 17 |
+
*/
|
| 18 |
+
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
| 19 |
+
$config_helper = Mage::helper('cornerdrop_collect/config');
|
| 20 |
+
|
| 21 |
+
if (!$this->isCornerDropAvailable($address)) {
|
| 22 |
+
return $this;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
$store = $address->getQuote()->getStore();
|
| 26 |
+
|
| 27 |
+
$base_additional_fee = $config_helper->getAdditionalFee($store);
|
| 28 |
+
if(!$base_additional_fee) {
|
| 29 |
+
return $this;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
parent::collect($address);
|
| 33 |
+
|
| 34 |
+
$this->_setAmount(0)
|
| 35 |
+
->_setBaseAmount(0);
|
| 36 |
+
|
| 37 |
+
$items = $this->_getAddressItems($address);
|
| 38 |
+
if (!count($items)) {
|
| 39 |
+
return $this;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
if(!$config_helper->isIncludeTax($store)) {
|
| 43 |
+
$custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
|
| 44 |
+
$taxCalculationModel = Mage::getSingleton('tax/calculation');
|
| 45 |
+
$request = $taxCalculationModel->getRateRequest(
|
| 46 |
+
$address,
|
| 47 |
+
$address->getQuote()->getBillingAddress(),
|
| 48 |
+
$custTaxClassId,
|
| 49 |
+
$store
|
| 50 |
+
);
|
| 51 |
+
|
| 52 |
+
$request->setProductClassId($config_helper->getTaxClass($store));
|
| 53 |
+
|
| 54 |
+
if ($rate = $taxCalculationModel->getRate($request)) {
|
| 55 |
+
$base_cornerdrop_tax = $store->roundPrice($base_additional_fee * $rate/100);
|
| 56 |
+
$cornerdrop_tax = $store->convertPrice($base_cornerdrop_tax);
|
| 57 |
+
$address->setTaxAmount($address->getTaxAmount() + $cornerdrop_tax);
|
| 58 |
+
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $base_cornerdrop_tax);
|
| 59 |
+
$address->setData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX, $cornerdrop_tax);
|
| 60 |
+
$address->setData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX, $base_cornerdrop_tax);
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
$additional_fee = $store->convertPrice($base_additional_fee, false);
|
| 64 |
+
$address->setTotalAmount($this->_code, $additional_fee);
|
| 65 |
+
$address->setBaseTotalAmount($this->_code, $base_additional_fee);
|
| 66 |
+
|
| 67 |
+
return $this;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
| 72 |
+
*
|
| 73 |
+
* @return CornerDrop_Collect_Model_Sales_Quote_Total_Additional_Fee
|
| 74 |
+
*/
|
| 75 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address) {
|
| 76 |
+
if ($this->isCornerDropAvailable($address)) {
|
| 77 |
+
$address->addTotal(array(
|
| 78 |
+
'code' => $this->getCode(),
|
| 79 |
+
'title' => $this->getLabel(),
|
| 80 |
+
'value' => $address->getCornerdropFeeAmount()
|
| 81 |
+
));
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
return $this;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Get CornerDrop Collect additional fee label
|
| 89 |
+
*
|
| 90 |
+
* @return string
|
| 91 |
+
*/
|
| 92 |
+
public function getLabel()
|
| 93 |
+
{
|
| 94 |
+
return Mage::helper('cornerdrop_collect')->getCornerDropFeeLabel();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Check if the given address is a CornerDrop Collect address.
|
| 99 |
+
*
|
| 100 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
| 101 |
+
*
|
| 102 |
+
* @return bool
|
| 103 |
+
*/
|
| 104 |
+
protected function isCornerDropAvailable($address)
|
| 105 |
+
{
|
| 106 |
+
$is_enabled = Mage::helper("cornerdrop_collect/config")->isExtensionEnabled($address->getQuote()->getStore());
|
| 107 |
+
$is_cornerdrop = Mage::helper("cornerdrop_collect")->isCornerDropAddress($address);
|
| 108 |
+
|
| 109 |
+
return $is_enabled && $is_cornerdrop;
|
| 110 |
+
}
|
| 111 |
+
}
|
app/code/community/CornerDrop/Collect/Test/.DS_Store
ADDED
|
Binary file
|
app/code/community/CornerDrop/Collect/Test/Config/Base.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Config_Base extends EcomDev_PHPUnit_Test_Case_Config {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* @test
|
| 7 |
+
*/
|
| 8 |
+
public function testClassAlias() {
|
| 9 |
+
$this->assertHelperAlias('cornerdrop_collect/test', 'CornerDrop_Collect_Helper_Test');
|
| 10 |
+
$this->assertBlockAlias('cornerdrop_collect/test', 'CornerDrop_Collect_Block_Test');
|
| 11 |
+
$this->assertModelAlias('cornerdrop_collect/test', 'Corn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|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/** @var CornerDrop_Collect_Helper_Data $helper */
|
| 7 |
+
protected $helper;
|
| 8 |
+
|
| 9 |
+
protected function setUp()
|
| 10 |
+
{
|
| 11 |
+
parent::setUp();
|
| 12 |
+
|
| 13 |
+
$this->helper = Mage::helper("cornerdrop_collect");
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
protected function tearDown()
|
| 17 |
+
{
|
| 18 |
+
unset($this->helper);
|
| 19 |
+
|
| 20 |
+
parent::tearDown();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public function testSearchReturnsResults()
|
| 24 |
+
{
|
| 25 |
+
$response_body = '{"result":{"results":[{"id":1,"displayName":"Test","latitude":51.320601,"longitude":-2.207436,"distance":7.6051834780367,"fullAddressHtml":"Test Street<br>Test City<br>Test County<br>AB1 1AB","address1":"Test Street","address2":"","address3":"","city":"Test City","county":"Test Region","country":"GB","postCode":"AB1 1AB","contactPhone":"123456789","openingHoursHtml":"Mon - Fri: 09:00 - 17:00<br>Sat: 09:00 - 17:00<br>","siteMarketing":"Test Description","availableSlots":5,"totalSlots":5}]},"code":2000,"message":"Success"}';
|
| 26 |
+
$result = array(
|
| 27 |
+
array(
|
| 28 |
+
"id" => 1,
|
| 29 |
+
"name" => "Test",
|
| 30 |
+
"description" => "Test Description",
|
| 31 |
+
"address" => array(
|
| 32 |
+
"vat_id" => null,
|
| 33 |
+
"prefix" => null,
|
| 34 |
+
"firstname" => null,
|
| 35 |
+
"middlename" => null,
|
| 36 |
+
"lastname" => null,
|
| 37 |
+
"suffix" => null,
|
| 38 |
+
"company" => "Test",
|
| 39 |
+
"street" => array(
|
| 40 |
+
"Test Street",
|
| 41 |
+
"",
|
| 42 |
+
""
|
| 43 |
+
),
|
| 44 |
+
"city" => "Test City",
|
| 45 |
+
"region" => "Test Region",
|
| 46 |
+
"postcode" => "AB1 1AB",
|
| 47 |
+
"country_id" => "GB",
|
| 48 |
+
"telephone" => "123456789",
|
| 49 |
+
"fax" => null,
|
| 50 |
+
"email" => null
|
| 51 |
+
),
|
| 52 |
+
"addressHtml" => "Test Street<br>Test City<br>Test County<br>AB1 1AB",
|
| 53 |
+
"location" => array(
|
| 54 |
+
"distance" => 7.6051834780367,
|
| 55 |
+
"latitude" => 51.320601,
|
| 56 |
+
"longitude" => -2.207436
|
| 57 |
+
),
|
| 58 |
+
"availability" => array(
|
| 59 |
+
"available" => 5,
|
| 60 |
+
"total" => 5
|
| 61 |
+
),
|
| 62 |
+
"openingHoursHtml" => "Mon - Fri: 09:00 - 17:00<br>Sat: 09:00 - 17:00<br>"
|
| 63 |
+
)
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
$api_action = $this->getModelMock("cornerdrop_collect/api_action_search", array("execute"));
|
| 67 |
+
$api_action
|
| 68 |
+
->expects($this->once())
|
| 69 |
+
->method("execute")
|
| 70 |
+
->will($this->returnValue(
|
| 71 |
+
Mage::getModel("cornerdrop_collect/api_response")
|
| 72 |
+
->setRawResponse(new Zend_Http_Response(200, array(), $response_body))
|
| 73 |
+
));
|
| 74 |
+
$this->replaceByMock("model", "cornerdrop_collect/api_action_search", $api_action);
|
| 75 |
+
|
| 76 |
+
$this->assertEquals(
|
| 77 |
+
$result,
|
| 78 |
+
$this->helper->search(Mage::getModel("sales/quote"), "1", "1", "1"),
|
| 79 |
+
"Failed asserting that search method returns results array on success."
|
| 80 |
+
);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
public function testSearchReturnsNullOnFailure()
|
| 84 |
+
{
|
| 85 |
+
$api_action = $this->getModelMock("cornerdrop_collect/api_action_search", array("execute"));
|
| 86 |
+
$api_action
|
| 87 |
+
->expects($this->once())
|
| 88 |
+
->method("execute")
|
| 89 |
+
->will($this->returnValue(
|
| 90 |
+
Mage::getModel("cornerdrop_collect/api_response")
|
| 91 |
+
->setRawResponse(new Zend_Http_Response(500, array(), ""))
|
| 92 |
+
));
|
| 93 |
+
$this->replaceByMock("model", "cornerdrop_collect/api_action_search", $api_action);
|
| 94 |
+
|
| 95 |
+
$this->assertNull(
|
| 96 |
+
$this->helper->search(Mage::getModel("sales/quote"), "1", "1", "1"),
|
| 97 |
+
"Failed asserting that search method returns null on failure."
|
| 98 |
+
);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
public function testSearchReturnsNullOnError()
|
| 102 |
+
{
|
| 103 |
+
$api_action = $this->getModelMock("cornerdrop_collect/api_action_search", array("execute"));
|
| 104 |
+
$api_action
|
| 105 |
+
->expects($this->once())
|
| 106 |
+
->method("execute")
|
| 107 |
+
->will($this->throwException(new Exception("Test exception")));
|
| 108 |
+
$this->replaceByMock("model", "cornerdrop_collect/api_action_search", $api_action);
|
| 109 |
+
|
| 110 |
+
$this->assertNull(
|
| 111 |
+
$this->helper->search(Mage::getModel("sales/quote"), "1", "1", "1"),
|
| 112 |
+
"Failed asserting that search method returns null on error."
|
| 113 |
+
);
|
| 114 |
+
}
|
| 115 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Action.php
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Api_Action extends CornerDrop_Collect_Test_Model_Api_Test_Case
|
| 4 |
+
{
|
| 5 |
+
public function setUp()
|
| 6 |
+
{
|
| 7 |
+
parent::setUp();
|
| 8 |
+
|
| 9 |
+
@session_start(); // Ignore header errors when attempting to start a session
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* @loadFixture
|
| 14 |
+
* @test
|
| 15 |
+
*/
|
| 16 |
+
public function testExecute()
|
| 17 |
+
{
|
| 18 |
+
$response_model = Mage::getModel('cornerdrop_collect/api_response');
|
| 19 |
+
$response_model
|
| 20 |
+
->setRawResponse(new Zend_Http_Response(200, array(), 'test response'));
|
| 21 |
+
|
| 22 |
+
$request_model = $this->getModelMock('cornerdrop_collect/api_request', array('send'));
|
| 23 |
+
$request_model
|
| 24 |
+
->expects($this->once())
|
| 25 |
+
->method('send')
|
| 26 |
+
->will($this->returnValue($response_model));
|
| 27 |
+
|
| 28 |
+
$action = Mage::getModel('cornerdrop_collect/api_action_status');
|
| 29 |
+
$action
|
| 30 |
+
->setApiIdentifier('test')
|
| 31 |
+
->setRequest($request_model)
|
| 32 |
+
->setResponse($response_model);
|
| 33 |
+
|
| 34 |
+
// Ensure the response matches our expected response.
|
| 35 |
+
$this->assertEquals($response_model, $action->execute(null, null));
|
| 36 |
+
|
| 37 |
+
// Ensure the request method is correct
|
| 38 |
+
$this->assertEquals('GET', $action->getRequest()->getMethod());
|
| 39 |
+
|
| 40 |
+
// Ensure the endpoint is correct
|
| 41 |
+
$this->assertEquals('https://testapi.cornerdrop.com/status', $action->getRequest()->getEndpoint());
|
| 42 |
+
|
| 43 |
+
// Ensure the headers are correct
|
| 44 |
+
$headers = array(
|
| 45 |
+
'ApiKey' => null,
|
| 46 |
+
'Identifier' => 'test',
|
| 47 |
+
'SessionId' => null,
|
| 48 |
+
'UserHostAddress' => null
|
| 49 |
+
);
|
| 50 |
+
$this->assertEquals($headers, $action->getRequest()->getHeaders());
|
| 51 |
+
}
|
| 52 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Action/fixtures/testExecute.yaml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/api_uri: https://testapi.cornerdrop.com
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Request.php
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Api_Request extends CornerDrop_Collect_Test_Model_Api_Test_Case
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* @test
|
| 7 |
+
* @expectedException Mage_Core_Exception
|
| 8 |
+
*/
|
| 9 |
+
public function testSendNoEndpoint()
|
| 10 |
+
{
|
| 11 |
+
$model = $this->getModelMock('cornerdrop_collect/api_request', array('getClient'));
|
| 12 |
+
$model
|
| 13 |
+
->expects($this->never())
|
| 14 |
+
->method('getClient');
|
| 15 |
+
|
| 16 |
+
$model->send();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* @test
|
| 21 |
+
*/
|
| 22 |
+
public function testSendNoResponse()
|
| 23 |
+
{
|
| 24 |
+
$http_client = $this->getMock('Zend_Http_Client', array('request'));
|
| 25 |
+
$http_client
|
| 26 |
+
->expects($this->once())
|
| 27 |
+
->method('request')
|
| 28 |
+
->will($this->throwException(new Zend_Http_Client_Exception('Test exception')));
|
| 29 |
+
|
| 30 |
+
$model = Mage::getModel('cornerdrop_collect/api_request');
|
| 31 |
+
$model
|
| 32 |
+
->setClient($http_client)
|
| 33 |
+
->setEndpoint('http://test.cornerdrop.com/');
|
| 34 |
+
|
| 35 |
+
$this->assertInstanceOf('CornerDrop_Collect_Model_Api_Response_Empty', $model->send());
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* @test
|
| 40 |
+
*/
|
| 41 |
+
public function testSendValidResponse()
|
| 42 |
+
{
|
| 43 |
+
$test_raw_response = new Zend_Http_Response(200, array());
|
| 44 |
+
|
| 45 |
+
$http_client = $this->getMock('Zend_Http_Client', array('request'));
|
| 46 |
+
$http_client
|
| 47 |
+
->expects($this->once())
|
| 48 |
+
->method('request')
|
| 49 |
+
->will($this->returnValue($test_raw_response));
|
| 50 |
+
|
| 51 |
+
$response_model = $this->getModelMock('cornerdrop_collect/api_response', array('getRawResponse'));
|
| 52 |
+
$response_model
|
| 53 |
+
->method('getRawResponse')
|
| 54 |
+
->will($this->returnValue($test_raw_response));
|
| 55 |
+
|
| 56 |
+
$request_model = Mage::getModel('cornerdrop_collect/api_request');
|
| 57 |
+
$request_model
|
| 58 |
+
->setClient($http_client)
|
| 59 |
+
->setEndpoint('http://test.cornerdrop.com/')
|
| 60 |
+
->setResponseModel($response_model);
|
| 61 |
+
|
| 62 |
+
$this->assertInstanceOf('CornerDrop_Collect_Model_Api_Response', $request_model->send());
|
| 63 |
+
}
|
| 64 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Response.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Api_Response extends CornerDrop_Collect_Test_Model_Api_Test_Case
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* @test
|
| 7 |
+
* @dataProvider dataProvider
|
| 8 |
+
* @dataProviderFile response_testIsSuccessful.yaml
|
| 9 |
+
*/
|
| 10 |
+
public function testIsSuccessful($response_code, $response_data_file, $is_successful)
|
| 11 |
+
{
|
| 12 |
+
$response_body = ($response_data_file) ? $this->getDataFileContents($response_data_file) : "";
|
| 13 |
+
$http_response = new Zend_Http_Response($response_code, array(), $response_body);
|
| 14 |
+
$model = Mage::getModel('cornerdrop_collect/api_response');
|
| 15 |
+
$model->setRawResponse($http_response);
|
| 16 |
+
|
| 17 |
+
$this->assertEquals($is_successful, $model->isSuccessful());
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Response/providers/response_testIsSuccessful.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
success:
|
| 2 |
+
response_code: 200
|
| 3 |
+
response_data_file: "response_valid.json"
|
| 4 |
+
is_successful: true
|
| 5 |
+
nojson:
|
| 6 |
+
response_code: 200
|
| 7 |
+
response_data_file: "response_nojson.json"
|
| 8 |
+
is_successful: false
|
| 9 |
+
httpfailcode:
|
| 10 |
+
response_code: 500
|
| 11 |
+
response_data_file: "response_valid.json"
|
| 12 |
+
is_successful: false
|
| 13 |
+
apifailcode:
|
| 14 |
+
response_code: 200
|
| 15 |
+
response_data_file: "response_failed.json"
|
| 16 |
+
is_successful: false
|
app/code/community/CornerDrop/Collect/Test/Model/Api/Test/Case.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
abstract class CornerDrop_Collect_Test_Model_Api_Test_Case extends EcomDev_PHPUnit_Test_Case
|
| 4 |
+
{
|
| 5 |
+
protected function getDataFileContents($file) {
|
| 6 |
+
$directory_tree = array(
|
| 7 |
+
Mage::getModuleDir('', 'CornerDrop_Collect'),
|
| 8 |
+
'Test',
|
| 9 |
+
'Model',
|
| 10 |
+
'Api',
|
| 11 |
+
'data',
|
| 12 |
+
$file
|
| 13 |
+
);
|
| 14 |
+
|
| 15 |
+
$file_path = join(DS, $directory_tree);
|
| 16 |
+
|
| 17 |
+
return file_get_contents($file_path);
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/data/data_response_success.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
{
|
| 2 |
+
"result": {
|
| 3 |
+
"creditBalance": 10
|
| 4 |
+
},
|
| 5 |
+
"code": 2000,
|
| 6 |
+
"message": "Success"
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_failed.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
{
|
| 2 |
+
"result": {},
|
| 3 |
+
"code": 4010,
|
| 4 |
+
"message": "Api key not supplied"
|
| 5 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_nojson.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
Â
|
| 1 |
+
TEST
|
app/code/community/CornerDrop/Collect/Test/Model/Api/data/response_valid.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
{
|
| 2 |
+
"result": {
|
| 3 |
+
"creditBalance": 10
|
| 4 |
+
},
|
| 5 |
+
"code": 2000,
|
| 6 |
+
"message": "Success"
|
| 7 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/Fee.php
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Sales_Order_Creditmemo_Total_CornerDrop_Fee extends EcomDev_PHPUnit_Test_Case {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Test the CornerDrop fee is added with tax.
|
| 7 |
+
*
|
| 8 |
+
* @test
|
| 9 |
+
* @loadFixture
|
| 10 |
+
*/
|
| 11 |
+
public function testCornerDropFeeAddedWithTax() {
|
| 12 |
+
$values = $this->_getValues();
|
| 13 |
+
$this->assertEquals(10, $values['total_fee']);
|
| 14 |
+
$this->assertEquals(10, $values['base_total_fee']);
|
| 15 |
+
$this->assertEquals(1, $values['tax']);
|
| 16 |
+
$this->assertEquals(1, $values['base_tax']);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Test the CornerDrop Fee is added without tax.
|
| 21 |
+
*
|
| 22 |
+
* @test
|
| 23 |
+
* @loadFixture
|
| 24 |
+
*/
|
| 25 |
+
public function testCornerDropFeeAddedWithNoTax() {
|
| 26 |
+
$values = $this->_getValues();
|
| 27 |
+
$this->assertEquals(10, $values['total_fee']);
|
| 28 |
+
$this->assertEquals(10, $values['base_total_fee']);
|
| 29 |
+
$this->assertEquals(0, $values['tax']);
|
| 30 |
+
$this->assertEquals(0, $values['base_tax']);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Check the CornerDrop Fee is not added to the invoice
|
| 35 |
+
* if the order is not a CornerDrop order.
|
| 36 |
+
*
|
| 37 |
+
* @test
|
| 38 |
+
* @loadFixture
|
| 39 |
+
*/
|
| 40 |
+
public function testCornerDropFeeNotAdded() {
|
| 41 |
+
$values = $this->_getValues();
|
| 42 |
+
$this->assertEquals(0, $values['total_fee']);
|
| 43 |
+
$this->assertEquals(0, $values['base_total_fee']);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Get the values which vary based on the loaded fixture.
|
| 48 |
+
*
|
| 49 |
+
* @return array
|
| 50 |
+
*/
|
| 51 |
+
private function _getValues() {
|
| 52 |
+
/** @var Mage_Sales_Model_Order_Creditmemo $creditmemo */
|
| 53 |
+
$creditmemo = Mage::getModel('sales/order_creditmemo')->getCollection()->getFirstItem();
|
| 54 |
+
/** @var CornerDrop_Collect_Model_Sales_Order_Creditmemo_Total_CornerDrop_Fee $total */
|
| 55 |
+
$total = Mage::getModel('cornerdrop_collect/sales_order_creditmemo_total_cornerdrop_fee');
|
| 56 |
+
|
| 57 |
+
$total->collect($creditmemo);
|
| 58 |
+
|
| 59 |
+
$total_fee = $creditmemo->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT);
|
| 60 |
+
$base_total_fee = $creditmemo->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT);
|
| 61 |
+
$tax = $creditmemo->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX);
|
| 62 |
+
$base_tax = $creditmemo->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX);
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
return compact(
|
| 66 |
+
'total_fee',
|
| 67 |
+
'base_total_fee',
|
| 68 |
+
'tax',
|
| 69 |
+
'base_tax'
|
| 70 |
+
);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/fixtures/testCornerDropFeeAddedWithNoTax.yaml
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 1
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 422
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: processing
|
| 22 |
+
status: processing
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: 151a17
|
| 25 |
+
shipping_description: Flat Rate - Fixed
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: 0
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 115
|
| 34 |
+
base_shipping_amount: 5
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: 5
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 100
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: 100
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 0
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: 0
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: 115
|
| 52 |
+
base_total_invoiced_cost: 0
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: 115
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: 0
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 115
|
| 63 |
+
shipping_amount: 5
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: 5
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 100
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: 100
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 0
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: 0
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: 115
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: 115
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 0
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 19
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 100
|
| 105 |
+
base_total_due: 0
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 100
|
| 109 |
+
total_due: 0
|
| 110 |
+
weight: 0
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 100000001
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: USD
|
| 115 |
+
customer_email: demo@example.com
|
| 116 |
+
customer_firstname: John
|
| 117 |
+
customer_lastname: Doe
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: USD
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: USD
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: flatrate_flatrate
|
| 136 |
+
store_currency_code: USD
|
| 137 |
+
store_name: Main Website
|
| 138 |
+
Main Website Store
|
| 139 |
+
Default Store View
|
| 140 |
+
x_forwarded_for: null
|
| 141 |
+
customer_note: null
|
| 142 |
+
created_at: 2015-04-20 10:16:35
|
| 143 |
+
updated_at: 2015-04-20 10:21:15
|
| 144 |
+
total_item_count: 1
|
| 145 |
+
customer_gender: null
|
| 146 |
+
hidden_tax_amount: 0
|
| 147 |
+
base_hidden_tax_amount: 0
|
| 148 |
+
shipping_hidden_tax_amount: 0
|
| 149 |
+
base_shipping_hidden_tax_amnt: 0
|
| 150 |
+
hidden_tax_invoiced: 0
|
| 151 |
+
base_hidden_tax_invoiced: 0
|
| 152 |
+
hidden_tax_refunded: null
|
| 153 |
+
base_hidden_tax_refunded: null
|
| 154 |
+
shipping_incl_tax: 5
|
| 155 |
+
base_shipping_incl_tax: 5
|
| 156 |
+
coupon_rule_name: null
|
| 157 |
+
paypal_ipn_customer_notified: 0
|
| 158 |
+
gift_message_id: null
|
| 159 |
+
cornerdrop_fee_amount: 10
|
| 160 |
+
base_cornerdrop_fee_amount: 10
|
| 161 |
+
cornerdrop_tax_amount: null
|
| 162 |
+
base_cornerdrop_tax_amount: null
|
| 163 |
+
sales_flat_order_address:
|
| 164 |
+
-
|
| 165 |
+
entity_id: 1
|
| 166 |
+
parent_id: 1
|
| 167 |
+
customer_address_id: null
|
| 168 |
+
quote_address_id: null
|
| 169 |
+
region_id: 12
|
| 170 |
+
customer_id: null
|
| 171 |
+
fax: null
|
| 172 |
+
region: California
|
| 173 |
+
postcode: 90210
|
| 174 |
+
lastname: Tester
|
| 175 |
+
street: Test
|
| 176 |
+
city: Test
|
| 177 |
+
email: test@example.com
|
| 178 |
+
telephone: 123456789
|
| 179 |
+
country_id: US
|
| 180 |
+
firstname: Test
|
| 181 |
+
address_type: billing
|
| 182 |
+
prefix: null
|
| 183 |
+
middlename: null
|
| 184 |
+
suffix: null
|
| 185 |
+
company: null
|
| 186 |
+
vat_id: null
|
| 187 |
+
vat_is_valid: null
|
| 188 |
+
vat_request_id: null
|
| 189 |
+
vat_request_date: null
|
| 190 |
+
vat_request_success: null
|
| 191 |
+
giftregistry_item_id: null
|
| 192 |
+
is_cornerdrop_collect: null
|
| 193 |
+
-
|
| 194 |
+
entity_id: 2
|
| 195 |
+
parent_id: 1
|
| 196 |
+
customer_address_id: null
|
| 197 |
+
quote_address_id: null
|
| 198 |
+
region_id: 12
|
| 199 |
+
customer_id: null
|
| 200 |
+
fax: null
|
| 201 |
+
region: California
|
| 202 |
+
postcode: 90210
|
| 203 |
+
lastname: Tester
|
| 204 |
+
street: Test
|
| 205 |
+
city: Test
|
| 206 |
+
email: null
|
| 207 |
+
telephone: 123456789
|
| 208 |
+
country_id: US
|
| 209 |
+
firstname: Test
|
| 210 |
+
address_type: shipping
|
| 211 |
+
prefix: null
|
| 212 |
+
middlename: null
|
| 213 |
+
suffix: null
|
| 214 |
+
company: null
|
| 215 |
+
vat_id: null
|
| 216 |
+
vat_is_valid: null
|
| 217 |
+
vat_request_id: null
|
| 218 |
+
vat_request_date: null
|
| 219 |
+
vat_request_success: null
|
| 220 |
+
giftregistry_item_id: null
|
| 221 |
+
is_cornerdrop_collect: 1
|
| 222 |
+
sales_flat_creditmemo:
|
| 223 |
+
-
|
| 224 |
+
entity_id: 1
|
| 225 |
+
store_id: 1
|
| 226 |
+
adjustment_positive: 0
|
| 227 |
+
base_shipping_tax_amount: 0
|
| 228 |
+
store_to_order_rate: 1
|
| 229 |
+
base_discount_amount: -2.42
|
| 230 |
+
base_to_order_rate: 1
|
| 231 |
+
grand_total: 315.09
|
| 232 |
+
base_adjustment_negative: 0
|
| 233 |
+
base_subtotal_incl_tax: 305.2
|
| 234 |
+
shipping_amount: 12.52
|
| 235 |
+
subtotal_incl_tax: 305.2
|
| 236 |
+
adjustment_negative: 0
|
| 237 |
+
base_shipping_amount: 12.52
|
| 238 |
+
store_to_base_rate: 1
|
| 239 |
+
base_to_global_rate: 1
|
| 240 |
+
base_adjustment: 0
|
| 241 |
+
base_subtotal: 280
|
| 242 |
+
discount_amount: -2.42
|
| 243 |
+
subtotal: 280
|
| 244 |
+
adjustment: 0
|
| 245 |
+
base_grand_total: 315.09
|
| 246 |
+
base_adjustment_positive: 0
|
| 247 |
+
base_tax_amount: 24.99
|
| 248 |
+
shipping_tax_amount: 0
|
| 249 |
+
tax_amount: 24.99
|
| 250 |
+
order_id: 1
|
| 251 |
+
email_sent: null
|
| 252 |
+
creditmemo_status: null
|
| 253 |
+
state: 2
|
| 254 |
+
shipping_address_id: 2
|
| 255 |
+
billing_address_id: 1
|
| 256 |
+
invoice_id: null
|
| 257 |
+
store_currency_code: USD
|
| 258 |
+
order_currency_code: USD
|
| 259 |
+
base_currency_code: USD
|
| 260 |
+
global_currency_code: USD
|
| 261 |
+
transaction_id: null
|
| 262 |
+
increment_id: 100000005
|
| 263 |
+
created_at: 2013-05-29 14:38:28
|
| 264 |
+
updated_at: 2013-05-29 14:38:28
|
| 265 |
+
hidden_tax_amount: 0
|
| 266 |
+
base_hidden_tax_amount: 0
|
| 267 |
+
shipping_hidden_tax_amount: null
|
| 268 |
+
base_shipping_hidden_tax_amnt: null
|
| 269 |
+
shipping_incl_tax: 12.52
|
| 270 |
+
base_shipping_incl_tax: 12.52
|
| 271 |
+
base_customer_balance_amount: null
|
| 272 |
+
customer_balance_amount: null
|
| 273 |
+
bs_customer_bal_total_refunded: 315.09
|
| 274 |
+
customer_bal_total_refunded: 315.09
|
| 275 |
+
base_gift_cards_amount: null
|
| 276 |
+
gift_cards_amount: null
|
| 277 |
+
gw_base_price: null
|
| 278 |
+
gw_price: null
|
| 279 |
+
gw_items_base_price: null
|
| 280 |
+
gw_items_price: null
|
| 281 |
+
gw_card_base_price: null
|
| 282 |
+
gw_card_price: null
|
| 283 |
+
gw_base_tax_amount: null
|
| 284 |
+
gw_tax_amount: null
|
| 285 |
+
gw_items_base_tax_amount: null
|
| 286 |
+
gw_items_tax_amount: null
|
| 287 |
+
gw_card_base_tax_amount: null
|
| 288 |
+
gw_card_tax_amount: null
|
| 289 |
+
base_reward_currency_amount: null
|
| 290 |
+
reward_currency_amount: null
|
| 291 |
+
reward_points_balance: null
|
| 292 |
+
reward_points_balance_refund: null
|
| 293 |
+
discount_description: Register10
|
| 294 |
+
cybersource_token: null
|
| 295 |
+
cornerdrop_fee_amount: null
|
| 296 |
+
base_cornerdrop_fee_amount: null
|
| 297 |
+
cornerdrop_tax_amount: null
|
| 298 |
+
base_cornerdrop_tax_amount: null
|
| 299 |
+
sales_flat_creditmemo_grid:
|
| 300 |
+
-
|
| 301 |
+
entity_id: 1
|
| 302 |
+
store_id: 1
|
| 303 |
+
store_to_order_rate: 1
|
| 304 |
+
base_to_order_rate: 1
|
| 305 |
+
grand_total: 315.09
|
| 306 |
+
store_to_base_rate: 1
|
| 307 |
+
base_to_global_rate: 1
|
| 308 |
+
base_grand_total: 315.09
|
| 309 |
+
order_id: 187
|
| 310 |
+
creditmemo_status: null
|
| 311 |
+
state: 2
|
| 312 |
+
invoice_id: null
|
| 313 |
+
store_currency_code: USD
|
| 314 |
+
order_currency_code: USD
|
| 315 |
+
base_currency_code: USD
|
| 316 |
+
global_currency_code: USD
|
| 317 |
+
increment_id: 100000005
|
| 318 |
+
order_increment_id: 100000206
|
| 319 |
+
created_at: 2013-05-29 14:38:28
|
| 320 |
+
order_created_at: 2013-05-29 02:28:25
|
| 321 |
+
billing_name: John Doe
|
| 322 |
+
sales_flat_creditmemo_item:
|
| 323 |
+
-
|
| 324 |
+
entity_id: 1
|
| 325 |
+
parent_id: 1
|
| 326 |
+
base_price: 280
|
| 327 |
+
tax_amount: 24.99
|
| 328 |
+
base_row_total: 280
|
| 329 |
+
discount_amount: 2.42
|
| 330 |
+
row_total: 280
|
| 331 |
+
base_discount_amount: 2.42
|
| 332 |
+
price_incl_tax: 305.2
|
| 333 |
+
base_tax_amount: 24.99
|
| 334 |
+
base_price_incl_tax: 305.2
|
| 335 |
+
qty: 1
|
| 336 |
+
base_cost: null
|
| 337 |
+
price: 280
|
| 338 |
+
base_row_total_incl_tax: 305.2
|
| 339 |
+
row_total_incl_tax: 305.2
|
| 340 |
+
product_id: 422
|
| 341 |
+
order_item_id: 1
|
| 342 |
+
additional_data: null
|
| 343 |
+
description: null
|
| 344 |
+
sku: acj00124
|
| 345 |
+
name: Pearl Strand Necklace
|
| 346 |
+
hidden_tax_amount: 0
|
| 347 |
+
base_hidden_tax_amount: 0
|
| 348 |
+
weee_tax_disposition: 0
|
| 349 |
+
weee_tax_row_disposition: 0
|
| 350 |
+
base_weee_tax_disposition: 0
|
| 351 |
+
base_weee_tax_row_disposition: 0
|
| 352 |
+
weee_tax_applied: a:0:{}
|
| 353 |
+
base_weee_tax_applied_amount: 0
|
| 354 |
+
base_weee_tax_applied_row_amnt: 0
|
| 355 |
+
weee_tax_applied_amount: 0
|
| 356 |
+
weee_tax_applied_row_amount: 0
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Creditmemo/Total/CornerDrop/fixtures/testCornerDropFeeAddedWithTax.yaml
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 0
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 422
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: processing
|
| 22 |
+
status: processing
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: 151a17
|
| 25 |
+
shipping_description: Flat Rate - Fixed
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: 0
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 115
|
| 34 |
+
base_shipping_amount: 5
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: 5
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 100
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: 100
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 0
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: 0
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: 115
|
| 52 |
+
base_total_invoiced_cost: 0
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: 115
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: 0
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 115
|
| 63 |
+
shipping_amount: 5
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: 5
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 100
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: 100
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 0
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: 0
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: 115
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: 115
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 0
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 19
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 100
|
| 105 |
+
base_total_due: 0
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 100
|
| 109 |
+
total_due: 0
|
| 110 |
+
weight: 0
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 100000001
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: USD
|
| 115 |
+
customer_email: demo@example.com
|
| 116 |
+
customer_firstname: John
|
| 117 |
+
customer_lastname: Doe
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: USD
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: USD
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: flatrate_flatrate
|
| 136 |
+
store_currency_code: USD
|
| 137 |
+
store_name: Main Website
|
| 138 |
+
Main Website Store
|
| 139 |
+
Default Store View
|
| 140 |
+
x_forwarded_for: null
|
| 141 |
+
customer_note: null
|
| 142 |
+
created_at: 2015-04-20 10:16:35
|
| 143 |
+
updated_at: 2015-04-20 10:21:15
|
| 144 |
+
total_item_count: 1
|
| 145 |
+
customer_gender: null
|
| 146 |
+
hidden_tax_amount: 0
|
| 147 |
+
base_hidden_tax_amount: 0
|
| 148 |
+
shipping_hidden_tax_amount: 0
|
| 149 |
+
base_shipping_hidden_tax_amnt: 0
|
| 150 |
+
hidden_tax_invoiced: 0
|
| 151 |
+
base_hidden_tax_invoiced: 0
|
| 152 |
+
hidden_tax_refunded: null
|
| 153 |
+
base_hidden_tax_refunded: null
|
| 154 |
+
shipping_incl_tax: 5
|
| 155 |
+
base_shipping_incl_tax: 5
|
| 156 |
+
coupon_rule_name: null
|
| 157 |
+
paypal_ipn_customer_notified: 0
|
| 158 |
+
gift_message_id: null
|
| 159 |
+
cornerdrop_fee_amount: 10
|
| 160 |
+
base_cornerdrop_fee_amount: 10
|
| 161 |
+
cornerdrop_tax_amount: 1
|
| 162 |
+
base_cornerdrop_tax_amount: 1
|
| 163 |
+
sales_flat_order_address:
|
| 164 |
+
-
|
| 165 |
+
entity_id: 1
|
| 166 |
+
parent_id: 1
|
| 167 |
+
customer_address_id: null
|
| 168 |
+
quote_address_id: null
|
| 169 |
+
region_id: 12
|
| 170 |
+
customer_id: null
|
| 171 |
+
fax: null
|
| 172 |
+
region: California
|
| 173 |
+
postcode: 90210
|
| 174 |
+
lastname: Tester
|
| 175 |
+
street: Test
|
| 176 |
+
city: Test
|
| 177 |
+
email: test@example.com
|
| 178 |
+
telephone: 123456789
|
| 179 |
+
country_id: US
|
| 180 |
+
firstname: Test
|
| 181 |
+
address_type: billing
|
| 182 |
+
prefix: null
|
| 183 |
+
middlename: null
|
| 184 |
+
suffix: null
|
| 185 |
+
company: null
|
| 186 |
+
vat_id: null
|
| 187 |
+
vat_is_valid: null
|
| 188 |
+
vat_request_id: null
|
| 189 |
+
vat_request_date: null
|
| 190 |
+
vat_request_success: null
|
| 191 |
+
giftregistry_item_id: null
|
| 192 |
+
is_cornerdrop_collect: null
|
| 193 |
+
-
|
| 194 |
+
entity_id: 2
|
| 195 |
+
parent_id: 1
|
| 196 |
+
customer_address_id: null
|
| 197 |
+
quote_address_id: null
|
| 198 |
+
region_id: 12
|
| 199 |
+
customer_id: null
|
| 200 |
+
fax: null
|
| 201 |
+
region: California
|
| 202 |
+
postcode: 90210
|
| 203 |
+
lastname: Tester
|
| 204 |
+
street: Test
|
| 205 |
+
city: Test
|
| 206 |
+
email: null
|
| 207 |
+
telephone: 123456789
|
| 208 |
+
country_id: US
|
| 209 |
+
firstname: Test
|
| 210 |
+
address_type: shipping
|
| 211 |
+
prefix: null
|
| 212 |
+
middlename: null
|
| 213 |
+
suffix: null
|
| 214 |
+
company: null
|
| 215 |
+
vat_id: null
|
| 216 |
+
vat_is_valid: null
|
| 217 |
+
vat_request_id: null
|
| 218 |
+
vat_request_date: null
|
| 219 |
+
vat_request_success: null
|
| 220 |
+
giftregistry_item_id: null
|
| 221 |
+
is_cornerdrop_collect: 1
|
| 222 |
+
sales_flat_creditmemo:
|
| 223 |
+
-
|
| 224 |
+
entity_id: 1
|
| 225 |
+
store_id: 1
|
| 226 |
+
adjustment_positive: 0
|
| 227 |
+
base_shipping_tax_amount: 0
|
| 228 |
+
store_to_order_rate: 1
|
| 229 |
+
base_discount_amount: -2.42
|
| 230 |
+
base_to_order_rate: 1
|
| 231 |
+
grand_total: 315.09
|
| 232 |
+
base_adjustment_negative: 0
|
| 233 |
+
base_subtotal_incl_tax: 305.2
|
| 234 |
+
shipping_amount: 12.52
|
| 235 |
+
subtotal_incl_tax: 305.2
|
| 236 |
+
adjustment_negative: 0
|
| 237 |
+
base_shipping_amount: 12.52
|
| 238 |
+
store_to_base_rate: 1
|
| 239 |
+
base_to_global_rate: 1
|
| 240 |
+
base_adjustment: 0
|
| 241 |
+
base_subtotal: 280
|
| 242 |
+
discount_amount: -2.42
|
| 243 |
+
subtotal: 280
|
| 244 |
+
adjustment: 0
|
| 245 |
+
base_grand_total: 315.09
|
| 246 |
+
base_adjustment_positive: 0
|
| 247 |
+
base_tax_amount: 24.99
|
| 248 |
+
shipping_tax_amount: 0
|
| 249 |
+
tax_amount: 24.99
|
| 250 |
+
order_id: 1
|
| 251 |
+
email_sent: null
|
| 252 |
+
creditmemo_status: null
|
| 253 |
+
state: 2
|
| 254 |
+
shipping_address_id: 2
|
| 255 |
+
billing_address_id: 1
|
| 256 |
+
invoice_id: null
|
| 257 |
+
store_currency_code: USD
|
| 258 |
+
order_currency_code: USD
|
| 259 |
+
base_currency_code: USD
|
| 260 |
+
global_currency_code: USD
|
| 261 |
+
transaction_id: null
|
| 262 |
+
increment_id: 100000005
|
| 263 |
+
created_at: 2013-05-29 14:38:28
|
| 264 |
+
updated_at: 2013-05-29 14:38:28
|
| 265 |
+
hidden_tax_amount: 0
|
| 266 |
+
base_hidden_tax_amount: 0
|
| 267 |
+
shipping_hidden_tax_amount: null
|
| 268 |
+
base_shipping_hidden_tax_amnt: null
|
| 269 |
+
shipping_incl_tax: 12.52
|
| 270 |
+
base_shipping_incl_tax: 12.52
|
| 271 |
+
base_customer_balance_amount: null
|
| 272 |
+
customer_balance_amount: null
|
| 273 |
+
bs_customer_bal_total_refunded: 315.09
|
| 274 |
+
customer_bal_total_refunded: 315.09
|
| 275 |
+
base_gift_cards_amount: null
|
| 276 |
+
gift_cards_amount: null
|
| 277 |
+
gw_base_price: null
|
| 278 |
+
gw_price: null
|
| 279 |
+
gw_items_base_price: null
|
| 280 |
+
gw_items_price: null
|
| 281 |
+
gw_card_base_price: null
|
| 282 |
+
gw_card_price: null
|
| 283 |
+
gw_base_tax_amount: null
|
| 284 |
+
gw_tax_amount: null
|
| 285 |
+
gw_items_base_tax_amount: null
|
| 286 |
+
gw_items_tax_amount: null
|
| 287 |
+
gw_card_base_tax_amount: null
|
| 288 |
+
gw_card_tax_amount: null
|
| 289 |
+
base_reward_currency_amount: null
|
| 290 |
+
reward_currency_amount: null
|
| 291 |
+
reward_points_balance: null
|
| 292 |
+
reward_points_balance_refund: null
|
| 293 |
+
discount_description: Register10
|
| 294 |
+
cybersource_token: null
|
| 295 |
+
cornerdrop_fee_amount: null
|
| 296 |
+
base_cornerdrop_fee_amount: null
|
| 297 |
+
cornerdrop_tax_amount: null
|
| 298 |
+
base_cornerdrop_tax_amount: null
|
| 299 |
+
sales_flat_creditmemo_grid:
|
| 300 |
+
-
|
| 301 |
+
entity_id: 1
|
| 302 |
+
store_id: 1
|
| 303 |
+
store_to_order_rate: 1
|
| 304 |
+
base_to_order_rate: 1
|
| 305 |
+
grand_total: 315.09
|
| 306 |
+
store_to_base_rate: 1
|
| 307 |
+
base_to_global_rate: 1
|
| 308 |
+
base_grand_total: 315.09
|
| 309 |
+
order_id: 187
|
| 310 |
+
creditmemo_status: null
|
| 311 |
+
state: 2
|
| 312 |
+
invoice_id: null
|
| 313 |
+
store_currency_code: USD
|
| 314 |
+
order_currency_code: USD
|
| 315 |
+
base_currency_code: USD
|
| 316 |
+
global_currency_code: USD
|
| 317 |
+
increment_id: 100000005
|
| 318 |
+
order_increment_id: 100000206
|
| 319 |
+
created_at: 2013-05-29 14:38:28
|
| 320 |
+
order_created_at: 2013-05-29 02:28:25
|
| 321 |
+
billing_name: John Doe
|
| 322 |
+
sales_flat_creditmemo_item:
|
| 323 |
+
-
|
| 324 |
+
entity_id: 1
|
| 325 |
+
parent_id: 1
|
| 326 |
+
base_price: 280
|
| 327 |
+
tax_amount: 24.99
|
| 328 |
+
base_row_total: 280
|
| 329 |
+
discount_amount: 2.42
|
| 330 |
+
row_total: 280
|
| 331 |
+
base_discount_amount: 2.42
|
| 332 |
+
price_incl_tax: 305.2
|
| 333 |
+
base_tax_amount: 24.99
|
| 334 |
+
base_price_incl_tax: 305.2
|
| 335 |
+
qty: 1
|
| 336 |
+
base_cost: null
|
| 337 |
+
price: 280
|
| 338 |
+
base_row_total_incl_tax: 305.2
|
| 339 |
+
row_total_incl_tax: 305.2
|
| 340 |
+
product_id: 422
|
| 341 |
+
order_item_id: 1
|
| 342 |
+
additional_data: null
|
| 343 |
+
description: null
|
| 344 |
+
sku: acj00124
|
| 345 |
+
name: Pearl Strand Necklace
|
| 346 |
+
hidden_tax_amount: 0
|
| 347 |
+
base_hidden_tax_amount: 0
|
| 348 |
+
weee_tax_disposition: 0
|
| 349 |
+
weee_tax_row_disposition: 0
|
| 350 |
+
base_weee_tax_disposition: 0
|
| 351 |
+
base_weee_tax_row_disposition: 0
|
| 352 |
+
weee_tax_applied: a:0:{}
|
| 353 |
+
base_weee_tax_applied_amount: 0
|
| 354 |
+
base_weee_tax_applied_row_amnt: 0
|
| 355 |
+
weee_tax_applied_amount: 0
|
| 356 |
+
weee_tax_applied_row_amount: 0
|
app/code/community/CornerDrop/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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 0
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 0
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 422
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: processing
|
| 22 |
+
status: processing
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: 151a17
|
| 25 |
+
shipping_description: Flat Rate - Fixed
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: 0
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 115
|
| 34 |
+
base_shipping_amount: 5
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: 5
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 100
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: 100
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 0
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: 0
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: 115
|
| 52 |
+
base_total_invoiced_cost: 0
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: 115
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: 0
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 115
|
| 63 |
+
shipping_amount: 5
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: 5
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 100
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: 100
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 0
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: 0
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: 115
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: 115
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 0
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 19
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 100
|
| 105 |
+
base_total_due: 0
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 100
|
| 109 |
+
total_due: 0
|
| 110 |
+
weight: 0
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 100000001
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: USD
|
| 115 |
+
customer_email: demo@example.com
|
| 116 |
+
customer_firstname: John
|
| 117 |
+
customer_lastname: Doe
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: USD
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: USD
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: flatrate_flatrate
|
| 136 |
+
store_currency_code: USD
|
| 137 |
+
store_name: Main Website
|
| 138 |
+
Main Website Store
|
| 139 |
+
Default Store View
|
| 140 |
+
x_forwarded_for: null
|
| 141 |
+
customer_note: null
|
| 142 |
+
created_at: 2015-04-20 10:16:35
|
| 143 |
+
updated_at: 2015-04-20 10:21:15
|
| 144 |
+
total_item_count: 1
|
| 145 |
+
customer_gender: null
|
| 146 |
+
hidden_tax_amount: 0
|
| 147 |
+
base_hidden_tax_amount: 0
|
| 148 |
+
shipping_hidden_tax_amount: 0
|
| 149 |
+
base_shipping_hidden_tax_amnt: 0
|
| 150 |
+
hidden_tax_invoiced: 0
|
| 151 |
+
base_hidden_tax_invoiced: 0
|
| 152 |
+
hidden_tax_refunded: null
|
| 153 |
+
base_hidden_tax_refunded: null
|
| 154 |
+
shipping_incl_tax: 5
|
| 155 |
+
base_shipping_incl_tax: 5
|
| 156 |
+
coupon_rule_name: null
|
| 157 |
+
paypal_ipn_customer_notified: 0
|
| 158 |
+
gift_message_id: null
|
| 159 |
+
cornerdrop_fee_amount: 0
|
| 160 |
+
base_cornerdrop_fee_amount: 0
|
| 161 |
+
cornerdrop_tax_amount: null
|
| 162 |
+
base_cornerdrop_tax_amount: null
|
| 163 |
+
sales_flat_order_address:
|
| 164 |
+
-
|
| 165 |
+
entity_id: 1
|
| 166 |
+
parent_id: 1
|
| 167 |
+
customer_address_id: null
|
| 168 |
+
quote_address_id: null
|
| 169 |
+
region_id: 12
|
| 170 |
+
customer_id: null
|
| 171 |
+
fax: null
|
| 172 |
+
region: California
|
| 173 |
+
postcode: 90210
|
| 174 |
+
lastname: Tester
|
| 175 |
+
street: Test
|
| 176 |
+
city: Test
|
| 177 |
+
email: test@example.com
|
| 178 |
+
telephone: 123456789
|
| 179 |
+
country_id: US
|
| 180 |
+
firstname: Test
|
| 181 |
+
address_type: billing
|
| 182 |
+
prefix: null
|
| 183 |
+
middlename: null
|
| 184 |
+
suffix: null
|
| 185 |
+
company: null
|
| 186 |
+
vat_id: null
|
| 187 |
+
vat_is_valid: null
|
| 188 |
+
vat_request_id: null
|
| 189 |
+
vat_request_date: null
|
| 190 |
+
vat_request_success: null
|
| 191 |
+
giftregistry_item_id: null
|
| 192 |
+
is_cornerdrop_collect: null
|
| 193 |
+
-
|
| 194 |
+
entity_id: 2
|
| 195 |
+
parent_id: 1
|
| 196 |
+
customer_address_id: null
|
| 197 |
+
quote_address_id: null
|
| 198 |
+
region_id: 12
|
| 199 |
+
customer_id: null
|
| 200 |
+
fax: null
|
| 201 |
+
region: California
|
| 202 |
+
postcode: 90210
|
| 203 |
+
lastname: Tester
|
| 204 |
+
street: Test
|
| 205 |
+
city: Test
|
| 206 |
+
email: null
|
| 207 |
+
telephone: 123456789
|
| 208 |
+
country_id: US
|
| 209 |
+
firstname: Test
|
| 210 |
+
address_type: shipping
|
| 211 |
+
prefix: null
|
| 212 |
+
middlename: null
|
| 213 |
+
suffix: null
|
| 214 |
+
company: null
|
| 215 |
+
vat_id: null
|
| 216 |
+
vat_is_valid: null
|
| 217 |
+
vat_request_id: null
|
| 218 |
+
vat_request_date: null
|
| 219 |
+
vat_request_success: null
|
| 220 |
+
giftregistry_item_id: null
|
| 221 |
+
is_cornerdrop_collect: 0
|
| 222 |
+
sales_flat_creditmemo:
|
| 223 |
+
-
|
| 224 |
+
entity_id: 1
|
| 225 |
+
store_id: 1
|
| 226 |
+
adjustment_positive: 0
|
| 227 |
+
base_shipping_tax_amount: 0
|
| 228 |
+
store_to_order_rate: 1
|
| 229 |
+
base_discount_amount: -2.42
|
| 230 |
+
base_to_order_rate: 1
|
| 231 |
+
grand_total: 315.09
|
| 232 |
+
base_adjustment_negative: 0
|
| 233 |
+
base_subtotal_incl_tax: 305.2
|
| 234 |
+
shipping_amount: 12.52
|
| 235 |
+
subtotal_incl_tax: 305.2
|
| 236 |
+
adjustment_negative: 0
|
| 237 |
+
base_shipping_amount: 12.52
|
| 238 |
+
store_to_base_rate: 1
|
| 239 |
+
base_to_global_rate: 1
|
| 240 |
+
base_adjustment: 0
|
| 241 |
+
base_subtotal: 280
|
| 242 |
+
discount_amount: -2.42
|
| 243 |
+
subtotal: 280
|
| 244 |
+
adjustment: 0
|
| 245 |
+
base_grand_total: 315.09
|
| 246 |
+
base_adjustment_positive: 0
|
| 247 |
+
base_tax_amount: 24.99
|
| 248 |
+
shipping_tax_amount: 0
|
| 249 |
+
tax_amount: 24.99
|
| 250 |
+
order_id: 1
|
| 251 |
+
email_sent: null
|
| 252 |
+
creditmemo_status: null
|
| 253 |
+
state: 2
|
| 254 |
+
shipping_address_id: 2
|
| 255 |
+
billing_address_id: 1
|
| 256 |
+
invoice_id: null
|
| 257 |
+
store_currency_code: USD
|
| 258 |
+
order_currency_code: USD
|
| 259 |
+
base_currency_code: USD
|
| 260 |
+
global_currency_code: USD
|
| 261 |
+
transaction_id: null
|
| 262 |
+
increment_id: 100000005
|
| 263 |
+
created_at: 2013-05-29 14:38:28
|
| 264 |
+
updated_at: 2013-05-29 14:38:28
|
| 265 |
+
hidden_tax_amount: 0
|
| 266 |
+
base_hidden_tax_amount: 0
|
| 267 |
+
shipping_hidden_tax_amount: null
|
| 268 |
+
base_shipping_hidden_tax_amnt: null
|
| 269 |
+
shipping_incl_tax: 12.52
|
| 270 |
+
base_shipping_incl_tax: 12.52
|
| 271 |
+
base_customer_balance_amount: null
|
| 272 |
+
customer_balance_amount: null
|
| 273 |
+
bs_customer_bal_total_refunded: 315.09
|
| 274 |
+
customer_bal_total_refunded: 315.09
|
| 275 |
+
base_gift_cards_amount: null
|
| 276 |
+
gift_cards_amount: null
|
| 277 |
+
gw_base_price: null
|
| 278 |
+
gw_price: null
|
| 279 |
+
gw_items_base_price: null
|
| 280 |
+
gw_items_price: null
|
| 281 |
+
gw_card_base_price: null
|
| 282 |
+
gw_card_price: null
|
| 283 |
+
gw_base_tax_amount: null
|
| 284 |
+
gw_tax_amount: null
|
| 285 |
+
gw_items_base_tax_amount: null
|
| 286 |
+
gw_items_tax_amount: null
|
| 287 |
+
gw_card_base_tax_amount: null
|
| 288 |
+
gw_card_tax_amount: null
|
| 289 |
+
base_reward_currency_amount: null
|
| 290 |
+
reward_currency_amount: null
|
| 291 |
+
reward_points_balance: null
|
| 292 |
+
reward_points_balance_refund: null
|
| 293 |
+
discount_description: Register10
|
| 294 |
+
cybersource_token: null
|
| 295 |
+
cornerdrop_fee_amount: null
|
| 296 |
+
base_cornerdrop_fee_amount: null
|
| 297 |
+
cornerdrop_tax_amount: null
|
| 298 |
+
base_cornerdrop_tax_amount: null
|
| 299 |
+
sales_flat_creditmemo_grid:
|
| 300 |
+
-
|
| 301 |
+
entity_id: 1
|
| 302 |
+
store_id: 1
|
| 303 |
+
store_to_order_rate: 1
|
| 304 |
+
base_to_order_rate: 1
|
| 305 |
+
grand_total: 315.09
|
| 306 |
+
store_to_base_rate: 1
|
| 307 |
+
base_to_global_rate: 1
|
| 308 |
+
base_grand_total: 315.09
|
| 309 |
+
order_id: 187
|
| 310 |
+
creditmemo_status: null
|
| 311 |
+
state: 2
|
| 312 |
+
invoice_id: null
|
| 313 |
+
store_currency_code: USD
|
| 314 |
+
order_currency_code: USD
|
| 315 |
+
base_currency_code: USD
|
| 316 |
+
global_currency_code: USD
|
| 317 |
+
increment_id: 100000005
|
| 318 |
+
order_increment_id: 100000206
|
| 319 |
+
created_at: 2013-05-29 14:38:28
|
| 320 |
+
order_created_at: 2013-05-29 02:28:25
|
| 321 |
+
billing_name: John Doe
|
| 322 |
+
sales_flat_creditmemo_item:
|
| 323 |
+
-
|
| 324 |
+
entity_id: 1
|
| 325 |
+
parent_id: 1
|
| 326 |
+
base_price: 280
|
| 327 |
+
tax_amount: 24.99
|
| 328 |
+
base_row_total: 280
|
| 329 |
+
discount_amount: 2.42
|
| 330 |
+
row_total: 280
|
| 331 |
+
base_discount_amount: 2.42
|
| 332 |
+
price_incl_tax: 305.2
|
| 333 |
+
base_tax_amount: 24.99
|
| 334 |
+
base_price_incl_tax: 305.2
|
| 335 |
+
qty: 1
|
| 336 |
+
base_cost: null
|
| 337 |
+
price: 280
|
| 338 |
+
base_row_total_incl_tax: 305.2
|
| 339 |
+
row_total_incl_tax: 305.2
|
| 340 |
+
product_id: 422
|
| 341 |
+
order_item_id: 1
|
| 342 |
+
additional_data: null
|
| 343 |
+
description: null
|
| 344 |
+
sku: acj00124
|
| 345 |
+
name: Pearl Strand Necklace
|
| 346 |
+
hidden_tax_amount: 0
|
| 347 |
+
base_hidden_tax_amount: 0
|
| 348 |
+
weee_tax_disposition: 0
|
| 349 |
+
weee_tax_row_disposition: 0
|
| 350 |
+
base_weee_tax_disposition: 0
|
| 351 |
+
base_weee_tax_row_disposition: 0
|
| 352 |
+
weee_tax_applied: a:0:{}
|
| 353 |
+
base_weee_tax_applied_amount: 0
|
| 354 |
+
base_weee_tax_applied_row_amnt: 0
|
| 355 |
+
weee_tax_applied_amount: 0
|
| 356 |
+
weee_tax_applied_row_amount: 0
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Sales_Order_Invoice_Total_CornerDrop_Fee extends EcomDev_PHPUnit_Test_Case {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Test the CornerDrop fee is added with tax.
|
| 7 |
+
*
|
| 8 |
+
* @test
|
| 9 |
+
* @loadFixture
|
| 10 |
+
*/
|
| 11 |
+
public function testCornerDropFeeAddedWithTax() {
|
| 12 |
+
$order = Mage::getModel("sales/order")->load(1);
|
| 13 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
|
| 14 |
+
|
| 15 |
+
$this->assertEquals(10, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT));
|
| 16 |
+
$this->assertEquals(10, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT));
|
| 17 |
+
$this->assertEquals(1, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX));
|
| 18 |
+
$this->assertEquals(1, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Test the CornerDrop fee is added without tax.
|
| 23 |
+
*
|
| 24 |
+
* @test
|
| 25 |
+
* @loadFixture
|
| 26 |
+
*/
|
| 27 |
+
public function testCornerDropFeeAddedWithNoTax() {
|
| 28 |
+
$order = Mage::getModel("sales/order")->load(1);
|
| 29 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
|
| 30 |
+
|
| 31 |
+
$this->assertEquals(10, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT));
|
| 32 |
+
$this->assertEquals(10, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT));
|
| 33 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX));
|
| 34 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX));
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Check the CornerDrop Fee is not added to the invoice
|
| 39 |
+
* if the order is not a CornerDrop order.
|
| 40 |
+
*
|
| 41 |
+
* @test
|
| 42 |
+
* @loadFixture
|
| 43 |
+
*/
|
| 44 |
+
public function testCornerDropFeeNotAdded() {
|
| 45 |
+
$order = Mage::getModel("sales/order")->load(1);
|
| 46 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
|
| 47 |
+
|
| 48 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT));
|
| 49 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT));
|
| 50 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX));
|
| 51 |
+
$this->assertEquals(0, $invoice->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX));
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithNoTax.yaml
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 1
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 1
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: new
|
| 22 |
+
status: pending
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: f0947e
|
| 25 |
+
shipping_description: Free Shipping - Free
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: null
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 415.94
|
| 34 |
+
base_shipping_amount: 0
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: null
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 375
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: null
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 30.94
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: null
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: null
|
| 52 |
+
base_total_invoiced_cost: null
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: null
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: null
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 415.94
|
| 63 |
+
shipping_amount: 0
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: null
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 375
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: null
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 30.94
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: null
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: null
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: null
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 1
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 703
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 405.94
|
| 105 |
+
base_total_due: null
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 405.94
|
| 109 |
+
total_due: null
|
| 110 |
+
weight: 1
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 145000019
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: GBP
|
| 115 |
+
customer_email: test@example.com
|
| 116 |
+
customer_firstname: Test
|
| 117 |
+
customer_lastname: Tester
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: GBP
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: GBP
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: freeshipping_freeshipping
|
| 136 |
+
store_currency_code: GBP
|
| 137 |
+
store_name: "Main Website\nMadison Island\nEnglish"
|
| 138 |
+
x_forwarded_for: null
|
| 139 |
+
customer_note: null
|
| 140 |
+
created_at: 2015-04-21 15:46:15
|
| 141 |
+
updated_at: 2015-04-21 15:46:15
|
| 142 |
+
total_item_count: 1
|
| 143 |
+
customer_gender: null
|
| 144 |
+
hidden_tax_amount: 0
|
| 145 |
+
base_hidden_tax_amount: 0
|
| 146 |
+
shipping_hidden_tax_amount: 0
|
| 147 |
+
base_shipping_hidden_tax_amnt: 0
|
| 148 |
+
hidden_tax_invoiced: null
|
| 149 |
+
base_hidden_tax_invoiced: null
|
| 150 |
+
hidden_tax_refunded: null
|
| 151 |
+
base_hidden_tax_refunded: null
|
| 152 |
+
shipping_incl_tax: 0
|
| 153 |
+
base_shipping_incl_tax: 0
|
| 154 |
+
coupon_rule_name: null
|
| 155 |
+
paypal_ipn_customer_notified: 0
|
| 156 |
+
gift_message_id: null
|
| 157 |
+
base_customer_balance_amount: null
|
| 158 |
+
customer_balance_amount: null
|
| 159 |
+
base_customer_balance_invoiced: null
|
| 160 |
+
customer_balance_invoiced: null
|
| 161 |
+
base_customer_balance_refunded: null
|
| 162 |
+
customer_balance_refunded: null
|
| 163 |
+
bs_customer_bal_total_refunded: null
|
| 164 |
+
customer_bal_total_refunded: null
|
| 165 |
+
gift_cards: null
|
| 166 |
+
base_gift_cards_amount: null
|
| 167 |
+
gift_cards_amount: null
|
| 168 |
+
base_gift_cards_invoiced: null
|
| 169 |
+
gift_cards_invoiced: null
|
| 170 |
+
base_gift_cards_refunded: null
|
| 171 |
+
gift_cards_refunded: null
|
| 172 |
+
gw_id: null
|
| 173 |
+
gw_allow_gift_receipt: null
|
| 174 |
+
gw_add_card: null
|
| 175 |
+
gw_base_price: null
|
| 176 |
+
gw_price: null
|
| 177 |
+
gw_items_base_price: null
|
| 178 |
+
gw_items_price: null
|
| 179 |
+
gw_card_base_price: null
|
| 180 |
+
gw_card_price: null
|
| 181 |
+
gw_base_tax_amount: null
|
| 182 |
+
gw_tax_amount: null
|
| 183 |
+
gw_items_base_tax_amount: null
|
| 184 |
+
gw_items_tax_amount: null
|
| 185 |
+
gw_card_base_tax_amount: null
|
| 186 |
+
gw_card_tax_amount: null
|
| 187 |
+
gw_base_price_invoiced: null
|
| 188 |
+
gw_price_invoiced: null
|
| 189 |
+
gw_items_base_price_invoiced: null
|
| 190 |
+
gw_items_price_invoiced: null
|
| 191 |
+
gw_card_base_price_invoiced: null
|
| 192 |
+
gw_card_price_invoiced: null
|
| 193 |
+
gw_base_tax_amount_invoiced: null
|
| 194 |
+
gw_tax_amount_invoiced: null
|
| 195 |
+
gw_items_base_tax_invoiced: null
|
| 196 |
+
gw_items_tax_invoiced: null
|
| 197 |
+
gw_card_base_tax_invoiced: null
|
| 198 |
+
gw_card_tax_invoiced: null
|
| 199 |
+
gw_base_price_refunded: null
|
| 200 |
+
gw_price_refunded: null
|
| 201 |
+
gw_items_base_price_refunded: null
|
| 202 |
+
gw_items_price_refunded: null
|
| 203 |
+
gw_card_base_price_refunded: null
|
| 204 |
+
gw_card_price_refunded: null
|
| 205 |
+
gw_base_tax_amount_refunded: null
|
| 206 |
+
gw_tax_amount_refunded: null
|
| 207 |
+
gw_items_base_tax_refunded: null
|
| 208 |
+
gw_items_tax_refunded: null
|
| 209 |
+
gw_card_base_tax_refunded: null
|
| 210 |
+
gw_card_tax_refunded: null
|
| 211 |
+
reward_points_balance: null
|
| 212 |
+
base_reward_currency_amount: null
|
| 213 |
+
reward_currency_amount: null
|
| 214 |
+
base_rwrd_crrncy_amt_invoiced: null
|
| 215 |
+
rwrd_currency_amount_invoiced: null
|
| 216 |
+
base_rwrd_crrncy_amnt_refnded: null
|
| 217 |
+
rwrd_crrncy_amnt_refunded: null
|
| 218 |
+
reward_points_balance_refund: null
|
| 219 |
+
reward_points_balance_refunded: null
|
| 220 |
+
reward_salesrule_points: null
|
| 221 |
+
cornerdrop_fee_amount: 10
|
| 222 |
+
base_cornerdrop_fee_amount: 10
|
| 223 |
+
cornerdrop_tax_amount: null
|
| 224 |
+
base_cornerdrop_tax_amount: null
|
| 225 |
+
sales_flat_order_address:
|
| 226 |
+
-
|
| 227 |
+
entity_id: 1
|
| 228 |
+
parent_id: 1
|
| 229 |
+
customer_address_id: null
|
| 230 |
+
quote_address_id: null
|
| 231 |
+
region_id: 12
|
| 232 |
+
customer_id: null
|
| 233 |
+
fax: null
|
| 234 |
+
region: California
|
| 235 |
+
postcode: 90210
|
| 236 |
+
lastname: Tester
|
| 237 |
+
street: 123 Test St
|
| 238 |
+
city: Test
|
| 239 |
+
email: test@example.com
|
| 240 |
+
telephone: 11231231234
|
| 241 |
+
country_id: US
|
| 242 |
+
firstname: Test
|
| 243 |
+
address_type: billing
|
| 244 |
+
prefix: null
|
| 245 |
+
middlename: null
|
| 246 |
+
suffix: null
|
| 247 |
+
company: null
|
| 248 |
+
vat_id: null
|
| 249 |
+
vat_is_valid: null
|
| 250 |
+
vat_request_id: null
|
| 251 |
+
vat_request_date: null
|
| 252 |
+
vat_request_success: null
|
| 253 |
+
giftregistry_item_id: null
|
| 254 |
+
is_cornerdrop_collect: null
|
| 255 |
+
-
|
| 256 |
+
entity_id: 2
|
| 257 |
+
parent_id: 1
|
| 258 |
+
customer_address_id: null
|
| 259 |
+
quote_address_id: null
|
| 260 |
+
region_id: 12
|
| 261 |
+
customer_id: null
|
| 262 |
+
fax: null
|
| 263 |
+
region: California
|
| 264 |
+
postcode: 90210
|
| 265 |
+
lastname: Tester
|
| 266 |
+
street: 123 Test St
|
| 267 |
+
city: Test
|
| 268 |
+
email: null
|
| 269 |
+
telephone: 11231231234
|
| 270 |
+
country_id: US
|
| 271 |
+
firstname: Test
|
| 272 |
+
address_type: shipping
|
| 273 |
+
prefix: null
|
| 274 |
+
middlename: null
|
| 275 |
+
suffix: null
|
| 276 |
+
company: null
|
| 277 |
+
vat_id: null
|
| 278 |
+
vat_is_valid: null
|
| 279 |
+
vat_request_id: null
|
| 280 |
+
vat_request_date: null
|
| 281 |
+
vat_request_success: null
|
| 282 |
+
giftregistry_item_id: null
|
| 283 |
+
is_cornerdrop_collect: 1
|
| 284 |
+
sales_flat_order_item:
|
| 285 |
+
-
|
| 286 |
+
item_id: 1
|
| 287 |
+
order_id: 1
|
| 288 |
+
parent_item_id: null
|
| 289 |
+
quote_item_id: 1
|
| 290 |
+
store_id: 1
|
| 291 |
+
created_at: 2015-04-21 15:46:15
|
| 292 |
+
updated_at: 2015-04-21 15:46:15
|
| 293 |
+
product_id: 1
|
| 294 |
+
product_type: simple
|
| 295 |
+
product_options: a:6:{s:15:"info_buyRequest";a:7:{s:4:"uenc";s:132:"aHR0cDovL3NreXdhcnAubG9jYWwvbWVhbmJlZS9jb3JuZXJkcm9wL2FjY2Vzc29yaWVzL3Nob2VzL3dpbmd0aXAtY29nbmFjLW94Zm9yZC01NTQuaHRtbD9fX19TSUQ9VQ,,";s:7:"product";s:3:"434";s:8:"form_key";s:16:"XiBqoVMM5jyZzUXw";s:15:"related_product";s:0:"";s:15:"super_attribute";a:2:{i:92;s:2:"19";i:186;s:3:"100";}s:3:"qty";s:1:"1";s:10:"return_url";s:0:"";}s:15:"attributes_info";a:2:{i:0;a:2:{s:5:"label";s:5:"Color";s:5:"value";s:6:"Cognac";}i:1;a:2:{s:5:"label";s:9:"Shoe size";s:5:"value";s:1:"8";}}s:11:"simple_name";s:21:"Wingtip Cognac Oxford";s:10:"simple_sku";s:6:"ams005";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;}
|
| 296 |
+
weight: 1
|
| 297 |
+
is_virtual: 0
|
| 298 |
+
sku: ams005
|
| 299 |
+
name: Wingtip Cognac Oxford
|
| 300 |
+
description: null
|
| 301 |
+
applied_rule_ids: null
|
| 302 |
+
additional_data: null
|
| 303 |
+
free_shipping: 0
|
| 304 |
+
is_qty_decimal: 0
|
| 305 |
+
no_discount: 0
|
| 306 |
+
qty_backordered: null
|
| 307 |
+
qty_canceled: 0
|
| 308 |
+
qty_invoiced: 0
|
| 309 |
+
qty_ordered: 1
|
| 310 |
+
qty_refunded: 0
|
| 311 |
+
qty_shipped: 0
|
| 312 |
+
base_cost: null
|
| 313 |
+
price: 375
|
| 314 |
+
base_price: 375
|
| 315 |
+
original_price: 375
|
| 316 |
+
base_original_price: 375
|
| 317 |
+
tax_percent: 8.25
|
| 318 |
+
tax_amount: 30.94
|
| 319 |
+
base_tax_amount: 30.94
|
| 320 |
+
tax_invoiced: 0
|
| 321 |
+
base_tax_invoiced: 0
|
| 322 |
+
discount_percent: 0
|
| 323 |
+
discount_amount: 0
|
| 324 |
+
base_discount_amount: 0
|
| 325 |
+
discount_invoiced: 0
|
| 326 |
+
base_discount_invoiced: 0
|
| 327 |
+
amount_refunded: 0
|
| 328 |
+
base_amount_refunded: 0
|
| 329 |
+
row_total: 375
|
| 330 |
+
base_row_total: 375
|
| 331 |
+
row_invoiced: 0
|
| 332 |
+
base_row_invoiced: 0
|
| 333 |
+
row_weight: 1
|
| 334 |
+
base_tax_before_discount: null
|
| 335 |
+
tax_before_discount: null
|
| 336 |
+
ext_order_item_id: null
|
| 337 |
+
locked_do_invoice: null
|
| 338 |
+
locked_do_ship: null
|
| 339 |
+
price_incl_tax: 405.94
|
| 340 |
+
base_price_incl_tax: 405.94
|
| 341 |
+
row_total_incl_tax: 405.94
|
| 342 |
+
base_row_total_incl_tax: 405.94
|
| 343 |
+
hidden_tax_amount: 0
|
| 344 |
+
base_hidden_tax_amount: 0
|
| 345 |
+
hidden_tax_invoiced: null
|
| 346 |
+
base_hidden_tax_invoiced: null
|
| 347 |
+
hidden_tax_refunded: null
|
| 348 |
+
base_hidden_tax_refunded: null
|
| 349 |
+
is_nominal: 0
|
| 350 |
+
tax_canceled: null
|
| 351 |
+
hidden_tax_canceled: null
|
| 352 |
+
tax_refunded: null
|
| 353 |
+
base_tax_refunded: null
|
| 354 |
+
discount_refunded: null
|
| 355 |
+
base_discount_refunded: null
|
| 356 |
+
gift_message_id: null
|
| 357 |
+
gift_message_available: 1
|
| 358 |
+
base_weee_tax_applied_amount: 0
|
| 359 |
+
base_weee_tax_applied_row_amnt: 0
|
| 360 |
+
weee_tax_applied_amount: 0
|
| 361 |
+
weee_tax_applied_row_amount: 0
|
| 362 |
+
weee_tax_applied: a:0:{}
|
| 363 |
+
weee_tax_disposition: 0
|
| 364 |
+
weee_tax_row_disposition: 0
|
| 365 |
+
base_weee_tax_disposition: 0
|
| 366 |
+
base_weee_tax_row_disposition: 0
|
| 367 |
+
event_id: null
|
| 368 |
+
giftregistry_item_id: null
|
| 369 |
+
gw_id: null
|
| 370 |
+
gw_base_price: null
|
| 371 |
+
gw_price: null
|
| 372 |
+
gw_base_tax_amount: null
|
| 373 |
+
gw_tax_amount: null
|
| 374 |
+
gw_base_price_invoiced: null
|
| 375 |
+
gw_price_invoiced: null
|
| 376 |
+
gw_base_tax_amount_invoiced: null
|
| 377 |
+
gw_tax_amount_invoiced: null
|
| 378 |
+
gw_base_price_refunded: null
|
| 379 |
+
gw_price_refunded: null
|
| 380 |
+
gw_base_tax_amount_refunded: null
|
| 381 |
+
gw_tax_amount_refunded: null
|
| 382 |
+
qty_returned: 0
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithTax.yaml
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 0
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 1
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: new
|
| 22 |
+
status: pending
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: f0947e
|
| 25 |
+
shipping_description: Free Shipping - Free
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: null
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 415.94
|
| 34 |
+
base_shipping_amount: 0
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: null
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 375
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: null
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 30.94
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: null
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: null
|
| 52 |
+
base_total_invoiced_cost: null
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: null
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: null
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 415.94
|
| 63 |
+
shipping_amount: 0
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: null
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 375
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: null
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 30.94
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: null
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: null
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: null
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 1
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 703
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 405.94
|
| 105 |
+
base_total_due: null
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 405.94
|
| 109 |
+
total_due: null
|
| 110 |
+
weight: 1
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 145000019
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: GBP
|
| 115 |
+
customer_email: test@example.com
|
| 116 |
+
customer_firstname: Test
|
| 117 |
+
customer_lastname: Tester
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: GBP
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: GBP
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: freeshipping_freeshipping
|
| 136 |
+
store_currency_code: GBP
|
| 137 |
+
store_name: "Main Website\nMadison Island\nEnglish"
|
| 138 |
+
x_forwarded_for: null
|
| 139 |
+
customer_note: null
|
| 140 |
+
created_at: 2015-04-21 15:46:15
|
| 141 |
+
updated_at: 2015-04-21 15:46:15
|
| 142 |
+
total_item_count: 1
|
| 143 |
+
customer_gender: null
|
| 144 |
+
hidden_tax_amount: 0
|
| 145 |
+
base_hidden_tax_amount: 0
|
| 146 |
+
shipping_hidden_tax_amount: 0
|
| 147 |
+
base_shipping_hidden_tax_amnt: 0
|
| 148 |
+
hidden_tax_invoiced: null
|
| 149 |
+
base_hidden_tax_invoiced: null
|
| 150 |
+
hidden_tax_refunded: null
|
| 151 |
+
base_hidden_tax_refunded: null
|
| 152 |
+
shipping_incl_tax: 0
|
| 153 |
+
base_shipping_incl_tax: 0
|
| 154 |
+
coupon_rule_name: null
|
| 155 |
+
paypal_ipn_customer_notified: 0
|
| 156 |
+
gift_message_id: null
|
| 157 |
+
base_customer_balance_amount: null
|
| 158 |
+
customer_balance_amount: null
|
| 159 |
+
base_customer_balance_invoiced: null
|
| 160 |
+
customer_balance_invoiced: null
|
| 161 |
+
base_customer_balance_refunded: null
|
| 162 |
+
customer_balance_refunded: null
|
| 163 |
+
bs_customer_bal_total_refunded: null
|
| 164 |
+
customer_bal_total_refunded: null
|
| 165 |
+
gift_cards: null
|
| 166 |
+
base_gift_cards_amount: null
|
| 167 |
+
gift_cards_amount: null
|
| 168 |
+
base_gift_cards_invoiced: null
|
| 169 |
+
gift_cards_invoiced: null
|
| 170 |
+
base_gift_cards_refunded: null
|
| 171 |
+
gift_cards_refunded: null
|
| 172 |
+
gw_id: null
|
| 173 |
+
gw_allow_gift_receipt: null
|
| 174 |
+
gw_add_card: null
|
| 175 |
+
gw_base_price: null
|
| 176 |
+
gw_price: null
|
| 177 |
+
gw_items_base_price: null
|
| 178 |
+
gw_items_price: null
|
| 179 |
+
gw_card_base_price: null
|
| 180 |
+
gw_card_price: null
|
| 181 |
+
gw_base_tax_amount: null
|
| 182 |
+
gw_tax_amount: null
|
| 183 |
+
gw_items_base_tax_amount: null
|
| 184 |
+
gw_items_tax_amount: null
|
| 185 |
+
gw_card_base_tax_amount: null
|
| 186 |
+
gw_card_tax_amount: null
|
| 187 |
+
gw_base_price_invoiced: null
|
| 188 |
+
gw_price_invoiced: null
|
| 189 |
+
gw_items_base_price_invoiced: null
|
| 190 |
+
gw_items_price_invoiced: null
|
| 191 |
+
gw_card_base_price_invoiced: null
|
| 192 |
+
gw_card_price_invoiced: null
|
| 193 |
+
gw_base_tax_amount_invoiced: null
|
| 194 |
+
gw_tax_amount_invoiced: null
|
| 195 |
+
gw_items_base_tax_invoiced: null
|
| 196 |
+
gw_items_tax_invoiced: null
|
| 197 |
+
gw_card_base_tax_invoiced: null
|
| 198 |
+
gw_card_tax_invoiced: null
|
| 199 |
+
gw_base_price_refunded: null
|
| 200 |
+
gw_price_refunded: null
|
| 201 |
+
gw_items_base_price_refunded: null
|
| 202 |
+
gw_items_price_refunded: null
|
| 203 |
+
gw_card_base_price_refunded: null
|
| 204 |
+
gw_card_price_refunded: null
|
| 205 |
+
gw_base_tax_amount_refunded: null
|
| 206 |
+
gw_tax_amount_refunded: null
|
| 207 |
+
gw_items_base_tax_refunded: null
|
| 208 |
+
gw_items_tax_refunded: null
|
| 209 |
+
gw_card_base_tax_refunded: null
|
| 210 |
+
gw_card_tax_refunded: null
|
| 211 |
+
reward_points_balance: null
|
| 212 |
+
base_reward_currency_amount: null
|
| 213 |
+
reward_currency_amount: null
|
| 214 |
+
base_rwrd_crrncy_amt_invoiced: null
|
| 215 |
+
rwrd_currency_amount_invoiced: null
|
| 216 |
+
base_rwrd_crrncy_amnt_refnded: null
|
| 217 |
+
rwrd_crrncy_amnt_refunded: null
|
| 218 |
+
reward_points_balance_refund: null
|
| 219 |
+
reward_points_balance_refunded: null
|
| 220 |
+
reward_salesrule_points: null
|
| 221 |
+
cornerdrop_fee_amount: 10
|
| 222 |
+
base_cornerdrop_fee_amount: 10
|
| 223 |
+
cornerdrop_tax_amount: 1
|
| 224 |
+
base_cornerdrop_tax_amount: 1
|
| 225 |
+
sales_flat_order_address:
|
| 226 |
+
-
|
| 227 |
+
entity_id: 1
|
| 228 |
+
parent_id: 1
|
| 229 |
+
customer_address_id: null
|
| 230 |
+
quote_address_id: null
|
| 231 |
+
region_id: 12
|
| 232 |
+
customer_id: null
|
| 233 |
+
fax: null
|
| 234 |
+
region: California
|
| 235 |
+
postcode: 90210
|
| 236 |
+
lastname: Tester
|
| 237 |
+
street: 123 Test St
|
| 238 |
+
city: Test
|
| 239 |
+
email: test@example.com
|
| 240 |
+
telephone: 11231231234
|
| 241 |
+
country_id: US
|
| 242 |
+
firstname: Test
|
| 243 |
+
address_type: billing
|
| 244 |
+
prefix: null
|
| 245 |
+
middlename: null
|
| 246 |
+
suffix: null
|
| 247 |
+
company: null
|
| 248 |
+
vat_id: null
|
| 249 |
+
vat_is_valid: null
|
| 250 |
+
vat_request_id: null
|
| 251 |
+
vat_request_date: null
|
| 252 |
+
vat_request_success: null
|
| 253 |
+
giftregistry_item_id: null
|
| 254 |
+
is_cornerdrop_collect: null
|
| 255 |
+
-
|
| 256 |
+
entity_id: 2
|
| 257 |
+
parent_id: 1
|
| 258 |
+
customer_address_id: null
|
| 259 |
+
quote_address_id: null
|
| 260 |
+
region_id: 12
|
| 261 |
+
customer_id: null
|
| 262 |
+
fax: null
|
| 263 |
+
region: California
|
| 264 |
+
postcode: 90210
|
| 265 |
+
lastname: Tester
|
| 266 |
+
street: 123 Test St
|
| 267 |
+
city: Test
|
| 268 |
+
email: null
|
| 269 |
+
telephone: 11231231234
|
| 270 |
+
country_id: US
|
| 271 |
+
firstname: Test
|
| 272 |
+
address_type: shipping
|
| 273 |
+
prefix: null
|
| 274 |
+
middlename: null
|
| 275 |
+
suffix: null
|
| 276 |
+
company: null
|
| 277 |
+
vat_id: null
|
| 278 |
+
vat_is_valid: null
|
| 279 |
+
vat_request_id: null
|
| 280 |
+
vat_request_date: null
|
| 281 |
+
vat_request_success: null
|
| 282 |
+
giftregistry_item_id: null
|
| 283 |
+
is_cornerdrop_collect: 1
|
| 284 |
+
sales_flat_order_item:
|
| 285 |
+
-
|
| 286 |
+
item_id: 1
|
| 287 |
+
order_id: 1
|
| 288 |
+
parent_item_id: null
|
| 289 |
+
quote_item_id: 1
|
| 290 |
+
store_id: 1
|
| 291 |
+
created_at: 2015-04-21 15:46:15
|
| 292 |
+
updated_at: 2015-04-21 15:46:15
|
| 293 |
+
product_id: 1
|
| 294 |
+
product_type: simple
|
| 295 |
+
product_options: a:6:{s:15:"info_buyRequest";a:7:{s:4:"uenc";s:132:"aHR0cDovL3NreXdhcnAubG9jYWwvbWVhbmJlZS9jb3JuZXJkcm9wL2FjY2Vzc29yaWVzL3Nob2VzL3dpbmd0aXAtY29nbmFjLW94Zm9yZC01NTQuaHRtbD9fX19TSUQ9VQ,,";s:7:"product";s:3:"434";s:8:"form_key";s:16:"XiBqoVMM5jyZzUXw";s:15:"related_product";s:0:"";s:15:"super_attribute";a:2:{i:92;s:2:"19";i:186;s:3:"100";}s:3:"qty";s:1:"1";s:10:"return_url";s:0:"";}s:15:"attributes_info";a:2:{i:0;a:2:{s:5:"label";s:5:"Color";s:5:"value";s:6:"Cognac";}i:1;a:2:{s:5:"label";s:9:"Shoe size";s:5:"value";s:1:"8";}}s:11:"simple_name";s:21:"Wingtip Cognac Oxford";s:10:"simple_sku";s:6:"ams005";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;}
|
| 296 |
+
weight: 1
|
| 297 |
+
is_virtual: 0
|
| 298 |
+
sku: ams005
|
| 299 |
+
name: Wingtip Cognac Oxford
|
| 300 |
+
description: null
|
| 301 |
+
applied_rule_ids: null
|
| 302 |
+
additional_data: null
|
| 303 |
+
free_shipping: 0
|
| 304 |
+
is_qty_decimal: 0
|
| 305 |
+
no_discount: 0
|
| 306 |
+
qty_backordered: null
|
| 307 |
+
qty_canceled: 0
|
| 308 |
+
qty_invoiced: 0
|
| 309 |
+
qty_ordered: 1
|
| 310 |
+
qty_refunded: 0
|
| 311 |
+
qty_shipped: 0
|
| 312 |
+
base_cost: null
|
| 313 |
+
price: 375
|
| 314 |
+
base_price: 375
|
| 315 |
+
original_price: 375
|
| 316 |
+
base_original_price: 375
|
| 317 |
+
tax_percent: 8.25
|
| 318 |
+
tax_amount: 30.94
|
| 319 |
+
base_tax_amount: 30.94
|
| 320 |
+
tax_invoiced: 0
|
| 321 |
+
base_tax_invoiced: 0
|
| 322 |
+
discount_percent: 0
|
| 323 |
+
discount_amount: 0
|
| 324 |
+
base_discount_amount: 0
|
| 325 |
+
discount_invoiced: 0
|
| 326 |
+
base_discount_invoiced: 0
|
| 327 |
+
amount_refunded: 0
|
| 328 |
+
base_amount_refunded: 0
|
| 329 |
+
row_total: 375
|
| 330 |
+
base_row_total: 375
|
| 331 |
+
row_invoiced: 0
|
| 332 |
+
base_row_invoiced: 0
|
| 333 |
+
row_weight: 1
|
| 334 |
+
base_tax_before_discount: null
|
| 335 |
+
tax_before_discount: null
|
| 336 |
+
ext_order_item_id: null
|
| 337 |
+
locked_do_invoice: null
|
| 338 |
+
locked_do_ship: null
|
| 339 |
+
price_incl_tax: 405.94
|
| 340 |
+
base_price_incl_tax: 405.94
|
| 341 |
+
row_total_incl_tax: 405.94
|
| 342 |
+
base_row_total_incl_tax: 405.94
|
| 343 |
+
hidden_tax_amount: 0
|
| 344 |
+
base_hidden_tax_amount: 0
|
| 345 |
+
hidden_tax_invoiced: null
|
| 346 |
+
base_hidden_tax_invoiced: null
|
| 347 |
+
hidden_tax_refunded: null
|
| 348 |
+
base_hidden_tax_refunded: null
|
| 349 |
+
is_nominal: 0
|
| 350 |
+
tax_canceled: null
|
| 351 |
+
hidden_tax_canceled: null
|
| 352 |
+
tax_refunded: null
|
| 353 |
+
base_tax_refunded: null
|
| 354 |
+
discount_refunded: null
|
| 355 |
+
base_discount_refunded: null
|
| 356 |
+
gift_message_id: null
|
| 357 |
+
gift_message_available: 1
|
| 358 |
+
base_weee_tax_applied_amount: 0
|
| 359 |
+
base_weee_tax_applied_row_amnt: 0
|
| 360 |
+
weee_tax_applied_amount: 0
|
| 361 |
+
weee_tax_applied_row_amount: 0
|
| 362 |
+
weee_tax_applied: a:0:{}
|
| 363 |
+
weee_tax_disposition: 0
|
| 364 |
+
weee_tax_row_disposition: 0
|
| 365 |
+
base_weee_tax_disposition: 0
|
| 366 |
+
base_weee_tax_row_disposition: 0
|
| 367 |
+
event_id: null
|
| 368 |
+
giftregistry_item_id: null
|
| 369 |
+
gw_id: null
|
| 370 |
+
gw_base_price: null
|
| 371 |
+
gw_price: null
|
| 372 |
+
gw_base_tax_amount: null
|
| 373 |
+
gw_tax_amount: null
|
| 374 |
+
gw_base_price_invoiced: null
|
| 375 |
+
gw_price_invoiced: null
|
| 376 |
+
gw_base_tax_amount_invoiced: null
|
| 377 |
+
gw_tax_amount_invoiced: null
|
| 378 |
+
gw_base_price_refunded: null
|
| 379 |
+
gw_price_refunded: null
|
| 380 |
+
gw_base_tax_amount_refunded: null
|
| 381 |
+
gw_tax_amount_refunded: null
|
| 382 |
+
qty_returned: 0
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Order/Invoice/Total/CornerDrop/Fee/fixtures/testCornerDropFeeNotAdded.yaml
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 0
|
| 3 |
+
default/cornerdrop_collect/fee_settings/include_tax: 1
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
eav:
|
| 6 |
+
catalog_product:
|
| 7 |
+
-
|
| 8 |
+
entity_id: 1
|
| 9 |
+
entity_type_id: 4
|
| 10 |
+
attribute_set_id: 4
|
| 11 |
+
type_id: simple
|
| 12 |
+
sku: CDTP
|
| 13 |
+
has_options: 0
|
| 14 |
+
required_options: 0
|
| 15 |
+
created_at: 2015-04-20 10:12:06
|
| 16 |
+
updated_at: 2015-04-20 10:13:06
|
| 17 |
+
tables:
|
| 18 |
+
sales_flat_order:
|
| 19 |
+
-
|
| 20 |
+
entity_id: 1
|
| 21 |
+
state: new
|
| 22 |
+
status: pending
|
| 23 |
+
coupon_code: null
|
| 24 |
+
protect_code: f0947e
|
| 25 |
+
shipping_description: Free Shipping - Free
|
| 26 |
+
is_virtual: 0
|
| 27 |
+
store_id: 1
|
| 28 |
+
customer_id: null
|
| 29 |
+
base_discount_amount: 0
|
| 30 |
+
base_discount_canceled: null
|
| 31 |
+
base_discount_invoiced: null
|
| 32 |
+
base_discount_refunded: null
|
| 33 |
+
base_grand_total: 415.94
|
| 34 |
+
base_shipping_amount: 0
|
| 35 |
+
base_shipping_canceled: null
|
| 36 |
+
base_shipping_invoiced: null
|
| 37 |
+
base_shipping_refunded: null
|
| 38 |
+
base_shipping_tax_amount: 0
|
| 39 |
+
base_shipping_tax_refunded: null
|
| 40 |
+
base_subtotal: 375
|
| 41 |
+
base_subtotal_canceled: null
|
| 42 |
+
base_subtotal_invoiced: null
|
| 43 |
+
base_subtotal_refunded: null
|
| 44 |
+
base_tax_amount: 30.94
|
| 45 |
+
base_tax_canceled: null
|
| 46 |
+
base_tax_invoiced: null
|
| 47 |
+
base_tax_refunded: null
|
| 48 |
+
base_to_global_rate: 1
|
| 49 |
+
base_to_order_rate: 1
|
| 50 |
+
base_total_canceled: null
|
| 51 |
+
base_total_invoiced: null
|
| 52 |
+
base_total_invoiced_cost: null
|
| 53 |
+
base_total_offline_refunded: null
|
| 54 |
+
base_total_online_refunded: null
|
| 55 |
+
base_total_paid: null
|
| 56 |
+
base_total_qty_ordered: null
|
| 57 |
+
base_total_refunded: null
|
| 58 |
+
discount_amount: 0
|
| 59 |
+
discount_canceled: null
|
| 60 |
+
discount_invoiced: null
|
| 61 |
+
discount_refunded: null
|
| 62 |
+
grand_total: 415.94
|
| 63 |
+
shipping_amount: 0
|
| 64 |
+
shipping_canceled: null
|
| 65 |
+
shipping_invoiced: null
|
| 66 |
+
shipping_refunded: null
|
| 67 |
+
shipping_tax_amount: 0
|
| 68 |
+
shipping_tax_refunded: null
|
| 69 |
+
store_to_base_rate: 1
|
| 70 |
+
store_to_order_rate: 1
|
| 71 |
+
subtotal: 375
|
| 72 |
+
subtotal_canceled: null
|
| 73 |
+
subtotal_invoiced: null
|
| 74 |
+
subtotal_refunded: null
|
| 75 |
+
tax_amount: 30.94
|
| 76 |
+
tax_canceled: null
|
| 77 |
+
tax_invoiced: null
|
| 78 |
+
tax_refunded: null
|
| 79 |
+
total_canceled: null
|
| 80 |
+
total_invoiced: null
|
| 81 |
+
total_offline_refunded: null
|
| 82 |
+
total_online_refunded: null
|
| 83 |
+
total_paid: null
|
| 84 |
+
total_qty_ordered: 1
|
| 85 |
+
total_refunded: null
|
| 86 |
+
can_ship_partially: null
|
| 87 |
+
can_ship_partially_item: null
|
| 88 |
+
customer_is_guest: 1
|
| 89 |
+
customer_note_notify: 1
|
| 90 |
+
billing_address_id: 1
|
| 91 |
+
customer_group_id: 0
|
| 92 |
+
edit_increment: null
|
| 93 |
+
email_sent: 1
|
| 94 |
+
forced_shipment_with_invoice: null
|
| 95 |
+
payment_auth_expiration: null
|
| 96 |
+
quote_address_id: null
|
| 97 |
+
quote_id: 703
|
| 98 |
+
shipping_address_id: 2
|
| 99 |
+
adjustment_negative: null
|
| 100 |
+
adjustment_positive: null
|
| 101 |
+
base_adjustment_negative: null
|
| 102 |
+
base_adjustment_positive: null
|
| 103 |
+
base_shipping_discount_amount: 0
|
| 104 |
+
base_subtotal_incl_tax: 405.94
|
| 105 |
+
base_total_due: null
|
| 106 |
+
payment_authorization_amount: null
|
| 107 |
+
shipping_discount_amount: 0
|
| 108 |
+
subtotal_incl_tax: 405.94
|
| 109 |
+
total_due: null
|
| 110 |
+
weight: 1
|
| 111 |
+
customer_dob: null
|
| 112 |
+
increment_id: 145000019
|
| 113 |
+
applied_rule_ids: null
|
| 114 |
+
base_currency_code: GBP
|
| 115 |
+
customer_email: test@example.com
|
| 116 |
+
customer_firstname: Test
|
| 117 |
+
customer_lastname: Tester
|
| 118 |
+
customer_middlename: null
|
| 119 |
+
customer_prefix: null
|
| 120 |
+
customer_suffix: null
|
| 121 |
+
customer_taxvat: null
|
| 122 |
+
discount_description: null
|
| 123 |
+
ext_customer_id: null
|
| 124 |
+
ext_order_id: null
|
| 125 |
+
global_currency_code: GBP
|
| 126 |
+
hold_before_state: null
|
| 127 |
+
hold_before_status: null
|
| 128 |
+
order_currency_code: GBP
|
| 129 |
+
original_increment_id: null
|
| 130 |
+
relation_child_id: null
|
| 131 |
+
relation_child_real_id: null
|
| 132 |
+
relation_parent_id: null
|
| 133 |
+
relation_parent_real_id: null
|
| 134 |
+
remote_ip: 127.0.0.1
|
| 135 |
+
shipping_method: freeshipping_freeshipping
|
| 136 |
+
store_currency_code: GBP
|
| 137 |
+
store_name: "Main Website\nMadison Island\nEnglish"
|
| 138 |
+
x_forwarded_for: null
|
| 139 |
+
customer_note: null
|
| 140 |
+
created_at: 2015-04-21 15:46:15
|
| 141 |
+
updated_at: 2015-04-21 15:46:15
|
| 142 |
+
total_item_count: 1
|
| 143 |
+
customer_gender: null
|
| 144 |
+
hidden_tax_amount: 0
|
| 145 |
+
base_hidden_tax_amount: 0
|
| 146 |
+
shipping_hidden_tax_amount: 0
|
| 147 |
+
base_shipping_hidden_tax_amnt: 0
|
| 148 |
+
hidden_tax_invoiced: null
|
| 149 |
+
base_hidden_tax_invoiced: null
|
| 150 |
+
hidden_tax_refunded: null
|
| 151 |
+
base_hidden_tax_refunded: null
|
| 152 |
+
shipping_incl_tax: 0
|
| 153 |
+
base_shipping_incl_tax: 0
|
| 154 |
+
coupon_rule_name: null
|
| 155 |
+
paypal_ipn_customer_notified: 0
|
| 156 |
+
gift_message_id: null
|
| 157 |
+
base_customer_balance_amount: null
|
| 158 |
+
customer_balance_amount: null
|
| 159 |
+
base_customer_balance_invoiced: null
|
| 160 |
+
customer_balance_invoiced: null
|
| 161 |
+
base_customer_balance_refunded: null
|
| 162 |
+
customer_balance_refunded: null
|
| 163 |
+
bs_customer_bal_total_refunded: null
|
| 164 |
+
customer_bal_total_refunded: null
|
| 165 |
+
gift_cards: null
|
| 166 |
+
base_gift_cards_amount: null
|
| 167 |
+
gift_cards_amount: null
|
| 168 |
+
base_gift_cards_invoiced: null
|
| 169 |
+
gift_cards_invoiced: null
|
| 170 |
+
base_gift_cards_refunded: null
|
| 171 |
+
gift_cards_refunded: null
|
| 172 |
+
gw_id: null
|
| 173 |
+
gw_allow_gift_receipt: null
|
| 174 |
+
gw_add_card: null
|
| 175 |
+
gw_base_price: null
|
| 176 |
+
gw_price: null
|
| 177 |
+
gw_items_base_price: null
|
| 178 |
+
gw_items_price: null
|
| 179 |
+
gw_card_base_price: null
|
| 180 |
+
gw_card_price: null
|
| 181 |
+
gw_base_tax_amount: null
|
| 182 |
+
gw_tax_amount: null
|
| 183 |
+
gw_items_base_tax_amount: null
|
| 184 |
+
gw_items_tax_amount: null
|
| 185 |
+
gw_card_base_tax_amount: null
|
| 186 |
+
gw_card_tax_amount: null
|
| 187 |
+
gw_base_price_invoiced: null
|
| 188 |
+
gw_price_invoiced: null
|
| 189 |
+
gw_items_base_price_invoiced: null
|
| 190 |
+
gw_items_price_invoiced: null
|
| 191 |
+
gw_card_base_price_invoiced: null
|
| 192 |
+
gw_card_price_invoiced: null
|
| 193 |
+
gw_base_tax_amount_invoiced: null
|
| 194 |
+
gw_tax_amount_invoiced: null
|
| 195 |
+
gw_items_base_tax_invoiced: null
|
| 196 |
+
gw_items_tax_invoiced: null
|
| 197 |
+
gw_card_base_tax_invoiced: null
|
| 198 |
+
gw_card_tax_invoiced: null
|
| 199 |
+
gw_base_price_refunded: null
|
| 200 |
+
gw_price_refunded: null
|
| 201 |
+
gw_items_base_price_refunded: null
|
| 202 |
+
gw_items_price_refunded: null
|
| 203 |
+
gw_card_base_price_refunded: null
|
| 204 |
+
gw_card_price_refunded: null
|
| 205 |
+
gw_base_tax_amount_refunded: null
|
| 206 |
+
gw_tax_amount_refunded: null
|
| 207 |
+
gw_items_base_tax_refunded: null
|
| 208 |
+
gw_items_tax_refunded: null
|
| 209 |
+
gw_card_base_tax_refunded: null
|
| 210 |
+
gw_card_tax_refunded: null
|
| 211 |
+
reward_points_balance: null
|
| 212 |
+
base_reward_currency_amount: null
|
| 213 |
+
reward_currency_amount: null
|
| 214 |
+
base_rwrd_crrncy_amt_invoiced: null
|
| 215 |
+
rwrd_currency_amount_invoiced: null
|
| 216 |
+
base_rwrd_crrncy_amnt_refnded: null
|
| 217 |
+
rwrd_crrncy_amnt_refunded: null
|
| 218 |
+
reward_points_balance_refund: null
|
| 219 |
+
reward_points_balance_refunded: null
|
| 220 |
+
reward_salesrule_points: null
|
| 221 |
+
cornerdrop_fee_amount: 0
|
| 222 |
+
base_cornerdrop_fee_amount: 0
|
| 223 |
+
cornerdrop_tax_amount: null
|
| 224 |
+
base_cornerdrop_tax_amount: null
|
| 225 |
+
sales_flat_order_address:
|
| 226 |
+
-
|
| 227 |
+
entity_id: 1
|
| 228 |
+
parent_id: 1
|
| 229 |
+
customer_address_id: null
|
| 230 |
+
quote_address_id: null
|
| 231 |
+
region_id: 12
|
| 232 |
+
customer_id: null
|
| 233 |
+
fax: null
|
| 234 |
+
region: California
|
| 235 |
+
postcode: 90210
|
| 236 |
+
lastname: Tester
|
| 237 |
+
street: 123 Test St
|
| 238 |
+
city: Test
|
| 239 |
+
email: test@example.com
|
| 240 |
+
telephone: 11231231234
|
| 241 |
+
country_id: US
|
| 242 |
+
firstname: Test
|
| 243 |
+
address_type: billing
|
| 244 |
+
prefix: null
|
| 245 |
+
middlename: null
|
| 246 |
+
suffix: null
|
| 247 |
+
company: null
|
| 248 |
+
vat_id: null
|
| 249 |
+
vat_is_valid: null
|
| 250 |
+
vat_request_id: null
|
| 251 |
+
vat_request_date: null
|
| 252 |
+
vat_request_success: null
|
| 253 |
+
giftregistry_item_id: null
|
| 254 |
+
is_cornerdrop_collect: null
|
| 255 |
+
-
|
| 256 |
+
entity_id: 2
|
| 257 |
+
parent_id: 1
|
| 258 |
+
customer_address_id: null
|
| 259 |
+
quote_address_id: null
|
| 260 |
+
region_id: 12
|
| 261 |
+
customer_id: null
|
| 262 |
+
fax: null
|
| 263 |
+
region: California
|
| 264 |
+
postcode: 90210
|
| 265 |
+
lastname: Tester
|
| 266 |
+
street: 123 Test St
|
| 267 |
+
city: Test
|
| 268 |
+
email: null
|
| 269 |
+
telephone: 11231231234
|
| 270 |
+
country_id: US
|
| 271 |
+
firstname: Test
|
| 272 |
+
address_type: shipping
|
| 273 |
+
prefix: null
|
| 274 |
+
middlename: null
|
| 275 |
+
suffix: null
|
| 276 |
+
company: null
|
| 277 |
+
vat_id: null
|
| 278 |
+
vat_is_valid: null
|
| 279 |
+
vat_request_id: null
|
| 280 |
+
vat_request_date: null
|
| 281 |
+
vat_request_success: null
|
| 282 |
+
giftregistry_item_id: null
|
| 283 |
+
is_cornerdrop_collect: 0
|
| 284 |
+
sales_flat_order_item:
|
| 285 |
+
-
|
| 286 |
+
item_id: 1
|
| 287 |
+
order_id: 1
|
| 288 |
+
parent_item_id: null
|
| 289 |
+
quote_item_id: 1
|
| 290 |
+
store_id: 1
|
| 291 |
+
created_at: 2015-04-21 15:46:15
|
| 292 |
+
updated_at: 2015-04-21 15:46:15
|
| 293 |
+
product_id: 1
|
| 294 |
+
product_type: simple
|
| 295 |
+
product_options: a:6:{s:15:"info_buyRequest";a:7:{s:4:"uenc";s:132:"aHR0cDovL3NreXdhcnAubG9jYWwvbWVhbmJlZS9jb3JuZXJkcm9wL2FjY2Vzc29yaWVzL3Nob2VzL3dpbmd0aXAtY29nbmFjLW94Zm9yZC01NTQuaHRtbD9fX19TSUQ9VQ,,";s:7:"product";s:3:"434";s:8:"form_key";s:16:"XiBqoVMM5jyZzUXw";s:15:"related_product";s:0:"";s:15:"super_attribute";a:2:{i:92;s:2:"19";i:186;s:3:"100";}s:3:"qty";s:1:"1";s:10:"return_url";s:0:"";}s:15:"attributes_info";a:2:{i:0;a:2:{s:5:"label";s:5:"Color";s:5:"value";s:6:"Cognac";}i:1;a:2:{s:5:"label";s:9:"Shoe size";s:5:"value";s:1:"8";}}s:11:"simple_name";s:21:"Wingtip Cognac Oxford";s:10:"simple_sku";s:6:"ams005";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;}
|
| 296 |
+
weight: 1
|
| 297 |
+
is_virtual: 0
|
| 298 |
+
sku: ams005
|
| 299 |
+
name: Wingtip Cognac Oxford
|
| 300 |
+
description: null
|
| 301 |
+
applied_rule_ids: null
|
| 302 |
+
additional_data: null
|
| 303 |
+
free_shipping: 0
|
| 304 |
+
is_qty_decimal: 0
|
| 305 |
+
no_discount: 0
|
| 306 |
+
qty_backordered: null
|
| 307 |
+
qty_canceled: 0
|
| 308 |
+
qty_invoiced: 0
|
| 309 |
+
qty_ordered: 1
|
| 310 |
+
qty_refunded: 0
|
| 311 |
+
qty_shipped: 0
|
| 312 |
+
base_cost: null
|
| 313 |
+
price: 375
|
| 314 |
+
base_price: 375
|
| 315 |
+
original_price: 375
|
| 316 |
+
base_original_price: 375
|
| 317 |
+
tax_percent: 8.25
|
| 318 |
+
tax_amount: 30.94
|
| 319 |
+
base_tax_amount: 30.94
|
| 320 |
+
tax_invoiced: 0
|
| 321 |
+
base_tax_invoiced: 0
|
| 322 |
+
discount_percent: 0
|
| 323 |
+
discount_amount: 0
|
| 324 |
+
base_discount_amount: 0
|
| 325 |
+
discount_invoiced: 0
|
| 326 |
+
base_discount_invoiced: 0
|
| 327 |
+
amount_refunded: 0
|
| 328 |
+
base_amount_refunded: 0
|
| 329 |
+
row_total: 375
|
| 330 |
+
base_row_total: 375
|
| 331 |
+
row_invoiced: 0
|
| 332 |
+
base_row_invoiced: 0
|
| 333 |
+
row_weight: 1
|
| 334 |
+
base_tax_before_discount: null
|
| 335 |
+
tax_before_discount: null
|
| 336 |
+
ext_order_item_id: null
|
| 337 |
+
locked_do_invoice: null
|
| 338 |
+
locked_do_ship: null
|
| 339 |
+
price_incl_tax: 405.94
|
| 340 |
+
base_price_incl_tax: 405.94
|
| 341 |
+
row_total_incl_tax: 405.94
|
| 342 |
+
base_row_total_incl_tax: 405.94
|
| 343 |
+
hidden_tax_amount: 0
|
| 344 |
+
base_hidden_tax_amount: 0
|
| 345 |
+
hidden_tax_invoiced: null
|
| 346 |
+
base_hidden_tax_invoiced: null
|
| 347 |
+
hidden_tax_refunded: null
|
| 348 |
+
base_hidden_tax_refunded: null
|
| 349 |
+
is_nominal: 0
|
| 350 |
+
tax_canceled: null
|
| 351 |
+
hidden_tax_canceled: null
|
| 352 |
+
tax_refunded: null
|
| 353 |
+
base_tax_refunded: null
|
| 354 |
+
discount_refunded: null
|
| 355 |
+
base_discount_refunded: null
|
| 356 |
+
gift_message_id: null
|
| 357 |
+
gift_message_available: 1
|
| 358 |
+
base_weee_tax_applied_amount: 0
|
| 359 |
+
base_weee_tax_applied_row_amnt: 0
|
| 360 |
+
weee_tax_applied_amount: 0
|
| 361 |
+
weee_tax_applied_row_amount: 0
|
| 362 |
+
weee_tax_applied: a:0:{}
|
| 363 |
+
weee_tax_disposition: 0
|
| 364 |
+
weee_tax_row_disposition: 0
|
| 365 |
+
base_weee_tax_disposition: 0
|
| 366 |
+
base_weee_tax_row_disposition: 0
|
| 367 |
+
event_id: null
|
| 368 |
+
giftregistry_item_id: null
|
| 369 |
+
gw_id: null
|
| 370 |
+
gw_base_price: null
|
| 371 |
+
gw_price: null
|
| 372 |
+
gw_base_tax_amount: null
|
| 373 |
+
gw_tax_amount: null
|
| 374 |
+
gw_base_price_invoiced: null
|
| 375 |
+
gw_price_invoiced: null
|
| 376 |
+
gw_base_tax_amount_invoiced: null
|
| 377 |
+
gw_tax_amount_invoiced: null
|
| 378 |
+
gw_base_price_refunded: null
|
| 379 |
+
gw_price_refunded: null
|
| 380 |
+
gw_base_tax_amount_refunded: null
|
| 381 |
+
gw_tax_amount_refunded: null
|
| 382 |
+
qty_returned: 0
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee.php
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Test_Model_Sales_Quote_Address_Total_CornerDrop_Fee extends EcomDev_PHPUnit_Test_Case {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Magento uses cookies to handle the addresses, PHPUnit
|
| 7 |
+
* never starts a session so the cookie could not be set.
|
| 8 |
+
*
|
| 9 |
+
* @link http://stackoverflow.com/a/23400885/2003205
|
| 10 |
+
*/
|
| 11 |
+
public function setUp(){
|
| 12 |
+
parent::setUp();
|
| 13 |
+
if(session_id() !== '') {
|
| 14 |
+
session_destroy();
|
| 15 |
+
}
|
| 16 |
+
@session_start();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Test the CornerDrop fee is added with tax.
|
| 21 |
+
*
|
| 22 |
+
* @test
|
| 23 |
+
* @loadFixture
|
| 24 |
+
*/
|
| 25 |
+
public function testCornerDropFeeAddedWithTax() {
|
| 26 |
+
$values = $this->_getValues();
|
| 27 |
+
$this->assertEquals(10, $values['total_fee']);
|
| 28 |
+
$this->assertEquals(10, $values['base_total_fee']);
|
| 29 |
+
$this->assertEquals(0.83, $values['tax']);
|
| 30 |
+
$this->assertEquals(0.83, $values['base_tax']);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Test the CornerDrop fee is added without tax.
|
| 35 |
+
*
|
| 36 |
+
* @test
|
| 37 |
+
* @loadFixture
|
| 38 |
+
*/
|
| 39 |
+
public function testCornerDropFeeAddedWithNoTax() {
|
| 40 |
+
$values = $this->_getValues();
|
| 41 |
+
$this->assertEquals(10, $values['total_fee']);
|
| 42 |
+
$this->assertEquals(10, $values['base_total_fee']);
|
| 43 |
+
$this->assertEquals(0, $values['tax']);
|
| 44 |
+
$this->assertEquals(0, $values['base_tax']);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Check the CornerDrop fee is not added to a Quote if it's not
|
| 49 |
+
* selected on checkout.
|
| 50 |
+
*
|
| 51 |
+
* @test
|
| 52 |
+
* @loadFixture
|
| 53 |
+
*/
|
| 54 |
+
public function testCornerDropFeeNotAdded() {
|
| 55 |
+
$values = $this->_getValues();
|
| 56 |
+
$this->assertEquals(0, $values['total_fee']);
|
| 57 |
+
$this->assertEquals(0, $values['base_total_fee']);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Get the values which vary based on the loaded fixture.
|
| 62 |
+
*
|
| 63 |
+
* @return array
|
| 64 |
+
*/
|
| 65 |
+
private function _getValues() {
|
| 66 |
+
/** @var CornerDrop_Collect_Model_Sales_Quote_Address_Total_CornerDrop_Fee $total */
|
| 67 |
+
$total = Mage::getModel('cornerdrop_collect/sales_quote_address_total_cornerdrop_fee');
|
| 68 |
+
$addresses = Mage::getModel('sales/quote_address')->getCollection()->addFieldToFilter('quote_id', array('eq' => 18))->addFieldToSelect('*');
|
| 69 |
+
$quote = Mage::getModel('sales/quote')->getCollection()->getFirstItem();
|
| 70 |
+
$total_fee = 0;
|
| 71 |
+
$base_total_fee = 0;
|
| 72 |
+
$tax = 0;
|
| 73 |
+
$base_tax = 0;
|
| 74 |
+
|
| 75 |
+
foreach($addresses as $address) {
|
| 76 |
+
/** @ var Mage_Sales_Model_Quote_Address $address */
|
| 77 |
+
$address->setQuote($quote);
|
| 78 |
+
$total->collect($address);
|
| 79 |
+
$total->fetch($address);
|
| 80 |
+
$total_fee += (float) $address->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT);
|
| 81 |
+
$base_total_fee += (float) $address->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT);
|
| 82 |
+
$tax += (float) $address->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_TAX);
|
| 83 |
+
$base_tax += (float) $address->getData(CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
return compact(
|
| 87 |
+
'total_fee',
|
| 88 |
+
'base_total_fee',
|
| 89 |
+
'tax',
|
| 90 |
+
'base_tax'
|
| 91 |
+
);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
}
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithNoTax.yaml
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
Â
|
|
|
Â
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
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/status/balance: 10
|
| 4 |
+
default/cornerdrop_collect/fee_settings/include_tax: 1
|
| 5 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 6 |
+
eav:
|
| 7 |
+
catalog_product:
|
| 8 |
+
-
|
| 9 |
+
entity_id: 421
|
| 10 |
+
entity_type_id: 4
|
| 11 |
+
attribute_set_id: 1
|
| 12 |
+
type_id: configurable
|
| 13 |
+
sku: wbk012c
|
| 14 |
+
has_options: 1
|
| 15 |
+
required_options: 1
|
| 16 |
+
created_at: 2013-04-04 06:25:11
|
| 17 |
+
updated_at: 2015-04-06 12:32:19
|
| 18 |
+
-
|
| 19 |
+
entity_id: 295
|
| 20 |
+
entity_type_id: 4
|
| 21 |
+
attribute_set_id: 1
|
| 22 |
+
type_id: simple
|
| 23 |
+
sku: wbk013
|
| 24 |
+
has_options: 0
|
| 25 |
+
required_options: 0
|
| 26 |
+
created_at: 2013-03-05 05:48:14
|
| 27 |
+
updated_at: 2014-03-08 08:17:50
|
| 28 |
+
tables:
|
| 29 |
+
tax_calculation_rule:
|
| 30 |
+
-
|
| 31 |
+
tax_calculation_rule_id: 2
|
| 32 |
+
code: CornerDrop Tax Rule
|
| 33 |
+
priority: 0
|
| 34 |
+
position: 0
|
| 35 |
+
calculate_subtotal: 0
|
| 36 |
+
tax_calculation:
|
| 37 |
+
-
|
| 38 |
+
tax_calculation_id: 3
|
| 39 |
+
tax_calculation_rate_id: 1
|
| 40 |
+
tax_calculation_rule_id: 2
|
| 41 |
+
customer_tax_class_id: 3
|
| 42 |
+
product_tax_class_id: 5
|
| 43 |
+
-
|
| 44 |
+
tax_calculation_id: 4
|
| 45 |
+
tax_calculation_rate_id: 2
|
| 46 |
+
tax_calculation_rule_id: 2
|
| 47 |
+
customer_tax_class_id: 3
|
| 48 |
+
product_tax_class_id: 5
|
| 49 |
+
sales_flat_quote:
|
| 50 |
+
-
|
| 51 |
+
entity_id: 18
|
| 52 |
+
store_id: 1
|
| 53 |
+
created_at: 2015-04-16 13:20:17
|
| 54 |
+
updated_at: 2015-04-16 12:20:18
|
| 55 |
+
converted_at: null
|
| 56 |
+
is_active: 1
|
| 57 |
+
is_virtual: 0
|
| 58 |
+
is_multi_shipping: 0
|
| 59 |
+
items_count: 1
|
| 60 |
+
items_qty: 1
|
| 61 |
+
orig_order_id: 0
|
| 62 |
+
store_to_base_rate: 1
|
| 63 |
+
store_to_quote_rate: 1
|
| 64 |
+
base_currency_code: USD
|
| 65 |
+
store_currency_code: USD
|
| 66 |
+
quote_currency_code: USD
|
| 67 |
+
grand_total: 161.55
|
| 68 |
+
base_grand_total: 161.55
|
| 69 |
+
checkout_method: null
|
| 70 |
+
customer_id: null
|
| 71 |
+
customer_tax_class_id: 10
|
| 72 |
+
customer_group_id: 0
|
| 73 |
+
customer_email: null
|
| 74 |
+
customer_prefix: null
|
| 75 |
+
customer_firstname: null
|
| 76 |
+
customer_middlename: null
|
| 77 |
+
customer_lastname: null
|
| 78 |
+
customer_suffix: null
|
| 79 |
+
customer_dob: null
|
| 80 |
+
customer_note: null
|
| 81 |
+
customer_note_notify: 1
|
| 82 |
+
customer_is_guest: 0
|
| 83 |
+
remote_ip: 127.0.0.1
|
| 84 |
+
applied_rule_ids: null
|
| 85 |
+
reserved_order_id: null
|
| 86 |
+
password_hash: null
|
| 87 |
+
coupon_code: null
|
| 88 |
+
global_currency_code: USD
|
| 89 |
+
base_to_global_rate: 1
|
| 90 |
+
base_to_quote_rate: 1
|
| 91 |
+
customer_taxvat: null
|
| 92 |
+
customer_gender: null
|
| 93 |
+
subtotal: 140
|
| 94 |
+
base_subtotal: 140
|
| 95 |
+
subtotal_with_discount: 140
|
| 96 |
+
base_subtotal_with_discount: 140
|
| 97 |
+
is_changed: 1
|
| 98 |
+
trigger_recollect: 0
|
| 99 |
+
ext_shipping_info: null
|
| 100 |
+
gift_message_id: null
|
| 101 |
+
is_persistent: 0
|
| 102 |
+
customer_balance_amount_used: null
|
| 103 |
+
base_customer_bal_amount_used: null
|
| 104 |
+
use_customer_balance: null
|
| 105 |
+
gift_cards: null
|
| 106 |
+
gift_cards_amount: null
|
| 107 |
+
base_gift_cards_amount: null
|
| 108 |
+
gift_cards_amount_used: null
|
| 109 |
+
base_gift_cards_amount_used: null
|
| 110 |
+
gw_id: null
|
| 111 |
+
gw_allow_gift_receipt: null
|
| 112 |
+
gw_add_card: null
|
| 113 |
+
gw_base_price: null
|
| 114 |
+
gw_price: null
|
| 115 |
+
gw_items_base_price: null
|
| 116 |
+
gw_items_price: null
|
| 117 |
+
gw_card_base_price: null
|
| 118 |
+
gw_card_price: null
|
| 119 |
+
gw_base_tax_amount: null
|
| 120 |
+
gw_tax_amount: null
|
| 121 |
+
gw_items_base_tax_amount: null
|
| 122 |
+
gw_items_tax_amount: null
|
| 123 |
+
gw_card_base_tax_amount: null
|
| 124 |
+
gw_card_tax_amount: null
|
| 125 |
+
use_reward_points: null
|
| 126 |
+
reward_points_balance: null
|
| 127 |
+
base_reward_currency_amount: null
|
| 128 |
+
reward_currency_amount: null
|
| 129 |
+
sales_flat_quote_address:
|
| 130 |
+
-
|
| 131 |
+
address_id: 2620
|
| 132 |
+
quote_id: 18
|
| 133 |
+
created_at: 2015-04-16 12:20:06
|
| 134 |
+
updated_at: 2015-04-16 12:20:18
|
| 135 |
+
customer_id: null
|
| 136 |
+
save_in_address_book: 0
|
| 137 |
+
customer_address_id: null
|
| 138 |
+
address_type: billing
|
| 139 |
+
email: null
|
| 140 |
+
prefix: null
|
| 141 |
+
firstname: null
|
| 142 |
+
middlename: null
|
| 143 |
+
lastname: null
|
| 144 |
+
suffix: null
|
| 145 |
+
company: null
|
| 146 |
+
street: null
|
| 147 |
+
city: null
|
| 148 |
+
region: CA
|
| 149 |
+
region_id: 12
|
| 150 |
+
postcode: null
|
| 151 |
+
country_id: US
|
| 152 |
+
telephone: null
|
| 153 |
+
fax: null
|
| 154 |
+
same_as_billing: 0
|
| 155 |
+
free_shipping: 0
|
| 156 |
+
collect_shipping_rates: 0
|
| 157 |
+
shipping_method: null
|
| 158 |
+
shipping_description: null
|
| 159 |
+
weight: 0
|
| 160 |
+
subtotal: 0
|
| 161 |
+
base_subtotal: 0
|
| 162 |
+
subtotal_with_discount: 0
|
| 163 |
+
base_subtotal_with_discount: 0
|
| 164 |
+
tax_amount: 0
|
| 165 |
+
base_tax_amount: 0
|
| 166 |
+
shipping_amount: 0
|
| 167 |
+
base_shipping_amount: 0
|
| 168 |
+
shipping_tax_amount: 0
|
| 169 |
+
base_shipping_tax_amount: 0
|
| 170 |
+
discount_amount: 0
|
| 171 |
+
base_discount_amount: 0
|
| 172 |
+
grand_total: 0
|
| 173 |
+
base_grand_total: 0
|
| 174 |
+
customer_notes: null
|
| 175 |
+
applied_taxes: a:0:{}
|
| 176 |
+
discount_description: null
|
| 177 |
+
shipping_discount_amount: null
|
| 178 |
+
base_shipping_discount_amount: null
|
| 179 |
+
subtotal_incl_tax: 0
|
| 180 |
+
base_subtotal_total_incl_tax: null
|
| 181 |
+
hidden_tax_amount: null
|
| 182 |
+
base_hidden_tax_amount: null
|
| 183 |
+
shipping_hidden_tax_amount: null
|
| 184 |
+
base_shipping_hidden_tax_amnt: null
|
| 185 |
+
shipping_incl_tax: 0
|
| 186 |
+
base_shipping_incl_tax: 0
|
| 187 |
+
vat_id: null
|
| 188 |
+
vat_is_valid: null
|
| 189 |
+
vat_request_id: null
|
| 190 |
+
vat_request_date: null
|
| 191 |
+
vat_request_success: null
|
| 192 |
+
gift_message_id: null
|
| 193 |
+
base_customer_balance_amount: null
|
| 194 |
+
customer_balance_amount: null
|
| 195 |
+
gift_cards_amount: null
|
| 196 |
+
base_gift_cards_amount: null
|
| 197 |
+
gift_cards: null
|
| 198 |
+
used_gift_cards: null
|
| 199 |
+
giftregistry_item_id: null
|
| 200 |
+
gw_id: null
|
| 201 |
+
gw_allow_gift_receipt: null
|
| 202 |
+
gw_add_card: null
|
| 203 |
+
gw_base_price: null
|
| 204 |
+
gw_price: null
|
| 205 |
+
gw_items_base_price: null
|
| 206 |
+
gw_items_price: null
|
| 207 |
+
gw_card_base_price: null
|
| 208 |
+
gw_card_price: null
|
| 209 |
+
gw_base_tax_amount: null
|
| 210 |
+
gw_tax_amount: null
|
| 211 |
+
gw_items_base_tax_amount: null
|
| 212 |
+
gw_items_tax_amount: null
|
| 213 |
+
gw_card_base_tax_amount: null
|
| 214 |
+
gw_card_tax_amount: null
|
| 215 |
+
reward_points_balance: null
|
| 216 |
+
base_reward_currency_amount: null
|
| 217 |
+
reward_currency_amount: null
|
| 218 |
+
is_cornerdrop_collect: null
|
| 219 |
+
cornerdrop_fee_amount: 0
|
| 220 |
+
base_cornerdrop_fee_amount: 0
|
| 221 |
+
cornerdrop_tax_amount: null
|
| 222 |
+
base_cornerdrop_tax_amount: null
|
| 223 |
+
-
|
| 224 |
+
address_id: 2621
|
| 225 |
+
quote_id: 18
|
| 226 |
+
created_at: 2015-04-16 12:20:06
|
| 227 |
+
updated_at: 2015-04-16 12:20:18
|
| 228 |
+
customer_id: null
|
| 229 |
+
save_in_address_book: 0
|
| 230 |
+
customer_address_id: null
|
| 231 |
+
address_type: shipping
|
| 232 |
+
email: null
|
| 233 |
+
prefix: null
|
| 234 |
+
firstname: null
|
| 235 |
+
middlename: null
|
| 236 |
+
lastname: null
|
| 237 |
+
suffix: null
|
| 238 |
+
company: null
|
| 239 |
+
street: null
|
| 240 |
+
city: null
|
| 241 |
+
region: CA
|
| 242 |
+
region_id: 12
|
| 243 |
+
postcode: null
|
| 244 |
+
country_id: US
|
| 245 |
+
telephone: null
|
| 246 |
+
fax: null
|
| 247 |
+
same_as_billing: 1
|
| 248 |
+
free_shipping: 0
|
| 249 |
+
collect_shipping_rates: 0
|
| 250 |
+
shipping_method: null
|
| 251 |
+
shipping_description: null
|
| 252 |
+
weight: 1
|
| 253 |
+
subtotal: 140
|
| 254 |
+
base_subtotal: 140
|
| 255 |
+
subtotal_with_discount: 0
|
| 256 |
+
base_subtotal_with_discount: 0
|
| 257 |
+
tax_amount: 12.38
|
| 258 |
+
base_tax_amount: 12.38
|
| 259 |
+
shipping_amount: 0
|
| 260 |
+
base_shipping_amount: 0
|
| 261 |
+
shipping_tax_amount: 0
|
| 262 |
+
base_shipping_tax_amount: 0
|
| 263 |
+
discount_amount: 0
|
| 264 |
+
base_discount_amount: 0
|
| 265 |
+
grand_total: 161.55
|
| 266 |
+
base_grand_total: 161.55
|
| 267 |
+
customer_notes: null
|
| 268 |
+
applied_taxes: a:1:{s:30:"US-All States-TaxableGoodsRate";a:6:{s:5:"rates";a:1:{i:0;a:6:{s:4:"code";s:30:"US-All States-TaxableGoodsRate";s:5:"title";s:30:"US-All States-TaxableGoodsRate";s:7:"percent";d:8.25;s:8:"position";s:1:"0";s:8:"priority";s:1:"0";s:7:"rule_id";s:2:"13";}}s:7:"percent";d:8.25;s:2:"id";s:30:"US-All States-TaxableGoodsRate";s:7:"process";i:0;s:6:"amount";d:11.550000000000001;s:11:"base_amount";d:11.550000000000001;}}
|
| 269 |
+
discount_description: null
|
| 270 |
+
shipping_discount_amount: 0
|
| 271 |
+
base_shipping_discount_amount: 0
|
| 272 |
+
subtotal_incl_tax: 151.55
|
| 273 |
+
base_subtotal_total_incl_tax: null
|
| 274 |
+
hidden_tax_amount: 0
|
| 275 |
+
base_hidden_tax_amount: 0
|
| 276 |
+
shipping_hidden_tax_amount: 0
|
| 277 |
+
base_shipping_hidden_tax_amnt: null
|
| 278 |
+
shipping_incl_tax: 0
|
| 279 |
+
base_shipping_incl_tax: 0
|
| 280 |
+
vat_id: null
|
| 281 |
+
vat_is_valid: null
|
| 282 |
+
vat_request_id: null
|
| 283 |
+
vat_request_date: null
|
| 284 |
+
vat_request_success: null
|
| 285 |
+
gift_message_id: null
|
| 286 |
+
base_customer_balance_amount: null
|
| 287 |
+
customer_balance_amount: null
|
| 288 |
+
gift_cards_amount: null
|
| 289 |
+
base_gift_cards_amount: null
|
| 290 |
+
gift_cards: null
|
| 291 |
+
used_gift_cards: null
|
| 292 |
+
giftregistry_item_id: null
|
| 293 |
+
gw_id: null
|
| 294 |
+
gw_allow_gift_receipt: null
|
| 295 |
+
gw_add_card: null
|
| 296 |
+
gw_base_price: null
|
| 297 |
+
gw_price: null
|
| 298 |
+
gw_items_base_price: null
|
| 299 |
+
gw_items_price: null
|
| 300 |
+
gw_card_base_price: null
|
| 301 |
+
gw_card_price: null
|
| 302 |
+
gw_base_tax_amount: null
|
| 303 |
+
gw_tax_amount: null
|
| 304 |
+
gw_items_base_tax_amount: null
|
| 305 |
+
gw_items_tax_amount: null
|
| 306 |
+
gw_card_base_tax_amount: null
|
| 307 |
+
gw_card_tax_amount: null
|
| 308 |
+
reward_points_balance: null
|
| 309 |
+
base_reward_currency_amount: null
|
| 310 |
+
reward_currency_amount: null
|
| 311 |
+
is_cornerdrop_collect: 1
|
| 312 |
+
cornerdrop_fee_amount: 10
|
| 313 |
+
base_cornerdrop_fee_amount: 10
|
| 314 |
+
cornerdrop_tax_amount: null
|
| 315 |
+
base_cornerdrop_tax_amount: null
|
| 316 |
+
sales_flat_quote_item:
|
| 317 |
+
-
|
| 318 |
+
item_id: 2517
|
| 319 |
+
quote_id: 18
|
| 320 |
+
created_at: 2015-04-16 12:20:06
|
| 321 |
+
updated_at: 2015-04-16 12:20:18
|
| 322 |
+
product_id: 421
|
| 323 |
+
store_id: 1
|
| 324 |
+
parent_item_id: null
|
| 325 |
+
is_virtual: 0
|
| 326 |
+
sku: wbk013
|
| 327 |
+
name: Elizabeth Knit Top
|
| 328 |
+
description: null
|
| 329 |
+
applied_rule_ids: null
|
| 330 |
+
additional_data: null
|
| 331 |
+
free_shipping: 0
|
| 332 |
+
is_qty_decimal: 0
|
| 333 |
+
no_discount: 0
|
| 334 |
+
weight: 1
|
| 335 |
+
qty: 1
|
| 336 |
+
price: 210
|
| 337 |
+
base_price: 210
|
| 338 |
+
custom_price: null
|
| 339 |
+
discount_percent: 0
|
| 340 |
+
discount_amount: 0
|
| 341 |
+
base_discount_amount: 0
|
| 342 |
+
tax_percent: 8.25
|
| 343 |
+
tax_amount: 17.33
|
| 344 |
+
base_tax_amount: 17.33
|
| 345 |
+
row_total: 210
|
| 346 |
+
base_row_total: 210
|
| 347 |
+
row_total_with_discount: 0
|
| 348 |
+
row_weight: 1
|
| 349 |
+
product_type: configurable
|
| 350 |
+
base_tax_before_discount: null
|
| 351 |
+
tax_before_discount: null
|
| 352 |
+
original_custom_price: null
|
| 353 |
+
redirect_url: null
|
| 354 |
+
base_cost: null
|
| 355 |
+
price_incl_tax: 227.33
|
| 356 |
+
base_price_incl_tax: 227.33
|
| 357 |
+
row_total_incl_tax: 227.33
|
| 358 |
+
base_row_total_incl_tax: 227.33
|
| 359 |
+
hidden_tax_amount: 0
|
| 360 |
+
base_hidden_tax_amount: 0
|
| 361 |
+
gift_message_id: null
|
| 362 |
+
weee_tax_disposition: 0
|
| 363 |
+
weee_tax_row_disposition: 0
|
| 364 |
+
base_weee_tax_disposition: 0
|
| 365 |
+
base_weee_tax_row_disposition: 0
|
| 366 |
+
weee_tax_applied: a:0:{}
|
| 367 |
+
weee_tax_applied_amount: 0
|
| 368 |
+
weee_tax_applied_row_amount: 0
|
| 369 |
+
base_weee_tax_applied_amount: 0
|
| 370 |
+
base_weee_tax_applied_row_amnt: null
|
| 371 |
+
event_id: null
|
| 372 |
+
giftregistry_item_id: null
|
| 373 |
+
gw_id: null
|
| 374 |
+
gw_base_price: null
|
| 375 |
+
gw_price: null
|
| 376 |
+
gw_base_tax_amount: null
|
| 377 |
+
gw_tax_amount: null
|
| 378 |
+
-
|
| 379 |
+
item_id: 2518
|
| 380 |
+
quote_id: 18
|
| 381 |
+
created_at: 2015-04-16 12:20:06
|
| 382 |
+
updated_at: 2015-04-16 12:20:18
|
| 383 |
+
product_id: 295
|
| 384 |
+
store_id: 1
|
| 385 |
+
parent_item_id: 2517
|
| 386 |
+
is_virtual: 0
|
| 387 |
+
sku: wbk013
|
| 388 |
+
name: Elizabeth Knit Top
|
| 389 |
+
description: null
|
| 390 |
+
applied_rule_ids: null
|
| 391 |
+
additional_data: null
|
| 392 |
+
free_shipping: 0
|
| 393 |
+
is_qty_decimal: 0
|
| 394 |
+
no_discount: 0
|
| 395 |
+
weight: 1
|
| 396 |
+
qty: 1
|
| 397 |
+
price: 0
|
| 398 |
+
base_price: 0
|
| 399 |
+
custom_price: null
|
| 400 |
+
discount_percent: 0
|
| 401 |
+
discount_amount: 0
|
| 402 |
+
base_discount_amount: 0
|
| 403 |
+
tax_percent: 0
|
| 404 |
+
tax_amount: 0
|
| 405 |
+
base_tax_amount: 0
|
| 406 |
+
row_total: 0
|
| 407 |
+
base_row_total: 0
|
| 408 |
+
row_total_with_discount: 0
|
| 409 |
+
row_weight: 0
|
| 410 |
+
product_type: simple
|
| 411 |
+
base_tax_before_discount: null
|
| 412 |
+
tax_before_discount: null
|
| 413 |
+
original_custom_price: null
|
| 414 |
+
redirect_url: null
|
| 415 |
+
base_cost: null
|
| 416 |
+
price_incl_tax: null
|
| 417 |
+
base_price_incl_tax: null
|
| 418 |
+
row_total_incl_tax: null
|
| 419 |
+
base_row_total_incl_tax: null
|
| 420 |
+
hidden_tax_amount: null
|
| 421 |
+
base_hidden_tax_amount: null
|
| 422 |
+
gift_message_id: null
|
| 423 |
+
weee_tax_disposition: 0
|
| 424 |
+
weee_tax_row_disposition: 0
|
| 425 |
+
base_weee_tax_disposition: 0
|
| 426 |
+
base_weee_tax_row_disposition: 0
|
| 427 |
+
weee_tax_applied: a:0:{}
|
| 428 |
+
weee_tax_applied_amount: 0
|
| 429 |
+
weee_tax_applied_row_amount: 0
|
| 430 |
+
base_weee_tax_applied_amount: 0
|
| 431 |
+
base_weee_tax_applied_row_amnt: null
|
| 432 |
+
event_id: null
|
| 433 |
+
giftregistry_item_id: null
|
| 434 |
+
gw_id: null
|
| 435 |
+
gw_base_price: null
|
| 436 |
+
gw_price: null
|
| 437 |
+
gw_base_tax_amount: null
|
| 438 |
+
gw_tax_amount: null
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeAddedWithTax.yaml
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enable: 1
|
| 3 |
+
default/cornerdrop_collect/status/balance: 10
|
| 4 |
+
default/cornerdrop_collect/fee_settings/include_tax: 0
|
| 5 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 6 |
+
eav:
|
| 7 |
+
catalog_product:
|
| 8 |
+
-
|
| 9 |
+
entity_id: 421
|
| 10 |
+
entity_type_id: 4
|
| 11 |
+
attribute_set_id: 1
|
| 12 |
+
type_id: configurable
|
| 13 |
+
sku: wbk012c
|
| 14 |
+
has_options: 1
|
| 15 |
+
required_options: 1
|
| 16 |
+
created_at: 2013-04-04 06:25:11
|
| 17 |
+
updated_at: 2015-04-06 12:32:19
|
| 18 |
+
-
|
| 19 |
+
entity_id: 295
|
| 20 |
+
entity_type_id: 4
|
| 21 |
+
attribute_set_id: 1
|
| 22 |
+
type_id: simple
|
| 23 |
+
sku: wbk013
|
| 24 |
+
has_options: 0
|
| 25 |
+
required_options: 0
|
| 26 |
+
created_at: 2013-03-05 05:48:14
|
| 27 |
+
updated_at: 2014-03-08 08:17:50
|
| 28 |
+
tables:
|
| 29 |
+
tax_calculation_rule:
|
| 30 |
+
-
|
| 31 |
+
tax_calculation_rule_id: 2
|
| 32 |
+
code: CornerDrop Tax Rule
|
| 33 |
+
priority: 0
|
| 34 |
+
position: 0
|
| 35 |
+
calculate_subtotal: 0
|
| 36 |
+
tax_calculation:
|
| 37 |
+
-
|
| 38 |
+
tax_calculation_id: 3
|
| 39 |
+
tax_calculation_rate_id: 1
|
| 40 |
+
tax_calculation_rule_id: 2
|
| 41 |
+
customer_tax_class_id: 3
|
| 42 |
+
product_tax_class_id: 5
|
| 43 |
+
-
|
| 44 |
+
tax_calculation_id: 4
|
| 45 |
+
tax_calculation_rate_id: 2
|
| 46 |
+
tax_calculation_rule_id: 2
|
| 47 |
+
customer_tax_class_id: 3
|
| 48 |
+
product_tax_class_id: 5
|
| 49 |
+
sales_flat_quote:
|
| 50 |
+
-
|
| 51 |
+
entity_id: 18
|
| 52 |
+
store_id: 1
|
| 53 |
+
created_at: 2015-04-16 13:20:17
|
| 54 |
+
updated_at: 2015-04-16 12:20:18
|
| 55 |
+
converted_at: null
|
| 56 |
+
is_active: 1
|
| 57 |
+
is_virtual: 0
|
| 58 |
+
is_multi_shipping: 0
|
| 59 |
+
items_count: 1
|
| 60 |
+
items_qty: 1
|
| 61 |
+
orig_order_id: 0
|
| 62 |
+
store_to_base_rate: 1
|
| 63 |
+
store_to_quote_rate: 1
|
| 64 |
+
base_currency_code: USD
|
| 65 |
+
store_currency_code: USD
|
| 66 |
+
quote_currency_code: USD
|
| 67 |
+
grand_total: 161.55
|
| 68 |
+
base_grand_total: 161.55
|
| 69 |
+
checkout_method: null
|
| 70 |
+
customer_id: null
|
| 71 |
+
customer_tax_class_id: 10
|
| 72 |
+
customer_group_id: 0
|
| 73 |
+
customer_email: null
|
| 74 |
+
customer_prefix: null
|
| 75 |
+
customer_firstname: null
|
| 76 |
+
customer_middlename: null
|
| 77 |
+
customer_lastname: null
|
| 78 |
+
customer_suffix: null
|
| 79 |
+
customer_dob: null
|
| 80 |
+
customer_note: null
|
| 81 |
+
customer_note_notify: 1
|
| 82 |
+
customer_is_guest: 0
|
| 83 |
+
remote_ip: 127.0.0.1
|
| 84 |
+
applied_rule_ids: null
|
| 85 |
+
reserved_order_id: null
|
| 86 |
+
password_hash: null
|
| 87 |
+
coupon_code: null
|
| 88 |
+
global_currency_code: USD
|
| 89 |
+
base_to_global_rate: 1
|
| 90 |
+
base_to_quote_rate: 1
|
| 91 |
+
customer_taxvat: null
|
| 92 |
+
customer_gender: null
|
| 93 |
+
subtotal: 140
|
| 94 |
+
base_subtotal: 140
|
| 95 |
+
subtotal_with_discount: 140
|
| 96 |
+
base_subtotal_with_discount: 140
|
| 97 |
+
is_changed: 1
|
| 98 |
+
trigger_recollect: 0
|
| 99 |
+
ext_shipping_info: null
|
| 100 |
+
gift_message_id: null
|
| 101 |
+
is_persistent: 0
|
| 102 |
+
customer_balance_amount_used: null
|
| 103 |
+
base_customer_bal_amount_used: null
|
| 104 |
+
use_customer_balance: null
|
| 105 |
+
gift_cards: null
|
| 106 |
+
gift_cards_amount: null
|
| 107 |
+
base_gift_cards_amount: null
|
| 108 |
+
gift_cards_amount_used: null
|
| 109 |
+
base_gift_cards_amount_used: null
|
| 110 |
+
gw_id: null
|
| 111 |
+
gw_allow_gift_receipt: null
|
| 112 |
+
gw_add_card: null
|
| 113 |
+
gw_base_price: null
|
| 114 |
+
gw_price: null
|
| 115 |
+
gw_items_base_price: null
|
| 116 |
+
gw_items_price: null
|
| 117 |
+
gw_card_base_price: null
|
| 118 |
+
gw_card_price: null
|
| 119 |
+
gw_base_tax_amount: null
|
| 120 |
+
gw_tax_amount: null
|
| 121 |
+
gw_items_base_tax_amount: null
|
| 122 |
+
gw_items_tax_amount: null
|
| 123 |
+
gw_card_base_tax_amount: null
|
| 124 |
+
gw_card_tax_amount: null
|
| 125 |
+
use_reward_points: null
|
| 126 |
+
reward_points_balance: null
|
| 127 |
+
base_reward_currency_amount: null
|
| 128 |
+
reward_currency_amount: null
|
| 129 |
+
sales_flat_quote_address:
|
| 130 |
+
-
|
| 131 |
+
address_id: 2620
|
| 132 |
+
quote_id: 18
|
| 133 |
+
created_at: 2015-04-16 12:20:06
|
| 134 |
+
updated_at: 2015-04-16 12:20:18
|
| 135 |
+
customer_id: null
|
| 136 |
+
save_in_address_book: 0
|
| 137 |
+
customer_address_id: null
|
| 138 |
+
address_type: billing
|
| 139 |
+
email: null
|
| 140 |
+
prefix: null
|
| 141 |
+
firstname: null
|
| 142 |
+
middlename: null
|
| 143 |
+
lastname: null
|
| 144 |
+
suffix: null
|
| 145 |
+
company: null
|
| 146 |
+
street: null
|
| 147 |
+
city: null
|
| 148 |
+
region: CA
|
| 149 |
+
region_id: 12
|
| 150 |
+
postcode: null
|
| 151 |
+
country_id: US
|
| 152 |
+
telephone: null
|
| 153 |
+
fax: null
|
| 154 |
+
same_as_billing: 0
|
| 155 |
+
free_shipping: 0
|
| 156 |
+
collect_shipping_rates: 0
|
| 157 |
+
shipping_method: null
|
| 158 |
+
shipping_description: null
|
| 159 |
+
weight: 0
|
| 160 |
+
subtotal: 0
|
| 161 |
+
base_subtotal: 0
|
| 162 |
+
subtotal_with_discount: 0
|
| 163 |
+
base_subtotal_with_discount: 0
|
| 164 |
+
tax_amount: 0
|
| 165 |
+
base_tax_amount: 0
|
| 166 |
+
shipping_amount: 0
|
| 167 |
+
base_shipping_amount: 0
|
| 168 |
+
shipping_tax_amount: 0
|
| 169 |
+
base_shipping_tax_amount: 0
|
| 170 |
+
discount_amount: 0
|
| 171 |
+
base_discount_amount: 0
|
| 172 |
+
grand_total: 0
|
| 173 |
+
base_grand_total: 0
|
| 174 |
+
customer_notes: null
|
| 175 |
+
applied_taxes: a:0:{}
|
| 176 |
+
discount_description: null
|
| 177 |
+
shipping_discount_amount: null
|
| 178 |
+
base_shipping_discount_amount: null
|
| 179 |
+
subtotal_incl_tax: 0
|
| 180 |
+
base_subtotal_total_incl_tax: null
|
| 181 |
+
hidden_tax_amount: null
|
| 182 |
+
base_hidden_tax_amount: null
|
| 183 |
+
shipping_hidden_tax_amount: null
|
| 184 |
+
base_shipping_hidden_tax_amnt: null
|
| 185 |
+
shipping_incl_tax: 0
|
| 186 |
+
base_shipping_incl_tax: 0
|
| 187 |
+
vat_id: null
|
| 188 |
+
vat_is_valid: null
|
| 189 |
+
vat_request_id: null
|
| 190 |
+
vat_request_date: null
|
| 191 |
+
vat_request_success: null
|
| 192 |
+
gift_message_id: null
|
| 193 |
+
base_customer_balance_amount: null
|
| 194 |
+
customer_balance_amount: null
|
| 195 |
+
gift_cards_amount: null
|
| 196 |
+
base_gift_cards_amount: null
|
| 197 |
+
gift_cards: null
|
| 198 |
+
used_gift_cards: null
|
| 199 |
+
giftregistry_item_id: null
|
| 200 |
+
gw_id: null
|
| 201 |
+
gw_allow_gift_receipt: null
|
| 202 |
+
gw_add_card: null
|
| 203 |
+
gw_base_price: null
|
| 204 |
+
gw_price: null
|
| 205 |
+
gw_items_base_price: null
|
| 206 |
+
gw_items_price: null
|
| 207 |
+
gw_card_base_price: null
|
| 208 |
+
gw_card_price: null
|
| 209 |
+
gw_base_tax_amount: null
|
| 210 |
+
gw_tax_amount: null
|
| 211 |
+
gw_items_base_tax_amount: null
|
| 212 |
+
gw_items_tax_amount: null
|
| 213 |
+
gw_card_base_tax_amount: null
|
| 214 |
+
gw_card_tax_amount: null
|
| 215 |
+
reward_points_balance: null
|
| 216 |
+
base_reward_currency_amount: null
|
| 217 |
+
reward_currency_amount: null
|
| 218 |
+
is_cornerdrop_collect: null
|
| 219 |
+
cornerdrop_fee_amount: 0
|
| 220 |
+
base_cornerdrop_fee_amount: 0
|
| 221 |
+
cornerdrop_tax_amount: null
|
| 222 |
+
base_cornerdrop_tax_amount: null
|
| 223 |
+
-
|
| 224 |
+
address_id: 2621
|
| 225 |
+
quote_id: 18
|
| 226 |
+
created_at: 2015-04-16 12:20:06
|
| 227 |
+
updated_at: 2015-04-16 12:20:18
|
| 228 |
+
customer_id: null
|
| 229 |
+
save_in_address_book: 0
|
| 230 |
+
customer_address_id: null
|
| 231 |
+
address_type: shipping
|
| 232 |
+
email: null
|
| 233 |
+
prefix: null
|
| 234 |
+
firstname: null
|
| 235 |
+
middlename: null
|
| 236 |
+
lastname: null
|
| 237 |
+
suffix: null
|
| 238 |
+
company: null
|
| 239 |
+
street: null
|
| 240 |
+
city: null
|
| 241 |
+
region: CA
|
| 242 |
+
region_id: 12
|
| 243 |
+
postcode: null
|
| 244 |
+
country_id: US
|
| 245 |
+
telephone: null
|
| 246 |
+
fax: null
|
| 247 |
+
same_as_billing: 1
|
| 248 |
+
free_shipping: 0
|
| 249 |
+
collect_shipping_rates: 0
|
| 250 |
+
shipping_method: null
|
| 251 |
+
shipping_description: null
|
| 252 |
+
weight: 1
|
| 253 |
+
subtotal: 140
|
| 254 |
+
base_subtotal: 140
|
| 255 |
+
subtotal_with_discount: 0
|
| 256 |
+
base_subtotal_with_discount: 0
|
| 257 |
+
tax_amount: 12.38
|
| 258 |
+
base_tax_amount: 12.38
|
| 259 |
+
shipping_amount: 0
|
| 260 |
+
base_shipping_amount: 0
|
| 261 |
+
shipping_tax_amount: 0
|
| 262 |
+
base_shipping_tax_amount: 0
|
| 263 |
+
discount_amount: 0
|
| 264 |
+
base_discount_amount: 0
|
| 265 |
+
grand_total: 161.55
|
| 266 |
+
base_grand_total: 161.55
|
| 267 |
+
customer_notes: null
|
| 268 |
+
applied_taxes: a:1:{s:30:"US-All States-TaxableGoodsRate";a:6:{s:5:"rates";a:1:{i:0;a:6:{s:4:"code";s:30:"US-All States-TaxableGoodsRate";s:5:"title";s:30:"US-All States-TaxableGoodsRate";s:7:"percent";d:8.25;s:8:"position";s:1:"0";s:8:"priority";s:1:"0";s:7:"rule_id";s:2:"13";}}s:7:"percent";d:8.25;s:2:"id";s:30:"US-All States-TaxableGoodsRate";s:7:"process";i:0;s:6:"amount";d:11.550000000000001;s:11:"base_amount";d:11.550000000000001;}}
|
| 269 |
+
discount_description: null
|
| 270 |
+
shipping_discount_amount: 0
|
| 271 |
+
base_shipping_discount_amount: 0
|
| 272 |
+
subtotal_incl_tax: 151.55
|
| 273 |
+
base_subtotal_total_incl_tax: null
|
| 274 |
+
hidden_tax_amount: 0
|
| 275 |
+
base_hidden_tax_amount: 0
|
| 276 |
+
shipping_hidden_tax_amount: 0
|
| 277 |
+
base_shipping_hidden_tax_amnt: null
|
| 278 |
+
shipping_incl_tax: 0
|
| 279 |
+
base_shipping_incl_tax: 0
|
| 280 |
+
vat_id: null
|
| 281 |
+
vat_is_valid: null
|
| 282 |
+
vat_request_id: null
|
| 283 |
+
vat_request_date: null
|
| 284 |
+
vat_request_success: null
|
| 285 |
+
gift_message_id: null
|
| 286 |
+
base_customer_balance_amount: null
|
| 287 |
+
customer_balance_amount: null
|
| 288 |
+
gift_cards_amount: null
|
| 289 |
+
base_gift_cards_amount: null
|
| 290 |
+
gift_cards: null
|
| 291 |
+
used_gift_cards: null
|
| 292 |
+
giftregistry_item_id: null
|
| 293 |
+
gw_id: null
|
| 294 |
+
gw_allow_gift_receipt: null
|
| 295 |
+
gw_add_card: null
|
| 296 |
+
gw_base_price: null
|
| 297 |
+
gw_price: null
|
| 298 |
+
gw_items_base_price: null
|
| 299 |
+
gw_items_price: null
|
| 300 |
+
gw_card_base_price: null
|
| 301 |
+
gw_card_price: null
|
| 302 |
+
gw_base_tax_amount: null
|
| 303 |
+
gw_tax_amount: null
|
| 304 |
+
gw_items_base_tax_amount: null
|
| 305 |
+
gw_items_tax_amount: null
|
| 306 |
+
gw_card_base_tax_amount: null
|
| 307 |
+
gw_card_tax_amount: null
|
| 308 |
+
reward_points_balance: null
|
| 309 |
+
base_reward_currency_amount: null
|
| 310 |
+
reward_currency_amount: null
|
| 311 |
+
is_cornerdrop_collect: 1
|
| 312 |
+
cornerdrop_fee_amount: 10
|
| 313 |
+
base_cornerdrop_fee_amount: 10
|
| 314 |
+
cornerdrop_tax_amount: 1
|
| 315 |
+
base_cornerdrop_tax_amount: 1
|
| 316 |
+
sales_flat_quote_item:
|
| 317 |
+
-
|
| 318 |
+
item_id: 2517
|
| 319 |
+
quote_id: 18
|
| 320 |
+
created_at: 2015-04-16 12:20:06
|
| 321 |
+
updated_at: 2015-04-16 12:20:18
|
| 322 |
+
product_id: 421
|
| 323 |
+
store_id: 1
|
| 324 |
+
parent_item_id: null
|
| 325 |
+
is_virtual: 0
|
| 326 |
+
sku: wbk013
|
| 327 |
+
name: Elizabeth Knit Top
|
| 328 |
+
description: null
|
| 329 |
+
applied_rule_ids: null
|
| 330 |
+
additional_data: null
|
| 331 |
+
free_shipping: 0
|
| 332 |
+
is_qty_decimal: 0
|
| 333 |
+
no_discount: 0
|
| 334 |
+
weight: 1
|
| 335 |
+
qty: 1
|
| 336 |
+
price: 210
|
| 337 |
+
base_price: 210
|
| 338 |
+
custom_price: null
|
| 339 |
+
discount_percent: 0
|
| 340 |
+
discount_amount: 0
|
| 341 |
+
base_discount_amount: 0
|
| 342 |
+
tax_percent: 8.25
|
| 343 |
+
tax_amount: 17.33
|
| 344 |
+
base_tax_amount: 17.33
|
| 345 |
+
row_total: 210
|
| 346 |
+
base_row_total: 210
|
| 347 |
+
row_total_with_discount: 0
|
| 348 |
+
row_weight: 1
|
| 349 |
+
product_type: configurable
|
| 350 |
+
base_tax_before_discount: null
|
| 351 |
+
tax_before_discount: null
|
| 352 |
+
original_custom_price: null
|
| 353 |
+
redirect_url: null
|
| 354 |
+
base_cost: null
|
| 355 |
+
price_incl_tax: 227.33
|
| 356 |
+
base_price_incl_tax: 227.33
|
| 357 |
+
row_total_incl_tax: 227.33
|
| 358 |
+
base_row_total_incl_tax: 227.33
|
| 359 |
+
hidden_tax_amount: 0
|
| 360 |
+
base_hidden_tax_amount: 0
|
| 361 |
+
gift_message_id: null
|
| 362 |
+
weee_tax_disposition: 0
|
| 363 |
+
weee_tax_row_disposition: 0
|
| 364 |
+
base_weee_tax_disposition: 0
|
| 365 |
+
base_weee_tax_row_disposition: 0
|
| 366 |
+
weee_tax_applied: a:0:{}
|
| 367 |
+
weee_tax_applied_amount: 0
|
| 368 |
+
weee_tax_applied_row_amount: 0
|
| 369 |
+
base_weee_tax_applied_amount: 0
|
| 370 |
+
base_weee_tax_applied_row_amnt: null
|
| 371 |
+
event_id: null
|
| 372 |
+
giftregistry_item_id: null
|
| 373 |
+
gw_id: null
|
| 374 |
+
gw_base_price: null
|
| 375 |
+
gw_price: null
|
| 376 |
+
gw_base_tax_amount: null
|
| 377 |
+
gw_tax_amount: null
|
| 378 |
+
-
|
| 379 |
+
item_id: 2518
|
| 380 |
+
quote_id: 18
|
| 381 |
+
created_at: 2015-04-16 12:20:06
|
| 382 |
+
updated_at: 2015-04-16 12:20:18
|
| 383 |
+
product_id: 295
|
| 384 |
+
store_id: 1
|
| 385 |
+
parent_item_id: 2517
|
| 386 |
+
is_virtual: 0
|
| 387 |
+
sku: wbk013
|
| 388 |
+
name: Elizabeth Knit Top
|
| 389 |
+
description: null
|
| 390 |
+
applied_rule_ids: null
|
| 391 |
+
additional_data: null
|
| 392 |
+
free_shipping: 0
|
| 393 |
+
is_qty_decimal: 0
|
| 394 |
+
no_discount: 0
|
| 395 |
+
weight: 1
|
| 396 |
+
qty: 1
|
| 397 |
+
price: 0
|
| 398 |
+
base_price: 0
|
| 399 |
+
custom_price: null
|
| 400 |
+
discount_percent: 0
|
| 401 |
+
discount_amount: 0
|
| 402 |
+
base_discount_amount: 0
|
| 403 |
+
tax_percent: 0
|
| 404 |
+
tax_amount: 0
|
| 405 |
+
base_tax_amount: 0
|
| 406 |
+
row_total: 0
|
| 407 |
+
base_row_total: 0
|
| 408 |
+
row_total_with_discount: 0
|
| 409 |
+
row_weight: 0
|
| 410 |
+
product_type: simple
|
| 411 |
+
base_tax_before_discount: null
|
| 412 |
+
tax_before_discount: null
|
| 413 |
+
original_custom_price: null
|
| 414 |
+
redirect_url: null
|
| 415 |
+
base_cost: null
|
| 416 |
+
price_incl_tax: null
|
| 417 |
+
base_price_incl_tax: null
|
| 418 |
+
row_total_incl_tax: null
|
| 419 |
+
base_row_total_incl_tax: null
|
| 420 |
+
hidden_tax_amount: null
|
| 421 |
+
base_hidden_tax_amount: null
|
| 422 |
+
gift_message_id: null
|
| 423 |
+
weee_tax_disposition: 0
|
| 424 |
+
weee_tax_row_disposition: 0
|
| 425 |
+
base_weee_tax_disposition: 0
|
| 426 |
+
base_weee_tax_row_disposition: 0
|
| 427 |
+
weee_tax_applied: a:0:{}
|
| 428 |
+
weee_tax_applied_amount: 0
|
| 429 |
+
weee_tax_applied_row_amount: 0
|
| 430 |
+
base_weee_tax_applied_amount: 0
|
| 431 |
+
base_weee_tax_applied_row_amnt: null
|
| 432 |
+
event_id: null
|
| 433 |
+
giftregistry_item_id: null
|
| 434 |
+
gw_id: null
|
| 435 |
+
gw_base_price: null
|
| 436 |
+
gw_price: null
|
| 437 |
+
gw_base_tax_amount: null
|
| 438 |
+
gw_tax_amount: null
|
app/code/community/CornerDrop/Collect/Test/Model/Sales/Quote/Address/Total/CornerDrop/Fee/fixtures/testCornerDropFeeNotAdded.yaml
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
config:
|
| 2 |
+
default/cornerdrop_collect/settings/enabled: 0
|
| 3 |
+
default/cornerdrop_collect/status/balance: 10
|
| 4 |
+
default/cornerdrop_collect/fee_settings/additional_fee: 10
|
| 5 |
+
default/cornerdrop_collect/fee_settings/include_tax: 1
|
| 6 |
+
tables:
|
| 7 |
+
sales_flat_quote:
|
| 8 |
+
-
|
| 9 |
+
entity_id: 18
|
| 10 |
+
store_id: 1
|
| 11 |
+
created_at: 2015-04-16 13:20:17
|
| 12 |
+
updated_at: 2015-04-16 12:20:18
|
| 13 |
+
converted_at: null
|
| 14 |
+
is_active: 1
|
| 15 |
+
is_virtual: 0
|
| 16 |
+
is_multi_shipping: 0
|
| 17 |
+
items_count: 1
|
| 18 |
+
items_qty: 1
|
| 19 |
+
orig_order_id: 0
|
| 20 |
+
store_to_base_rate: 1
|
| 21 |
+
store_to_quote_rate: 1
|
| 22 |
+
base_currency_code: USD
|
| 23 |
+
store_currency_code: USD
|
| 24 |
+
quote_currency_code: USD
|
| 25 |
+
grand_total: 161.55
|
| 26 |
+
base_grand_total: 161.55
|
| 27 |
+
checkout_method: null
|
| 28 |
+
customer_id: null
|
| 29 |
+
customer_tax_class_id: 10
|
| 30 |
+
customer_group_id: 0
|
| 31 |
+
customer_email: null
|
| 32 |
+
customer_prefix: null
|
| 33 |
+
customer_firstname: null
|
| 34 |
+
customer_middlename: null
|
| 35 |
+
customer_lastname: null
|
| 36 |
+
customer_suffix: null
|
| 37 |
+
customer_dob: null
|
| 38 |
+
customer_note: null
|
| 39 |
+
customer_note_notify: 1
|
| 40 |
+
customer_is_guest: 0
|
| 41 |
+
remote_ip: 127.0.0.1
|
| 42 |
+
applied_rule_ids: null
|
| 43 |
+
reserved_order_id: null
|
| 44 |
+
password_hash: null
|
| 45 |
+
coupon_code: null
|
| 46 |
+
global_currency_code: USD
|
| 47 |
+
base_to_global_rate: 1
|
| 48 |
+
base_to_quote_rate: 1
|
| 49 |
+
customer_taxvat: null
|
| 50 |
+
customer_gender: null
|
| 51 |
+
subtotal: 140
|
| 52 |
+
base_subtotal: 140
|
| 53 |
+
subtotal_with_discount: 140
|
| 54 |
+
base_subtotal_with_discount: 140
|
| 55 |
+
is_changed: 1
|
| 56 |
+
trigger_recollect: 0
|
| 57 |
+
ext_shipping_info: null
|
| 58 |
+
gift_message_id: null
|
| 59 |
+
is_persistent: 0
|
| 60 |
+
customer_balance_amount_used: null
|
| 61 |
+
base_customer_bal_amount_used: null
|
| 62 |
+
use_customer_balance: null
|
| 63 |
+
gift_cards: null
|
| 64 |
+
gift_cards_amount: null
|
| 65 |
+
base_gift_cards_amount: null
|
| 66 |
+
gift_cards_amount_used: null
|
| 67 |
+
base_gift_cards_amount_used: null
|
| 68 |
+
gw_id: null
|
| 69 |
+
gw_allow_gift_receipt: null
|
| 70 |
+
gw_add_card: null
|
| 71 |
+
gw_base_price: null
|
| 72 |
+
gw_price: null
|
| 73 |
+
gw_items_base_price: null
|
| 74 |
+
gw_items_price: null
|
| 75 |
+
gw_card_base_price: null
|
| 76 |
+
gw_card_price: null
|
| 77 |
+
gw_base_tax_amount: null
|
| 78 |
+
gw_tax_amount: null
|
| 79 |
+
gw_items_base_tax_amount: null
|
| 80 |
+
gw_items_tax_amount: null
|
| 81 |
+
gw_card_base_tax_amount: null
|
| 82 |
+
gw_card_tax_amount: null
|
| 83 |
+
use_reward_points: null
|
| 84 |
+
reward_points_balance: null
|
| 85 |
+
base_reward_currency_amount: null
|
| 86 |
+
reward_currency_amount: null
|
| 87 |
+
sales_flat_quote_address:
|
| 88 |
+
-
|
| 89 |
+
address_id: 2620
|
| 90 |
+
quote_id: 18
|
| 91 |
+
created_at: 2015-04-16 12:20:06
|
| 92 |
+
updated_at: 2015-04-16 12:20:18
|
| 93 |
+
customer_id: null
|
| 94 |
+
save_in_address_book: 0
|
| 95 |
+
customer_address_id: null
|
| 96 |
+
address_type: billing
|
| 97 |
+
email: null
|
| 98 |
+
prefix: null
|
| 99 |
+
firstname: null
|
| 100 |
+
middlename: null
|
| 101 |
+
lastname: null
|
| 102 |
+
suffix: null
|
| 103 |
+
company: null
|
| 104 |
+
street: null
|
| 105 |
+
city: null
|
| 106 |
+
region: CA
|
| 107 |
+
region_id: 12
|
| 108 |
+
postcode: null
|
| 109 |
+
country_id: US
|
| 110 |
+
telephone: null
|
| 111 |
+
fax: null
|
| 112 |
+
same_as_billing: 0
|
| 113 |
+
free_shipping: 0
|
| 114 |
+
collect_shipping_rates: 0
|
| 115 |
+
shipping_method: null
|
| 116 |
+
shipping_description: null
|
| 117 |
+
weight: 0
|
| 118 |
+
subtotal: 0
|
| 119 |
+
base_subtotal: 0
|
| 120 |
+
subtotal_with_discount: 0
|
| 121 |
+
base_subtotal_with_discount: 0
|
| 122 |
+
tax_amount: 0
|
| 123 |
+
base_tax_amount: 0
|
| 124 |
+
shipping_amount: 0
|
| 125 |
+
base_shipping_amount: 0
|
| 126 |
+
shipping_tax_amount: 0
|
| 127 |
+
base_shipping_tax_amount: 0
|
| 128 |
+
discount_amount: 0
|
| 129 |
+
base_discount_amount: 0
|
| 130 |
+
grand_total: 0
|
| 131 |
+
base_grand_total: 0
|
| 132 |
+
customer_notes: null
|
| 133 |
+
applied_taxes: a:0:{}
|
| 134 |
+
discount_description: null
|
| 135 |
+
shipping_discount_amount: null
|
| 136 |
+
base_shipping_discount_amount: null
|
| 137 |
+
subtotal_incl_tax: 0
|
| 138 |
+
base_subtotal_total_incl_tax: null
|
| 139 |
+
hidden_tax_amount: null
|
| 140 |
+
base_hidden_tax_amount: null
|
| 141 |
+
shipping_hidden_tax_amount: null
|
| 142 |
+
base_shipping_hidden_tax_amnt: null
|
| 143 |
+
shipping_incl_tax: 0
|
| 144 |
+
base_shipping_incl_tax: 0
|
| 145 |
+
vat_id: null
|
| 146 |
+
vat_is_valid: null
|
| 147 |
+
vat_request_id: null
|
| 148 |
+
vat_request_date: null
|
| 149 |
+
vat_request_success: null
|
| 150 |
+
gift_message_id: null
|
| 151 |
+
base_customer_balance_amount: null
|
| 152 |
+
customer_balance_amount: null
|
| 153 |
+
gift_cards_amount: null
|
| 154 |
+
base_gift_cards_amount: null
|
| 155 |
+
gift_cards: null
|
| 156 |
+
used_gift_cards: null
|
| 157 |
+
giftregistry_item_id: null
|
| 158 |
+
gw_id: null
|
| 159 |
+
gw_allow_gift_receipt: null
|
| 160 |
+
gw_add_card: null
|
| 161 |
+
gw_base_price: null
|
| 162 |
+
gw_price: null
|
| 163 |
+
gw_items_base_price: null
|
| 164 |
+
gw_items_price: null
|
| 165 |
+
gw_card_base_price: null
|
| 166 |
+
gw_card_price: null
|
| 167 |
+
gw_base_tax_amount: null
|
| 168 |
+
gw_tax_amount: null
|
| 169 |
+
gw_items_base_tax_amount: null
|
| 170 |
+
gw_items_tax_amount: null
|
| 171 |
+
gw_card_base_tax_amount: null
|
| 172 |
+
gw_card_tax_amount: null
|
| 173 |
+
reward_points_balance: null
|
| 174 |
+
base_reward_currency_amount: null
|
| 175 |
+
reward_currency_amount: null
|
| 176 |
+
is_cornerdrop_collect: null
|
| 177 |
+
cornerdrop_fee_amount: 0
|
| 178 |
+
base_cornerdrop_fee_amount: 0
|
| 179 |
+
cornerdrop_tax_amount: null
|
| 180 |
+
base_cornerdrop_tax_amount: null
|
| 181 |
+
-
|
| 182 |
+
address_id: 2621
|
| 183 |
+
quote_id: 18
|
| 184 |
+
created_at: 2015-04-16 12:20:06
|
| 185 |
+
updated_at: 2015-04-16 12:20:18
|
| 186 |
+
customer_id: null
|
| 187 |
+
save_in_address_book: 0
|
| 188 |
+
customer_address_id: null
|
| 189 |
+
address_type: shipping
|
| 190 |
+
email: null
|
| 191 |
+
prefix: null
|
| 192 |
+
firstname: null
|
| 193 |
+
middlename: null
|
| 194 |
+
lastname: null
|
| 195 |
+
suffix: null
|
| 196 |
+
company: null
|
| 197 |
+
street: null
|
| 198 |
+
city: null
|
| 199 |
+
region: CA
|
| 200 |
+
region_id: 12
|
| 201 |
+
postcode: null
|
| 202 |
+
country_id: US
|
| 203 |
+
telephone: null
|
| 204 |
+
fax: null
|
| 205 |
+
same_as_billing: 1
|
| 206 |
+
free_shipping: 0
|
| 207 |
+
collect_shipping_rates: 0
|
| 208 |
+
shipping_method: null
|
| 209 |
+
shipping_description: null
|
| 210 |
+
weight: 1
|
| 211 |
+
subtotal: 140
|
| 212 |
+
base_subtotal: 140
|
| 213 |
+
subtotal_with_discount: 0
|
| 214 |
+
base_subtotal_with_discount: 0
|
| 215 |
+
tax_amount: 12.38
|
| 216 |
+
base_tax_amount: 12.38
|
| 217 |
+
shipping_amount: 0
|
| 218 |
+
base_shipping_amount: 0
|
| 219 |
+
shipping_tax_amount: 0
|
| 220 |
+
base_shipping_tax_amount: 0
|
| 221 |
+
discount_amount: 0
|
| 222 |
+
base_discount_amount: 0
|
| 223 |
+
grand_total: 161.55
|
| 224 |
+
base_grand_total: 161.55
|
| 225 |
+
customer_notes: null
|
| 226 |
+
applied_taxes: a:1:{s:30:"US-All States-TaxableGoodsRate";a:6:{s:5:"rates";a:1:{i:0;a:6:{s:4:"code";s:30:"US-All States-TaxableGoodsRate";s:5:"title";s:30:"US-All States-TaxableGoodsRate";s:7:"percent";d:8.25;s:8:"position";s:1:"0";s:8:"priority";s:1:"0";s:7:"rule_id";s:2:"13";}}s:7:"percent";d:8.25;s:2:"id";s:30:"US-All States-TaxableGoodsRate";s:7:"process";i:0;s:6:"amount";d:11.550000000000001;s:11:"base_amount";d:11.550000000000001;}}
|
| 227 |
+
discount_description: null
|
| 228 |
+
shipping_discount_amount: 0
|
| 229 |
+
base_shipping_discount_amount: 0
|
| 230 |
+
subtotal_incl_tax: 151.55
|
| 231 |
+
base_subtotal_total_incl_tax: null
|
| 232 |
+
hidden_tax_amount: 0
|
| 233 |
+
base_hidden_tax_amount: 0
|
| 234 |
+
shipping_hidden_tax_amount: 0
|
| 235 |
+
base_shipping_hidden_tax_amnt: null
|
| 236 |
+
shipping_incl_tax: 0
|
| 237 |
+
base_shipping_incl_tax: 0
|
| 238 |
+
vat_id: null
|
| 239 |
+
vat_is_valid: null
|
| 240 |
+
vat_request_id: null
|
| 241 |
+
vat_request_date: null
|
| 242 |
+
vat_request_success: null
|
| 243 |
+
gift_message_id: null
|
| 244 |
+
base_customer_balance_amount: null
|
| 245 |
+
customer_balance_amount: null
|
| 246 |
+
gift_cards_amount: null
|
| 247 |
+
base_gift_cards_amount: null
|
| 248 |
+
gift_cards: null
|
| 249 |
+
used_gift_cards: null
|
| 250 |
+
giftregistry_item_id: null
|
| 251 |
+
gw_id: null
|
| 252 |
+
gw_allow_gift_receipt: null
|
| 253 |
+
gw_add_card: null
|
| 254 |
+
gw_base_price: null
|
| 255 |
+
gw_price: null
|
| 256 |
+
gw_items_base_price: null
|
| 257 |
+
gw_items_price: null
|
| 258 |
+
gw_card_base_price: null
|
| 259 |
+
gw_card_price: null
|
| 260 |
+
gw_base_tax_amount: null
|
| 261 |
+
gw_tax_amount: null
|
| 262 |
+
gw_items_base_tax_amount: null
|
| 263 |
+
gw_items_tax_amount: null
|
| 264 |
+
gw_card_base_tax_amount: null
|
| 265 |
+
gw_card_tax_amount: null
|
| 266 |
+
reward_points_balance: null
|
| 267 |
+
base_reward_currency_amount: null
|
| 268 |
+
reward_currency_amount: null
|
| 269 |
+
is_cornerdrop_collect: 0
|
| 270 |
+
cornerdrop_fee_amount: 0
|
| 271 |
+
base_cornerdrop_fee_amount: 0
|
| 272 |
+
cornerdrop_tax_amount: null
|
| 273 |
+
base_cornerdrop_tax_amount: null
|
app/code/community/CornerDrop/Collect/controllers/Adminhtml/Cornerdrop/Collect/SearchController.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_Adminhtml_Cornerdrop_Collect_SearchController extends Mage_Adminhtml_Controller_Action
|
| 4 |
+
{
|
| 5 |
+
public function indexAction()
|
| 6 |
+
{
|
| 7 |
+
$query = $this->getRequest()->getParam("q");
|
| 8 |
+
$lat = $this->getRequest()->getParam("lat");
|
| 9 |
+
$long = $this->getRequest()->getParam("long");
|
| 10 |
+
|
| 11 |
+
if (is_null($lat) || is_null($long)) {
|
| 12 |
+
return $this->setErrorResponse(400, $this->getHelper()->__("Missing parameters."));
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
/** @var Mage_Sales_Model_Quote $quote */
|
| 16 |
+
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
| 17 |
+
|
| 18 |
+
$quote->setRemoteIp(Mage::helper('core/http')->getRemoteAddr());
|
| 19 |
+
|
| 20 |
+
$results = $this->getHelper()->search(
|
| 21 |
+
$quote,
|
| 22 |
+
$query,
|
| 23 |
+
$lat,
|
| 24 |
+
$long
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
if (is_null($results)) {
|
| 28 |
+
return $this->setErrorResponse(500, $this->getHelper()->__("Failed to fetch the search results, please try again."));
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
$this->getResponse()
|
| 32 |
+
->setHeader("Content-type", "application/json")
|
| 33 |
+
->appendBody(Mage::helper("core")->jsonEncode($results));
|
| 34 |
+
|
| 35 |
+
return $this;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Get the module helper.
|
| 40 |
+
*
|
| 41 |
+
* @return CornerDrop_Collect_Helper_Data
|
| 42 |
+
*/
|
| 43 |
+
protected function getHelper()
|
| 44 |
+
{
|
| 45 |
+
return Mage::helper("cornerdrop_collect");
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Set an error code and message on the response.
|
| 50 |
+
*
|
| 51 |
+
* @param int $code
|
| 52 |
+
* @param string $message
|
| 53 |
+
*
|
| 54 |
+
* @return $this
|
| 55 |
+
* @throws Zend_Controller_Response_Exception
|
| 56 |
+
*/
|
| 57 |
+
protected function setErrorResponse($code, $message)
|
| 58 |
+
{
|
| 59 |
+
$this->getResponse()
|
| 60 |
+
->setHttpResponseCode($code)
|
| 61 |
+
->setHeader("Content-type", "application/json")
|
| 62 |
+
->appendBody(Mage::helper("core")->jsonEncode(array(
|
| 63 |
+
"message" => $message
|
| 64 |
+
)));
|
| 65 |
+
|
| 66 |
+
return $this;
|
| 67 |
+
}
|
| 68 |
+
}
|
app/code/community/CornerDrop/Collect/controllers/SearchController.php
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CornerDrop_Collect_SearchController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function indexAction()
|
| 7 |
+
{
|
| 8 |
+
$query = $this->getRequest()->getParam("q");
|
| 9 |
+
$lat = $this->getRequest()->getParam("lat");
|
| 10 |
+
$long = $this->getRequest()->getParam("long");
|
| 11 |
+
|
| 12 |
+
if (is_null($lat) || is_null($long)) {
|
| 13 |
+
return $this->setErrorResponse(400, $this->getHelper()->__("Missing parameters."));
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
$quote = Mage::getSingleton("checkout/session")->getQuote();
|
| 17 |
+
|
| 18 |
+
if (!$quote->getId()) {
|
| 19 |
+
return $this->setErrorResponse(400, $this->getHelper()->__("Invalid session."));
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
$results = $this->getHelper()->search(
|
| 23 |
+
$quote,
|
| 24 |
+
$query,
|
| 25 |
+
$lat,
|
| 26 |
+
$long
|
| 27 |
+
);
|
| 28 |
+
|
| 29 |
+
if (is_null($results)) {
|
| 30 |
+
return $this->setErrorResponse(500, $this->getHelper()->__("Failed to fetch the search results, please try again."));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
$this->getResponse()
|
| 34 |
+
->setHeader("Content-type", "application/json")
|
| 35 |
+
->appendBody(Mage::helper("core")->jsonEncode($results));
|
| 36 |
+
|
| 37 |
+
return $this;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Set an error code and message on the response.
|
| 42 |
+
*
|
| 43 |
+
* @param int $code
|
| 44 |
+
* @param string $message
|
| 45 |
+
*
|
| 46 |
+
* @return $this
|
| 47 |
+
* @throws Zend_Controller_Response_Exception
|
| 48 |
+
*/
|
| 49 |
+
protected function setErrorResponse($code, $message)
|
| 50 |
+
{
|
| 51 |
+
$this->getResponse()
|
| 52 |
+
->setHttpResponseCode($code)
|
| 53 |
+
->setHeader("Content-type", "application/json")
|
| 54 |
+
->appendBody(Mage::helper("core")->jsonEncode(array(
|
| 55 |
+
"message" => $message
|
| 56 |
+
)));
|
| 57 |
+
|
| 58 |
+
return $this;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Get the module helper.
|
| 63 |
+
*
|
| 64 |
+
* @return CornerDrop_Collect_Helper_Data
|
| 65 |
+
*/
|
| 66 |
+
protected function getHelper()
|
| 67 |
+
{
|
| 68 |
+
return Mage::helper("cornerdrop_collect");
|
| 69 |
+
}
|
| 70 |
+
}
|
app/code/community/CornerDrop/Collect/data/cornerdrop_collect_setup/data-install-1.0.0.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/** @var Mage_Core_Model_Resource_Setup $installer */
|
| 4 |
+
$installer = $this;
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
// Add is_cornerdrop_collect attribute to customer address
|
| 8 |
+
|
| 9 |
+
$admin_store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
| 10 |
+
|
| 11 |
+
$attribute = Mage::getSingleton('eav/config')
|
| 12 |
+
->getAttribute('customer_address', CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT);
|
| 13 |
+
$attribute->setWebsite($admin_store->getWebsite());
|
| 14 |
+
if (!$attribute->getId()) {
|
| 15 |
+
$attribute->addData(array(
|
| 16 |
+
'label' => 'Is CornerDrop Collect',
|
| 17 |
+
'backend_type' => 'int',
|
| 18 |
+
'frontend_input' => 'hidden',
|
| 19 |
+
'is_user_defined' => 0,
|
| 20 |
+
'is_system' => 1,
|
| 21 |
+
'is_visible' => 1,
|
| 22 |
+
'is_required' => 0,
|
| 23 |
+
'used_in_forms' => array(
|
| 24 |
+
'customer_address_edit'
|
| 25 |
+
)
|
| 26 |
+
));
|
| 27 |
+
$attribute->save();
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// Add cornerdrop_store_id attribute to customer address
|
| 31 |
+
|
| 32 |
+
$attribute = Mage::getSingleton('eav/config')
|
| 33 |
+
->getAttribute('customer_address', CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN);
|
| 34 |
+
$attribute->setWebsite($admin_store->getWebsite());
|
| 35 |
+
if (!$attribute->getId()) {
|
| 36 |
+
$attribute->addData(array(
|
| 37 |
+
'label' => 'CornerDrop Store ID',
|
| 38 |
+
'backend_type' => 'int',
|
| 39 |
+
'frontend_input' => 'hidden',
|
| 40 |
+
'is_user_defined' => 0,
|
| 41 |
+
'is_system' => 1,
|
| 42 |
+
'is_visible' => 1,
|
| 43 |
+
'is_required' => 0,
|
| 44 |
+
'used_in_forms' => array(
|
| 45 |
+
'customer_address_edit'
|
| 46 |
+
)
|
| 47 |
+
));
|
| 48 |
+
$attribute->save();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// Add CornerDrop Collect tax class
|
| 52 |
+
|
| 53 |
+
/** @var Mage_Tax_Model_Class $model */
|
| 54 |
+
$model = Mage::getModel('tax/class');
|
| 55 |
+
/** @var CornerDrop_Collect_Helper_Data $helper */
|
| 56 |
+
$helper = Mage::helper('cornerdrop_collect');
|
| 57 |
+
|
| 58 |
+
try {
|
| 59 |
+
$model->setData(array(
|
| 60 |
+
'class_name' => $helper->getCornerDropFeeLabel(),
|
| 61 |
+
'class_type' => Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT
|
| 62 |
+
));
|
| 63 |
+
$model->save();
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Set CornerDrop Tax Class to default value.
|
| 67 |
+
*/
|
| 68 |
+
Mage::getModel('core/config')->saveConfig(CornerDrop_Collect_Helper_Config::XML_PATH_FEE_SETTINGS_TAX_CLASS, $model->getId());
|
| 69 |
+
|
| 70 |
+
} catch (Exception $e) {
|
| 71 |
+
$helper->log($e->getMessage());
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
$installer->endSetup();
|
app/code/community/CornerDrop/Collect/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<cornerdrop_collect translate="title" module="cornerdrop_collect">
|
| 12 |
+
<title>CornerDrop Configuration</title>
|
| 13 |
+
</cornerdrop_collect>
|
| 14 |
+
</children>
|
| 15 |
+
</config>
|
| 16 |
+
</children>
|
| 17 |
+
</system>
|
| 18 |
+
</children>
|
| 19 |
+
</admin>
|
| 20 |
+
</resources>
|
| 21 |
+
</acl>
|
| 22 |
+
</config>
|
app/code/community/CornerDrop/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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<CornerDrop_Collect>
|
| 5 |
+
<version>1.2.0</version>
|
| 6 |
+
</CornerDrop_Collect>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<cornerdrop_collect>
|
| 11 |
+
<class>CornerDrop_Collect_Block</class>
|
| 12 |
+
</cornerdrop_collect>
|
| 13 |
+
</blocks>
|
| 14 |
+
<helpers>
|
| 15 |
+
<cornerdrop_collect>
|
| 16 |
+
<class>CornerDrop_Collect_Helper</class>
|
| 17 |
+
</cornerdrop_collect>
|
| 18 |
+
</helpers>
|
| 19 |
+
<models>
|
| 20 |
+
<cornerdrop_collect>
|
| 21 |
+
<class>CornerDrop_Collect_Model</class>
|
| 22 |
+
</cornerdrop_collect>
|
| 23 |
+
</models>
|
| 24 |
+
<events>
|
| 25 |
+
<admin_system_config_changed_section_cornerdrop_collect>
|
| 26 |
+
<observers>
|
| 27 |
+
<cornerdrop_collect>
|
| 28 |
+
<type>singleton</type>
|
| 29 |
+
<class>cornerdrop_collect/observer</class>
|
| 30 |
+
<method>checkAccountStatus</method>
|
| 31 |
+
</cornerdrop_collect>
|
| 32 |
+
</observers>
|
| 33 |
+
</admin_system_config_changed_section_cornerdrop_collect>
|
| 34 |
+
<controller_action_predispatch_checkout_onepage_saveBilling>
|
| 35 |
+
<observers>
|
| 36 |
+
<cornerdrop_collect>
|
| 37 |
+
<type>singleton</type>
|
| 38 |
+
<class>cornerdrop_collect/observer</class>
|
| 39 |
+
<method>setCornerDropCollectFlag</method>
|
| 40 |
+
</cornerdrop_collect>
|
| 41 |
+
</observers>
|
| 42 |
+
</controller_action_predispatch_checkout_onepage_saveBilling>
|
| 43 |
+
<controller_action_predispatch_checkout_onepage_saveShipping>
|
| 44 |
+
<observers>
|
| 45 |
+
<cornerdrop_collect>
|
| 46 |
+
<type>singleton</type>
|
| 47 |
+
<class>cornerdrop_collect/observer</class>
|
| 48 |
+
<method>makeCornerDropCollectReservation</method>
|
| 49 |
+
</cornerdrop_collect>
|
| 50 |
+
</observers>
|
| 51 |
+
</controller_action_predispatch_checkout_onepage_saveShipping>
|
| 52 |
+
<customer_address_format>
|
| 53 |
+
<observers>
|
| 54 |
+
<cornerdrop_collect>
|
| 55 |
+
<type>singleton</type>
|
| 56 |
+
<class>cornerdrop_collect/observer</class>
|
| 57 |
+
<method>addCustomerAddressTemplate</method>
|
| 58 |
+
</cornerdrop_collect>
|
| 59 |
+
</observers>
|
| 60 |
+
</customer_address_format>
|
| 61 |
+
<paypal_prepare_line_items>
|
| 62 |
+
<observers>
|
| 63 |
+
<cornerdrop_collect>
|
| 64 |
+
<type>singleton</type>
|
| 65 |
+
<class>cornerdrop_collect/observer</class>
|
| 66 |
+
<method>addTotalToPaypal</method>
|
| 67 |
+
</cornerdrop_collect>
|
| 68 |
+
</observers>
|
| 69 |
+
</paypal_prepare_line_items>
|
| 70 |
+
</events>
|
| 71 |
+
<sales>
|
| 72 |
+
<quote>
|
| 73 |
+
<totals>
|
| 74 |
+
<cornerdrop_fee>
|
| 75 |
+
<class>cornerdrop_collect/sales_quote_address_total_cornerDrop_fee</class>
|
| 76 |
+
<after>tax</after>
|
| 77 |
+
</cornerdrop_fee>
|
| 78 |
+
</totals>
|
| 79 |
+
</quote>
|
| 80 |
+
<order_invoice>
|
| 81 |
+
<totals>
|
| 82 |
+
<cornerdrop_fee>
|
| 83 |
+
<class>cornerdrop_collect/sales_order_invoice_total_cornerDrop_fee</class>
|
| 84 |
+
<after>tax</after>
|
| 85 |
+
</cornerdrop_fee>
|
| 86 |
+
</totals>
|
| 87 |
+
</order_invoice>
|
| 88 |
+
<order_creditmemo>
|
| 89 |
+
<totals>
|
| 90 |
+
<cornerdrop_fee>
|
| 91 |
+
<class>cornerdrop_collect/sales_order_creditmemo_total_cornerDrop_fee</class>
|
| 92 |
+
<after>tax</after>
|
| 93 |
+
</cornerdrop_fee>
|
| 94 |
+
</totals>
|
| 95 |
+
</order_creditmemo>
|
| 96 |
+
</sales>
|
| 97 |
+
<fieldsets>
|
| 98 |
+
<sales_convert_quote_address>
|
| 99 |
+
<is_cornerdrop_collect>
|
| 100 |
+
<to_order_address>*</to_order_address>
|
| 101 |
+
</is_cornerdrop_collect>
|
| 102 |
+
<cornerdrop_store_id>
|
| 103 |
+
<to_order_address>*</to_order_address>
|
| 104 |
+
</cornerdrop_store_id>
|
| 105 |
+
<cornerdrop_reservation_code>
|
| 106 |
+
<to_order_address>*</to_order_address>
|
| 107 |
+
</cornerdrop_reservation_code>
|
| 108 |
+
<cornerdrop_fee_amount>
|
| 109 |
+
<to_order>*</to_order>
|
| 110 |
+
</cornerdrop_fee_amount>
|
| 111 |
+
<base_cornerdrop_fee_amount>
|
| 112 |
+
<to_order>*</to_order>
|
| 113 |
+
</base_cornerdrop_fee_amount>
|
| 114 |
+
<cornerdrop_tax_amount>
|
| 115 |
+
<to_order>*</to_order>
|
| 116 |
+
</cornerdrop_tax_amount>
|
| 117 |
+
<base_cornerdrop_tax_amount>
|
| 118 |
+
<to_order>*</to_order>
|
| 119 |
+
</base_cornerdrop_tax_amount>
|
| 120 |
+
</sales_convert_quote_address>
|
| 121 |
+
</fieldsets>
|
| 122 |
+
<resources>
|
| 123 |
+
<cornerdrop_collect_setup>
|
| 124 |
+
<setup>
|
| 125 |
+
<module>CornerDrop_Collect</module>
|
| 126 |
+
<class>CornerDrop_Collect_Model_Resource_Setup</class>
|
| 127 |
+
</setup>
|
| 128 |
+
</cornerdrop_collect_setup>
|
| 129 |
+
</resources>
|
| 130 |
+
<template>
|
| 131 |
+
<email>
|
| 132 |
+
<cornerdrop_collect_settings_code_email_template>
|
| 133 |
+
<label>CornerDrop Collect Code</label>
|
| 134 |
+
<file>cornerdrop/collect/code.html</file>
|
| 135 |
+
<type>html</type>
|
| 136 |
+
</cornerdrop_collect_settings_code_email_template>
|
| 137 |
+
</email>
|
| 138 |
+
</template>
|
| 139 |
+
</global>
|
| 140 |
+
<admin>
|
| 141 |
+
<routers>
|
| 142 |
+
<adminhtml>
|
| 143 |
+
<args>
|
| 144 |
+
<modules>
|
| 145 |
+
<cornerdrop_collect before="Mage_Adminhtml">CornerDrop_Collect_Adminhtml</cornerdrop_collect>
|
| 146 |
+
</modules>
|
| 147 |
+
</args>
|
| 148 |
+
</adminhtml>
|
| 149 |
+
</routers>
|
| 150 |
+
</admin>
|
| 151 |
+
<adminhtml>
|
| 152 |
+
<layout>
|
| 153 |
+
<updates>
|
| 154 |
+
<cornerdrop_collect>
|
| 155 |
+
<file>cornerdrop/collect.xml</file>
|
| 156 |
+
</cornerdrop_collect>
|
| 157 |
+
</updates>
|
| 158 |
+
</layout>
|
| 159 |
+
<events>
|
| 160 |
+
<adminhtml_sales_order_create_process_data>
|
| 161 |
+
<observers>
|
| 162 |
+
<cornerdrop_collect>
|
| 163 |
+
<type>singleton</type>
|
| 164 |
+
<class>cornerdrop_collect/observer</class>
|
| 165 |
+
<method>setAdminCornerDropCollectFlagAndReserve</method>
|
| 166 |
+
</cornerdrop_collect>
|
| 167 |
+
</observers>
|
| 168 |
+
</adminhtml_sales_order_create_process_data>
|
| 169 |
+
</events>
|
| 170 |
+
</adminhtml>
|
| 171 |
+
<frontend>
|
| 172 |
+
<routers>
|
| 173 |
+
<cornerdrop_collect>
|
| 174 |
+
<use>standard</use>
|
| 175 |
+
<args>
|
| 176 |
+
<module>CornerDrop_Collect</module>
|
| 177 |
+
<frontName>cornerdrop_collect</frontName>
|
| 178 |
+
</args>
|
| 179 |
+
</cornerdrop_collect>
|
| 180 |
+
</routers>
|
| 181 |
+
<layout>
|
| 182 |
+
<updates>
|
| 183 |
+
<cornerdrop_collect>
|
| 184 |
+
<file>cornerdrop/collect.xml</file>
|
| 185 |
+
</cornerdrop_collect>
|
| 186 |
+
</updates>
|
| 187 |
+
</layout>
|
| 188 |
+
</frontend>
|
| 189 |
+
<crontab>
|
| 190 |
+
<jobs>
|
| 191 |
+
<cornerdrop_collect_account_status_check>
|
| 192 |
+
<schedule>
|
| 193 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
| 194 |
+
</schedule>
|
| 195 |
+
<run>
|
| 196 |
+
<model>cornerdrop_collect/observer::checkAccountStatus</model>
|
| 197 |
+
</run>
|
| 198 |
+
</cornerdrop_collect_account_status_check>
|
| 199 |
+
<cornerdrop_collect_send_notifications>
|
| 200 |
+
<schedule>
|
| 201 |
+
<cron_expr>*/15 * * * *</cron_expr>
|
| 202 |
+
</schedule>
|
| 203 |
+
<run>
|
| 204 |
+
<model>cornerdrop_collect/cron::sendNotifications</model>
|
| 205 |
+
</run>
|
| 206 |
+
</cornerdrop_collect_send_notifications>
|
| 207 |
+
</jobs>
|
| 208 |
+
</crontab>
|
| 209 |
+
<default>
|
| 210 |
+
<cornerdrop_collect>
|
| 211 |
+
<settings>
|
| 212 |
+
<active>0</active>
|
| 213 |
+
<code_email_template>cornerdrop_collect_code_email_template</code_email_template>
|
| 214 |
+
<api_uri>https://api.cornerdrop.com/papi/</api_uri>
|
| 215 |
+
</settings>
|
| 216 |
+
<address_templates>
|
| 217 |
+
<text><![CDATA[
|
| 218 |
+
{{depend is_cornerdrop_collect}}(CornerDrop address){{/depend}}]]></text>
|
| 219 |
+
<oneline><![CDATA[{{depend is_cornerdrop_collect}} (CornerDrop address){{/depend}}]]></oneline>
|
| 220 |
+
<html><![CDATA[{{depend is_cornerdrop_collect}}<br/>(CornerDrop address){{/depend}}]]></html>
|
| 221 |
+
<pdf><![CDATA[{{depend is_cornerdrop_collect}}<br/>(CornerDrop address){{/depend}}]]></pdf>
|
| 222 |
+
</address_templates>
|
| 223 |
+
</cornerdrop_collect>
|
| 224 |
+
</default>
|
| 225 |
+
<phpunit>
|
| 226 |
+
<suite>
|
| 227 |
+
<modules>
|
| 228 |
+
<CornerDrop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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<config>
|
| 2 |
+
<sections>
|
| 3 |
+
<cornerdrop_collect translate="label" module="cornerdrop_collect">
|
| 4 |
+
<label>CornerDrop</label>
|
| 5 |
+
<tab>sales</tab>
|
| 6 |
+
<frontend_type>text</frontend_type>
|
| 7 |
+
<sort_order>990</sort_order>
|
| 8 |
+
<show_in_default>1</show_in_default>
|
| 9 |
+
<show_in_website>1</show_in_website>
|
| 10 |
+
<show_in_store>1</show_in_store>
|
| 11 |
+
<groups>
|
| 12 |
+
<status translate="label">
|
| 13 |
+
<label>Account Status</label>
|
| 14 |
+
<sort_order>10</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
<expanded>1</expanded>
|
| 19 |
+
<fields>
|
| 20 |
+
<balance translate="label">
|
| 21 |
+
<label>Credit Balance</label>
|
| 22 |
+
<frontend_model>cornerdrop_collect/adminhtml_form_field_account_balance</frontend_model>
|
| 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 |
+
</balance>
|
| 28 |
+
<last_checked translate="label">
|
| 29 |
+
<label>Last Checked</label>
|
| 30 |
+
<frontend_type>label</frontend_type>
|
| 31 |
+
<sort_order>100</sort_order>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
</last_checked>
|
| 36 |
+
</fields>
|
| 37 |
+
</status>
|
| 38 |
+
<settings translate="label">
|
| 39 |
+
<label>General Settings</label>
|
| 40 |
+
<frontend_type>text</frontend_type>
|
| 41 |
+
<sort_order>20</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>1</show_in_store>
|
| 45 |
+
<expanded>1</expanded>
|
| 46 |
+
<fields>
|
| 47 |
+
<enable translate="label">
|
| 48 |
+
<label>Enabled</label>
|
| 49 |
+
<frontend_type>select</frontend_type>
|
| 50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 51 |
+
<sort_order>1</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 |
+
</enable>
|
| 56 |
+
<api_key translate="label">
|
| 57 |
+
<label>API Key</label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<validate>required-entry</validate>
|
| 60 |
+
<comment><![CDATA[Login to your CornerDrop account at <a href="https://cornerdrop.com/" target="_blank">www.cornerdrop.com</a> to obtain your API key.]]></comment>
|
| 61 |
+
<sort_order>2</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 |
+
</api_key>
|
| 66 |
+
<api_uri>
|
| 67 |
+
<label>API URL</label>
|
| 68 |
+
<frontend_type>text</frontend_type>
|
| 69 |
+
<validate>required-entry</validate>
|
| 70 |
+
<comment><![CDATA[Default value.]]></comment>
|
| 71 |
+
<sort_order>3</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 |
+
</api_uri>
|
| 76 |
+
<code_email_template translate="label">
|
| 77 |
+
<label>CornerDrop Customer Collection Email Template</label>
|
| 78 |
+
<frontend_type>select</frontend_type>
|
| 79 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
| 80 |
+
<sort_order>10</sort_order>
|
| 81 |
+
<show_in_default>1</show_in_default>
|
| 82 |
+
<show_in_website>1</show_in_website>
|
| 83 |
+
<show_in_store>1</show_in_store>
|
| 84 |
+
</code_email_template>
|
| 85 |
+
</fields>
|
| 86 |
+
</settings>
|
| 87 |
+
<address_templates translate="label comment">
|
| 88 |
+
<label>Address Templates</label>
|
| 89 |
+
<comment><![CDATA[These address templates are appended to the Customer Address templates for any CornerDrop location addresses.]]></comment>
|
| 90 |
+
<sort_order>30</sort_order>
|
| 91 |
+
<show_in_default>1</show_in_default>
|
| 92 |
+
<show_in_website>1</show_in_website>
|
| 93 |
+
<show_in_store>1</show_in_store>
|
| 94 |
+
<fields>
|
| 95 |
+
<text translate="label">
|
| 96 |
+
<label>Text</label>
|
| 97 |
+
<frontend_type>textarea</frontend_type>
|
| 98 |
+
<sort_order>1</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 |
+
</text>
|
| 103 |
+
<oneline translate="label">
|
| 104 |
+
<label>Text One Line</label>
|
| 105 |
+
<frontend_type>textarea</frontend_type>
|
| 106 |
+
<sort_order>2</sort_order>
|
| 107 |
+
<show_in_default>1</show_in_default>
|
| 108 |
+
<show_in_website>1</show_in_website>
|
| 109 |
+
<show_in_store>1</show_in_store>
|
| 110 |
+
</oneline>
|
| 111 |
+
<html translate="label">
|
| 112 |
+
<label>HTML</label>
|
| 113 |
+
<frontend_type>textarea</frontend_type>
|
| 114 |
+
<sort_order>3</sort_order>
|
| 115 |
+
<show_in_default>1</show_in_default>
|
| 116 |
+
<show_in_website>1</show_in_website>
|
| 117 |
+
<show_in_store>1</show_in_store>
|
| 118 |
+
</html>
|
| 119 |
+
<pdf translate="label">
|
| 120 |
+
<label>PDF</label>
|
| 121 |
+
<frontend_type>textarea</frontend_type>
|
| 122 |
+
<sort_order>4</sort_order>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>1</show_in_store>
|
| 126 |
+
</pdf>
|
| 127 |
+
</fields>
|
| 128 |
+
</address_templates>
|
| 129 |
+
<fee_settings translate="label">
|
| 130 |
+
<label>CornerDrop Fee Settings</label>
|
| 131 |
+
<frontend_type>text</frontend_type>
|
| 132 |
+
<sort_order>40</sort_order>
|
| 133 |
+
<show_in_default>1</show_in_default>
|
| 134 |
+
<show_in_website>1</show_in_website>
|
| 135 |
+
<show_in_store>1</show_in_store>
|
| 136 |
+
<fields>
|
| 137 |
+
<additional_fee translate="label">
|
| 138 |
+
<label>Additional Fee</label>
|
| 139 |
+
<frontend_type>text</frontend_type>
|
| 140 |
+
<validate>validate-number</validate>
|
| 141 |
+
<validate>validate-not-negative-number</validate>
|
| 142 |
+
<comment><![CDATA[Additional fee (excluding tax) which is charged to the customer. Uses the default store currency.]]></comment>
|
| 143 |
+
<sort_order>1</sort_order>
|
| 144 |
+
<show_in_default>1</show_in_default>
|
| 145 |
+
<show_in_website>1</show_in_website>
|
| 146 |
+
<show_in_store>1</show_in_store>
|
| 147 |
+
</additional_fee>
|
| 148 |
+
<include_tax translate="label">
|
| 149 |
+
<label>CornerDrop Fee Include Tax?</label>
|
| 150 |
+
<frontend_type>select</frontend_type>
|
| 151 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 152 |
+
<comment><![CDATA[Is the 'Additional Fee' inclusive of tax?]]></comment>
|
| 153 |
+
<sort_order>2</sort_order>
|
| 154 |
+
<show_in_default>1</show_in_default>
|
| 155 |
+
<show_in_website>1</show_in_website>
|
| 156 |
+
<show_in_store>1</show_in_store>
|
| 157 |
+
</include_tax>
|
| 158 |
+
<tax_class translate="label">
|
| 159 |
+
<label>Tax Class</label>
|
| 160 |
+
<frontend_type>select</frontend_type>
|
| 161 |
+
<source_model>tax/resource_class_collection</source_model>
|
| 162 |
+
<sort_order>3</sort_order>
|
| 163 |
+
<show_in_default>1</show_in_default>
|
| 164 |
+
<show_in_website>1</show_in_website>
|
| 165 |
+
<show_in_store>1</show_in_store>
|
| 166 |
+
</tax_class>
|
| 167 |
+
</fields>
|
| 168 |
+
</fee_settings>
|
| 169 |
+
</groups>
|
| 170 |
+
</cornerdrop_collect>
|
| 171 |
+
</sections>
|
| 172 |
+
</config>
|
app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/install-1.0.0.php
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/** @var Mage_Core_Model_Resource_Setup $installer */
|
| 4 |
+
$installer = $this;
|
| 5 |
+
|
| 6 |
+
$installer->startSetup();
|
| 7 |
+
|
| 8 |
+
$connection = $installer->getConnection();
|
| 9 |
+
|
| 10 |
+
$type_decimal_column = array(
|
| 11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
| 12 |
+
'scale' => '4',
|
| 13 |
+
'precision' => '12',
|
| 14 |
+
'comment' => 'CornerDrop Collect Column'
|
| 15 |
+
);
|
| 16 |
+
|
| 17 |
+
$type_int_column = array(
|
| 18 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
| 19 |
+
'unsigned' => true,
|
| 20 |
+
'comment' => "CornerDrop Collect Column"
|
| 21 |
+
);
|
| 22 |
+
|
| 23 |
+
$type_boolean_column = array(
|
| 24 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
| 25 |
+
'nullable' => false,
|
| 26 |
+
'default' => 0,
|
| 27 |
+
'comment' => "CornerDrop Collect Column"
|
| 28 |
+
);
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
$tables = array(
|
| 32 |
+
$installer->getTable('sales/quote_address') => array(
|
| 33 |
+
CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
| 34 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN => $type_int_column,
|
| 35 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 36 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 37 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $type_decimal_column,
|
| 38 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $type_decimal_column
|
| 39 |
+
),
|
| 40 |
+
$installer->getTable('sales/order') => array(
|
| 41 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 42 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 43 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $type_decimal_column,
|
| 44 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $type_decimal_column,
|
| 45 |
+
CornerDrop_Collect_Helper_Data::ORDERED_NOTIFICATION_COLUMN => $type_boolean_column,
|
| 46 |
+
CornerDrop_Collect_Helper_Data::SHIPPED_NOTIFICATION_COLUMN => $type_boolean_column,
|
| 47 |
+
CornerDrop_Collect_Helper_Data::CANCELLED_NOTIFICATION_COLUMN => $type_boolean_column
|
| 48 |
+
),
|
| 49 |
+
$installer->getTable('sales/order_address') => array(
|
| 50 |
+
CornerDrop_Collect_Helper_Data::IS_CORNERDROP_COLLECT => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
| 51 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN => $type_int_column
|
| 52 |
+
),
|
| 53 |
+
$installer->getTable('sales/invoice') => array(
|
| 54 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 55 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 56 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $type_decimal_column,
|
| 57 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $type_decimal_column
|
| 58 |
+
),
|
| 59 |
+
$installer->getTable('sales/creditmemo') => array(
|
| 60 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 61 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_FEE_AMOUNT => $type_decimal_column,
|
| 62 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_TAX => $type_decimal_column,
|
| 63 |
+
CornerDrop_Collect_Helper_Data::BASE_CORNERDROP_TAX => $type_decimal_column
|
| 64 |
+
)
|
| 65 |
+
);
|
| 66 |
+
|
| 67 |
+
foreach($tables as $table => $columns) {
|
| 68 |
+
foreach ($columns as $column => $type) {
|
| 69 |
+
if (!$connection->tableColumnExists($table, $column)) {
|
| 70 |
+
$connection->addColumn($table, $column, $type);
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
$installer->endSetup();
|
app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/upgrade-1.0.0-1.1.0.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/** @var Mage_Core_Model_Resource_Setup $installer */
|
| 4 |
+
$installer = $this;
|
| 5 |
+
|
| 6 |
+
$installer->startSetup();
|
| 7 |
+
|
| 8 |
+
$connection = $installer->getConnection();
|
| 9 |
+
|
| 10 |
+
$type_int_column = array(
|
| 11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
| 12 |
+
'unsigned' => true,
|
| 13 |
+
'comment' => "CornerDrop Collect Column"
|
| 14 |
+
);
|
| 15 |
+
|
| 16 |
+
$tables = array(
|
| 17 |
+
$installer->getTable('sales/quote_address') => array(
|
| 18 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_RESERVATION_CODE => $type_int_column,
|
| 19 |
+
),
|
| 20 |
+
$installer->getTable('sales/order_address') => array(
|
| 21 |
+
CornerDrop_Collect_Helper_Data::CORNERDROP_RESERVATION_CODE => $type_int_column
|
| 22 |
+
)
|
| 23 |
+
);
|
| 24 |
+
|
| 25 |
+
foreach($tables as $table => $columns) {
|
| 26 |
+
foreach ($columns as $column => $type) {
|
| 27 |
+
if (!$connection->tableColumnExists($table, $column)) {
|
| 28 |
+
$connection->addColumn($table, $column, $type);
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
$installer->endSetup();
|
app/code/community/CornerDrop/Collect/sql/cornerdrop_collect_setup/upgrade-1.1.0-1.2.0.php
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/** @var Mage_Core_Model_Resource_Setup $installer */
|
| 4 |
+
$installer = $this;
|
| 5 |
+
|
| 6 |
+
$installer->startSetup();
|
| 7 |
+
|
| 8 |
+
$connection = $installer->getConnection();
|
| 9 |
+
|
| 10 |
+
// Convert all order notification columns to int
|
| 11 |
+
|
| 12 |
+
$table = $installer->getTable("sales/order");
|
| 13 |
+
|
| 14 |
+
$notification_columns = array(
|
| 15 |
+
CornerDrop_Collect_Helper_Data::ORDERED_NOTIFICATION_COLUMN,
|
| 16 |
+
CornerDrop_Collect_Helper_Data::SHIPPED_NOTIFICATION_COLUMN,
|
| 17 |
+
CornerDrop_Collect_Helper_Data::CANCELLED_NOTIFICATION_COLUMN
|
| 18 |
+
);
|
| 19 |
+
|
| 20 |
+
$type = array(
|
| 21 |
+
"type" => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
| 22 |
+
"unsigned" => true,
|
| 23 |
+
"nullable" => false,
|
| 24 |
+
"default" => 0,
|
| 25 |
+
"comment" => "CornerDrop Collect Column"
|
| 26 |
+
);
|
| 27 |
+
|
| 28 |
+
foreach ($notification_columns as $column) {
|
| 29 |
+
$connection->modifyColumn(
|
| 30 |
+
$table,
|
| 31 |
+
$column,
|
| 32 |
+
$type
|
| 33 |
+
);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/cornerdrop/collect.xml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
|
| 4 |
+
<adminhtml_sales_order_create_index>
|
| 5 |
+
<update handle="editor" />
|
| 6 |
+
|
| 7 |
+
<reference name="head">
|
| 8 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 9 |
+
<file>cornerdrop/collect/switch.js</file>
|
| 10 |
+
</action>
|
| 11 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 12 |
+
<file>cornerdrop/collect/search.js</file>
|
| 13 |
+
</action>
|
| 14 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 15 |
+
<file>cornerdrop/collect/geolocationAPI.js</file>
|
| 16 |
+
</action>
|
| 17 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 18 |
+
<file>cornerdrop/collect/gmaps.js</file>
|
| 19 |
+
</action>
|
| 20 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 21 |
+
<file>cornerdrop/collect/adminhtml_search.js</file>
|
| 22 |
+
</action>
|
| 23 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 24 |
+
<file>cornerdrop/collect/ui.js</file>
|
| 25 |
+
</action>
|
| 26 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 27 |
+
<file>cornerdrop/collect/adminhtml_ui.js</file>
|
| 28 |
+
</action>
|
| 29 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 30 |
+
<file>cornerdrop/collect/adminhtml.js</file>
|
| 31 |
+
</action>
|
| 32 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 33 |
+
<file>cornerdrop/collect/event.simulate.js</file>
|
| 34 |
+
</action>
|
| 35 |
+
<action method="addCss"><name>cornerdrop/collect/css/collect.css</name></action>
|
| 36 |
+
</reference>
|
| 37 |
+
|
| 38 |
+
<reference name="shipping_address">
|
| 39 |
+
<action method="setTemplate" ifconfig="cornerdrop_collect/settings/enable"><template>cornerdrop/collect/order/create/form/address/shipping.phtml</template></action>
|
| 40 |
+
</reference>
|
| 41 |
+
|
| 42 |
+
<reference name="before_body_end">
|
| 43 |
+
<block type="core/text" name="google.api">
|
| 44 |
+
<action method="setText" ifconfig="cornerdrop_collect/settings/enable"><text><![CDATA[<script src='http://maps.google.com/maps/api/js?sensor=false'></script>]]></text></action>
|
| 45 |
+
</block>
|
| 46 |
+
</reference>
|
| 47 |
+
</adminhtml_sales_order_create_index>
|
| 48 |
+
|
| 49 |
+
<adminhtml_sales_order_create_load_block_shipping_address>
|
| 50 |
+
<reference name="shipping_address">
|
| 51 |
+
<action method="setTemplate" ifconfig="cornerdrop_collect/settings/enable"><template>cornerdrop/collect/order/create/form/address/shipping.phtml</template></action>
|
| 52 |
+
</reference>
|
| 53 |
+
</adminhtml_sales_order_create_load_block_shipping_address>
|
| 54 |
+
|
| 55 |
+
<adminhtml_sales_order_create_load_block_data>
|
| 56 |
+
<reference name="shipping_address">
|
| 57 |
+
<action method="setTemplate" ifconfig="cornerdrop_collect/settings/enable"><template>cornerdrop/collect/order/create/form/address/shipping.phtml</template></action>
|
| 58 |
+
</reference>
|
| 59 |
+
</adminhtml_sales_order_create_load_block_data>
|
| 60 |
+
|
| 61 |
+
<adminhtml_sales_order_view>
|
| 62 |
+
<reference name="order_totals">
|
| 63 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 64 |
+
</reference>
|
| 65 |
+
</adminhtml_sales_order_view>
|
| 66 |
+
<adminhtml_sales_order_invoice_view>
|
| 67 |
+
<reference name="invoice_totals">
|
| 68 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 69 |
+
</reference>
|
| 70 |
+
</adminhtml_sales_order_invoice_view>
|
| 71 |
+
<adminhtml_sales_order_creditmemo_view>
|
| 72 |
+
<reference name="creditmemo_totals">
|
| 73 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 74 |
+
</reference>
|
| 75 |
+
</adminhtml_sales_order_creditmemo_view>
|
| 76 |
+
|
| 77 |
+
<adminhtml_sales_order_invoice_new>
|
| 78 |
+
<reference name="invoice_totals">
|
| 79 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 80 |
+
</reference>
|
| 81 |
+
</adminhtml_sales_order_invoice_new>
|
| 82 |
+
<adminhtml_sales_order_creditmemo_new>
|
| 83 |
+
<reference name="creditmemo_totals">
|
| 84 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 85 |
+
</reference>
|
| 86 |
+
</adminhtml_sales_order_creditmemo_new>
|
| 87 |
+
|
| 88 |
+
<adminhtml_sales_order_invoice_updateqty>
|
| 89 |
+
<reference name="invoice_totals">
|
| 90 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 91 |
+
</reference>
|
| 92 |
+
</adminhtml_sales_order_invoice_updateqty>
|
| 93 |
+
<adminhtml_sales_order_creditmemo_updateqty>
|
| 94 |
+
<reference name="creditmemo_totals">
|
| 95 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 96 |
+
</reference>
|
| 97 |
+
</adminhtml_sales_order_creditmemo_updateqty>
|
| 98 |
+
|
| 99 |
+
</layout>
|
app/design/adminhtml/default/default/template/cornerdrop/collect/order/create/form/address/shipping.phtml
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|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
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 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@magento.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.magento.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
if($this->getIsShipping()):
|
| 27 |
+
$_fieldsContainerId = 'order-shipping_address_fields';
|
| 28 |
+
$_addressChoiceContainerId = 'order-shipping_address_choice';
|
| 29 |
+
?>
|
| 30 |
+
<script type="text/javascript">
|
| 31 |
+
order.shippingAddressContainer = '<?php echo $_fieldsContainerId ?>';
|
| 32 |
+
order.setAddresses(<?php echo $this->getAddressCollectionJson() ?>);
|
| 33 |
+
</script>
|
| 34 |
+
<?php
|
| 35 |
+
else:
|
| 36 |
+
$_fieldsContainerId = 'order-billing_address_fields';
|
| 37 |
+
$_addressChoiceContainerId = 'order-billing_address_choice';
|
| 38 |
+
?>
|
| 39 |
+
<script type="text/javascript">
|
| 40 |
+
order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>';
|
| 41 |
+
</script>
|
| 42 |
+
<?php
|
| 43 |
+
endif; ?>
|
| 44 |
+
<div class="entry-edit">
|
| 45 |
+
|
| 46 |
+
<div class="entry-edit-head">
|
| 47 |
+
<h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<fieldset class="np">
|
| 51 |
+
<div id = "<?php echo $_addressChoiceContainerId ?>" class="order-choose-address">
|
| 52 |
+
<?php echo Mage::helper('sales')->__('Select from existing customer addresses:') ?><br/>
|
| 53 |
+
<?php $_id = $this->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?>
|
| 54 |
+
<select id="<?php echo $_id ?>" name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[customer_address_id]" style="width:97.5%;" onchange="order.selectAddress(this, '<?php echo $_fieldsContainerId ?>')">
|
| 55 |
+
<option value=""><?php echo Mage::helper('sales')->__('Add New Address') ?></option>
|
| 56 |
+
<?php foreach ($this->getAddressCollection() as $_address): ?>
|
| 57 |
+
<?php //if($this->getAddressAsString($_address)!=$this->getAddressAsString($this->getAddress())): ?>
|
| 58 |
+
<option value="<?php echo $_address->getId() ?>"<?php if ($_address->getId()==$this->getAddressId()): ?> selected="selected"<?php endif; ?>>
|
| 59 |
+
<?php echo $this->getAddressAsString($_address) ?>
|
| 60 |
+
</option>
|
| 61 |
+
<?php //endif; ?>
|
| 62 |
+
<?php endforeach; ?>
|
| 63 |
+
|
| 64 |
+
</select>
|
| 65 |
+
<br/>
|
| 66 |
+
<?php if($this->getIsShipping()): ?>
|
| 67 |
+
<input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing" onclick="order.setShippingAsBilling(this.checked)" <?php if($this->getIsAsBilling()): ?>checked<?php endif; ?>/>
|
| 68 |
+
<label for="order-shipping_same_as_billing" class="no-float"><?php echo Mage::helper('sales')->__('Same As Billing Address') ?></label>
|
| 69 |
+
<?php else: ?>
|
| 70 |
+
|
| 71 |
+
<?php endif; ?>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<div class="cdc-control content">
|
| 75 |
+
<span class="cdc-control-info"></span>
|
| 76 |
+
<button class="cdc-control-button <?php if($this->getIsAsBilling()): ?>disabled<?php endif; ?>"><?php echo Mage::helper("cornerdrop_collect")->__("Click & Collect from a CornerDrop location") ?></button>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<div class="order-address" id="<?php echo $_fieldsContainerId ?>">
|
| 80 |
+
<div class="content">
|
| 81 |
+
<?php echo $this->getForm()->toHtml() ?>
|
| 82 |
+
<table cellspacing="0" class="form-list">
|
| 83 |
+
<tr>
|
| 84 |
+
<td class="label">
|
| 85 |
+
<label for="order-shipping_address-cornerdrop_store_id">CornerDrop Store</label>
|
| 86 |
+
</td>
|
| 87 |
+
<td class="value">
|
| 88 |
+
<input id="order-shipping_address-cornerdrop_store_id" name="order[shipping_address][cornerdrop_store_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getData(CornerDrop_Collect_Helper_Data::CORNERDROP_STORE_ID_COLUMN)) ?>" readonly="readonly" class=" input-text" type="text" />
|
| 89 |
+
</td>
|
| 90 |
+
</tr>
|
| 91 |
+
<tr>
|
| 92 |
+
<td></td>
|
| 93 |
+
<td>
|
| 94 |
+
<p class="note">
|
| 95 |
+
This is the CornerDrop store identifier associated with this order. If this is left blank
|
| 96 |
+
then the order will not be submitted to CornerDrop. To populate this field, use the store
|
| 97 |
+
locator Click & Collect wizard above. If you no longer wish to fulfil this order via
|
| 98 |
+
CornerDrop <a href="#" class="js-cdc-clear-cornerdrop">click here</a>
|
| 99 |
+
to clear the store and shipping address.
|
| 100 |
+
</p>
|
| 101 |
+
</td>
|
| 102 |
+
</tr>
|
| 103 |
+
</table>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="order-save-in-address-book">
|
| 106 |
+
<input name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[save_in_address_book]" type="checkbox" id="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book" value="1" <?php if (!$this->getDontSaveInAddressBook() && $this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?>/>
|
| 107 |
+
<label for="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book"><?php echo Mage::helper('sales')->__('Save in address book') ?></label>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
<?php $hideElement = 'address-' . ($this->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?>
|
| 111 |
+
<div style="display:none;" id="<?php echo $hideElement ?>" class="overlay"><span><?php echo $this->__('Shipping address selection is not applicable') ?></span></div>
|
| 112 |
+
<script type="text/javascript">
|
| 113 |
+
order.bindAddressFields('<?php echo $_fieldsContainerId ?>');
|
| 114 |
+
order.bindAddressFields('<?php echo $_addressChoiceContainerId ?>');
|
| 115 |
+
<?php if($this->getIsShipping() && $this->getIsAsBilling()): ?>
|
| 116 |
+
order.disableShippingAddress(true);
|
| 117 |
+
<?php endif; ?>
|
| 118 |
+
</script>
|
| 119 |
+
</fieldset>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<?php $cdc_search_template = <<<HTML
|
| 123 |
+
<div class="cdc-panel">
|
| 124 |
+
<div class="cdc-info">
|
| 125 |
+
</div>
|
| 126 |
+
<div class="cdc-search-container">
|
| 127 |
+
<form action="" id="cdc-search-form" class="cdc-search-form">
|
| 128 |
+
<ul>
|
| 129 |
+
<li class="wide">
|
| 130 |
+
<label for="cornerdrop-collect-search" class="cdc-search-label">Search city, town or
|
| 131 |
+
postcode</label>
|
| 132 |
+
<input type="text" placeholder="Search city, town or postcode"
|
| 133 |
+
name="cornerdrop-collect[search]" class="cdc-searchbox input-text"
|
| 134 |
+
id="cornerdrop-collect-search"/>
|
| 135 |
+
<button class="js-cdc-reset-button cdc-reset-button cdc-hidden" type="reset">Reset
|
| 136 |
+
</button>
|
| 137 |
+
<button class="js-cdc-search-button cdc-search-button">Search</button>
|
| 138 |
+
|
| 139 |
+
<i class="js-cdc-geolocation cdc-geolocation"><!-- noop --></i>
|
| 140 |
+
<i class="js-cdc-undo cdc-undo"><!-- noop --></i>
|
| 141 |
+
</li>
|
| 142 |
+
</ul>
|
| 143 |
+
</form>
|
| 144 |
+
</div>
|
| 145 |
+
|
| 146 |
+
<div class="js-cdc-search-results cdc-search-results cdc-hidden">
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<a class="js-cdc-results-pager cdc-results-pager cdc-hidden" href="#">View more results</a>
|
| 150 |
+
|
| 151 |
+
<div class="cdc-map-container">
|
| 152 |
+
<div id="cdc-map-canvas" class="cdc-map"></div>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<div class="js-cdc-store cdc-hidden cdc-store">
|
| 156 |
+
<span class="cdc-store-title">Selected Store:</span>
|
| 157 |
+
|
| 158 |
+
<div class="js-cdc-store-details cdc-store-details">
|
| 159 |
+
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
HTML;
|
| 164 |
+
?>
|
| 165 |
+
|
| 166 |
+
<script type="text/javascript">
|
| 167 |
+
CornerDrop_Collect_Adminhtml = new window.CornerDrop.Collect.Adminhtml({
|
| 168 |
+
activateLabel: "<?php echo Mage::helper("cornerdrop_collect")->__("Click & Collect from a CornerDrop location") ?>",
|
| 169 |
+
editLabel: "<?php echo Mage::helper("cornerdrop_collect")->__("Edit") ?>",
|
| 170 |
+
dialogTitle: "<?php echo Mage::helper("cornerdrop_collect")->__("Select CornerDrop location") ?>",
|
| 171 |
+
uiSearchEndpoint: "<?php echo $this->getUrl('adminhtml/cornerdrop_collect_search/index') ?>",
|
| 172 |
+
searchWindowTemplate: <?php echo Mage::helper('core')->jsonEncode($cdc_search_template) ?>
|
| 173 |
+
});
|
| 174 |
+
</script>
|
| 175 |
+
|
app/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
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
|
| 4 |
+
<checkout_onepage_index>
|
| 5 |
+
<reference name="head">
|
| 6 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 7 |
+
<file>cornerdrop/collect/switch.js</file>
|
| 8 |
+
</action>
|
| 9 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 10 |
+
<file>cornerdrop/collect/search.js</file>
|
| 11 |
+
</action>
|
| 12 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 13 |
+
<file>cornerdrop/collect/geolocationAPI.js</file>
|
| 14 |
+
</action>
|
| 15 |
+
<block type="core/text" name="google.api">
|
| 16 |
+
<action method="setText" ifconfig="cornerdrop_collect/settings/enable"><text><![CDATA[<script src='http://maps.google.com/maps/api/js?sensor=false'></script>]]></text></action>
|
| 17 |
+
</block>
|
| 18 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 19 |
+
<file>cornerdrop/collect/gmaps.js</file>
|
| 20 |
+
</action>
|
| 21 |
+
<action method="addJs" ifconfig="cornerdrop_collect/settings/enable">
|
| 22 |
+
<file>cornerdrop/collect/ui.js</file>
|
| 23 |
+
</action>
|
| 24 |
+
<action method="addCss"><name>cornerdrop/collect/css/collect.css</name></action>
|
| 25 |
+
</reference>
|
| 26 |
+
<reference name="content">
|
| 27 |
+
<block type="cornerdrop_collect/checkout_switch" name="cornerdrop.collect.switch" before="-" template="cornerdrop/collect/checkout/switch.phtml">
|
| 28 |
+
<block type="core/template" name="cornerdrop.collect.switch.search" as="search_template" template="cornerdrop/collect/search.phtml" />
|
| 29 |
+
</block>
|
| 30 |
+
</reference>
|
| 31 |
+
</checkout_onepage_index>
|
| 32 |
+
|
| 33 |
+
<checkout_onepage_success>
|
| 34 |
+
<reference name="head">
|
| 35 |
+
<action method="addCss"><name>cornerdrop/collect/css/collect.css</name></action>
|
| 36 |
+
</reference>
|
| 37 |
+
<reference name="content">
|
| 38 |
+
<block type="cornerdrop_collect/checkout_success" name="cornerdrop.collect.success" template="cornerdrop/collect/checkout/success.phtml" />
|
| 39 |
+
</reference>
|
| 40 |
+
</checkout_onepage_success>
|
| 41 |
+
|
| 42 |
+
<sales_order_view>
|
| 43 |
+
<reference name="order_totals">
|
| 44 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 45 |
+
</reference>
|
| 46 |
+
</sales_order_view>
|
| 47 |
+
<sales_guest_view>
|
| 48 |
+
<reference name="order_totals">
|
| 49 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 50 |
+
</reference>
|
| 51 |
+
</sales_guest_view>
|
| 52 |
+
<sales_order_invoice>
|
| 53 |
+
<reference name="invoice_totals">
|
| 54 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 55 |
+
</reference>
|
| 56 |
+
</sales_order_invoice>
|
| 57 |
+
<sales_guest_invoice>
|
| 58 |
+
<reference name="invoice_totals">
|
| 59 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 60 |
+
</reference>
|
| 61 |
+
</sales_guest_invoice>
|
| 62 |
+
<sales_order_creditmemo>
|
| 63 |
+
<reference name="creditmemo_totals">
|
| 64 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 65 |
+
</reference>
|
| 66 |
+
</sales_order_creditmemo>
|
| 67 |
+
<sales_guest_creditmemo>
|
| 68 |
+
<reference name="creditmemo_totals">
|
| 69 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 70 |
+
</reference>
|
| 71 |
+
</sales_guest_creditmemo>
|
| 72 |
+
|
| 73 |
+
<sales_order_print>
|
| 74 |
+
<reference name="order_totals">
|
| 75 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 76 |
+
</reference>
|
| 77 |
+
</sales_order_print>
|
| 78 |
+
<sales_guest_print>
|
| 79 |
+
<reference name="order_totals">
|
| 80 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 81 |
+
</reference>
|
| 82 |
+
</sales_guest_print>
|
| 83 |
+
<sales_order_printinvoice>
|
| 84 |
+
<reference name="invoice_totals">
|
| 85 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 86 |
+
</reference>
|
| 87 |
+
</sales_order_printinvoice>
|
| 88 |
+
<sales_guest_printinvoice>
|
| 89 |
+
<reference name="invoice_totals">
|
| 90 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 91 |
+
</reference>
|
| 92 |
+
</sales_guest_printinvoice>
|
| 93 |
+
<sales_order_printcreditmemo>
|
| 94 |
+
<reference name="creditmemo_totals">
|
| 95 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 96 |
+
</reference>
|
| 97 |
+
</sales_order_printcreditmemo>
|
| 98 |
+
<sales_guest_printcreditmemo>
|
| 99 |
+
<reference name="creditmemo_totals">
|
| 100 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 101 |
+
</reference>
|
| 102 |
+
</sales_guest_printcreditmemo>
|
| 103 |
+
|
| 104 |
+
<sales_email_order_items>
|
| 105 |
+
<reference name="order_totals">
|
| 106 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 107 |
+
</reference>
|
| 108 |
+
</sales_email_order_items>
|
| 109 |
+
<sales_email_order_invoice_items>
|
| 110 |
+
<reference name="invoice_totals">
|
| 111 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 112 |
+
</reference>
|
| 113 |
+
</sales_email_order_invoice_items>
|
| 114 |
+
<sales_email_order_creditmemo_items>
|
| 115 |
+
<reference name="creditmemo_totals">
|
| 116 |
+
<block type="cornerdrop_collect/sales_order_totals" name="cornerdrop_fee_total" />
|
| 117 |
+
</reference>
|
| 118 |
+
</sales_email_order_creditmemo_items>
|
| 119 |
+
|
| 120 |
+
<sales_email_order_shipment_items>
|
| 121 |
+
<reference name="additional.product.info">
|
| 122 |
+
<block type="core/template" name="additional.product.info.cornerdrop" template="cornerdrop/collect/email/shipment.phtml" />
|
| 123 |
+
</reference>
|
| 124 |
+
</sales_email_order_shipment_items>
|
| 125 |
+
|
| 126 |
+
</layout>
|
app/design/frontend/base/default/template/cornerdrop/collect/checkout/success.phtml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php /** @var CornerDrop_Collect_Block_Checkout_Success $this */ ?>
|
| 2 |
+
<?php if ($this->isCornerDropOrder()): ?>
|
| 3 |
+
<p><?php echo $this->__("Thank you for choosing Click & Collect with %s. You will receive an email with your parcel code to collect your order from your CornerDrop location. Simply present this and your PIN to pick up your parcel.", $this->getLogoHtml()) ?></p>
|
| 4 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/cornerdrop/collect/checkout/switch.phtml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php /** @var CornerDrop_Collect_Block_Checkout_Switch $this */ ?>
|
| 2 |
+
<?php $_helper = Mage::helper("cornerdrop_collect"); ?>
|
| 3 |
+
<?php if ($this->isEnabled()): ?>
|
| 4 |
+
<script type="text/javascript">
|
| 5 |
+
document.observe("dom:loaded", function () {
|
| 6 |
+
CornerDrop_Collect_Switch = new window.CornerDrop.Collect.Switch({
|
| 7 |
+
labels: {
|
| 8 |
+
checkbox: <?php echo json_encode($this->getCheckboxLabel()) ?>,
|
| 9 |
+
deactivateButton: "<?php echo $this->getModuleHelper()->__("Switch to home delivery") ?>",
|
| 10 |
+
activateButton: "<?php echo $this->getModuleHelper()->__("Use CornerDrop") ?>"
|
| 11 |
+
},
|
| 12 |
+
value: <?php echo $this->getValue() ? "true" : "false" ?>
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
+
CornerDrop_Collect_UI = new window.CornerDrop.Collect.UI({
|
| 16 |
+
searchClass: new window.CornerDrop.Collect.Search({
|
| 17 |
+
endpoint: '<?php echo $this->getUrl('cornerdrop_collect/search/') ?>',
|
| 18 |
+
prepareFormCallback: shipping.newAddress.bind(shipping),
|
| 19 |
+
regionUpdateCallback: shippingRegionUpdater.update.bind(shippingRegionUpdater)
|
| 20 |
+
}),
|
| 21 |
+
geolocationAPIClass: new window.CornerDrop.Collect.GeolocationAPI(),
|
| 22 |
+
gmapsClass: new window.CornerDrop.Collect.Gmaps({
|
| 23 |
+
markerImage: '<?php echo $this->getImageUrl('droppoint_active.png') ?>'
|
| 24 |
+
}),
|
| 25 |
+
searchTemplate: <?php echo json_encode($this->getSearchTemplateHtml()) ?>,
|
| 26 |
+
initialState: <?php echo $this->getValue() ? "true" : "false" ?>,
|
| 27 |
+
termsAndConditionsLabel: "<?php echo $this->getModuleHelper()->__("By using this service you agree to the <a href='%s' target='_blank'>Terms & Conditions</a>.", "https://cornerdrop.com/legal/consumer-terms-retailer") ?>"
|
| 28 |
+
});
|
| 29 |
+
});
|
| 30 |
+
</script>
|
| 31 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/cornerdrop/collect/email/shipment.phtml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php /** @var Mage_Core_Block_Template $this */ ?>
|
| 2 |
+
<?php /** @var Mage_Sales_Model_Order_Shipment $shipment */ ?>
|
| 3 |
+
<?php $shipment = $this->getShipment() ?>
|
| 4 |
+
<?php if (count($shipment->getAllTracks()) > 0): ?>
|
| 5 |
+
<p><?php echo Mage::helper("cornerdrop_collect")->__("Track your parcel and collect it from your chosen CornerDrop within 10 days of delivery") ?></p>
|
| 6 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/cornerdrop/collect/search.phtml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php /** @var Mage_Core_Block_Template $this **/ ?>
|
| 2 |
+
<?php $config = Mage::helper("cornerdrop_collect/config") ?>
|
| 3 |
+
<div class="cdc-panel">
|
| 4 |
+
<div class="cdc-info">
|
| 5 |
+
<p><?php echo $this->__("Click & Collect from a CornerDrop location at a time that suits you.") ?></p>
|
| 6 |
+
<?php if ($config->getAdditionalFee()): ?>
|
| 7 |
+
<p><?php echo $this->__("This will add an additional %s fee to your order.", $config->getFormattedFee()) ?></p>
|
| 8 |
+
<?php endif; ?>
|
| 9 |
+
</div>
|
| 10 |
+
<div class="cdc-search-container">
|
| 11 |
+
<form action="" id="cdc-search-form" class="cdc-search-form">
|
| 12 |
+
<ul>
|
| 13 |
+
<li class="wide">
|
| 14 |
+
<label for="cornerdrop-collect-search" class="cdc-search-label"><?php echo $this->__('Search city, town or postcode') ?></label>
|
| 15 |
+
<input type="text" placeholder="Search city, town or postcode" name="cornerdrop-collect[search]" class="cdc-searchbox input-text" id="cornerdrop-collect-search"/>
|
| 16 |
+
<button class="js-cdc-reset-button cdc-reset-button cdc-hidden" type="reset"><?php echo $this->__('Reset') ?></button>
|
| 17 |
+
<button class="js-cdc-search-button cdc-search-button"><?php echo $this->__('Search'); ?></button>
|
| 18 |
+
</li>
|
| 19 |
+
</ul>
|
| 20 |
+
</form>
|
| 21 |
+
<i class="js-cdc-geolocation cdc-geolocation"><?php echo $this->__('Geolocation') ?></i>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<div class="js-cdc-search-results cdc-search-results cdc-hidden">
|
| 25 |
+
</div>
|
| 26 |
+
|
| 27 |
+
<a class="js-cdc-results-pager cdc-results-pager cdc-hidden" href="#"><?php echo $this->__('View more results') ?></a>
|
| 28 |
+
|
| 29 |
+
<div class="cdc-map-container">
|
| 30 |
+
<div id="cdc-map-canvas" class="cdc-map"></div>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<div class="js-cdc-store cdc-hidden cdc-store">
|
| 34 |
+
<span class="cdc-store-title"><?php echo $this->__('Selected Store:') ?></span>
|
| 35 |
+
<div class="js-cdc-store-details cdc-store-details"></div>
|
| 36 |
+
<a href="#" class="js-cdc-undo"><?php echo $this->__('Undo') ?></a>
|
| 37 |
+
</div>
|
| 38 |
+
</div>
|
app/etc/modules/CornerDrop_Collect.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<CornerDrop_Collect>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Sales />
|
| 9 |
+
</depends>
|
| 10 |
+
</CornerDrop_Collect>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
app/locale/en_US/template/email/cornerdrop/collect/code.html
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<!--@subject {{var store.getFrontendName()}}: CornerDrop Package Code (Order # {{var order.increment_id}}) @-->
|
| 2 |
+
<!--@vars
|
| 3 |
+
{"var store.getFrontendName()":"Store Name",
|
| 4 |
+
"var order.increment_id":"Order Id",
|
| 5 |
+
"var cornerdrop_ref":"CornerDrop Package Reference",
|
| 6 |
+
"var cornerdrop_pin":"CornerDrop Secret PIN",
|
| 7 |
+
"var order.getShippingAddress().format('html')":"CornerDrop Location Address"}
|
| 8 |
+
@-->
|
| 9 |
+
<!--@styles
|
| 10 |
+
@-->
|
| 11 |
+
|
| 12 |
+
{{template config_path="design/email/header"}}
|
| 13 |
+
{{inlinecss file="email-inline.css"}}
|
| 14 |
+
|
| 15 |
+
<table cellpadding="0" cellspacing="0" border="0">
|
| 16 |
+
<tr>
|
| 17 |
+
<td>
|
| 18 |
+
<table cellpadding="0" cellspacing="0" border="0">
|
| 19 |
+
<tr>
|
| 20 |
+
<td class="email-heading">
|
| 21 |
+
<h1>Thank you for using CornerDrop for your order.</h1>
|
| 22 |
+
<p>Here are some instructions on how to collect your package once it has been delivered.</p>
|
| 23 |
+
</td>
|
| 24 |
+
<td class="store-info">
|
| 25 |
+
<h4>Order Questions?</h4>
|
| 26 |
+
<p>
|
| 27 |
+
{{depend store_phone}}
|
| 28 |
+
<b>Call Us:</b>
|
| 29 |
+
<a href="tel:{{var phone}}">{{var store_phone}}</a><br>
|
| 30 |
+
{{/depend}}
|
| 31 |
+
{{depend store_hours}}
|
| 32 |
+
<span class="no-link">{{var store_hours}}</span><br>
|
| 33 |
+
{{/depend}}
|
| 34 |
+
{{depend store_email}}
|
| 35 |
+
<b>Email:</b> <a href="mailto:{{var store_email}}">{{var store_email}}</a>
|
| 36 |
+
{{/depend}}
|
| 37 |
+
</p>
|
| 38 |
+
</td>
|
| 39 |
+
</tr>
|
| 40 |
+
</table>
|
| 41 |
+
</td>
|
| 42 |
+
</tr>
|
| 43 |
+
<tr>
|
| 44 |
+
<td class="order-details">
|
| 45 |
+
<h3>Your order #{{var order.increment_id}}</h3>
|
| 46 |
+
<p>To collect your package just show the package reference number and secret pin at the location indicated below. You can collect your package up to 10 days after it has been delivered.</p>
|
| 47 |
+
</td>
|
| 48 |
+
</tr>
|
| 49 |
+
<tr class="order-information">
|
| 50 |
+
<td>
|
| 51 |
+
<table cellspacing="0" cellpadding="0" border="0">
|
| 52 |
+
<tr>
|
| 53 |
+
<td class="method-info">
|
| 54 |
+
<h6>CornerDrop Package Reference:</h6>
|
| 55 |
+
<p>{{var cornerdrop_ref}}</p>
|
| 56 |
+
</td>
|
| 57 |
+
<td class="method-info">
|
| 58 |
+
<h6>Secret PIN:</h6>
|
| 59 |
+
<p>{{var cornerdrop_pin}}</p>
|
| 60 |
+
</td>
|
| 61 |
+
</tr>
|
| 62 |
+
<tr>
|
| 63 |
+
<td class="address-details">
|
| 64 |
+
<h6>CornerDrop Location address:</h6>
|
| 65 |
+
<p>{{var order.getShippingAddress().format('html')}}</p>
|
| 66 |
+
</td>
|
| 67 |
+
</tr>
|
| 68 |
+
</table>
|
| 69 |
+
</td>
|
| 70 |
+
</tr>
|
| 71 |
+
</table>
|
| 72 |
+
|
| 73 |
+
{{template config_path="design/email/footer"}}
|
js/cornerdrop/collect/adminhtml.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function () {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
window.CornerDrop.Collect.Adminhtml = Class.create({
|
| 8 |
+
|
| 9 |
+
initialize: function ( options ) {
|
| 10 |
+
var self = this;
|
| 11 |
+
|
| 12 |
+
self.options = Object.extend({
|
| 13 |
+
activateLabel: "Click & Collect from a CornerDrop location",
|
| 14 |
+
editLabel: "Edit",
|
| 15 |
+
dialogTitle: "Select CornerDrop location",
|
| 16 |
+
controlButtonSelector: ".cdc-control-button",
|
| 17 |
+
shippingAddressSelector: "#order-shipping_address_choice",
|
| 18 |
+
sameAsBillingCheckboxSelector: '#order-shipping_same_as_billing',
|
| 19 |
+
uiSearchEndpoint: '',
|
| 20 |
+
clearCornerDropSelectionSelector: ".js-cdc-clear-cornerdrop",
|
| 21 |
+
clearCornerDropShippingAddressFields: 'input[type=text][name^="order[shipping_address]"',
|
| 22 |
+
searchWindowTemplate: 'No template defined'
|
| 23 |
+
}, options || {});
|
| 24 |
+
|
| 25 |
+
self.elements = {};
|
| 26 |
+
self.observers = [];
|
| 27 |
+
|
| 28 |
+
self.attachObservers();
|
| 29 |
+
},
|
| 30 |
+
|
| 31 |
+
attachObservers: function () {
|
| 32 |
+
var self = this;
|
| 33 |
+
|
| 34 |
+
var control = self._get(self.options.controlButtonSelector);
|
| 35 |
+
if (control) {
|
| 36 |
+
self._attachObserver(control, "click", self.open.bind(self));
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
var sameAsBillingCheckbox = self._get(self.options.sameAsBillingCheckboxSelector);
|
| 40 |
+
if (sameAsBillingCheckbox) {
|
| 41 |
+
self._attachObserver(sameAsBillingCheckbox, "click", self.toggleDisabledState.bind(self));
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
var clearCornerDrop = self._get(self.options.clearCornerDropSelectionSelector);
|
| 45 |
+
if (clearCornerDrop) {
|
| 46 |
+
self._attachObserver(clearCornerDrop, "click", self.clearCornerDropSelection.bind(self));
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
open: function (event) {
|
| 51 |
+
var self = this;
|
| 52 |
+
|
| 53 |
+
if (typeof event !== "undefined" && event.preventDefault) {
|
| 54 |
+
event.preventDefault();
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
var control = self._get(self.options.controlButtonSelector);
|
| 58 |
+
|
| 59 |
+
// Don't open the window if the button is disabled in some way.
|
| 60 |
+
if (control.hasClassName('disabled') || control.disabled) {
|
| 61 |
+
return;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
self._displayDialog();
|
| 65 |
+
},
|
| 66 |
+
|
| 67 |
+
close: function (event) {
|
| 68 |
+
var self = this;
|
| 69 |
+
|
| 70 |
+
if (typeof event !== "undefined" && event.preventDefault) {
|
| 71 |
+
event.preventDefault();
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
if (self.dialog) {
|
| 75 |
+
self.dialog.close();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// Trigger the region updater to refresh
|
| 79 |
+
$('order-shipping_address_country_id').simulate('change');
|
| 80 |
+
|
| 81 |
+
self.reloadShippingAddress();
|
| 82 |
+
},
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Submit the shipping address, and reload the areas of the page that we need to.
|
| 86 |
+
*/
|
| 87 |
+
reloadShippingAddress: function () {
|
| 88 |
+
// Reload shipping address
|
| 89 |
+
var data = window.order.serializeData(window.order.shippingAddressContainer).toObject();
|
| 90 |
+
|
| 91 |
+
window.order.loadArea(['shipping_method', 'totals', 'billing_method'], true, data);
|
| 92 |
+
},
|
| 93 |
+
|
| 94 |
+
_displayDialog: function () {
|
| 95 |
+
var self = this;
|
| 96 |
+
|
| 97 |
+
self.dialog = Dialog.info('', {
|
| 98 |
+
id: "cdc-dialog",
|
| 99 |
+
className: "magento",
|
| 100 |
+
windowClassName: "popup-window",
|
| 101 |
+
title: self.options.dialogTitle,
|
| 102 |
+
width: 950,
|
| 103 |
+
height: 450,
|
| 104 |
+
top: 50,
|
| 105 |
+
zIndex: 300,
|
| 106 |
+
recenterAuto: true,
|
| 107 |
+
draggable: true,
|
| 108 |
+
resizable: false,
|
| 109 |
+
closable: true,
|
| 110 |
+
showEffect: Element.show,
|
| 111 |
+
hideEffect: Element.hide,
|
| 112 |
+
onClose: self.close.bind(self),
|
| 113 |
+
onShow: function () {
|
| 114 |
+
new window.CornerDrop.Collect.Adminhtml_UI({
|
| 115 |
+
searchClass: new window.CornerDrop.Collect.Adminhtml_Search({
|
| 116 |
+
form: '#order-shipping_address',
|
| 117 |
+
endpoint: self.options.uiSearchEndpoint,
|
| 118 |
+
storeIdField: "order[shipping_address][cornerdrop_store_id]"
|
| 119 |
+
}),
|
| 120 |
+
geolocationAPIClass: new window.CornerDrop.Collect.GeolocationAPI(),
|
| 121 |
+
gmapsClass: new window.CornerDrop.Collect.Gmaps(),
|
| 122 |
+
searchTemplate: self.options.searchWindowTemplate,
|
| 123 |
+
initialState: true,
|
| 124 |
+
shouldCheckTermsAndConditions: false,
|
| 125 |
+
elements: {
|
| 126 |
+
injectLocation: '#cdc-dialog_content .magento_message',
|
| 127 |
+
cornerdropContainer: '.cdc-panel',
|
| 128 |
+
searchForm: '#cdc-search-form',
|
| 129 |
+
searchField: '#cdc-search-form input',
|
| 130 |
+
geolocationIcon: '.js-cdc-geolocation',
|
| 131 |
+
searchList: '.js-cdc-search-results',
|
| 132 |
+
storeContainer: '.js-cdc-store',
|
| 133 |
+
selectedStore: '.js-cdc-store-details',
|
| 134 |
+
error: '.js-cdc-error',
|
| 135 |
+
shippingForm: '#co-shipping-form .form-list',
|
| 136 |
+
searchButton: '.js-cdc-search-button',
|
| 137 |
+
resetButton: '.js-cdc-reset-button',
|
| 138 |
+
resultsPager: '.js-cdc-results-pager',
|
| 139 |
+
undoElement: '.js-cdc-undo',
|
| 140 |
+
shippingFormSubmit: '#shipping-buttons-container button'
|
| 141 |
+
}
|
| 142 |
+
});
|
| 143 |
+
}
|
| 144 |
+
});
|
| 145 |
+
},
|
| 146 |
+
|
| 147 |
+
/**
|
| 148 |
+
* Observer: Called when the "Same as billing address" checkbox is changed.
|
| 149 |
+
*/
|
| 150 |
+
toggleDisabledState: function () {
|
| 151 |
+
var self = this;
|
| 152 |
+
|
| 153 |
+
var sameAsBillingCheckbox = self._get(self.options.sameAsBillingCheckboxSelector);
|
| 154 |
+
var control = self._get(self.options.controlButtonSelector);
|
| 155 |
+
|
| 156 |
+
var disabledClassName = 'disabled';
|
| 157 |
+
|
| 158 |
+
if (sameAsBillingCheckbox && control) {
|
| 159 |
+
var sameAsBilling = sameAsBillingCheckbox.checked;
|
| 160 |
+
|
| 161 |
+
if (sameAsBilling) {
|
| 162 |
+
control.addClassName(disabledClassName);
|
| 163 |
+
} else {
|
| 164 |
+
control.removeClassName(disabledClassName);
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
},
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Observer: Called when the "reset form" link is clicked. This resets the shipping form, ensuring that we don't
|
| 171 |
+
* communicate this order as a cornerdrop order to the backend processes.
|
| 172 |
+
*/
|
| 173 |
+
clearCornerDropSelection: function (event) {
|
| 174 |
+
if (typeof event !== "undefined" && event.preventDefault) {
|
| 175 |
+
event.preventDefault();
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
var confirmation = confirm("Are you sure you want to reset the shipping address?");
|
| 179 |
+
|
| 180 |
+
if (confirmation) {
|
| 181 |
+
$$(this.options.clearCornerDropShippingAddressFields).each(function (el) {
|
| 182 |
+
el.value = '';
|
| 183 |
+
});
|
| 184 |
+
|
| 185 |
+
this.reloadShippingAddress();
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
|
| 189 |
+
_get: function(selector) {
|
| 190 |
+
var self = this;
|
| 191 |
+
|
| 192 |
+
if (typeof self.elements[selector] == 'undefined') {
|
| 193 |
+
self.elements[selector] = $$(selector).first();
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
return self.elements[selector];
|
| 197 |
+
},
|
| 198 |
+
|
| 199 |
+
_attachObserver: function (element, event, handler) {
|
| 200 |
+
var self = this;
|
| 201 |
+
|
| 202 |
+
self.observers.push({
|
| 203 |
+
element: element,
|
| 204 |
+
event: event,
|
| 205 |
+
handler: handler
|
| 206 |
+
});
|
| 207 |
+
|
| 208 |
+
element.observe(event, handler);
|
| 209 |
+
},
|
| 210 |
+
|
| 211 |
+
_destroyObservers: function () {
|
| 212 |
+
var self = this;
|
| 213 |
+
|
| 214 |
+
self.observers.each(function (observer) {
|
| 215 |
+
observer.element.stopObserving(observer.event, observer.handler);
|
| 216 |
+
});
|
| 217 |
+
|
| 218 |
+
self.observers = [];
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
});
|
| 222 |
+
})();
|
js/cornerdrop/collect/adminhtml_search.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function() {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class, $$, $H, google */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.Adminhtml_Search = Class.create(window.CornerDrop.Collect.Search, {
|
| 10 |
+
_injectMarkup: function ($super) {
|
| 11 |
+
/* noop, markup is already on the page for admin */
|
| 12 |
+
},
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
+
})();
|
js/cornerdrop/collect/adminhtml_ui.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function() {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class, $$, $H, google */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.Adminhtml_UI = Class.create(window.CornerDrop.Collect.UI, {
|
| 10 |
+
disableContinueButton: function($super, state) {
|
| 11 |
+
/* noop */
|
| 12 |
+
}
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
+
})();
|
js/cornerdrop/collect/event.simulate.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/**
|
| 2 |
+
* Event.simulate(@element, eventName[, options]) -> Element
|
| 3 |
+
*
|
| 4 |
+
* - @element: element to fire event on
|
| 5 |
+
* - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
|
| 6 |
+
* - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
|
| 7 |
+
*
|
| 8 |
+
* $('foo').simulate('click'); // => fires "click" event on an element with id=foo
|
| 9 |
+
*
|
| 10 |
+
**/
|
| 11 |
+
(function(){
|
| 12 |
+
|
| 13 |
+
var eventMatchers = {
|
| 14 |
+
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
| 15 |
+
'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/
|
| 16 |
+
}
|
| 17 |
+
var defaultOptions = {
|
| 18 |
+
pointerX: 0,
|
| 19 |
+
pointerY: 0,
|
| 20 |
+
button: 0,
|
| 21 |
+
ctrlKey: false,
|
| 22 |
+
altKey: false,
|
| 23 |
+
shiftKey: false,
|
| 24 |
+
metaKey: false,
|
| 25 |
+
bubbles: true,
|
| 26 |
+
cancelable: true
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
Event.simulate = function(element, eventName) {
|
| 30 |
+
var options = Object.extend(Object.clone(defaultOptions), arguments[2] || { });
|
| 31 |
+
var oEvent, eventType = null;
|
| 32 |
+
|
| 33 |
+
element = $(element);
|
| 34 |
+
|
| 35 |
+
for (var name in eventMatchers) {
|
| 36 |
+
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (!eventType)
|
| 40 |
+
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
| 41 |
+
|
| 42 |
+
if (document.createEvent) {
|
| 43 |
+
oEvent = document.createEvent(eventType);
|
| 44 |
+
if (eventType == 'HTMLEvents') {
|
| 45 |
+
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
| 46 |
+
}
|
| 47 |
+
else {
|
| 48 |
+
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
| 49 |
+
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
| 50 |
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
| 51 |
+
}
|
| 52 |
+
element.dispatchEvent(oEvent);
|
| 53 |
+
}
|
| 54 |
+
else {
|
| 55 |
+
options.clientX = options.pointerX;
|
| 56 |
+
options.clientY = options.pointerY;
|
| 57 |
+
oEvent = Object.extend(document.createEventObject(), options);
|
| 58 |
+
element.fireEvent('on' + eventName, oEvent);
|
| 59 |
+
}
|
| 60 |
+
return element;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
Element.addMethods({ simulate: Event.simulate });
|
| 64 |
+
})();
|
js/cornerdrop/collect/geolocationAPI.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function() {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.GeolocationAPI = Class.create({
|
| 10 |
+
initialize: function( options ) {
|
| 11 |
+
var self = this;
|
| 12 |
+
|
| 13 |
+
self.options = Object.extend({
|
| 14 |
+
enableHighAccuracy: false,
|
| 15 |
+
timeout: 5000,
|
| 16 |
+
maximumAge: 0,
|
| 17 |
+
watcher: false,
|
| 18 |
+
afterRequestCallback: function() {
|
| 19 |
+
|
| 20 |
+
}
|
| 21 |
+
}, options || {});
|
| 22 |
+
|
| 23 |
+
self.geoOptions = {
|
| 24 |
+
enableHighAccuracy: self.options.enableHighAccuracy,
|
| 25 |
+
timeout: self.options.timeout,
|
| 26 |
+
maximumAge: self.options.maximumAge
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
self.position = {
|
| 30 |
+
latitude: null,
|
| 31 |
+
longitude: null,
|
| 32 |
+
error: ''
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
if (self.options.watcher) {
|
| 36 |
+
this.watcherID = navigator.geolocation.watchPosition(self.onSuccess.bind(this), self.onError.bind(this), self.geoOptions);
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
|
| 40 |
+
getLocation: function(callback, errorCallback) {
|
| 41 |
+
var self = this;
|
| 42 |
+
|
| 43 |
+
if (navigator.geolocation) {
|
| 44 |
+
navigator.geolocation.getCurrentPosition(self.onSuccess.bind(this, callback), self.onError.bind(this, errorCallback), self.geoOptions);
|
| 45 |
+
self.options.afterRequestCallback();
|
| 46 |
+
} else {
|
| 47 |
+
self.options.afterRequestCallback();
|
| 48 |
+
return false;
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
|
| 52 |
+
onSuccess: function(callback, location) {
|
| 53 |
+
var self = this;
|
| 54 |
+
|
| 55 |
+
self.position.latitude = location.coords.latitude;
|
| 56 |
+
self.position.longitude = location.coords.longitude;
|
| 57 |
+
|
| 58 |
+
if (callback) {
|
| 59 |
+
callback(location);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
return;
|
| 63 |
+
},
|
| 64 |
+
|
| 65 |
+
onError: function(callback, error) {
|
| 66 |
+
var self = this;
|
| 67 |
+
|
| 68 |
+
switch(error.code) {
|
| 69 |
+
case error.PERMISSION_DENIED:
|
| 70 |
+
self.position.error = "User denied the request for Geolocation.";
|
| 71 |
+
break;
|
| 72 |
+
case error.POSITION_UNAVAILABLE:
|
| 73 |
+
self.position.error = "Location information is unavailable.";
|
| 74 |
+
break;
|
| 75 |
+
case error.TIMEOUT:
|
| 76 |
+
self.position.error = "The request to get user location timed out.";
|
| 77 |
+
break;
|
| 78 |
+
case error.UNKNOWN_ERROR:
|
| 79 |
+
self.position.error = "An unknown error occurred.";
|
| 80 |
+
break;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
if (callback) {
|
| 84 |
+
callback(self.position.error);
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
});
|
| 89 |
+
})();
|
js/cornerdrop/collect/gmaps.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function() {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.Gmaps = Class.create({
|
| 10 |
+
initialize: function( options ) {
|
| 11 |
+
var self = this;
|
| 12 |
+
|
| 13 |
+
self.options = Object.extend({
|
| 14 |
+
mapOptions: {
|
| 15 |
+
center: {
|
| 16 |
+
lat: -34.397,
|
| 17 |
+
lng: 150.644
|
| 18 |
+
},
|
| 19 |
+
zoom: 8
|
| 20 |
+
},
|
| 21 |
+
mapSelector: '#cdc-map-canvas',
|
| 22 |
+
mapClass: typeof google !== "undefined" && typeof google.maps !== "undefined" ? google.maps : null,
|
| 23 |
+
baseUrl: null,
|
| 24 |
+
markerImage: null
|
| 25 |
+
}, options || {});
|
| 26 |
+
|
| 27 |
+
self.markers = [];
|
| 28 |
+
self.bounds = [];
|
| 29 |
+
|
| 30 |
+
self._createLocationObject();
|
| 31 |
+
},
|
| 32 |
+
|
| 33 |
+
createMap: function() {
|
| 34 |
+
var self = this;
|
| 35 |
+
|
| 36 |
+
if (self.options.mapClass) {
|
| 37 |
+
self.mapElement = $$(self.options.mapSelector).first();
|
| 38 |
+
self.mapObject = new self.options.mapClass.Map(self.mapElement, self.locationObject);
|
| 39 |
+
self.infoWindow = new self.options.mapClass.InfoWindow();
|
| 40 |
+
} else {
|
| 41 |
+
throw '[CornerDrop Collect] Google Maps object not found';
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
|
| 45 |
+
resizeMap: function() {
|
| 46 |
+
var self = this;
|
| 47 |
+
self.options.mapClass.event.trigger(self.mapElement, 'resize')
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
createMarkers: function( data, markerCallback ) {
|
| 51 |
+
var self = this;
|
| 52 |
+
|
| 53 |
+
if (self.options.mapClass) {
|
| 54 |
+
self._clearMapBounds();
|
| 55 |
+
|
| 56 |
+
if (data.length) {
|
| 57 |
+
data.each(function (item) {
|
| 58 |
+
self._createMarker(item, markerCallback);
|
| 59 |
+
});
|
| 60 |
+
} else {
|
| 61 |
+
self._createMarker(data, markerCallback);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
self._setMapBounds();
|
| 65 |
+
} else {
|
| 66 |
+
throw '[CornerDrop Collect] Google Maps object not found';
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
|
| 70 |
+
deleteMarkers: function() {
|
| 71 |
+
var self = this;
|
| 72 |
+
|
| 73 |
+
self._clearMarkers();
|
| 74 |
+
self.markers = [];
|
| 75 |
+
},
|
| 76 |
+
|
| 77 |
+
triggerMarker: function(marker) {
|
| 78 |
+
var self = this;
|
| 79 |
+
|
| 80 |
+
if (self.options.mapClass) {
|
| 81 |
+
if (marker.getAnimation() != null) {
|
| 82 |
+
marker.setAnimation(null);
|
| 83 |
+
} else {
|
| 84 |
+
marker.setAnimation(self.options.mapClass.Animation.BOUNCE);
|
| 85 |
+
window.setTimeout(function () {
|
| 86 |
+
marker.setAnimation(null);
|
| 87 |
+
}, 1400);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
var infoWindowContent = '<strong>' + marker.title + ' (' + marker.distance + ' miles)</strong>';
|
| 91 |
+
|
| 92 |
+
if (marker.cdcAddress) {
|
| 93 |
+
infoWindowContent += '<br />' + marker.cdcAddress;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
if (marker.cdcOpeningHours) {
|
| 97 |
+
infoWindowContent += '<br />' + marker.cdcOpeningHours;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
self.infoWindow.setContent(infoWindowContent);
|
| 101 |
+
self.infoWindow.open(self.mapObject, marker);
|
| 102 |
+
} else {
|
| 103 |
+
throw '[CornerDrop Collect] Google Maps object not found';
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
|
| 107 |
+
_createMarker: function(item, markerCallback) {
|
| 108 |
+
var self = this;
|
| 109 |
+
var bounds = new self.options.mapClass.LatLng(item.location.latitude, item.location.longitude);
|
| 110 |
+
var marker = new self.options.mapClass.Marker({
|
| 111 |
+
position: bounds,
|
| 112 |
+
map: self.mapObject,
|
| 113 |
+
title: item.name,
|
| 114 |
+
id: item.id,
|
| 115 |
+
cdcAddress: item.addressHtml,
|
| 116 |
+
cdcOpeningHours: item.openingHoursHtml,
|
| 117 |
+
distance: item.location.distance.toFixed(1),
|
| 118 |
+
icon: self.options.markerImage
|
| 119 |
+
});
|
| 120 |
+
|
| 121 |
+
self.markers.push(marker);
|
| 122 |
+
self.bounds.push(bounds);
|
| 123 |
+
|
| 124 |
+
self.options.mapClass.event.addListener(marker, 'click', function() {
|
| 125 |
+
markerCallback(item.id);
|
| 126 |
+
});
|
| 127 |
+
},
|
| 128 |
+
|
| 129 |
+
_createLocationObject: function() {
|
| 130 |
+
var self = this;
|
| 131 |
+
|
| 132 |
+
self.locationObject = {
|
| 133 |
+
center: {
|
| 134 |
+
lat: self.options.mapOptions.center.lat,
|
| 135 |
+
lng: self.options.mapOptions.center.lng
|
| 136 |
+
},
|
| 137 |
+
zoom: self.options.mapOptions.zoom
|
| 138 |
+
}
|
| 139 |
+
},
|
| 140 |
+
|
| 141 |
+
_clearMarkers: function() {
|
| 142 |
+
var self = this;
|
| 143 |
+
|
| 144 |
+
for (var i = 0; i < self.markers.length; i++) {
|
| 145 |
+
self.markers[i].setMap(null);
|
| 146 |
+
}
|
| 147 |
+
},
|
| 148 |
+
|
| 149 |
+
_clearMapBounds: function() {
|
| 150 |
+
var self = this;
|
| 151 |
+
|
| 152 |
+
if (self.mapBounds) {
|
| 153 |
+
self.mapBounds = null;
|
| 154 |
+
self.bounds = [];
|
| 155 |
+
}
|
| 156 |
+
},
|
| 157 |
+
|
| 158 |
+
_setMapBounds: function() {
|
| 159 |
+
var self = this;
|
| 160 |
+
|
| 161 |
+
// Ensure all of the markers are shown inside the bounds
|
| 162 |
+
// of the map object
|
| 163 |
+
self.mapBounds = new self.options.mapClass.LatLngBounds(self.bounds[0]);
|
| 164 |
+
self.bounds.each(function(item) {
|
| 165 |
+
self.mapBounds.extend(item);
|
| 166 |
+
});
|
| 167 |
+
self.mapObject.fitBounds(self.mapBounds);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
});
|
| 171 |
+
})();
|
js/cornerdrop/collect/search.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function () {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class, Ajax, $$, $H, shipping, shippingRegionUpdater */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.Search = Class.create({
|
| 10 |
+
|
| 11 |
+
initialize: function (options) {
|
| 12 |
+
var self = this;
|
| 13 |
+
|
| 14 |
+
self.options = Object.extend({
|
| 15 |
+
endpoint: null,
|
| 16 |
+
form: "#co-shipping-form",
|
| 17 |
+
storeIdField: "shipping[cornerdrop_store_id]",
|
| 18 |
+
prepareFormCallback: function () {},
|
| 19 |
+
regionUpdateCallback: function () {}
|
| 20 |
+
}, options || {});
|
| 21 |
+
|
| 22 |
+
if (!self.options.endpoint) {
|
| 23 |
+
throw "[CornerDrop Collect] Search endpoint missing!";
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
self.results = [];
|
| 27 |
+
|
| 28 |
+
self._injectMarkup();
|
| 29 |
+
self._applyObservers();
|
| 30 |
+
},
|
| 31 |
+
|
| 32 |
+
search: function (query, lat, long, callback) {
|
| 33 |
+
var self = this;
|
| 34 |
+
|
| 35 |
+
self.clear();
|
| 36 |
+
|
| 37 |
+
new Ajax.Request(self.options.endpoint, {
|
| 38 |
+
method: "GET",
|
| 39 |
+
parameters: {
|
| 40 |
+
q: query,
|
| 41 |
+
lat: lat,
|
| 42 |
+
long: long
|
| 43 |
+
},
|
| 44 |
+
evalJSON: true,
|
| 45 |
+
onSuccess: function (response) {
|
| 46 |
+
self.results = response.responseJSON;
|
| 47 |
+
},
|
| 48 |
+
onFailure: function (response) {
|
| 49 |
+
if (response.responseJSON) {
|
| 50 |
+
self.error = response.responseJSON.message;
|
| 51 |
+
} else {
|
| 52 |
+
self.error = true;
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
+
onComplete: function (response) {
|
| 56 |
+
if (callback) {
|
| 57 |
+
callback(self);
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
});
|
| 61 |
+
},
|
| 62 |
+
|
| 63 |
+
getResultById: function(id) {
|
| 64 |
+
var self = this;
|
| 65 |
+
var foundResult = null;
|
| 66 |
+
|
| 67 |
+
self.results.each(function (result) {
|
| 68 |
+
if (result.id == id) {
|
| 69 |
+
foundResult = result;
|
| 70 |
+
}
|
| 71 |
+
});
|
| 72 |
+
|
| 73 |
+
return foundResult;
|
| 74 |
+
},
|
| 75 |
+
|
| 76 |
+
select: function (id) {
|
| 77 |
+
var self = this;
|
| 78 |
+
|
| 79 |
+
self.selected = self.getResultById(id);
|
| 80 |
+
|
| 81 |
+
if (self.selected) {
|
| 82 |
+
this._fillForm(self.selected);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
return !!self.selected;
|
| 86 |
+
},
|
| 87 |
+
|
| 88 |
+
deselect: function () {
|
| 89 |
+
var self = this;
|
| 90 |
+
self.resetStoreId();
|
| 91 |
+
self.selected = null;
|
| 92 |
+
},
|
| 93 |
+
|
| 94 |
+
clear: function () {
|
| 95 |
+
var self = this;
|
| 96 |
+
|
| 97 |
+
self.results = [];
|
| 98 |
+
self.error = null;
|
| 99 |
+
},
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Return the currently selected store id, blank if no store is selected.
|
| 103 |
+
*
|
| 104 |
+
* @returns {*}
|
| 105 |
+
*/
|
| 106 |
+
getStoreId: function () {
|
| 107 |
+
var element = $("shipping:cornerdrop_store_id");
|
| 108 |
+
if (element) {
|
| 109 |
+
return element.value;
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
|
| 113 |
+
resetStoreId: function() {
|
| 114 |
+
var element = $("shipping:cornerdrop_store_id");
|
| 115 |
+
if (element) {
|
| 116 |
+
element.value = null;
|
| 117 |
+
}
|
| 118 |
+
},
|
| 119 |
+
|
| 120 |
+
fillForm: function() {
|
| 121 |
+
var self = this;
|
| 122 |
+
|
| 123 |
+
if (self.selected) {
|
| 124 |
+
self._fillForm(self.selected);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
return false;
|
| 128 |
+
},
|
| 129 |
+
|
| 130 |
+
_getForm: function () {
|
| 131 |
+
var self = this;
|
| 132 |
+
|
| 133 |
+
if (!self.form) {
|
| 134 |
+
self.form = $$(self.options.form).first();
|
| 135 |
+
|
| 136 |
+
if (!self.form) {
|
| 137 |
+
throw "[CornerDrop Collect] Shipping Address form not found!";
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
return self.form;
|
| 142 |
+
},
|
| 143 |
+
|
| 144 |
+
_getFormElement: function (form, name, first) {
|
| 145 |
+
first = typeof first !== 'undefined' ? first : true;
|
| 146 |
+
|
| 147 |
+
var elements = form.select('[name *= "[' + name + ']"]');
|
| 148 |
+
|
| 149 |
+
return first ? elements.first() : elements;
|
| 150 |
+
},
|
| 151 |
+
|
| 152 |
+
_injectMarkup: function () {
|
| 153 |
+
var self = this;
|
| 154 |
+
|
| 155 |
+
self._getForm().appendChild(new Element("input", {
|
| 156 |
+
type: "hidden",
|
| 157 |
+
name: self.options.storeIdField,
|
| 158 |
+
value: "",
|
| 159 |
+
id: "shipping:cornerdrop_store_id"
|
| 160 |
+
}));
|
| 161 |
+
},
|
| 162 |
+
|
| 163 |
+
_applyObservers: function () {
|
| 164 |
+
var self = this;
|
| 165 |
+
|
| 166 |
+
Event.observe(document, "cornerdrop_collect:disabled", self.resetStoreId.bind(this));
|
| 167 |
+
Event.observe(document, "cornerdrop_collect:enabled", self.fillForm.bind(self));
|
| 168 |
+
},
|
| 169 |
+
|
| 170 |
+
_fillForm: function (data) {
|
| 171 |
+
var self = this;
|
| 172 |
+
|
| 173 |
+
var element;
|
| 174 |
+
var form = self._getForm();
|
| 175 |
+
|
| 176 |
+
if (self.options.prepareFormCallback) {
|
| 177 |
+
self.options.prepareFormCallback(true);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
$H(data.address).each(function (item) {
|
| 181 |
+
if (item.key == "street") {
|
| 182 |
+
var idx = 0;
|
| 183 |
+
self._getFormElement(form, "street", false).each(function (field) {
|
| 184 |
+
field.value = item.value[idx++];
|
| 185 |
+
});
|
| 186 |
+
} else {
|
| 187 |
+
element = self._getFormElement(form, item.key);
|
| 188 |
+
if (element) {
|
| 189 |
+
element.value = item.value;
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
});
|
| 193 |
+
|
| 194 |
+
if (self.options.regionUpdateCallback) {
|
| 195 |
+
self.options.regionUpdateCallback();
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
["region_id", "region"].each(function (field) {
|
| 199 |
+
element = self._getFormElement(form, field);
|
| 200 |
+
if (element) {
|
| 201 |
+
element.value = data.address[field];
|
| 202 |
+
}
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
element = self._getFormElement(form, "cornerdrop_store_id");
|
| 206 |
+
if (element) {
|
| 207 |
+
element.value = data.id;
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
});
|
| 211 |
+
})();
|
js/cornerdrop/collect/switch.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|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
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function () {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class, $, $$ */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.Switch = Class.create({
|
| 10 |
+
|
| 11 |
+
initialize: function ( options ) {
|
| 12 |
+
var self = this;
|
| 13 |
+
|
| 14 |
+
self.options = Object.extend({
|
| 15 |
+
labels: {
|
| 16 |
+
checkbox: "Ship to a CornerDrop location",
|
| 17 |
+
deactivateButton: 'Switch to home delivery',
|
| 18 |
+
activateButton: 'Use CornerDrop'
|
| 19 |
+
},
|
| 20 |
+
value: false,
|
| 21 |
+
elements: {
|
| 22 |
+
toggleButton: '#cornerdrop-collect-toggle-button',
|
| 23 |
+
toggleButtonLocation: '#shipping-buttons-container',
|
| 24 |
+
billingFormList: '#co-billing-form ul.form-list',
|
| 25 |
+
shippingFormList: '#co-shipping-form ul.form-list'
|
| 26 |
+
}
|
| 27 |
+
}, options || {});
|
| 28 |
+
|
| 29 |
+
self.observers = [];
|
| 30 |
+
|
| 31 |
+
self.build();
|
| 32 |
+
},
|
| 33 |
+
|
| 34 |
+
build: function () {
|
| 35 |
+
var self = this;
|
| 36 |
+
|
| 37 |
+
// Create control element in the billing form
|
| 38 |
+
|
| 39 |
+
var control = new Element("li", {
|
| 40 |
+
id: "billing:cornerdrop_control",
|
| 41 |
+
class: "control"
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
control.appendChild(new Element("input", {
|
| 45 |
+
type: "hidden",
|
| 46 |
+
name: "billing[ship_to_cornerdrop]",
|
| 47 |
+
value: self.options.value ? "1" : "0",
|
| 48 |
+
id: "billing:ship_to_cornerdrop"
|
| 49 |
+
}));
|
| 50 |
+
|
| 51 |
+
control.appendChild(new Element("input", {
|
| 52 |
+
type: "radio",
|
| 53 |
+
name: "billing[use_for_shipping]",
|
| 54 |
+
value: "0",
|
| 55 |
+
checked: !!self.options.value,
|
| 56 |
+
title: self.options.labels.checkbox,
|
| 57 |
+
id: "billing:use_for_shipping_cornerdrop",
|
| 58 |
+
'class': "radio"
|
| 59 |
+
}));
|
| 60 |
+
|
| 61 |
+
control.appendChild(new Element("label", {
|
| 62 |
+
for: "billing:use_for_shipping_cornerdrop"
|
| 63 |
+
}).update(self.options.labels.checkbox));
|
| 64 |
+
|
| 65 |
+
var billingFormList = $$(self.options.elements.billingFormList).first();
|
| 66 |
+
if (!billingFormList) {
|
| 67 |
+
throw "[CornerDrop Collect] Could not find the billing form list!";
|
| 68 |
+
}
|
| 69 |
+
billingFormList.appendChild(control);
|
| 70 |
+
|
| 71 |
+
// Create switch field in the shipping form
|
| 72 |
+
|
| 73 |
+
var cornerdropField = new Element("input", {
|
| 74 |
+
type: "hidden",
|
| 75 |
+
name: "shipping[is_cornerdrop_collect]",
|
| 76 |
+
value: self.options.value ? "1" : "0",
|
| 77 |
+
id: "shipping:is_cornerdrop_collect"
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
var shippingFormList = $$(self.options.elements.shippingFormList).first();
|
| 81 |
+
if (!shippingFormList) {
|
| 82 |
+
throw "[CornerDrop Collect] Could not find the shipping form list!";
|
| 83 |
+
}
|
| 84 |
+
shippingFormList.appendChild(cornerdropField);
|
| 85 |
+
|
| 86 |
+
// Create activate switch in shipping address form
|
| 87 |
+
|
| 88 |
+
var toggleLinkLabel = self.options.value ? self.options.labels.deactivateButton : self.options.labels.activateButton;
|
| 89 |
+
var toggleLink = new Element('a', {
|
| 90 |
+
'id': self.options.elements.toggleButton.replace(/#/, ''),
|
| 91 |
+
'href': '',
|
| 92 |
+
'class': 'cdc-toggle-button'
|
| 93 |
+
}).update(toggleLinkLabel);
|
| 94 |
+
|
| 95 |
+
var insertLocation = $$(self.options.elements.toggleButtonLocation).first();
|
| 96 |
+
if (!insertLocation) {
|
| 97 |
+
throw "[CornerDrop Collect] Could not find the insert location";
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
insertLocation.insert({
|
| 101 |
+
before: toggleLink
|
| 102 |
+
});
|
| 103 |
+
|
| 104 |
+
// Attach observers
|
| 105 |
+
|
| 106 |
+
self._attachObserver($("billing:cornerdrop_control"), "click", self._enableCornerdrop.bind(self));
|
| 107 |
+
self._attachObserver($("billing:use_for_shipping_yes"), "click", self._disableCornerdrop.bind(self));
|
| 108 |
+
self._attachObserver($("billing:use_for_shipping_no"), "click", self._disableCornerdrop.bind(self));
|
| 109 |
+
self._attachObserver($$(self.options.elements.toggleButton).first(), "click", self._toggleCornerDrop.bind(self));
|
| 110 |
+
},
|
| 111 |
+
|
| 112 |
+
destroy: function () {
|
| 113 |
+
var self = this;
|
| 114 |
+
|
| 115 |
+
self._destroyObservers();
|
| 116 |
+
|
| 117 |
+
$("billing:cornerdrop_control").remove();
|
| 118 |
+
},
|
| 119 |
+
|
| 120 |
+
_toggleCornerDrop: function() {
|
| 121 |
+
event.preventDefault();
|
| 122 |
+
var self = this;
|
| 123 |
+
|
| 124 |
+
if (self.options.value) {
|
| 125 |
+
self._disableCornerdrop();
|
| 126 |
+
} else {
|
| 127 |
+
self._enableCornerdrop();
|
| 128 |
+
}
|
| 129 |
+
},
|
| 130 |
+
|
| 131 |
+
_enableCornerdrop: function () {
|
| 132 |
+
var self = this;
|
| 133 |
+
|
| 134 |
+
self.options.value = true;
|
| 135 |
+
$("shipping:same_as_billing").checked = false;
|
| 136 |
+
$("billing:ship_to_cornerdrop").value = "1";
|
| 137 |
+
$("shipping:is_cornerdrop_collect").value = "1";
|
| 138 |
+
$("billing:use_for_shipping_cornerdrop").checked = true;
|
| 139 |
+
$$(self.options.elements.toggleButton).first().update(self.options.labels.deactivateButton);
|
| 140 |
+
Event.fire(document, 'cornerdrop_collect:enabled');
|
| 141 |
+
},
|
| 142 |
+
|
| 143 |
+
_disableCornerdrop: function () {
|
| 144 |
+
var self = this;
|
| 145 |
+
|
| 146 |
+
var no_checked = $("billing:use_for_shipping_no").checked;
|
| 147 |
+
var yes_checked = $("billing:use_for_shipping_yes").checked;
|
| 148 |
+
var something_checked = no_checked || yes_checked;
|
| 149 |
+
|
| 150 |
+
self.options.value = false;
|
| 151 |
+
$("billing:ship_to_cornerdrop").value = "0";
|
| 152 |
+
$("shipping:is_cornerdrop_collect").value = "0";
|
| 153 |
+
|
| 154 |
+
if (!something_checked) {
|
| 155 |
+
$("billing:use_for_shipping_no").checked = true;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
$$(self.options.elements.toggleButton).first().update(self.options.labels.activateButton);
|
| 159 |
+
Event.fire(document, 'cornerdrop_collect:disabled');
|
| 160 |
+
},
|
| 161 |
+
|
| 162 |
+
_attachObserver: function (element, event, handler) {
|
| 163 |
+
var self = this;
|
| 164 |
+
|
| 165 |
+
self.observers.push({
|
| 166 |
+
element: element,
|
| 167 |
+
event: event,
|
| 168 |
+
handler: handler
|
| 169 |
+
});
|
| 170 |
+
|
| 171 |
+
element.observe(event, handler);
|
| 172 |
+
},
|
| 173 |
+
|
| 174 |
+
_destroyObservers: function () {
|
| 175 |
+
var self = this;
|
| 176 |
+
|
| 177 |
+
self.observers.each(function (observer) {
|
| 178 |
+
observer.element.stopObserving(observer.event, observer.handler);
|
| 179 |
+
});
|
| 180 |
+
|
| 181 |
+
self.observers = [];
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
});
|
| 185 |
+
})();
|
js/cornerdrop/collect/ui.js
ADDED
|
@@ -0,0 +1,558 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
if (!window.CornerDrop) window.CornerDrop = {};
|
| 2 |
+
if (!window.CornerDrop.Collect) window.CornerDrop.Collect = {};
|
| 3 |
+
|
| 4 |
+
(function() {
|
| 5 |
+
'use strict';
|
| 6 |
+
|
| 7 |
+
/* global Class, $$, $H, google */
|
| 8 |
+
|
| 9 |
+
window.CornerDrop.Collect.UI = Class.create({
|
| 10 |
+
initialize: function( options ) {
|
| 11 |
+
var self = this;
|
| 12 |
+
|
| 13 |
+
self.options = Object.extend({
|
| 14 |
+
geolocationAPIClass: null,
|
| 15 |
+
searchClass: null,
|
| 16 |
+
gmapsClass: null,
|
| 17 |
+
geocoder: typeof google !== "undefined" && typeof google.maps !== "undefined" ? google.maps.Geocoder : null,
|
| 18 |
+
geocoderStatus: typeof google !== "undefined" && typeof google.maps !== "undefined" ? google.maps.GeocoderStatus : null,
|
| 19 |
+
searchTemplate: null,
|
| 20 |
+
shouldCheckTermsAndConditions: true,
|
| 21 |
+
termsAndConditionsLabel: 'By using this service you agree to the <a href="https://cornerdrop.com/legal/consumer-terms-retailer" target="_blank">Terms & Conditions.</a>',
|
| 22 |
+
elements: {
|
| 23 |
+
cornerdropContainer: '.cdc-panel',
|
| 24 |
+
injectLocation: '#checkout-step-shipping',
|
| 25 |
+
searchForm: '#cdc-search-form',
|
| 26 |
+
searchField: '#cdc-search-form input',
|
| 27 |
+
geolocationIcon: '.js-cdc-geolocation',
|
| 28 |
+
searchList: '.js-cdc-search-results',
|
| 29 |
+
storeContainer: '.js-cdc-store',
|
| 30 |
+
selectedStore: '.js-cdc-store-details',
|
| 31 |
+
error: '.js-cdc-error',
|
| 32 |
+
shippingForm: '#co-shipping-form .form-list',
|
| 33 |
+
searchButton: '.js-cdc-search-button',
|
| 34 |
+
resetButton: '.js-cdc-reset-button',
|
| 35 |
+
resultsPager: '.js-cdc-results-pager',
|
| 36 |
+
undoElement: '.js-cdc-undo',
|
| 37 |
+
shippingFormSubmit: '#shipping-buttons-container button',
|
| 38 |
+
termsAndConditionsCheckbox: '#cornerdrop-collect-tc-checkbox',
|
| 39 |
+
termsAndConditionsLocation: '#cornerdrop-collect-toggle-button'
|
| 40 |
+
},
|
| 41 |
+
pager: {
|
| 42 |
+
resultsPerPage: 5
|
| 43 |
+
},
|
| 44 |
+
classes: {
|
| 45 |
+
hidden: 'cdc-hidden',
|
| 46 |
+
error: 'cdc-error',
|
| 47 |
+
loading: 'cdc-loading',
|
| 48 |
+
active: 'cdc-active',
|
| 49 |
+
resultItem: 'cdc-result',
|
| 50 |
+
show: 'cdc-show'
|
| 51 |
+
},
|
| 52 |
+
initialState: false,
|
| 53 |
+
afterRequestCallback: function() {
|
| 54 |
+
|
| 55 |
+
}
|
| 56 |
+
}, options || {});
|
| 57 |
+
|
| 58 |
+
self.els = {};
|
| 59 |
+
self.observers = [];
|
| 60 |
+
self.delegatedObservers = [];
|
| 61 |
+
self.searchValue = null;
|
| 62 |
+
self.isGeolocationQuery = null;
|
| 63 |
+
self.resultsPage = 1;
|
| 64 |
+
|
| 65 |
+
self.injectSearchTemplate();
|
| 66 |
+
self.injectTermsAndConditions();
|
| 67 |
+
|
| 68 |
+
self.createElementReferences(self.options.elements);
|
| 69 |
+
self.applyObservers();
|
| 70 |
+
self.addListeners();
|
| 71 |
+
self.toggleCornerdrop(self.options.initialState);
|
| 72 |
+
self.disableContinueButton(true);
|
| 73 |
+
|
| 74 |
+
if (self.options.gmapsClass) {
|
| 75 |
+
self.options.gmapsClass.createMap();
|
| 76 |
+
self._hideElement(self.options.gmapsClass.mapElement, true);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
if (self.options.geocoder) {
|
| 80 |
+
self.geocoder = new self.options.geocoder();
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
|
| 84 |
+
createElementReferences: function(elements) {
|
| 85 |
+
var hash = $H(elements);
|
| 86 |
+
var self = this;
|
| 87 |
+
|
| 88 |
+
hash.each(function(item) {
|
| 89 |
+
self.els[item.key] = $$(item.value).first();
|
| 90 |
+
});
|
| 91 |
+
},
|
| 92 |
+
|
| 93 |
+
injectSearchTemplate: function() {
|
| 94 |
+
var self = this;
|
| 95 |
+
var injectLocation = $$(self.options.elements.injectLocation).first();
|
| 96 |
+
|
| 97 |
+
injectLocation.insert({
|
| 98 |
+
top: self.options.searchTemplate
|
| 99 |
+
});
|
| 100 |
+
},
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* Build terms and conditions elements.
|
| 104 |
+
*/
|
| 105 |
+
injectTermsAndConditions: function() {
|
| 106 |
+
var self = this;
|
| 107 |
+
|
| 108 |
+
if (!self.options.shouldCheckTermsAndConditions) {
|
| 109 |
+
return;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
var termsAndConditionsContainer = new Element('div', {
|
| 113 |
+
'class': 'cdc-tc-container'
|
| 114 |
+
});
|
| 115 |
+
|
| 116 |
+
var termsAndConditionsCheckbox = new Element('input', {
|
| 117 |
+
'type': 'checkbox',
|
| 118 |
+
'checked': 'checked',
|
| 119 |
+
'id': self.options.elements.termsAndConditionsCheckbox.replace(/#/, '')
|
| 120 |
+
});
|
| 121 |
+
|
| 122 |
+
var termsAndConditionsLabel = new Element('label', {
|
| 123 |
+
'class': 'cdc-tc-label',
|
| 124 |
+
'for': self.options.elements.termsAndConditionsCheckbox.replace(/#/, '')
|
| 125 |
+
}).update(self.options.termsAndConditionsLabel);
|
| 126 |
+
|
| 127 |
+
termsAndConditionsContainer.insert({
|
| 128 |
+
bottom: termsAndConditionsCheckbox
|
| 129 |
+
}).insert({
|
| 130 |
+
bottom: termsAndConditionsLabel
|
| 131 |
+
});
|
| 132 |
+
|
| 133 |
+
var termsAndConditionsInsertLocation = $$(self.options.elements.termsAndConditionsLocation).first();
|
| 134 |
+
if (termsAndConditionsInsertLocation) {
|
| 135 |
+
termsAndConditionsInsertLocation.insert({
|
| 136 |
+
before: termsAndConditionsContainer
|
| 137 |
+
});
|
| 138 |
+
}
|
| 139 |
+
},
|
| 140 |
+
|
| 141 |
+
requestLocation: function(callback, errorCallback) {
|
| 142 |
+
var self = this;
|
| 143 |
+
|
| 144 |
+
if ( self.options.geolocationAPIClass ) {
|
| 145 |
+
if ( callback && errorCallback ) {
|
| 146 |
+
self.options.geolocationAPIClass.getLocation(callback, errorCallback);
|
| 147 |
+
} else {
|
| 148 |
+
throw '[CornerDrop Collect] Geolocation callback not provided';
|
| 149 |
+
}
|
| 150 |
+
} else {
|
| 151 |
+
throw '[CornerDrop Collect] GeolocationAPI class not defined';
|
| 152 |
+
}
|
| 153 |
+
},
|
| 154 |
+
|
| 155 |
+
searchGeolocation: function(event) {
|
| 156 |
+
event.preventDefault();
|
| 157 |
+
|
| 158 |
+
var self = this;
|
| 159 |
+
|
| 160 |
+
self._resetFormButtons(event);
|
| 161 |
+
self.els.searchButton.addClassName(self.options.classes.loading);
|
| 162 |
+
self.els.geolocationIcon.addClassName(self.options.classes.active);
|
| 163 |
+
self.requestLocation(self.search.bind(self), self.error.bind(self));
|
| 164 |
+
self.isGeolocationQuery = true;
|
| 165 |
+
},
|
| 166 |
+
|
| 167 |
+
searchQuery: function(event) {
|
| 168 |
+
event.preventDefault();
|
| 169 |
+
|
| 170 |
+
var self = this;
|
| 171 |
+
var location = {
|
| 172 |
+
coords: {
|
| 173 |
+
latitude: null,
|
| 174 |
+
longitude: null
|
| 175 |
+
}
|
| 176 |
+
};
|
| 177 |
+
|
| 178 |
+
self.isGeolocationQuery = false;
|
| 179 |
+
self.els.searchButton.addClassName(self.options.classes.loading);
|
| 180 |
+
self.searchValue = self.els.searchField.value;
|
| 181 |
+
self.els.searchList.addClassName(self.options.classes.hidden);
|
| 182 |
+
|
| 183 |
+
if (self.geocoder) {
|
| 184 |
+
self.geocoder.geocode({ 'address': self.searchValue }, function geocoderResults(results, status) {
|
| 185 |
+
if (status == self.options.geocoderStatus.OK) {
|
| 186 |
+
location.coords.latitude = results[0].geometry.location.lat();
|
| 187 |
+
location.coords.longitude = results[0].geometry.location.lng();
|
| 188 |
+
self.search.call(self, location);
|
| 189 |
+
} else {
|
| 190 |
+
self.error('Location not found, please refine your search');
|
| 191 |
+
throw '[CornerDrop Collect] Geocoding failed:' + status;
|
| 192 |
+
}
|
| 193 |
+
});
|
| 194 |
+
} else {
|
| 195 |
+
self.requestLocation(self.search.bind(self), self.error.bind(self));
|
| 196 |
+
}
|
| 197 |
+
},
|
| 198 |
+
|
| 199 |
+
search: function(location) {
|
| 200 |
+
var self = this;
|
| 201 |
+
var latitude = location.coords.latitude;
|
| 202 |
+
var longitude = location.coords.longitude;
|
| 203 |
+
|
| 204 |
+
self.resultsPage = 1;
|
| 205 |
+
|
| 206 |
+
if (self.options.searchClass) {
|
| 207 |
+
if (latitude && longitude) {
|
| 208 |
+
self.options.searchClass.search(self.searchValue, latitude, longitude, self.displayResultsList.bind(self));
|
| 209 |
+
} else {
|
| 210 |
+
self.error('CornerDrop is currently unavailable');
|
| 211 |
+
throw '[CornerDrop Collect] Location services are unavailable';
|
| 212 |
+
}
|
| 213 |
+
} else {
|
| 214 |
+
throw '[CornerDrop Collect] Search class not found';
|
| 215 |
+
}
|
| 216 |
+
},
|
| 217 |
+
|
| 218 |
+
_createResult: function(item) {
|
| 219 |
+
var result = new Element('div');
|
| 220 |
+
var distance = item.location.distance.toFixed(1);
|
| 221 |
+
|
| 222 |
+
var itemTitle = new Element('span', {
|
| 223 |
+
'class': 'cdc-result-item-title'
|
| 224 |
+
}).update(item.name + ' (' + distance + ' miles)');
|
| 225 |
+
result.appendChild(itemTitle);
|
| 226 |
+
|
| 227 |
+
var address = new Element('span', {
|
| 228 |
+
'class': 'cdc-result-item-body'
|
| 229 |
+
}).update(item.addressHtml);
|
| 230 |
+
result.appendChild(address);
|
| 231 |
+
|
| 232 |
+
var openingHours = new Element('span', {
|
| 233 |
+
'class': 'cdc-result-item-body'
|
| 234 |
+
}).update(item.openingHoursHtml);
|
| 235 |
+
result.appendChild(openingHours);
|
| 236 |
+
|
| 237 |
+
return result;
|
| 238 |
+
},
|
| 239 |
+
|
| 240 |
+
displayResultsList: function(classCallback) {
|
| 241 |
+
var self = this;
|
| 242 |
+
var resultsList = new Element('ul');
|
| 243 |
+
var searchList = self.els.searchList;
|
| 244 |
+
var error;
|
| 245 |
+
|
| 246 |
+
if (!self.options.searchClass.error) {
|
| 247 |
+
|
| 248 |
+
if (classCallback.results.length) {
|
| 249 |
+
searchList.innerHTML = '';
|
| 250 |
+
|
| 251 |
+
classCallback.results.each(function resultItem(item) {
|
| 252 |
+
var element = new Element('li', {
|
| 253 |
+
"data-store-id": item.id,
|
| 254 |
+
'class': self.options.classes.resultItem
|
| 255 |
+
});
|
| 256 |
+
|
| 257 |
+
var result = self._createResult(item);
|
| 258 |
+
|
| 259 |
+
if (result) {
|
| 260 |
+
element.appendChild(result);
|
| 261 |
+
|
| 262 |
+
resultsList.insert({
|
| 263 |
+
bottom: element
|
| 264 |
+
});
|
| 265 |
+
}
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
searchList.insert(resultsList);
|
| 269 |
+
|
| 270 |
+
if (self.options.gmapsClass.options.mapClass) {
|
| 271 |
+
self.displayResultsOnMap(classCallback.results, self.setStore.bind(self));
|
| 272 |
+
} else {
|
| 273 |
+
self.setStore.bind(self);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
self.els.searchList.removeClassName(self.options.classes.hidden);
|
| 277 |
+
|
| 278 |
+
if (error = self.els.error) {
|
| 279 |
+
error.addClassName(self.options.classes.hidden);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
self._showResultsPage();
|
| 283 |
+
} else {
|
| 284 |
+
self.displayResultsOnMap(self.options.searchClass.selected, self.setStore.bind(self));
|
| 285 |
+
self.error('No results were found');
|
| 286 |
+
}
|
| 287 |
+
} else {
|
| 288 |
+
self.error('CornerDrop is currently unavailable');
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
self.els.searchButton.removeClassName(self.options.classes.loading);
|
| 292 |
+
|
| 293 |
+
if (self.isGeolocationQuery) {
|
| 294 |
+
self.els.geolocationIcon.addClassName('cdc-active');
|
| 295 |
+
self.els.searchField.value = '';
|
| 296 |
+
} else {
|
| 297 |
+
self.els.searchButton.addClassName(self.options.classes.hidden);
|
| 298 |
+
self.els.resetButton.removeClassName(self.options.classes.hidden);
|
| 299 |
+
self.els.geolocationIcon.removeClassName('cdc-active');
|
| 300 |
+
}
|
| 301 |
+
},
|
| 302 |
+
|
| 303 |
+
displayResultsOnMap: function(data, callback) {
|
| 304 |
+
var self = this;
|
| 305 |
+
|
| 306 |
+
// Setup the markers and ensure the map is displayed
|
| 307 |
+
self._hideElement(self.options.gmapsClass.mapElement, false);
|
| 308 |
+
self.options.gmapsClass.resizeMap();
|
| 309 |
+
|
| 310 |
+
self.options.gmapsClass.deleteMarkers();
|
| 311 |
+
if (data) {
|
| 312 |
+
self.options.gmapsClass.createMarkers(data, callback);
|
| 313 |
+
}
|
| 314 |
+
},
|
| 315 |
+
|
| 316 |
+
error: function(message) {
|
| 317 |
+
var self = this;
|
| 318 |
+
var errorElement;
|
| 319 |
+
|
| 320 |
+
if (!self.els.error) {
|
| 321 |
+
errorElement = new Element('div', {
|
| 322 |
+
class: self.options.classes.error
|
| 323 |
+
});
|
| 324 |
+
|
| 325 |
+
self.els.searchList.insert({
|
| 326 |
+
before: errorElement
|
| 327 |
+
});
|
| 328 |
+
|
| 329 |
+
self.els.error = errorElement;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
self.els.error.innerHTML = message;
|
| 333 |
+
self.els.error.removeClassName(self.options.classes.hidden);
|
| 334 |
+
self.els.searchButton.removeClassName(self.options.classes.loading);
|
| 335 |
+
self.isGeolocationQuery = false;
|
| 336 |
+
},
|
| 337 |
+
|
| 338 |
+
selectResult: function(event, element) {
|
| 339 |
+
var self = this;
|
| 340 |
+
|
| 341 |
+
self.setStore(element.readAttribute('data-store-id'));
|
| 342 |
+
},
|
| 343 |
+
|
| 344 |
+
setStore: function(storeId) {
|
| 345 |
+
var self = this;
|
| 346 |
+
var item = self.options.searchClass.getResultById(storeId);
|
| 347 |
+
|
| 348 |
+
if (item) {
|
| 349 |
+
self.els.selectedStore.update(self._createResult(item));
|
| 350 |
+
self.options.searchClass.select(storeId);
|
| 351 |
+
self._hideElement(self.els.undoElement, false);
|
| 352 |
+
|
| 353 |
+
self._hideElement(self.els.storeContainer, false);
|
| 354 |
+
self._hideElement(self.els.searchList, true);
|
| 355 |
+
|
| 356 |
+
// For the marker with a matching ID to the storeId
|
| 357 |
+
// trigger animation and display of the markers info
|
| 358 |
+
self.options.gmapsClass.markers.each(function (element) {
|
| 359 |
+
if (element.id == storeId) {
|
| 360 |
+
self.options.gmapsClass.triggerMarker(element);
|
| 361 |
+
}
|
| 362 |
+
});
|
| 363 |
+
|
| 364 |
+
self.checkCanDisableContinueButton();
|
| 365 |
+
}
|
| 366 |
+
},
|
| 367 |
+
|
| 368 |
+
undoSetStore: function(event) {
|
| 369 |
+
event.preventDefault();
|
| 370 |
+
var self = this;
|
| 371 |
+
|
| 372 |
+
self.els.selectedStore.innerHTML = "";
|
| 373 |
+
self._hideElement(self.els.storeContainer, true);
|
| 374 |
+
self._hideElement(self.els.searchList, false);
|
| 375 |
+
|
| 376 |
+
self.options.searchClass.deselect();
|
| 377 |
+
self.checkCanDisableContinueButton();
|
| 378 |
+
},
|
| 379 |
+
|
| 380 |
+
/**
|
| 381 |
+
* Establish whether or not the continue button should be disabled by checking the store selection and the terms
|
| 382 |
+
* and conditions checkbox.
|
| 383 |
+
*
|
| 384 |
+
* If it should be enabled, enabled it. If it should be disabled, disable it.
|
| 385 |
+
*/
|
| 386 |
+
checkCanDisableContinueButton: function () {
|
| 387 |
+
var self = this;
|
| 388 |
+
|
| 389 |
+
var isTermsAndConditionsChecked = !self.options.shouldCheckTermsAndConditions || self.els.termsAndConditionsCheckbox.checked;
|
| 390 |
+
var isStoredSelected = !!self.options.searchClass.selected;
|
| 391 |
+
|
| 392 |
+
if (isTermsAndConditionsChecked && isStoredSelected) {
|
| 393 |
+
self.disableContinueButton(false);
|
| 394 |
+
} else {
|
| 395 |
+
self.disableContinueButton(true);
|
| 396 |
+
}
|
| 397 |
+
},
|
| 398 |
+
|
| 399 |
+
disableContinueButton: function(state) {
|
| 400 |
+
var self = this;
|
| 401 |
+
|
| 402 |
+
if (state) {
|
| 403 |
+
self.els.shippingFormSubmit.disabled = 'disabled';
|
| 404 |
+
} else {
|
| 405 |
+
self.els.shippingFormSubmit.disabled = '';
|
| 406 |
+
}
|
| 407 |
+
},
|
| 408 |
+
|
| 409 |
+
checkTermsAndConditions: function (event) {
|
| 410 |
+
var self = this;
|
| 411 |
+
self.checkCanDisableContinueButton();
|
| 412 |
+
},
|
| 413 |
+
|
| 414 |
+
toggleCornerdrop: function(state, event) {
|
| 415 |
+
if (event) {
|
| 416 |
+
event.preventDefault();
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
var self = this;
|
| 420 |
+
|
| 421 |
+
self._hideElement(self.els.shippingForm, state);
|
| 422 |
+
self._hideElement(self.els.cornerdropContainer, !state);
|
| 423 |
+
self._hideElement($$('.cdc-tc-container').first(), !state);
|
| 424 |
+
if (state) {
|
| 425 |
+
self.checkCanDisableContinueButton();
|
| 426 |
+
} else {
|
| 427 |
+
self.disableContinueButton(false);
|
| 428 |
+
}
|
| 429 |
+
},
|
| 430 |
+
|
| 431 |
+
applyObservers: function() {
|
| 432 |
+
var self = this;
|
| 433 |
+
|
| 434 |
+
self._attachObserver(self.els.geolocationIcon, 'click', self.searchGeolocation.bind(self));
|
| 435 |
+
self._attachObserver(self.els.searchForm, 'submit', self.searchQuery.bind(self));
|
| 436 |
+
self._attachObserver(self.els.searchField, 'keyup', self._searchFieldActions.bind(self));
|
| 437 |
+
self._attachObserver(self.els.resetButton, 'click', self._resetFormButtons.bind(self));
|
| 438 |
+
self._attachObserver(self.els.resultsPager, 'click', self._showResultsPage.bind(self));
|
| 439 |
+
self._attachObserver(self.els.undoElement, 'click', self.undoSetStore.bind(self));
|
| 440 |
+
self._attachDelegatedObserver(self.els.searchList, 'click', 'li.cdc-result', self.selectResult.bind(self));
|
| 441 |
+
|
| 442 |
+
if (self.options.shouldCheckTermsAndConditions) {
|
| 443 |
+
self._attachObserver(self.els.termsAndConditionsCheckbox, 'click', self.checkTermsAndConditions.bind(self));
|
| 444 |
+
}
|
| 445 |
+
},
|
| 446 |
+
|
| 447 |
+
addListeners: function() {
|
| 448 |
+
var self = this;
|
| 449 |
+
|
| 450 |
+
Event.observe(document, 'cornerdrop_collect:enabled', self.toggleCornerdrop.bind(self, true));
|
| 451 |
+
Event.observe(document, 'cornerdrop_collect:disabled', self.toggleCornerdrop.bind(self, false));
|
| 452 |
+
},
|
| 453 |
+
|
| 454 |
+
destroyObservers: function() {
|
| 455 |
+
var self = this;
|
| 456 |
+
|
| 457 |
+
// Destroy event observers
|
| 458 |
+
self.observers.each(function (observer) {
|
| 459 |
+
Event.stopObserving(observer.element, observer.event, observer.handler);
|
| 460 |
+
});
|
| 461 |
+
|
| 462 |
+
self.observers = [];
|
| 463 |
+
|
| 464 |
+
// Destroy delegated observers
|
| 465 |
+
self.delegatedObservers.each(function (observer) {
|
| 466 |
+
observer.stop();
|
| 467 |
+
});
|
| 468 |
+
|
| 469 |
+
self.delegatedObservers = [];
|
| 470 |
+
},
|
| 471 |
+
|
| 472 |
+
_showResultsPage: function(event) {
|
| 473 |
+
if ( event ) {
|
| 474 |
+
event.preventDefault();
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
var self = this;
|
| 478 |
+
var end = self.resultsPage * self.options.pager.resultsPerPage;
|
| 479 |
+
var start = end - self.options.pager.resultsPerPage;
|
| 480 |
+
var elements = self.els.searchList.select('.' + self.options.classes.resultItem + ':nth-child(n+' + start + '):nth-child(-n+' + end + ')');
|
| 481 |
+
|
| 482 |
+
// Show the next page of items
|
| 483 |
+
elements.each(function(item) {
|
| 484 |
+
item.addClassName(self.options.classes.show);
|
| 485 |
+
});
|
| 486 |
+
|
| 487 |
+
if (start < self.options.searchClass.results.length) {
|
| 488 |
+
self.resultsPage++;
|
| 489 |
+
self.els.resultsPager.removeClassName(self.options.classes.hidden);
|
| 490 |
+
} else {
|
| 491 |
+
self.els.resultsPager.addClassName(self.options.classes.hidden);
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
// Hide pager if max has been met on last pagination
|
| 495 |
+
if (start + self.options.pager.resultsPerPage >= self.options.searchClass.results.length) {
|
| 496 |
+
self.els.resultsPager.addClassName(self.options.classes.hidden);
|
| 497 |
+
}
|
| 498 |
+
},
|
| 499 |
+
|
| 500 |
+
_searchFieldActions: function(event) {
|
| 501 |
+
var self = this;
|
| 502 |
+
var searchFieldLength = self.els.searchField.value.length;
|
| 503 |
+
|
| 504 |
+
if (searchFieldLength > 0) {
|
| 505 |
+
self.els.searchButton.addClassName(self.options.classes.active);
|
| 506 |
+
} else {
|
| 507 |
+
self.els.searchButton.removeClassName(self.options.classes.active);
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
self._resetFormButtons(event);
|
| 511 |
+
},
|
| 512 |
+
|
| 513 |
+
_resetFormButtons: function(event) {
|
| 514 |
+
var self = this;
|
| 515 |
+
|
| 516 |
+
if (event.keyCode !== 13) {
|
| 517 |
+
self.els.resetButton.addClassName(self.options.classes.hidden);
|
| 518 |
+
self.els.searchButton.removeClassName(self.options.classes.hidden);
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
if (event.keyCode === 0) {
|
| 522 |
+
self.els.searchButton.removeClassName(self.options.classes.active);
|
| 523 |
+
}
|
| 524 |
+
},
|
| 525 |
+
|
| 526 |
+
_attachObserver: function(element, event, handler) {
|
| 527 |
+
var self = this;
|
| 528 |
+
|
| 529 |
+
self.observers.push({
|
| 530 |
+
element: element,
|
| 531 |
+
event: event,
|
| 532 |
+
handler: handler
|
| 533 |
+
});
|
| 534 |
+
|
| 535 |
+
Event.observe(element, event, handler);
|
| 536 |
+
},
|
| 537 |
+
|
| 538 |
+
_attachDelegatedObserver: function(element, event, delegationElement, handler) {
|
| 539 |
+
var self = this;
|
| 540 |
+
var observer = Event.on(element, event, delegationElement, handler);
|
| 541 |
+
|
| 542 |
+
self.delegatedObservers.push(observer);
|
| 543 |
+
},
|
| 544 |
+
|
| 545 |
+
_hideElement: function(element, state) {
|
| 546 |
+
var self = this;
|
| 547 |
+
|
| 548 |
+
if (element) {
|
| 549 |
+
if (state) {
|
| 550 |
+
element.addClassName(self.options.classes.hidden);
|
| 551 |
+
} else {
|
| 552 |
+
element.removeClassName(self.options.classes.hidden);
|
| 553 |
+
}
|
| 554 |
+
}
|
| 555 |
+
}
|
| 556 |
+
});
|
| 557 |
+
|
| 558 |
+
})();
|
package.xml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>CornerDrop_Collect</name>
|
| 4 |
+
<version>1.2.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="https://cornerdrop.com/">CornerDrop</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Offer a click and collect solution to all your customers today.</summary>
|
| 10 |
+
<description>CornerDrop is the fastest growing UK wide parcel collection network, targeted at over 5,000 locations by 2016. You can offer CornerDrop without changing any fulfillment agreements or your packing processes.
|
| 11 |
+

|
| 12 |
+
To support our launch and for a limited time, we are currently offering retailers who integrate &amp; offer the CornerDrop Magento extension, 10 free credits!
|
| 13 |
+

|
| 14 |
+
Assured first time delivery rates
|
| 15 |
+
Happier customers, a better shopping experience and more repeat sales
|
| 16 |
+
Less time managing customer complaints and compensation claims
|
| 17 |
+
Your customers have access to the fastest growing parcel collection network in the UK (and not just train stations!)
|
| 18 |
+
Easy to install and configure
|
| 19 |
+
Uses Google Maps to allow customers to search for their nearest CornerDrop location and opening times
|
| 20 |
+
Unique delivery codes and secure PIN, ensures that only the customer can collect their parcel
|
| 21 |
+
CornerDrop assures each parcel up to the value of £200
|
| 22 |
+
Provides real convenience to your busy customers!
|
| 23 |
+
CornerDrop sits separately to any shipping tools and integrates seamlessly into your store checkout process. Our extension can be offered alongside any other click and collection solution that you may have, to increase the number of locations that you can offer your customers.
|
| 24 |
+
Free to download and simple to install.
|
| 25 |
+
You are only charged once a customer has used the service (minimum purchase of 10 credits) – a true PAYG service.
|
| 26 |
+

|
| 27 |
+
You can find out more information and register the API for your account at https://cornerdrop.com/magento. If you have any questions, please contact us at https://cornerdrop.com/contact-us
|
| 28 |
+
</description>
|
| 29 |
+
<notes>Initial release</notes>
|
| 30 |
+
<authors><author><name>CornerDrop</name><user>CornerDrop</user><email>alasota@cornerdrop.com</email></author></authors>
|
| 31 |
+
<date>2015-08-06</date>
|
| 32 |
+
<time>15:03:51</time>
|
| 33 |
+
<contents><target name="mageetc"><dir name="modules"><file name="CornerDrop_Collect.xml" hash="d0b626320e928e90d8efe38cac4bc76c"/></dir></target><target name="magecommunity"><dir name="CornerDrop"><dir name="Collect"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><dir name="Account"><file name="Balance.php" hash="f98406499d46ba9938b4020a9ddff45b"/></dir></dir></dir></dir><dir name="Checkout"><file name="Success.php" hash="8ef06c1238ba4af9fd593774ba8d4254"/><file name="Switch.php" hash="9a700e7df647f01811c758cfdbcb089e"/></dir><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="0d9845999fe2eacca5516b0895dd9949"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="67c74a693b0e88e46c411eef410d4ed1"/><file name="Config.php" hash="602628cdb758d7a9d11a5d58e365d883"/><file name="Data.php" hash="a9f40bbfc679f28baf70764925cbc44d"/><file name="Order.php" hash="92cfe3cebfd589411bdb2acadef98454"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><file name="OrderCancel.php" hash="35c8d7e7109ad096686b00150e8d7675"/><file name="OrderCreate.php" hash="dc5473e06809e3716e59482e1d4b29a2"/><file name="OrderDispatch.php" hash="5ea88918c680471375f2566776eea1ac"/><file name="OrderReserve.php" hash="ff1b5236b9acb6ca1e0e03839a2efc8a"/><file name="Search.php" hash="319453c85744a8e26b9d2c814710307a"/><file name="Status.php" hash="1276c6cd3865ae0d1849bd6ecdc20760"/></dir><file name="Action.php" hash="6387460f33b01021869e27d9d149b45c"/><file name="Request.php" hash="6cfddc8db491c7ca0080d573b13beee0"/><dir name="Response"><file name="Empty.php" hash="bfbaa43d4d497306f8da2b3a2c655697"/></dir><file name="Response.php" hash="7dce2136ca51d593f5d228153ae280a2"/></dir><file name="Cron.php" hash="4f9a640497398338ce2705211a30c585"/><file name="Observer.php" hash="7f515ebd6345e5bd854cb413936749ee"/><dir name="Resource"><file name="Setup.php" hash="147d81b7361f9f1195f28d0bb6b984eb"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><dir name="CornerDrop"><file name="Fee.php" hash="48ae579ca2e85763e9948ac3835cf46c"/></dir></dir></dir><dir name="Invoice"><dir name="Total"><dir name="CornerDrop"><file name="Fee.php" hash="7182e4731dc7050e23f548f0e9e5856f"/></dir></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="CornerDrop"><file name="Fee.php" hash="d6b96acd34f6f53e11cf30cda9fb72ca"/></dir></dir></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="f21459ba9b4361c8c763510ff422da7a"/></dir><dir name="Helper"><file name="Data.php" hash="6fb31792dd3486b9958afd173ccaef3a"/></dir><dir name="Model"><dir name="Api"><dir name="Action"><dir name="fixtures"><file name="testExecute.yaml" hash="4bf971b7e6f563b6e5bb76d76dd6cf64"/></dir></dir><file name="Action.php" hash="531761671dfc4484a691a0b5417ff135"/><file name="Request.php" hash="f31d6e19575a537d7032a2b82cf015ea"/><dir name="Response"><dir name="providers"><file name="response_testIsSuccessful.yaml" hash="dcd28982bc03aa1e8fda487e033aa1c1"/></dir></dir><file name="Response.php" hash="21754f49b5614c09bd979de417613564"/><dir name="Test"><file name="Case.php" hash="6da3a5034451a458f3fd48ce1e08cb90"/></dir><dir name="data"><file name="data_response_success.json" hash="d4f878fbf642de88900d14e45a3bcdb8"/><file name="response_failed.json" hash="fc7fc43732a9c5dd02bcdbfcbc97d5d5"/><file name="response_nojson.json" hash="2debfdcf79f03e4a65a667d21ef9de14"/><file name="response_valid.json" hash="d4f878fbf642de88900d14e45a3bcdb8"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><dir name="CornerDrop"><file name="Fee.php" hash="84b03283e27b1fd816201635c597be79"/><dir name="fixtures"><file name="testCornerDropFeeAddedWithNoTax.yaml" hash="73e7632380055b126fcf92c7132b3e59"/><file name="testCornerDropFeeAddedWithTax.yaml" hash="845d8e32971ba0f3d05244a512624424"/><file name="testCornerDropFeeNotAdded.yaml" hash="6fa7d5697f427f2b012119f5c98a4864"/></dir></dir></dir></dir><dir name="Invoice"><dir name="Total"><dir name="CornerDrop"><dir name="Fee"><dir name="fixtures"><file name="testCornerDropFeeAddedWithNoTax.yaml" hash="3ca60a8d63d85607e21f4056cd5e1c1e"/><file name="testCornerDropFeeAddedWithTax.yaml" hash="dbd4b0e984c33d67d42914b2b1fe51dc"/><file name="testCornerDropFeeNotAdded.yaml" hash="546edfba9d003abb71e25504d6a24bb8"/></dir></dir><file name="Fee.php" hash="9b3712ec678e9ab4e23997eeaed44882"/></dir></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><dir name="CornerDrop"><dir name="Fee"><dir name="fixtures"><file name="testCornerDropFeeAddedWithNoTax.yaml" hash="b73185d76bcf68a8f4427494a7edcec9"/><file name="testCornerDropFeeAddedWithTax.yaml" hash="990dbd28f7bc5df0b3022ca1324bd6dd"/><file name="testCornerDropFeeNotAdded.yaml" hash="978e2ea4f1cf243c1c0009b29d665474"/></dir></dir><file name="Fee.php" hash="4210ff4e9cbdcf9b7e4be01e065c4d7c"/></dir></dir></dir></dir></dir></dir><file name=".DS_Store" hash="d3e93ef36d9ad5164750e1060b7d57db"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Cornerdrop"><dir name="Collect"><file name="SearchController.php" hash="24650d32e8f349e6b0509dd554977a21"/></dir></dir></dir><file name="SearchController.php" hash="e0a80753defd41c8fd74f68cf11fd272"/></dir><dir name="data"><dir name="cornerdrop_collect_setup"><file name="data-install-1.0.0.php" hash="5af153d7f4bbccb01b43192dc2d20e98"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="13314d591c3e31da4c8dcc6ed855788c"/><file name="config.xml" hash="acef391a24eb76755abdb1617a29c18e"/><file name="system.xml" hash="cbcf83be33ea59ca73d2846e8945ad5e"/></dir><dir name="sql"><dir name="cornerdrop_collect_setup"><file name="install-1.0.0.php" hash="65791be82f1e27d834270b4298a29623"/><file name="upgrade-1.0.0-1.1.0.php" hash="572467dbfb19cd300667817e73e2a6c0"/><file name="upgrade-1.1.0-1.2.0.php" hash="1cdf2aa5ac04fe35ababbdbcb3ce3079"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="cornerdrop"><file name="collect.xml" hash="f0b49d7f0db1da1cf77423cc2ece9290"/></dir></dir><dir name="template"><dir name="cornerdrop"><dir name="collect"><dir name="order"><dir name="create"><dir name="form"><dir name="address"><file name="shipping.phtml" hash="208494dde07849f56ea1543de7f281f7"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="cornerdrop"><file name="collect.xml" hash="d0cc6cc9426b15a41772f793f8330cde"/></dir></dir><dir name="template"><dir name="cornerdrop"><dir name="collect"><dir name="checkout"><file name="success.phtml" hash="809a6a237973e9ffedfffe35f42885c5"/><file name="switch.phtml" hash="ad52fd177f0a5ecf17cc1dc58abc377c"/></dir><dir name="email"><file name="shipment.phtml" hash="871f258e2997572074eef316c23d0c9b"/></dir><file name="search.phtml" hash="3c91f620562806745d28f761616a0f95"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="cornerdrop"><dir name="collect"><file name="code.html" hash="3001e4a02fd80da21e1ac608dedf4645"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="cornerdrop"><dir name="collect"><file name="adminhtml.js" hash="f0ac452f665e1c805db1358cca78f3a4"/><file name="adminhtml_search.js" hash="51c23cb61d90f9b1840fe6f21b16bdfc"/><file name="adminhtml_ui.js" hash="173b95d667ed5934f3acdd53c6559add"/><file name="event.simulate.js" hash="0a68da6e1bb534e7a2848e3efd7a2116"/><file name="geolocationAPI.js" hash="2c36b8b741b4462e72f125e84724912d"/><file name="gmaps.js" hash="9da30fae7f25aae9a632dc8d6cb7993d"/><file name="search.js" hash="c522d932dbad7dcf0684bf3e3154b99e"/><file name="switch.js" hash="e3bd569c9cdd83fea6e2262a01912d38"/><file name="ui.js" hash="6bf0b7a81f43b907e72f9c1eb2cc63fa"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="cornerdrop"><dir name="collect"><dir name="css"><file name="collect.css" hash="b657d1d1624da6d94102d55cd68a747d"/></dir><dir name="images"><file name="ajax-loader.gif" hash="7a7359b58d310f8edff5c1e6d46c8a09"/><file name="geolocation.png" hash="7721b57ba09ca1e3ba6b8e70b3683130"/><file name="reset.png" hash="882b5f458b8fd19356a758afe0b4062f"/><file name="search.png" hash="8c6298ce9cc6329f5d69810c3d2a4d71"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="cornerdrop"><dir name="collect"><dir name="css"><file name="collect.css" hash="453495d721502344c3949160ad55a22c"/></dir><dir name="images"><file name="ajax-loader.gif" hash="7a7359b58d310f8edff5c1e6d46c8a09"/><file name="droppoint_active.png" hash="9f57a12c9f840944ae2ddeb1a46a63b8"/><file name="droppoint_inactive.png" hash="7fcf659b69695a001bf234cda72b4796"/><file name="droppoint_muted.png" hash="87efbda22a647a6f91dfee5211132496"/><file name="geolocation.png" hash="7721b57ba09ca1e3ba6b8e70b3683130"/><file name="logo_125.jpg" hash="0274087c0194b8b1f56e32788b928b4b"/><file name="logo_250.jpg" hash="d94f2421782938260b3d8ec5fff8e32b"/><file name="logo_500.jpg" hash="80a099917459d94a02b3a64ee867c0ba"/><file name="reset.png" hash="882b5f458b8fd19356a758afe0b4062f"/><file name="search.png" hash="8c6298ce9cc6329f5d69810c3d2a4d71"/></dir><file name=".DS_Store" hash="33c2f217f36b47c4ca54cf99420edf36"/></dir></dir></dir></dir></dir></target></contents>
|
| 34 |
+
<compatible/>
|
| 35 |
+
<dependencies><required><php><min>5.4.0</min><max>5.6.0</max></php></required></dependencies>
|
| 36 |
+
</package>
|
skin/adminhtml/default/default/cornerdrop/collect/css/collect.css
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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,
|
| 2 |
+
.cdc-search-container:after,
|
| 3 |
+
.cdc-error:after,
|
| 4 |
+
.cdc-search-results:after,
|
| 5 |
+
.cdc-toggle-button:before {
|
| 6 |
+
clear: both;
|
| 7 |
+
content: '';
|
| 8 |
+
display: table;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.cdc-panel {
|
| 12 |
+
margin-bottom: 10px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
.cdc-info {
|
| 16 |
+
margin-bottom: 10px;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.cdc-search-container {
|
| 20 |
+
margin-bottom: 10px;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.cdc-search-form {
|
| 24 |
+
display: inline-block;
|
| 25 |
+
position: relative;
|
| 26 |
+
max-width: calc(100% - 35px);
|
| 27 |
+
width: 365px;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.cdc-search-label {
|
| 31 |
+
border: 0;
|
| 32 |
+
clip: rect(0 0 0 0);
|
| 33 |
+
height: 1px;
|
| 34 |
+
margin: -1px;
|
| 35 |
+
overflow: hidden;
|
| 36 |
+
padding: 0;
|
| 37 |
+
position: absolute;
|
| 38 |
+
width: 1px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.cdc-search-results ul {
|
| 42 |
+
display: block;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.cdc-result {
|
| 46 |
+
cursor: pointer;
|
| 47 |
+
display: none;
|
| 48 |
+
margin: 10px 0;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.cdc-result-item-title {
|
| 52 |
+
display: block;
|
| 53 |
+
font-weight: bold;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.cdc-result-item-body {
|
| 57 |
+
display: block;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.cdc-store {
|
| 61 |
+
clear: both;
|
| 62 |
+
padding: 20px 0;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.cdc-store-title {
|
| 66 |
+
font-weight: bold;
|
| 67 |
+
text-transform: uppercase;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.cdc-map-container {
|
| 71 |
+
margin: 10px auto;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.cdc-map {
|
| 75 |
+
height: 300px;
|
| 76 |
+
width: 100%;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.cdc-map:empty {
|
| 80 |
+
height: 0;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/* Classes */
|
| 84 |
+
.cdc-hidden {
|
| 85 |
+
display: none;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.cdc-error {
|
| 89 |
+
clear: both;
|
| 90 |
+
color: #df280a;
|
| 91 |
+
margin: 5px auto;
|
| 92 |
+
text-align: center;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.cdc-show {
|
| 96 |
+
display: inherit;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.cdc-active {
|
| 100 |
+
opacity: 1;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
@media only screen and (min-width: 770px) {
|
| 104 |
+
.cdc-search-results {
|
| 105 |
+
float: left;
|
| 106 |
+
overflow: scroll;
|
| 107 |
+
max-height: 370px;
|
| 108 |
+
width: 35%;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.cdc-store {
|
| 112 |
+
clear: none;
|
| 113 |
+
float: left;
|
| 114 |
+
width: 35%;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.cdc-map-container {
|
| 118 |
+
float: right;
|
| 119 |
+
width: 65%;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.cdc-map {
|
| 123 |
+
height: 350px;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.cdc-result {
|
| 127 |
+
display: inherit;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/* This hides the pager for larger screens where it is not
|
| 131 |
+
* used. Conditional JS is therefore not required.
|
| 132 |
+
*/
|
| 133 |
+
.js-cdc-results-pager {
|
| 134 |
+
display: none;
|
| 135 |
+
}
|
| 136 |
+
}
|
skin/adminhtml/default/default/cornerdrop/collect/images/ajax-loader.gif
ADDED
|
Binary file
|
skin/adminhtml/default/default/cornerdrop/collect/images/geolocation.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/cornerdrop/collect/images/reset.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/cornerdrop/collect/images/search.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/.DS_Store
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/css/collect.css
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
.cdc-panel:after,
|
| 2 |
+
.cdc-search-container:after,
|
| 3 |
+
.cdc-error:after,
|
| 4 |
+
.cdc-search-results:after,
|
| 5 |
+
.cdc-toggle-button:before {
|
| 6 |
+
clear: both;
|
| 7 |
+
content: '';
|
| 8 |
+
display: table;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.cdc-logo {
|
| 12 |
+
display: inline-block;
|
| 13 |
+
vertical-align: top;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.cdc-panel {
|
| 17 |
+
margin-bottom: 10px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.cdc-info {
|
| 21 |
+
margin-bottom: 10px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.cdc-search-container {
|
| 25 |
+
margin-bottom: 10px;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.cdc-search-button,
|
| 29 |
+
.cdc-reset-button {
|
| 30 |
+
top: 0;
|
| 31 |
+
right: 0;
|
| 32 |
+
position: absolute;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.cdc-search-button {
|
| 36 |
+
background: transparent url(../images/search.png) no-repeat center;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.cdc-reset-button {
|
| 40 |
+
background: transparent url(../images/reset.png) no-repeat center;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.cdc-geolocation {
|
| 44 |
+
background: transparent url(../images/geolocation.png) no-repeat center;
|
| 45 |
+
cursor: pointer;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.cdc-geolocation:hover {
|
| 49 |
+
opacity: 1;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.cdc-geolocation,
|
| 53 |
+
.cdc-search-button,
|
| 54 |
+
.cdc-reset-button {
|
| 55 |
+
border: 0;
|
| 56 |
+
display: inline-block;
|
| 57 |
+
height: 30px;
|
| 58 |
+
text-indent: -9999px;
|
| 59 |
+
vertical-align: middle;
|
| 60 |
+
width: 30px;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.cdc-geolocation,
|
| 64 |
+
.cdc-search-button {
|
| 65 |
+
opacity: .5;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.cdc-search-form {
|
| 69 |
+
display: inline-block;
|
| 70 |
+
position: relative;
|
| 71 |
+
max-width: calc(100% - 35px);
|
| 72 |
+
width: 365px;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.cdc-search-label {
|
| 76 |
+
border: 0;
|
| 77 |
+
clip: rect(0 0 0 0);
|
| 78 |
+
height: 1px;
|
| 79 |
+
margin: -1px;
|
| 80 |
+
overflow: hidden;
|
| 81 |
+
padding: 0;
|
| 82 |
+
position: absolute;
|
| 83 |
+
width: 1px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.cdc-search-results ul {
|
| 87 |
+
display: block;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.cdc-result {
|
| 91 |
+
cursor: pointer;
|
| 92 |
+
display: none;
|
| 93 |
+
margin: 10px 0;
|
| 94 |
+
}
|
| 95 |
+
.cdc-result:hover {
|
| 96 |
+
background-color: #dff4ff;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.cdc-result-item-title {
|
| 100 |
+
color: #39C;
|
| 101 |
+
display: block;
|
| 102 |
+
font-weight: bold;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.cdc-result-item-body {
|
| 106 |
+
display: block;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.cdc-store {
|
| 110 |
+
clear: both;
|
| 111 |
+
padding: 20px 0;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.cdc-store-title {
|
| 115 |
+
font-weight: bold;
|
| 116 |
+
text-transform: uppercase;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.cdc-map-container {
|
| 120 |
+
margin: 10px auto;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.cdc-map {
|
| 124 |
+
height: 300px;
|
| 125 |
+
width: 100%;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.cdc-map:empty {
|
| 129 |
+
height: 0;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.cdc-tc-container {
|
| 133 |
+
margin-bottom: 10px;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.cdc-tc-label {
|
| 137 |
+
cursor: pointer;
|
| 138 |
+
padding-left: 5px;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/* Classes */
|
| 142 |
+
.cdc-hidden {
|
| 143 |
+
display: none;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.cdc-error {
|
| 147 |
+
clear: both;
|
| 148 |
+
color: #df280a;
|
| 149 |
+
margin: 5px auto;
|
| 150 |
+
text-align: center;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.cdc-show {
|
| 154 |
+
display: inherit;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.cdc-loading {
|
| 158 |
+
background-image: url('../images/ajax-loader.gif');
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
.cdc-active {
|
| 162 |
+
opacity: 1;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
@media only screen and (min-width: 770px) {
|
| 166 |
+
.cdc-search-results {
|
| 167 |
+
float: left;
|
| 168 |
+
overflow: scroll;
|
| 169 |
+
max-height: 370px;
|
| 170 |
+
width: 35%;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
.cdc-store {
|
| 174 |
+
clear: none;
|
| 175 |
+
float: left;
|
| 176 |
+
width: 35%;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
.cdc-map-container {
|
| 180 |
+
float: right;
|
| 181 |
+
width: 65%;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.cdc-map {
|
| 185 |
+
height: 350px;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.cdc-result {
|
| 189 |
+
display: inherit;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/* This hides the pager for larger screens where it is not
|
| 193 |
+
* used. Conditional JS is therefore not required.
|
| 194 |
+
*/
|
| 195 |
+
.js-cdc-results-pager {
|
| 196 |
+
display: none;
|
| 197 |
+
}
|
| 198 |
+
}
|
skin/frontend/base/default/cornerdrop/collect/images/ajax-loader.gif
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/droppoint_active.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/droppoint_inactive.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/droppoint_muted.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/geolocation.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/logo_125.jpg
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/logo_250.jpg
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/logo_500.jpg
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/reset.png
ADDED
|
Binary file
|
skin/frontend/base/default/cornerdrop/collect/images/search.png
ADDED
|
Binary file
|
