Version Notes
1.0.0 release allow system output universal variables and configure OpenTag script thought configuration panel.
Download this release
Release Info
Developer | Jing Dong |
Extension | QuBit_UniversalVariable |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/QuBit/UniversalVariable/Block/Uv.php +6 -0
- app/code/local/QuBit/UniversalVariable/Helper/Data.php +4 -0
- app/code/local/QuBit/UniversalVariable/Model/.DS_Store +0 -0
- app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php +229 -0
- app/code/local/QuBit/UniversalVariable/controllers/IndexController.php +15 -0
- app/code/local/QuBit/UniversalVariable/etc/config.xml +108 -0
- app/code/local/QuBit/UniversalVariable/etc/system.xml +94 -0
- app/design/frontend/default/default/layout/qubit/.DS_Store +0 -0
- app/design/frontend/default/default/layout/qubit/universal_variable.xml +8 -0
- app/design/frontend/default/default/template/qubit/.DS_Store +0 -0
- app/design/frontend/default/default/template/qubit/universal_variable.phtml +55 -0
- app/etc/modules/QuBit_all.xml +20 -0
- package.xml +22 -0
app/code/local/QuBit/UniversalVariable/Block/Uv.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class QuBit_UniversalVariable_Block_Uv extends Mage_Core_Block_Template {
|
3 |
+
|
4 |
+
}
|
5 |
+
|
6 |
+
?>
|
app/code/local/QuBit/UniversalVariable/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class QuBit_UniversalVariable_Helper_Data extends Mage_Core_Helper_Data
|
3 |
+
{
|
4 |
+
}
|
app/code/local/QuBit/UniversalVariable/Model/.DS_Store
ADDED
Binary file
|
app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class QuBit_UniversalVariable_Model_Page_Observer {
|
3 |
+
|
4 |
+
protected $_version = "1.0.0";
|
5 |
+
protected $_user = null;
|
6 |
+
protected $_page = null;
|
7 |
+
protected $_basket = null;
|
8 |
+
protected $_product = null;
|
9 |
+
protected $_search = null;
|
10 |
+
protected $_transaction = null;
|
11 |
+
protected $_listing = null;
|
12 |
+
|
13 |
+
protected function _getRequest() {
|
14 |
+
return Mage::app()->getFrontController()->getRequest();
|
15 |
+
}
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Returns Controller Name
|
19 |
+
*/
|
20 |
+
protected function _getControllerName() {
|
21 |
+
return $this->_getRequest()->getControllerName();
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _getActionName() {
|
25 |
+
return $this->_getRequest()->getActionName();
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _getModuleName() {
|
29 |
+
return $this->_getRequest()->getModuleName();
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _getRouteName() {
|
33 |
+
return $this->_getRequest()->getRouteName();
|
34 |
+
}
|
35 |
+
|
36 |
+
/*
|
37 |
+
* Creates Block View
|
38 |
+
*/
|
39 |
+
protected function _createBlock() {
|
40 |
+
$layout = Mage::app()->getLayout();
|
41 |
+
$block = $layout->createBlock('QuBit_UniversalVariable_Block_Uv','universal_variable_block');
|
42 |
+
}
|
43 |
+
|
44 |
+
/*
|
45 |
+
* Sets user information
|
46 |
+
*/
|
47 |
+
public function _setUser() {
|
48 |
+
$user = Mage::helper('customer')->getCustomer();
|
49 |
+
$this->_user = array();
|
50 |
+
$this->_user['email'] = $user->getEmail();
|
51 |
+
$this->_user['id'] = $user->getEntityId();
|
52 |
+
$this->_user['returning'] = $this->_user['id'] ? true : false;
|
53 |
+
$this->_user['language'] = Mage::app()->getLocale()->getDefaultLocale();
|
54 |
+
}
|
55 |
+
|
56 |
+
/*
|
57 |
+
* Sets current page information
|
58 |
+
*/
|
59 |
+
public function _setPage() {
|
60 |
+
$this->_page = array();
|
61 |
+
$this->_page['category'] = $this->_getModuleName().'/'.$this->_getControllerName().'/'.$this->_getActionName();
|
62 |
+
}
|
63 |
+
|
64 |
+
public function _getAddress($address) {
|
65 |
+
$billing = array();
|
66 |
+
$billing['name'] = $address->getName();
|
67 |
+
$billing['address'] = $address->getStreetFull();
|
68 |
+
$billing['city'] = $address->getCity();
|
69 |
+
// TODO: $billing['state']
|
70 |
+
$billing['postcode'] = $address->getPostcode();
|
71 |
+
$billing['country'] = $address->getCountry();
|
72 |
+
return $billing;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function _setTranscation() {
|
76 |
+
// default controllerName is "onepage"
|
77 |
+
if ($this->_getModuleName() =="checkout" && $this->_getActionName() == "success") {
|
78 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
79 |
+
if ($orderId) {
|
80 |
+
$transaction = array();
|
81 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
82 |
+
$items = $order->getAllItems();
|
83 |
+
$line_items = $this->_getInvoicedLineItems($items);
|
84 |
+
$shippingId = $order->getShippingAddress()->getId();
|
85 |
+
$address = Mage::getModel('sales/order_address')->load($shippingId);
|
86 |
+
$billingAddress = $order->getBillingAddress();
|
87 |
+
$shippingAddress = $order->getShippingAddress();
|
88 |
+
|
89 |
+
$transaction['order_id'] = $orderId;
|
90 |
+
$transaction['currency'] = $this->_getCurrency();
|
91 |
+
$transaction['subtotal'] = $order->getSubtotal();
|
92 |
+
// TODO: subtotal_include_tax
|
93 |
+
$transaction['total'] = $order->getGrandTotal();
|
94 |
+
$transaction['voucher'] = $order->getCouponCode();
|
95 |
+
// TODO: voucher_discount
|
96 |
+
$transaction['tax'] = $order->getTax();
|
97 |
+
$transaction['shipping_cost'] = $order->getShippingAmount();
|
98 |
+
$transaction['shipping_method'] = $order->getShippingMethod();
|
99 |
+
$transaction['billing'] = $this->_getAddress($billingAddress);
|
100 |
+
$transaction['delivery'] = $this->_getAddress($shippingAddress);
|
101 |
+
$transaction['line_items'] = $line_items;
|
102 |
+
$this->_transaction = $transaction;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
public function _setProduct() {
|
108 |
+
$product = Mage::registry('current_product');
|
109 |
+
if ($product) {
|
110 |
+
$this->_product = $this->_getProductModel($product);;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
public function _getProuctStock($product) {
|
115 |
+
return (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
116 |
+
}
|
117 |
+
|
118 |
+
public function _getCurrency() {
|
119 |
+
return Mage::app()->getStore()->getCurrentCurrencyCode();
|
120 |
+
}
|
121 |
+
|
122 |
+
public function _getProductModel($product) {
|
123 |
+
$product_model = array();
|
124 |
+
$product_model['id'] = $product->getId();
|
125 |
+
$product_model['sku_code'] = $product->getSku();
|
126 |
+
$product_model['url'] = $product->getProductUrl();
|
127 |
+
$product_model['name'] = $product->getName();
|
128 |
+
$product_model['unit_price'] = $product->getPrice();
|
129 |
+
$product_model['unit_sale_price'] = $product->getFinalPrice();
|
130 |
+
$product_model['currency'] = $this->_getCurrency();
|
131 |
+
$product_model['description'] = $product->getDescription();
|
132 |
+
$product_model['stock'] = $this->_getProuctStock($product);
|
133 |
+
return $product_model;
|
134 |
+
}
|
135 |
+
|
136 |
+
public function _getLineItems($items) {
|
137 |
+
$line_items = array();
|
138 |
+
foreach($items as $item) {
|
139 |
+
$litem_model = array();
|
140 |
+
$litem_model['product'] = $this->_getProductModel($item->getProduct());
|
141 |
+
$litem_model['quantity'] = $item->getQty();
|
142 |
+
$litem_model['subtotal'] = $item->getCalculationPrice() * $item -> getQty();
|
143 |
+
array_push($line_items, $litem_model);
|
144 |
+
}
|
145 |
+
return $line_items;
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
public function _getInvoicedLineItems($items) {
|
150 |
+
$line_items = array();
|
151 |
+
foreach($items as $item) {
|
152 |
+
$litem_model = array();
|
153 |
+
$litem_model['product'] = $this->_getProductModel($item->getProduct());
|
154 |
+
$litem_model['quantity'] = $item->getQtyToInvoice();
|
155 |
+
$litem_model['subtotal'] = $item->getPrice();
|
156 |
+
array_push($line_items, $litem_model);
|
157 |
+
}
|
158 |
+
return $line_items;
|
159 |
+
}
|
160 |
+
|
161 |
+
public function _setListing() {
|
162 |
+
}
|
163 |
+
|
164 |
+
/*
|
165 |
+
* Sets basket information
|
166 |
+
*/
|
167 |
+
public function _setBasket() {
|
168 |
+
$cart = Mage::getSingleton('checkout/cart');
|
169 |
+
$quote = $cart->getQuote();
|
170 |
+
$basket = array();
|
171 |
+
$items = $quote->getAllItems();
|
172 |
+
$subTotal = $quote->getSubtotal();
|
173 |
+
$grandTotal = $quote->getGrandTotal();
|
174 |
+
$line_items = $this->_getLineItems($items);
|
175 |
+
|
176 |
+
$basket['id'] = Mage::getSingleton('checkout/session')->getQuoteId();
|
177 |
+
$basket['currency'] = $this->_getCurrency();
|
178 |
+
$basket['subtotal'] = $subTotal;
|
179 |
+
// TODO: subtotal_incluce_tax
|
180 |
+
// TODO: tax
|
181 |
+
// TODO: shipping_cost
|
182 |
+
// TODO: shipping_method
|
183 |
+
$basket['total'] = $grandTotal;
|
184 |
+
$basket['line_items'] = $line_items;
|
185 |
+
$this->_basket = $basket;
|
186 |
+
}
|
187 |
+
|
188 |
+
public function setUniversalVariable($observer) {
|
189 |
+
$this->_setUser();
|
190 |
+
$this->_setPage();
|
191 |
+
$this->_setProduct();
|
192 |
+
$this->_setListing();
|
193 |
+
$this->_setBasket();
|
194 |
+
$this->_setTranscation();
|
195 |
+
$this->_createBlock();
|
196 |
+
|
197 |
+
return $this;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
public function getVersion() {
|
202 |
+
return $this->_version;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function getUser() {
|
206 |
+
return $this->_user;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function getPage() {
|
210 |
+
return $this->_page;
|
211 |
+
}
|
212 |
+
|
213 |
+
public function getProduct() {
|
214 |
+
return $this->_product;
|
215 |
+
}
|
216 |
+
|
217 |
+
public function getBasket() {
|
218 |
+
return $this->_basket;
|
219 |
+
}
|
220 |
+
|
221 |
+
public function getTransaction() {
|
222 |
+
return $this->_transaction;
|
223 |
+
}
|
224 |
+
|
225 |
+
public function getListing() {
|
226 |
+
return $_listing;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
?>
|
app/code/local/QuBit/UniversalVariable/controllers/IndexController.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class QuBit_UniversalVariable_IndexController
|
4 |
+
extends Mage_Core_Controller_Front_Action {
|
5 |
+
|
6 |
+
public function testAction () {
|
7 |
+
echo "test index";
|
8 |
+
}
|
9 |
+
|
10 |
+
public function mamethodeAction () {
|
11 |
+
echo "test mymethod";
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
?>
|
app/code/local/QuBit/UniversalVariable/etc/config.xml
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<QuBit_UniversalVariable>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</QuBit_UniversalVariable>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<universal_variable_main>
|
12 |
+
<class>QuBit_UniversalVariable_Model_Page</class>
|
13 |
+
</universal_variable_main>
|
14 |
+
</models>
|
15 |
+
<helpers>
|
16 |
+
<universal_variable_main>
|
17 |
+
<class>QuBit_UniversalVariable_Helper</class>
|
18 |
+
</universal_variable_main>
|
19 |
+
</helpers>
|
20 |
+
<events>
|
21 |
+
<controller_action_layout_load_before>
|
22 |
+
<observers>
|
23 |
+
<QuBit_UniversalVariable_Model_Page_Observer>
|
24 |
+
<type>singleton</type>
|
25 |
+
<class>universal_variable_main/observer</class>
|
26 |
+
<method>setUniversalVariable</method>
|
27 |
+
</QuBit_UniversalVariable_Model_Page_Observer>
|
28 |
+
</observers>
|
29 |
+
</controller_action_layout_load_before>
|
30 |
+
</events>
|
31 |
+
<blocks>
|
32 |
+
<universal_variable_block>
|
33 |
+
<class>QuBit_UniversalVariable_Block_Uv</class>
|
34 |
+
</universal_variable_block>
|
35 |
+
</blocks>
|
36 |
+
</global>
|
37 |
+
|
38 |
+
<frontend>
|
39 |
+
<routers>
|
40 |
+
<routeurfrontend>
|
41 |
+
<use>standard</use>
|
42 |
+
<args>
|
43 |
+
<module>QuBit_UniversalVariable</module>
|
44 |
+
<frontName>universal_variable</frontName>
|
45 |
+
</args>
|
46 |
+
</routeurfrontend>
|
47 |
+
</routers>
|
48 |
+
|
49 |
+
<!-- Layout -->
|
50 |
+
<layout>
|
51 |
+
<updates>
|
52 |
+
<qubit_universal_variable>
|
53 |
+
<file>qubit/universal_variable.xml</file>
|
54 |
+
</qubit_universal_variable>
|
55 |
+
</updates>
|
56 |
+
</layout>
|
57 |
+
</frontend>
|
58 |
+
<adminhtml>
|
59 |
+
<acl>
|
60 |
+
<resources>
|
61 |
+
<all>
|
62 |
+
<title>Allow Everything</title>
|
63 |
+
</all>
|
64 |
+
<admin>
|
65 |
+
<children>
|
66 |
+
<QuBit_UniversalVariable module="QuBit_UniversalVariable">
|
67 |
+
<title>QuBit</title>
|
68 |
+
<sort_order>0</sort_order>
|
69 |
+
<children>
|
70 |
+
<QuBit_UniversalVariable module="QuBit_UniversalVariable">
|
71 |
+
<title>Manage QuBit Script</title>
|
72 |
+
<sort_order>0</sort_order>
|
73 |
+
</QuBit_UniversalVariable>
|
74 |
+
</children>
|
75 |
+
</QuBit_UniversalVariable>
|
76 |
+
<system>
|
77 |
+
<children>
|
78 |
+
<config>
|
79 |
+
<children>
|
80 |
+
<QuBit_UniversalVariable translate="title" module="QuBit_UniversalVariable">
|
81 |
+
<sort_order>0</sort_order>
|
82 |
+
<title>Manage QuBit Script</title>
|
83 |
+
</QuBit_UniversalVariable>
|
84 |
+
</children>
|
85 |
+
</config>
|
86 |
+
</children>
|
87 |
+
</system>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
</adminhtml>
|
93 |
+
|
94 |
+
|
95 |
+
<!-- Admin Configuration Default Values -->
|
96 |
+
<default>
|
97 |
+
<!-- <QuBit_UniversalVariable>
|
98 |
+
<QuBit_UniversalVariable_Settings>
|
99 |
+
<QuBit_OpenTag_Async>1</QuBit_OpenTag_Async>
|
100 |
+
</QuBit_UniversalVariable_Settings>
|
101 |
+
</QuBit_UniversalVariable> -->
|
102 |
+
<qubit>
|
103 |
+
<qubit_opentag_async>1</qubit_opentag_async>
|
104 |
+
<qubit_opentag_enabled>1</qubit_opentag_enabled>
|
105 |
+
<qubit_universal_variable_enabled>1</qubit_universal_variable_enabled>
|
106 |
+
</qubit>
|
107 |
+
</default>
|
108 |
+
</config>
|
app/code/local/QuBit/UniversalVariable/etc/system.xml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<QuBit_tab translate="label">
|
5 |
+
<label>Universal Variable</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</QuBit_tab>
|
8 |
+
</tabs>
|
9 |
+
|
10 |
+
<sections>
|
11 |
+
<QuBit_UniversalVariable translate="label">
|
12 |
+
<label>Configuration</label>
|
13 |
+
<tab>QuBit_tab</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>2</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<QuBit_UniversalVariable_Settings translate="label">
|
21 |
+
<label>Universal Variable Configuration</label>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<QuBit_UniversalVariable_Enabled translate="label">
|
28 |
+
<label>Enable Universal Variable</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<config_path>qubit/qubit_universal_variable_enabled</config_path>
|
32 |
+
<comment><![CDATA[ Variables output on every page are based on <br/>
|
33 |
+
<a href="https://github.com/QubitProducts/UniversalVariable " target="_blank">Universal Variable Specification</a> ]]></comment>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</QuBit_UniversalVariable_Enabled>
|
39 |
+
</fields>
|
40 |
+
</QuBit_UniversalVariable_Settings>
|
41 |
+
|
42 |
+
<QuBit_OpenTag_Settings translate="label">
|
43 |
+
<label>QuBit OpenTag Configuration</label>
|
44 |
+
<sort_order>2</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<QuBit_OpenTag_Container translate="label">
|
50 |
+
<label>Container ID</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<config_path>qubit/qubit_opentag_container_id</config_path>
|
53 |
+
<comment><![CDATA[ Click 'Embed' button in OpenTag interface for the container you'd like to implement.<br/>
|
54 |
+
Your container ID should look like 1234-56789, for example: <br/>
|
55 |
+
<script src="//d3c3cq33003psk.cloudfront.net/opentag-<strong>1234-56789</strong>.js" async defer></script> <br/>
|
56 |
+
You can <a href="https://opentag.qubitproducts.com/QDashboard/" target="_blank">Sign In</a> or <a href="https://opentag.qubitproducts.com/QDashboard/register.html" target="_blank"> Signup an OpenTag account</a>.
|
57 |
+
]]>
|
58 |
+
</comment>
|
59 |
+
<sort_order>1</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</QuBit_OpenTag_Container>
|
64 |
+
|
65 |
+
<QuBit_OpenTag_Async translate="label">
|
66 |
+
<label>Asynchronous</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<config_path>qubit/qubit_opentag_async</config_path>
|
70 |
+
<comment><![CDATA[ Asynchronous is recommended. ]]></comment>
|
71 |
+
<sort_order>2</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 |
+
</QuBit_OpenTag_Async>
|
76 |
+
|
77 |
+
<QuBit_OpenTag_Enabled translate="label">
|
78 |
+
<label>Enable OpenTag</label>
|
79 |
+
<frontend_type>select</frontend_type>
|
80 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
81 |
+
<config_path>qubit/qubit_opentag_enabled</config_path>
|
82 |
+
<sort_order>3</sort_order>
|
83 |
+
<show_in_default>1</show_in_default>
|
84 |
+
<show_in_website>1</show_in_website>
|
85 |
+
<show_in_store>1</show_in_store>
|
86 |
+
</QuBit_OpenTag_Enabled>
|
87 |
+
</fields>
|
88 |
+
</QuBit_OpenTag_Settings>
|
89 |
+
|
90 |
+
|
91 |
+
</groups>
|
92 |
+
</QuBit_UniversalVariable>
|
93 |
+
</sections>
|
94 |
+
</config>
|
app/design/frontend/default/default/layout/qubit/.DS_Store
ADDED
Binary file
|
app/design/frontend/default/default/layout/qubit/universal_variable.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="core/template" name="universal_variable" as="universal_variable" template="qubit/universal_variable.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
</layout>
|
app/design/frontend/default/default/template/qubit/.DS_Store
ADDED
Binary file
|
app/design/frontend/default/default/template/qubit/universal_variable.phtml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$qubit_opentag_container_id = Mage::getStoreConfig('qubit/qubit_opentag_container_id');
|
3 |
+
$qubit_opentag_async = Mage::getStoreConfig('qubit/qubit_opentag_async');
|
4 |
+
$qubit_opentag_enabled = Mage::getStoreConfig('qubit/qubit_opentag_enabled');
|
5 |
+
$qubit_universal_variable_enabled = Mage::getStoreConfig('qubit/qubit_universal_variable_enabled');
|
6 |
+
|
7 |
+
$observer = 'universal_variable_main/observer';
|
8 |
+
$mage = Mage::getSingleton($observer);
|
9 |
+
|
10 |
+
if ($qubit_opentag_async == 1) {
|
11 |
+
$qubit_opentag_async = 'async defer';
|
12 |
+
} else {
|
13 |
+
$qubit_opentag_async = '';
|
14 |
+
};
|
15 |
+
?>
|
16 |
+
|
17 |
+
<?php if ($qubit_universal_variable_enabled == 1):?>
|
18 |
+
<?php
|
19 |
+
// extract variable only when universal variable is enabled
|
20 |
+
$version = $mage->getVersion();
|
21 |
+
$page = $mage->getPage();
|
22 |
+
$user = $mage->getUser();
|
23 |
+
$product = $mage->getProduct();
|
24 |
+
$basket = $mage->getBasket();
|
25 |
+
$listing = $mage->getListing();
|
26 |
+
$transaction = $mage->getTransaction();
|
27 |
+
?>
|
28 |
+
<!-- Universal Variable Start -->
|
29 |
+
<script type="text/javascript">
|
30 |
+
window.universal_variable = window.universal_variable || {};
|
31 |
+
window.universal_variable.version = <?php echo json_encode($version) ?>;
|
32 |
+
window.universal_variable.page = <?php echo json_encode($page) ?>;
|
33 |
+
window.universal_variable.user = <?php echo json_encode($user) ?>;
|
34 |
+
<?php if ($product) : ?>
|
35 |
+
window.universal_variable.product = <?php echo json_encode($product) ?>;
|
36 |
+
<?php endif?>
|
37 |
+
<?php if ($basket) : ?>
|
38 |
+
window.universal_variable.basket = <?php echo json_encode($basket) ?>;
|
39 |
+
<?php endif ?>
|
40 |
+
<?php if ($listing) : ?>
|
41 |
+
window.universal_variable.listing = <?php echo json_encode($listing) ?>;
|
42 |
+
<?php endif ?>
|
43 |
+
<?php if ($transaction) : ?>
|
44 |
+
window.universal_variable.transaction = <?php echo json_encode($transaction) ?>;
|
45 |
+
<?php endif ?>
|
46 |
+
</script>
|
47 |
+
<!-- Universal Variable End -->
|
48 |
+
<?php endif;?>
|
49 |
+
|
50 |
+
<?php if ($qubit_opentag_container_id && $qubit_opentag_enabled == 1):?>
|
51 |
+
<!-- QuBit OpenTag Start -->
|
52 |
+
<script type="text/javascript" src='//d3c3cq33003psk.cloudfront.net/opentag-<?php echo $qubit_opentag_container_id;?>.js' <?php echo $qubit_opentag_async;?>></script>
|
53 |
+
<!-- QuBit OpenTag End -->
|
54 |
+
|
55 |
+
<?php endif;?>
|
app/etc/modules/QuBit_all.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version = "1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<QuBit_UniversalVariable>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</QuBit_UniversalVariable>
|
8 |
+
</modules>
|
9 |
+
<frontend>
|
10 |
+
<routers>
|
11 |
+
<routeurfrontend>
|
12 |
+
<use>standard</use>
|
13 |
+
<args>
|
14 |
+
<module>QuBit_UniversalVariable</module>
|
15 |
+
<frontName>universal_variable</frontName>
|
16 |
+
</args>
|
17 |
+
</routeurfrontend>
|
18 |
+
</routers>
|
19 |
+
</frontend>
|
20 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>QuBit_UniversalVariable</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>QuBit Universal Variable is our suggested way to structure the data presented on your pages. Affiliates, remarking or advertising tags become easier to implement.
|
10 |
+

|
11 |
+
</summary>
|
12 |
+
<description>QuBit OpenTag recommends creating the releavant JavaScript object on your page prior to the OpenTag container script. This will assure the values are present on the page when a script tries to access them.
|
13 |
+

|
14 |
+
If a page does not have the variables of an object that are mentioned below, simply do not even declare them. For example, if your pages only have category and no subcategory, just declare your category. Likewise, if you feel the need to extend the objects below or feel like renaming them, please do so. However, please take a note of the new variable names or the edited ones, because in order to access them from your scripts in your OpenTag container, you will need to use the new variable names.</description>
|
15 |
+
<notes>1.0.0 release allow system output universal variables and configure OpenTag script thought configuration panel. </notes>
|
16 |
+
<authors><author><name>Jing Dong</name><user>qubitproducts</user><email>jing@qubitdigital.com</email></author></authors>
|
17 |
+
<date>2012-08-02</date>
|
18 |
+
<time>11:25:13</time>
|
19 |
+
<contents><target name="magelocal"><dir name="QuBit"><dir name="UniversalVariable"><dir name="Block"><file name="Uv.php" hash="9b5cd71bebc9576b5d0714b3fe5c13bb"/></dir><dir name="Helper"><file name="Data.php" hash="0af6989ffa9bd859fda429fba84a684e"/></dir><dir name="Model"><dir name="Page"><file name="Observer.php" hash="2b6d9ed912920a883c3637857940c4f7"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="controllers"><file name="IndexController.php" hash="5daac581cce2856275aab613046fa0ae"/></dir><dir name="etc"><file name="config.xml" hash="04a1473f38f3d7db75b6bbf833ab2af9"/><file name="system.xml" hash="944a9a1ca7984eae63f1e2e0800404f9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="qubit"><file name="universal_variable.xml" hash="f568ad884f941850720324d35868c45c"/><file name=".DS_Store" hash="2632898af4a7dd21eb81072ff8eb1f04"/></dir></dir><dir name="template"><dir name="qubit"><file name="universal_variable.phtml" hash="db054d84a48d9dd833e99eca1d9fc8e0"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="QuBit_all.xml" hash="549545c1cf35f87658a129ad5093d13f"/></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|