Version Notes
First Release
Download this release
Release Info
| Developer | Magebuzz |
| Extension | Magebuzz_Darwin |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/community/Magebuzz/Darwin/Block/Darwin.php +17 -0
- app/code/community/Magebuzz/Darwin/Helper/Data.php +66 -0
- app/code/community/Magebuzz/Darwin/Model/Observer.php +68 -0
- app/code/community/Magebuzz/Darwin/controllers/IndexController.php +62 -0
- app/code/community/Magebuzz/Darwin/etc/adminhtml.xml +26 -0
- app/code/community/Magebuzz/Darwin/etc/config.xml +90 -0
- app/code/community/Magebuzz/Darwin/etc/system.xml +65 -0
- app/design/frontend/base/default/layout/darwin.xml +8 -0
- app/design/frontend/base/default/template/darwin/dp.phtml +17 -0
- app/etc/modules/Magebuzz_Darwin.xml +9 -0
- package.xml +18 -0
app/code/community/Magebuzz/Darwin/Block/Darwin.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) 2015 www.magebuzz.com
|
| 4 |
+
*/
|
| 5 |
+
class Magebuzz_Darwin_Block_Darwin extends Mage_Core_Block_Template {
|
| 6 |
+
public function _prepareLayout() {
|
| 7 |
+
return parent::_prepareLayout();
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
public function isActive() {
|
| 11 |
+
return Mage::helper('darwin')->isActive();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
public function getSiteUrl() {
|
| 15 |
+
return Mage::helper('darwin')->getSiteUrl();
|
| 16 |
+
}
|
| 17 |
+
}
|
app/code/community/Magebuzz/Darwin/Helper/Data.php
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) 2015 www.magebuzz.com
|
| 4 |
+
*/
|
| 5 |
+
class Magebuzz_Darwin_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 6 |
+
protected $_storeId;
|
| 7 |
+
|
| 8 |
+
public function _construct() {
|
| 9 |
+
parent::_construct();
|
| 10 |
+
$this->_storeId = Mage::app()->getStore()->getId();
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
public function isActive() {
|
| 14 |
+
return Mage::getStoreConfig('darwin/general/is_active', $this->_storeId);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public function getApiUrl() {
|
| 18 |
+
return Mage::getStoreConfig('darwin/general/api_url', $this->_storeId);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public function getApiUser() {
|
| 22 |
+
return Mage::getStoreConfig('darwin/general/api_user', $this->_storeId);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getSecretKey() {
|
| 26 |
+
return Mage::getStoreConfig('darwin/general/secret_key', $this->_storeId);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getSiteUrl() {
|
| 30 |
+
$siteUrl = '';
|
| 31 |
+
$siteUrl = $this->getApiUrl() ? $this->getApiUrl() : 'https://api.darwinpricing.com';
|
| 32 |
+
$siteUrl .= '/widget?site-id=' . $this->getApiUser();
|
| 33 |
+
return $siteUrl;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/*
|
| 37 |
+
* call function to post data to API server
|
| 38 |
+
*/
|
| 39 |
+
public function post($data = null, $type = 'order') {
|
| 40 |
+
$url = $this->getApiUrl() ? $this->getApiUrl() : 'https://api.darwinpricing.com';
|
| 41 |
+
if ($type == 'order') {
|
| 42 |
+
$url .= '/magento/webhook-order-payment?site-id=' . $this->getApiUser() . '&hash=' . $this->getSecretKey();
|
| 43 |
+
}
|
| 44 |
+
else {
|
| 45 |
+
$url .= '/magento/webhook-refund-create?site-id=' . $this->getApiUser() . '&hash=' . $this->getSecretKey();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
Mage::log('url '. $url, null, 'darwinpricing.log');
|
| 49 |
+
try {
|
| 50 |
+
$ch = curl_init();
|
| 51 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
| 52 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
| 53 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
| 54 |
+
|
| 55 |
+
$response = curl_exec($ch);
|
| 56 |
+
|
| 57 |
+
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
| 58 |
+
}
|
| 59 |
+
catch (Exception $e) {
|
| 60 |
+
echo $e->getMessage();
|
| 61 |
+
die('fff');
|
| 62 |
+
}
|
| 63 |
+
Mage::log('response '. print_r(json_decode($response, true), true), null, 'darwinpricing.log');
|
| 64 |
+
return json_decode($response, true);
|
| 65 |
+
}
|
| 66 |
+
}
|
app/code/community/Magebuzz/Darwin/Model/Observer.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) 2015 www.magebuzz.com
|
| 4 |
+
*/
|
| 5 |
+
class Magebuzz_Darwin_Model_Observer {
|
| 6 |
+
public function postOrderDetail(Varien_Event_Observer $observer) {
|
| 7 |
+
Mage::log('after invoice created', null, 'darwinpricing.log');
|
| 8 |
+
$invoice = $observer->getEvent()->getInvoice();
|
| 9 |
+
$orderId = $invoice->getOrderId();
|
| 10 |
+
|
| 11 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
| 12 |
+
$orderData = array();
|
| 13 |
+
$orderData['order_id'] = $orderId;
|
| 14 |
+
$orderData['total'] = $order->getGrandTotal();
|
| 15 |
+
$orderData['currency'] = $order->getOrderCurrencyCode();
|
| 16 |
+
$orderData['coupon_code'] = $order->getCouponCode();
|
| 17 |
+
|
| 18 |
+
$items = array();
|
| 19 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
| 20 |
+
$items[] = array(
|
| 21 |
+
'id' => $item->getProductId(),
|
| 22 |
+
'qty' => $item->getQtyOrdered(),
|
| 23 |
+
'unit_price' => $item->getPrice()
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
$orderData['items'] = $items;
|
| 28 |
+
$orderData['shipping_amount'] = $order->getShippingAmount();
|
| 29 |
+
$ip_address = $order->getXForwardedFor() ? $order->getXForwardedFor() : $order->getRemoteIp();
|
| 30 |
+
$orderData['customer'] = array(
|
| 31 |
+
'id' => $order->getCustomerId(),
|
| 32 |
+
'email_address' => $order->getCustomerEmail(),
|
| 33 |
+
'ip_address' => $ip_address
|
| 34 |
+
);
|
| 35 |
+
|
| 36 |
+
$jsonData = json_encode($orderData);
|
| 37 |
+
Mage::log('json data'. $jsonData, null, 'darwinpricing.log');
|
| 38 |
+
|
| 39 |
+
$result = Mage::helper('darwin')->post($jsonData);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
public function refundOrder(Varien_Event_Observer $observer) {
|
| 43 |
+
$creditMemo = $observer->getEvent()->getCreditmemo();
|
| 44 |
+
$payment = $observer->getEvent()->getPayment();
|
| 45 |
+
$order = $creditMemo->getOrder();
|
| 46 |
+
$data = array();
|
| 47 |
+
$data['refund_id'] = $creditMemo->getId();
|
| 48 |
+
$data['order_id'] = $order->getId();
|
| 49 |
+
$data['refunded_amount'] = $creditMemo->getGrandTotal();
|
| 50 |
+
$data['currency'] = $order->getOrderCurrencyCode();
|
| 51 |
+
$ip_address = $order->getXForwardedFor() ? $order->getXForwardedFor() : $order->getRemoteIp();
|
| 52 |
+
$data['customer'] = array(
|
| 53 |
+
'id' => $order->getCustomerId(),
|
| 54 |
+
'email_address' => $order->getCustomerEmail(),
|
| 55 |
+
'ip_address' => $ip_address
|
| 56 |
+
);
|
| 57 |
+
foreach ($creditMemo->getAllItems() as $item) {
|
| 58 |
+
$items[] = array(
|
| 59 |
+
'id' => $item->getProductId(),
|
| 60 |
+
'qty' => $item->getQty(),
|
| 61 |
+
'unit_price' => $item->getPrice()
|
| 62 |
+
);
|
| 63 |
+
}
|
| 64 |
+
$data['items'] = $items;
|
| 65 |
+
$jsonData = json_encode($data);
|
| 66 |
+
$result = Mage::helper('darwin')->post($jsonData, 'refund');
|
| 67 |
+
}
|
| 68 |
+
}
|
app/code/community/Magebuzz/Darwin/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) 2015 www.magebuzz.com
|
| 4 |
+
*/
|
| 5 |
+
class Magebuzz_Darwin_IndexController extends Mage_Core_Controller_Front_Action {
|
| 6 |
+
public function indexAction() {
|
| 7 |
+
$orderId = '5';
|
| 8 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
| 9 |
+
$orderData = array();
|
| 10 |
+
$orderData['total'] = $order->getGrandTotal();
|
| 11 |
+
$orderData['currency'] = $order->getOrderCurrencyCode();
|
| 12 |
+
$orderData['coupon_code'] = $order->getCouponCode();
|
| 13 |
+
$items = array();
|
| 14 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
| 15 |
+
$items[] = array(
|
| 16 |
+
'id' => $item->getProductId(),
|
| 17 |
+
'qty' => $item->getQtyOrdered(),
|
| 18 |
+
'unit_price' => $item->getPrice()
|
| 19 |
+
);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
$orderData['items'] = $items;
|
| 23 |
+
$orderData['shipping_amount'] = $order->getShippingAmount();
|
| 24 |
+
$orderData['customer'] = array(
|
| 25 |
+
'id' => $order->getCustomerId(),
|
| 26 |
+
'email_address' => $order->getCustomerEmail(),
|
| 27 |
+
'ip_address' => $order->getRemoteIp()
|
| 28 |
+
);
|
| 29 |
+
$jsonData = json_encode($orderData);
|
| 30 |
+
Mage::helper('darwin')->post($jsonData);
|
| 31 |
+
|
| 32 |
+
die('xxx');
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function refundAction() {
|
| 37 |
+
$creditMemo = Mage::getModel('sales/order_creditmemo')->load(1);
|
| 38 |
+
$order = $creditMemo->getOrder();
|
| 39 |
+
$data = array();
|
| 40 |
+
$data['refund_id'] = $creditMemo->getId();
|
| 41 |
+
$data['order_id'] = $order->getId();
|
| 42 |
+
$data['refunded_amount'] = $creditMemo->getGrandTotal();
|
| 43 |
+
$data['currency'] = $order->getOrderCurrencyCode();
|
| 44 |
+
$data['customer'] = array(
|
| 45 |
+
'id' => $order->getCustomerId(),
|
| 46 |
+
'email_address' => $order->getCustomerEmail(),
|
| 47 |
+
'ip_address' => $order->getRemoteIp()
|
| 48 |
+
);
|
| 49 |
+
foreach ($creditMemo->getAllItems() as $item) {
|
| 50 |
+
$items[] = array(
|
| 51 |
+
'id' => $item->getProductId(),
|
| 52 |
+
'qty' => $item->getQty(),
|
| 53 |
+
'unit_price' => $item->getPrice()
|
| 54 |
+
);
|
| 55 |
+
}
|
| 56 |
+
$data['items'] = $items;
|
| 57 |
+
|
| 58 |
+
$jsonData = json_encode($data);
|
| 59 |
+
echo $jsonData.'<br/>';
|
| 60 |
+
die('aaaa');
|
| 61 |
+
}
|
| 62 |
+
}
|
app/code/community/Magebuzz/Darwin/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<all>
|
| 6 |
+
<title>Allow Everything</title>
|
| 7 |
+
</all>
|
| 8 |
+
<admin>
|
| 9 |
+
<children>
|
| 10 |
+
<system>
|
| 11 |
+
<children>
|
| 12 |
+
<config>
|
| 13 |
+
<children>
|
| 14 |
+
<darwin>
|
| 15 |
+
<title>Darwin Pricing</title>
|
| 16 |
+
<sort_order>500</sort_order>
|
| 17 |
+
</darwin>
|
| 18 |
+
</children>
|
| 19 |
+
</config>
|
| 20 |
+
</children>
|
| 21 |
+
</system>
|
| 22 |
+
</children>
|
| 23 |
+
</admin>
|
| 24 |
+
</resources>
|
| 25 |
+
</acl>
|
| 26 |
+
</config>
|
app/code/community/Magebuzz/Darwin/etc/config.xml
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Magebuzz_Darwin>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Magebuzz_Darwin>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<darwin>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>Magebuzz_Darwin</module>
|
| 14 |
+
<frontName>darwin</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</darwin>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<darwin>
|
| 21 |
+
<file>darwin.xml</file>
|
| 22 |
+
</darwin>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
<translate>
|
| 26 |
+
<modules>
|
| 27 |
+
<Magebuzz_Darwin>
|
| 28 |
+
<files>
|
| 29 |
+
<default>Magebuzz_Darwin.csv</default>
|
| 30 |
+
</files>
|
| 31 |
+
</Magebuzz_Darwin>
|
| 32 |
+
</modules>
|
| 33 |
+
</translate>
|
| 34 |
+
</frontend>
|
| 35 |
+
<adminhtml>
|
| 36 |
+
<translate>
|
| 37 |
+
<modules>
|
| 38 |
+
<Magebuzz_Darwin>
|
| 39 |
+
<files>
|
| 40 |
+
<default>Magebuzz_Darwin.csv</default>
|
| 41 |
+
</files>
|
| 42 |
+
</Magebuzz_Darwin>
|
| 43 |
+
</modules>
|
| 44 |
+
</translate>
|
| 45 |
+
</adminhtml>
|
| 46 |
+
<global>
|
| 47 |
+
<models>
|
| 48 |
+
<darwin>
|
| 49 |
+
<class>Magebuzz_Darwin_Model</class>
|
| 50 |
+
<resourceModel>darwin_mysql4</resourceModel>
|
| 51 |
+
</darwin>
|
| 52 |
+
</models>
|
| 53 |
+
<blocks>
|
| 54 |
+
<darwin>
|
| 55 |
+
<class>Magebuzz_Darwin_Block</class>
|
| 56 |
+
</darwin>
|
| 57 |
+
</blocks>
|
| 58 |
+
<helpers>
|
| 59 |
+
<darwin>
|
| 60 |
+
<class>Magebuzz_Darwin_Helper</class>
|
| 61 |
+
</darwin>
|
| 62 |
+
</helpers>
|
| 63 |
+
<events>
|
| 64 |
+
<sales_order_invoice_pay>
|
| 65 |
+
<observers>
|
| 66 |
+
<darwinpricing_order_paid>
|
| 67 |
+
<class>darwin/observer</class>
|
| 68 |
+
<method>postOrderDetail</method>
|
| 69 |
+
</darwinpricing_order_paid>
|
| 70 |
+
</observers>
|
| 71 |
+
</sales_order_invoice_pay>
|
| 72 |
+
<sales_order_payment_refund>
|
| 73 |
+
<observers>
|
| 74 |
+
<darwinpricing_order_refund>
|
| 75 |
+
<class>darwin/observer</class>
|
| 76 |
+
<method>refundOrder</method>
|
| 77 |
+
</darwinpricing_order_refund>
|
| 78 |
+
</observers>
|
| 79 |
+
</sales_order_payment_refund>
|
| 80 |
+
</events>
|
| 81 |
+
</global>
|
| 82 |
+
<default>
|
| 83 |
+
<darwin>
|
| 84 |
+
<general>
|
| 85 |
+
<is_active>1</is_active>
|
| 86 |
+
<api_url>https://api.darwinpricing.com</api_url>
|
| 87 |
+
</general>
|
| 88 |
+
</darwin>
|
| 89 |
+
</default>
|
| 90 |
+
</config>
|
app/code/community/Magebuzz/Darwin/etc/system.xml
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<magebuzz translate="label" module="darwin">
|
| 5 |
+
<label>Magebuzz Add-ons</label>
|
| 6 |
+
<sort_order>400</sort_order>
|
| 7 |
+
</magebuzz>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<darwin translate="label" module="darwin">
|
| 11 |
+
<label>Darwin Pricing</label>
|
| 12 |
+
<tab>magebuzz</tab>
|
| 13 |
+
<sort_order>500</sort_order>
|
| 14 |
+
<show_in_default>1</show_in_default>
|
| 15 |
+
<show_in_website>1</show_in_website>
|
| 16 |
+
<show_in_store>1</show_in_store>
|
| 17 |
+
<groups>
|
| 18 |
+
<general translate="label" module="darwin">
|
| 19 |
+
<label>General Settings</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>1</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>0</show_in_store>
|
| 25 |
+
<fields>
|
| 26 |
+
<is_active translate="label">
|
| 27 |
+
<label>Enable Darwin Pricing</label>
|
| 28 |
+
<frontend_type>select</frontend_type>
|
| 29 |
+
<sort_order>0</sort_order>
|
| 30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
<show_in_default>1</show_in_default>
|
| 34 |
+
<show_in_store>0</show_in_store>
|
| 35 |
+
</is_active>
|
| 36 |
+
<api_user translate="label">
|
| 37 |
+
<label>API User ID</label>
|
| 38 |
+
<frontend_type>text</frontend_type>
|
| 39 |
+
<sort_order>10</sort_order>
|
| 40 |
+
<show_in_default>1</show_in_default>
|
| 41 |
+
<show_in_website>1</show_in_website>
|
| 42 |
+
<show_in_store>0</show_in_store>
|
| 43 |
+
</api_user>
|
| 44 |
+
<api_url translate="label">
|
| 45 |
+
<label>API URL</label>
|
| 46 |
+
<frontend_type>text</frontend_type>
|
| 47 |
+
<sort_order>20</sort_order>
|
| 48 |
+
<show_in_default>1</show_in_default>
|
| 49 |
+
<show_in_website>1</show_in_website>
|
| 50 |
+
<show_in_store>0</show_in_store>
|
| 51 |
+
</api_url>
|
| 52 |
+
<secret_key translate="label">
|
| 53 |
+
<label>Secret Key</label>
|
| 54 |
+
<frontend_type>text</frontend_type>
|
| 55 |
+
<sort_order>30</sort_order>
|
| 56 |
+
<show_in_default>1</show_in_default>
|
| 57 |
+
<show_in_website>1</show_in_website>
|
| 58 |
+
<show_in_store>0</show_in_store>
|
| 59 |
+
</secret_key>
|
| 60 |
+
</fields>
|
| 61 |
+
</general>
|
| 62 |
+
</groups>
|
| 63 |
+
</darwin>
|
| 64 |
+
</sections>
|
| 65 |
+
</config>
|
app/design/frontend/base/default/layout/darwin.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head" before="-">
|
| 5 |
+
<block type="darwin/darwin" name="darwin_pricing" as="darwin_pricing" template="darwin/dp.phtml" />
|
| 6 |
+
</reference>
|
| 7 |
+
</default>
|
| 8 |
+
</layout>
|
app/design/frontend/base/default/template/darwin/dp.phtml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) 2015 www.magebuzz.com
|
| 4 |
+
*/
|
| 5 |
+
?>
|
| 6 |
+
<?php if ($this->isActive()): ?>
|
| 7 |
+
<?php $siteUrl = $this->getSiteUrl();?>
|
| 8 |
+
<script>
|
| 9 |
+
(function(s, n) {
|
| 10 |
+
s = document.createElement('script');
|
| 11 |
+
s.async = 1;
|
| 12 |
+
s.src = '<?php echo $siteUrl?>';
|
| 13 |
+
n = document.getElementsByTagName('script')[0];
|
| 14 |
+
n.parentNode.insertBefore(s, n);
|
| 15 |
+
})();
|
| 16 |
+
</script>
|
| 17 |
+
<?php endif?>
|
app/etc/modules/Magebuzz_Darwin.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Magebuzz_Darwin>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Magebuzz_Darwin>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Magebuzz_Darwin</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Integrate Magento with Darwin Pricing system. </summary>
|
| 10 |
+
<description>Automatically add Darwin Pricing script to Magento store. It allows you to track visitors, orders, benefits through Darwin Pricing admin page.</description>
|
| 11 |
+
<notes>First Release</notes>
|
| 12 |
+
<authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
|
| 13 |
+
<date>2015-05-13</date>
|
| 14 |
+
<time>03:16:26</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Darwin"><dir name="Block"><file name="Darwin.php" hash="c6195d9aadee05b0900ab39826dd50de"/></dir><dir name="Helper"><file name="Data.php" hash="cd43c6c0d3c1dd0800a966697145629d"/></dir><dir name="Model"><file name="Observer.php" hash="d8738056ef8c1c2788c458fe382fcca4"/></dir><dir name="controllers"><file name="IndexController.php" hash="cb4e4be6ab89282c1424d393d3d53a43"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3a141d2120d48d7ddff29c4cd8ad3f04"/><file name="config.xml" hash="77f52892a335c00b3fbe5c914972ac38"/><file name="system.xml" hash="58bc7c2c9ae58b90a32fc69de7f347a8"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="darwin"><file name="dp.phtml" hash="496720623f7fb3d0bb0c3e66615057b5"/></dir></dir><dir name="layout"><file name="darwin.xml" hash="65b926b248fc4a386b2957839692f663"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Darwin.xml" hash="c0ce6e6d10f135ac1c3711c76e134e21"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
