Version Notes
Integration Settings tab added to System/Configuration.
Download this release
Release Info
Developer | Oyvind Henriksen |
Extension | Poq_Integration |
Version | 1.0.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.0.1
- app/code/community/Poq/.DS_Store +0 -0
- app/code/community/Poq/Integration/Helper/Data.php +118 -0
- app/code/community/Poq/Integration/controllers/IndexController.php +496 -0
- app/code/community/Poq/Integration/etc/adminhtml.xml +33 -0
- app/code/community/Poq/Integration/etc/config.xml +48 -0
- app/code/community/Poq/Integration/etc/system.xml +155 -0
- app/etc/modules/Poq_Integration.xml +19 -0
- package.xml +18 -0
app/code/community/Poq/.DS_Store
ADDED
Binary file
|
app/code/community/Poq/Integration/Helper/Data.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Integration Data helper
|
5 |
+
*
|
6 |
+
* @author Poq Studio
|
7 |
+
*/
|
8 |
+
class Poq_Integration_Helper_Data extends Mage_Core_Helper_Data {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Store ID
|
12 |
+
* @var int
|
13 |
+
*/
|
14 |
+
public $store_id;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Image Base URL
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
public $image_base_url;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* List of Images to Ignore
|
24 |
+
* @var array
|
25 |
+
*/
|
26 |
+
public $image_ignore_string = array();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Tax Rates
|
30 |
+
* @var boolean
|
31 |
+
*/
|
32 |
+
public $tax_rates_enabled;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Checkout URL
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $checkout_url;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Requires HTTPS
|
42 |
+
* @var boolean
|
43 |
+
*/
|
44 |
+
public $requires_https;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Requires Signed Request
|
48 |
+
* @var boolean
|
49 |
+
*/
|
50 |
+
public $requires_signed_request;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Signed Request String
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
public $signed_request_string;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Limit Referer
|
60 |
+
* @var boolean
|
61 |
+
*/
|
62 |
+
public $limit_referer;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Safe Referer List
|
66 |
+
* @var array
|
67 |
+
*/
|
68 |
+
public $safe_referer_list = array();
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Tracking Code
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
public $tracking_code;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get settings
|
78 |
+
*/
|
79 |
+
public function getSettings() {
|
80 |
+
// Get store id
|
81 |
+
$this->store_id = Mage::getStoreConfig('integration/integration_feed_group/integration_feed_store_input', Mage::app()->getStore());
|
82 |
+
|
83 |
+
// Get base image url
|
84 |
+
$this->image_base_url = Mage::getStoreConfig('integration/integration_feed_group/integration_feed_image_url_input', Mage::app()->getStore());
|
85 |
+
|
86 |
+
// Get ignored image list
|
87 |
+
$this->image_ignore_string = Mage::getStoreConfig('integration/integration_feed_group/integration_feed_image_ignore_input', Mage::app()->getStore());
|
88 |
+
|
89 |
+
// Parse tax enabled
|
90 |
+
$this->tax_rates_enabled = filter_var(Mage::getStoreConfig('integration/integration_feed_group/integration_feed_taxrates_select', Mage::app()->getStore()), FILTER_VALIDATE_BOOLEAN);
|
91 |
+
|
92 |
+
// Get checkout url
|
93 |
+
$this->checkout_url = Mage::getStoreConfig('integration/integration_checkout_group/integration_checkout_checkout_input', Mage::app()->getStore());
|
94 |
+
|
95 |
+
// Parse require https
|
96 |
+
$this->requires_https = filter_var(Mage::getStoreConfig('integration/integration_checkoutsecurity_group/integration_checkout_requirehttps_select', Mage::app()->getStore()), FILTER_VALIDATE_BOOLEAN);
|
97 |
+
|
98 |
+
// Parse signed request
|
99 |
+
$this->requires_signed_request = filter_var(Mage::getStoreConfig('integration/integration_checkoutsecurity_group/integration_checkout_requiresignedrequest_select', Mage::app()->getStore()), FILTER_VALIDATE_BOOLEAN);
|
100 |
+
|
101 |
+
// Get signed request
|
102 |
+
$this->signed_request_string = Mage::getStoreConfig('integration/integration_checkoutsecurity_group/integration_checkout_signedrequeststring_input', Mage::app()->getStore());
|
103 |
+
|
104 |
+
// Parse limit referer
|
105 |
+
$this->limit_referer = filter_var(Mage::getStoreConfig('integration/integration_checkoutsecurity_group/integration_checkout_limitreferrrer_select', Mage::app()->getStore()), FILTER_VALIDATE_BOOLEAN);
|
106 |
+
|
107 |
+
// Get safe referer list
|
108 |
+
$this->safe_referer_list = Mage::getStoreConfig('integration/integration_checkoutsecurity_group/integration_checkout_safereferrerlist_input', Mage::app()->getStore());
|
109 |
+
$this->safe_referer_list = split(',', $this->safe_referer_list);
|
110 |
+
|
111 |
+
// Get tracking code
|
112 |
+
$this->tracking_code = Mage::getStoreConfig('integration/integration_checkout_group/integration_checkout_trackingcode_input', Mage::app()->getStore());
|
113 |
+
|
114 |
+
// return settings
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
app/code/community/Poq/Integration/controllers/IndexController.php
ADDED
@@ -0,0 +1,496 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Poq Integration model
|
5 |
+
*
|
6 |
+
* @author Poq Studio
|
7 |
+
*/
|
8 |
+
class Poq_Integration_IndexController extends Mage_Core_Controller_Front_Action {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Info page for checking extension status
|
12 |
+
*/
|
13 |
+
public function indexAction() {
|
14 |
+
|
15 |
+
// Get layout
|
16 |
+
$this->loadLayout();
|
17 |
+
|
18 |
+
// Create static block dynmacially
|
19 |
+
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'Integration Settings', array('template' => 'poqintegration/index.phtml'));
|
20 |
+
|
21 |
+
// Push block to layout
|
22 |
+
$this->getLayout()->getBlock('content')->append($block);
|
23 |
+
|
24 |
+
// Show settings
|
25 |
+
//Set CSV content type
|
26 |
+
if ($_GET['debug'] == '1') {
|
27 |
+
// Get extension settings
|
28 |
+
$settings = Mage::helper('poq_integration')->getSettings();
|
29 |
+
var_dump($settings);
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
// Render page
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Create csv feed file with respecto extension settings
|
39 |
+
*/
|
40 |
+
public function feedAction() {
|
41 |
+
|
42 |
+
// Get extension settings
|
43 |
+
$settings = Mage::helper('poq_integration')->getSettings();
|
44 |
+
|
45 |
+
//Configuration values
|
46 |
+
$store_id = $settings->store_id;
|
47 |
+
$image_base_url = $settings->image_base_url;
|
48 |
+
$image_ignore_strings = $settings->image_ignore_string;
|
49 |
+
$tax_rates_enabled = $settings->tax_enabled;
|
50 |
+
|
51 |
+
//Trying to get default values
|
52 |
+
if ($store_id == 0) {
|
53 |
+
$store_id = Mage::app()->getStore()->getStoreId();
|
54 |
+
}
|
55 |
+
|
56 |
+
//Set CSV content type
|
57 |
+
if ($_GET['debug'] == '1') {
|
58 |
+
header("Content-type: text/plain");
|
59 |
+
} else {
|
60 |
+
header("Content-type: text/csv");
|
61 |
+
header("Content-Disposition: attachment; filename=feed.csv");
|
62 |
+
}
|
63 |
+
header("Pragma: no-cache");
|
64 |
+
header("Expires: 0");
|
65 |
+
$productSizeDescriptions = array();
|
66 |
+
$parentProductIds = array();
|
67 |
+
|
68 |
+
$conn = Mage::getSingleton('core/resource')->getConnection('core_setup');
|
69 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
70 |
+
->joinField(
|
71 |
+
'qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left'
|
72 |
+
)
|
73 |
+
->addAttributeToFilter('status', 1) // enabled
|
74 |
+
->addUrlRewrite()
|
75 |
+
->addPriceData()
|
76 |
+
->addStoreFilter($store_id)
|
77 |
+
->addAttributeToSelect('*');
|
78 |
+
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
|
79 |
+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
|
80 |
+
$collection->setOrder('sku', 'desc');
|
81 |
+
|
82 |
+
if ($_GET['debug'] == '1') {
|
83 |
+
//only get the first hundred rows, useful for faster testing. Also enable profiler, so we can see performance data.
|
84 |
+
$collection->setPageSize(200)->setCurPage(1);
|
85 |
+
$conn->getProfiler()->setEnabled(true);
|
86 |
+
echo $collection->getSelect()->__toString() . "\n\n";
|
87 |
+
}
|
88 |
+
|
89 |
+
//Read the dataset into memory
|
90 |
+
$collection->load();
|
91 |
+
|
92 |
+
//Preload the media_gallery image data into memory
|
93 |
+
//For use with Option #1 below
|
94 |
+
$_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
|
95 |
+
$_read = Mage::getSingleton('core/resource')->getConnection('catalog_read');
|
96 |
+
$_mediaGalleryData = $_read->fetchAll('SELECT
|
97 |
+
main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
|
98 |
+
`value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`,
|
99 |
+
`default_value`.`position` AS `position_default`,
|
100 |
+
`default_value`.`disabled` AS `disabled_default`
|
101 |
+
FROM `catalog_product_entity_media_gallery` AS `main`
|
102 |
+
LEFT JOIN `catalog_product_entity_media_gallery_value` AS `value`
|
103 |
+
ON main.value_id=value.value_id AND value.store_id=' . $store_id . '
|
104 |
+
LEFT JOIN `catalog_product_entity_media_gallery_value` AS `default_value`
|
105 |
+
ON main.value_id=default_value.value_id AND default_value.store_id=0
|
106 |
+
WHERE (
|
107 |
+
main.attribute_id = ' . $_read->quote($_mediaGalleryAttributeId) . ')
|
108 |
+
AND (main.entity_id IN (' . $_read->quote($collection->getAllIds()) . '))
|
109 |
+
ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
|
110 |
+
');
|
111 |
+
$_mediaGalleryByProductId = array();
|
112 |
+
foreach ($_mediaGalleryData as $_galleryImage) {
|
113 |
+
$k = $_galleryImage['entity_id'];
|
114 |
+
unset($_galleryImage['entity_id']);
|
115 |
+
if (!isset($_mediaGalleryByProductId[$k])) {
|
116 |
+
$_mediaGalleryByProductId[$k] = array();
|
117 |
+
}
|
118 |
+
$_mediaGalleryByProductId[$k][] = $_galleryImage;
|
119 |
+
}
|
120 |
+
unset($_mediaGalleryData);
|
121 |
+
foreach ($collection as &$_product) {
|
122 |
+
$_productId = $_product->getData('entity_id');
|
123 |
+
if (isset($_mediaGalleryByProductId[$_productId])) {
|
124 |
+
$_product->setData('media_gallery', array('images' => $_mediaGalleryByProductId[$_productId]));
|
125 |
+
}
|
126 |
+
}
|
127 |
+
unset($_mediaGalleryByProductId);
|
128 |
+
// End of media_gallery queries for Option #1
|
129 |
+
//Go through configurable products, and preload data into $parentProductIds and $productSizeDescriptions
|
130 |
+
foreach ($collection as $product) {
|
131 |
+
if ($product->getTypeId() == "configurable") {
|
132 |
+
|
133 |
+
//Get list of related sub-products
|
134 |
+
$productids = $product->getTypeInstance()->getUsedProductIds();
|
135 |
+
foreach ($productids as $productid) {
|
136 |
+
$parentProductIds[$productid] = $product->getId(); //Add to array of related products, so we can look up when we loop through the main products later.
|
137 |
+
}
|
138 |
+
|
139 |
+
//Look up the relationship's attribute, so we can describe the relationship (such as the size)
|
140 |
+
$code = "";
|
141 |
+
$confAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product); //var_dump($confAttributes);
|
142 |
+
if (sizeof($confAttributes) > 0) {
|
143 |
+
$code = $confAttributes[0]["attribute_code"]; //Read the attribute code of the configured product, so we can look up the right name
|
144 |
+
}
|
145 |
+
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
|
146 |
+
$col = $conf->getUsedProductCollection()->addAttributeToSelect($code)->addFilterByRequiredOptions();
|
147 |
+
foreach ($col as $simple_product) {
|
148 |
+
if ($code != "") { //if we know which code to look up, find the attribute value and put it on the list.
|
149 |
+
$productSizeDescriptions[$simple_product->getId()] = $simple_product->getAttributeText($code);
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
//Add one line of headers above the actual content.
|
156 |
+
echo "\"id\"";
|
157 |
+
echo ",\"name\"";
|
158 |
+
echo ",\"description\"";
|
159 |
+
echo ",\"price\"";
|
160 |
+
echo ",\"specialprice\"";
|
161 |
+
echo ",\"parentproductid\"";
|
162 |
+
echo ",\"sku\"";
|
163 |
+
echo ",\"isinstock\"";
|
164 |
+
echo ",\"quantity\"";
|
165 |
+
echo ",\"size\"";
|
166 |
+
echo ",\"productURL\"";
|
167 |
+
echo ",\"pictureurls\"";
|
168 |
+
echo ",\"categoryid\"";
|
169 |
+
echo ",\"categoryname\"";
|
170 |
+
echo "\n";
|
171 |
+
|
172 |
+
// Get tax rates if enabled
|
173 |
+
$tax_classes;
|
174 |
+
|
175 |
+
if ($tax_rates_enabled) {
|
176 |
+
|
177 |
+
// Get all tax classes with their values
|
178 |
+
$tax_classes = Mage::helper('tax')->getAllRatesByProductClass();
|
179 |
+
}
|
180 |
+
|
181 |
+
//Loop through the products, get the values and write them in CSV format
|
182 |
+
foreach ($collection as $product) {
|
183 |
+
|
184 |
+
$description = strip_tags($product->getDescription()); //Remove HTML tags from the description
|
185 |
+
$description = addslashes($description); //Escape quotes etc from the text
|
186 |
+
$description = preg_replace('#\s{2,}#', '\\n', $description); //Remove line breaks, "\\n" will be put back in as line breaks when importing.
|
187 |
+
//$description = preg_replace('/(?<!,)"(?!,)/', '""', $description); //double up any double quote that is not immediately preceded or followed by a comma
|
188 |
+
$description = preg_replace('/\"/', '""', $description); //double up any double quote
|
189 |
+
|
190 |
+
echo "\"" . $product->getId() . "\"";
|
191 |
+
echo ",\"" . addslashes($product->getName()) . "\"";
|
192 |
+
echo ",\"" . $description . "\"";
|
193 |
+
|
194 |
+
// Original price might have been tax rates applied on live site
|
195 |
+
// Fix by macromania
|
196 |
+
//echo ",\"" . $product->getPrice() . "\""; )
|
197 |
+
try {
|
198 |
+
|
199 |
+
// Original price without tax
|
200 |
+
$product_price = $product->getPrice();
|
201 |
+
$special_price = $product->getFinalPrice();
|
202 |
+
|
203 |
+
if ($tax_rates_enabled) {
|
204 |
+
|
205 |
+
// Get product tax class id
|
206 |
+
$tax_class_id = $_product->getData('tax_class_id');
|
207 |
+
|
208 |
+
// $tax_classes is returned as string. So parsing is needed to get the value
|
209 |
+
// an example $tax_classes could be like {"value_2":20,"value_4":20,"value_5":20,"value_6":0,"value_7":5}
|
210 |
+
$tax_classes = str_replace('{', '', $tax_classes);
|
211 |
+
$tax_classes = str_replace('}', '', $tax_classes);
|
212 |
+
$tax_class_value_array = explode(',', $tax_classes);
|
213 |
+
|
214 |
+
// Tax value
|
215 |
+
$product_tax_value = 0;
|
216 |
+
|
217 |
+
foreach ($tax_class_value_array as $tax_class) {
|
218 |
+
|
219 |
+
$values = explode(':', $tax_class);
|
220 |
+
if ($values[0] == '"value_' . $tax_class_id . '"') {
|
221 |
+
// Get the rate
|
222 |
+
$product_tax_value = $values[1];
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
// Apply tax rate
|
227 |
+
if ($product_tax_value > 0) {
|
228 |
+
$product_price += $product_price * $product_tax_value / 100;
|
229 |
+
$special_price += $special_price * $product_tax_value / 100;
|
230 |
+
}
|
231 |
+
|
232 |
+
echo ",\"" . ceil($product_price) . "\"";
|
233 |
+
echo ",\"" . ceil($special_price) . "\"";
|
234 |
+
} else {
|
235 |
+
echo ",\"" . $product_price . "\"";
|
236 |
+
echo ",\"" . $special_price . "\"";
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
//echo '<p style="color:red">------<br/>Caught exception: ', ceil($product_price),'----',$product->getPrice(), '<br/>-----</p>';
|
242 |
+
} catch (Exception $eproductprice) {
|
243 |
+
echo '<p style="color:red">------<br/>Caught exception: ', $e2->getMessage(), '<br/>-----</p>';
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
|
248 |
+
echo ",\"" . $parentProductIds[$product->getId()] . "\"";
|
249 |
+
echo ",\"" . $product->getSku() . "\"";
|
250 |
+
echo ",\"" . $product->getStockItem()->getIsInStock() . "\"";
|
251 |
+
echo ",\"" . $product->getQty() . "\"";
|
252 |
+
echo ",\"" . $productSizeDescriptions[$product->getId()] . "\"";
|
253 |
+
|
254 |
+
if ($product->getVisibility() == 4) { //Only products that are individually visible need URLs, pictures, categories.
|
255 |
+
//Get product URL
|
256 |
+
echo ",\"" . $product->getProductUrl() . "\"";
|
257 |
+
|
258 |
+
//Get main image
|
259 |
+
$imageString = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
|
260 |
+
|
261 |
+
//attempt to audo-detect base image url, if necessary
|
262 |
+
if ($image_base_url == '') {
|
263 |
+
$image_base_url = substr($imageString, 0, strrpos($imageString, 'media/catalog/product')) . 'media/catalog/product';
|
264 |
+
}
|
265 |
+
|
266 |
+
//Option #1 - Fast way to get all media gallery images from preloaded array
|
267 |
+
$_images = $product->getData('media_gallery');
|
268 |
+
foreach ($_images as $imagegallery) {
|
269 |
+
foreach ($imagegallery as $add_image) {
|
270 |
+
|
271 |
+
//Check if image should be filtered.
|
272 |
+
$image_should_be_added = true;
|
273 |
+
if ($image_ignore_strings != '') {
|
274 |
+
//echo "\n image_ignore_strings: " . $image_ignore_strings;
|
275 |
+
$image_ignore_string_array = explode(",", $image_ignore_strings);
|
276 |
+
foreach ($image_ignore_string_array as $image_ignore_string) {
|
277 |
+
//echo "\n image_ignore_string: " . $image_ignore_string;
|
278 |
+
if (strpos($add_image['file'], $image_ignore_string) !== false) {
|
279 |
+
//echo "\n IGNORING: " . $add_image['file'];
|
280 |
+
$image_should_be_added = false;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
if ($image_should_be_added) {
|
285 |
+
$imageString .= ',' . $image_base_url . $add_image['file'];
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
//Option #2 - Slower, but more reliable way to get all images. Try this is option #1 does not run
|
291 |
+
// $_images = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages();
|
292 |
+
// foreach ($_images as $imagegallery) {
|
293 |
+
// $imageString .= ';' . $imagegallery['url'];
|
294 |
+
// }
|
295 |
+
echo ",\"" . $imageString . "\"";
|
296 |
+
|
297 |
+
//List the categories this product should be listed in
|
298 |
+
$cats = $product->getCategoryIds();
|
299 |
+
$category_id_list = "";
|
300 |
+
$category_name_list = "";
|
301 |
+
foreach ($cats as $category_id) {
|
302 |
+
|
303 |
+
|
304 |
+
// $_cat = Mage::getModel('catalog/category')->load($category_id); // Throws error
|
305 |
+
// some php configurations might throw "Cannot send headers" error.
|
306 |
+
// To avoid those errors and continue to the process
|
307 |
+
// following try/catch blog has been added by macromania
|
308 |
+
try {
|
309 |
+
$cat = Mage::getModel('catalog/category');
|
310 |
+
$cat->load($category_id);
|
311 |
+
$cat_name = $cat->getName(); //Remove any semicolons from the category name.
|
312 |
+
$cat_name = str_replace(';', '', $cat_name);
|
313 |
+
$category_name_list .= $cat_name . ";";
|
314 |
+
$category_id_list .= $category_id . ";"; //only append the id if we can successfully get the category name. -OH
|
315 |
+
} catch (Exception $e2) {
|
316 |
+
//echo '<p style="color:red">------<br/>Caught exception: ', $e2->getMessage(), '<br/>-----</p>';
|
317 |
+
}
|
318 |
+
}
|
319 |
+
$category_id_list = substr($category_id_list, 0, -1);
|
320 |
+
$category_name_list = substr($category_name_list, 0, -1);
|
321 |
+
echo ",\"" . $category_id_list . "\"";
|
322 |
+
echo ",\"" . $category_name_list . "\"";
|
323 |
+
}
|
324 |
+
echo "\n";
|
325 |
+
}
|
326 |
+
if ($_GET['debug'] == '1') { //Show performance data
|
327 |
+
echo "\n\n\n" . Varien_Profiler::getSqlProfiler($conn);
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
public function cartAction() {
|
332 |
+
|
333 |
+
//Configuration values
|
334 |
+
$next_url = '/checkout/'; //After the product are added, redirect to this url.
|
335 |
+
$require_https = false; //SSL-encrypted requests cannot be read by anyone else, and will not be stored in history etc.
|
336 |
+
$require_signed_request = false; //If enabled, will require the request to be signed, we can verify that the URL has not been tampered with.
|
337 |
+
$signed_request_secret = ''; //Get this configuration value from Poq Studio
|
338 |
+
$limit_referer = false; //Enable this to require the request to come from our trusted source. Also makes it difficult to URL hack and investigate
|
339 |
+
$safe_referer_list = array("poqstudio.com", "cloudapp.net"); //add mobile website domains here, leave cloudapp.net and poqstudio.com.
|
340 |
+
$tracking_code = "utm_source=mobile&utm_campaign=poq"; //If set, will be added to the checkout page URL.
|
341 |
+
//End of configuration values
|
342 |
+
|
343 |
+
header("Pragma: no-cache");
|
344 |
+
header("Expires: 0");
|
345 |
+
$session = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
346 |
+
|
347 |
+
//Security check #1 - make sure reference id is set and has a decent format
|
348 |
+
$reference_id = $_GET['reference_id'];
|
349 |
+
if (empty($reference_id)) {
|
350 |
+
die("Invalid request. Error 1001.");
|
351 |
+
} else if (!strpos($reference_id, '-')) {
|
352 |
+
die("Invalid request. Error 1002.");
|
353 |
+
}
|
354 |
+
$session->setPoqReferenceId($reference_id); //Save reference ID in session, for cross-tracking
|
355 |
+
//Security Check #2 - is the request SSL-encrypted?
|
356 |
+
if ($require_https) {
|
357 |
+
$is_https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443);
|
358 |
+
if (!$is_https) {
|
359 |
+
die("Invalid request. Error 2001.");
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
//Security Check #3 - is the referer from poqstudio.com?
|
364 |
+
if ($limit_referer) {
|
365 |
+
$http_referer = $_SERVER['HTTP_REFERER'];
|
366 |
+
$is_from_safe_referer = false;
|
367 |
+
foreach ($safe_referer_list as $referer) {
|
368 |
+
if (strpos($http_referer, $referer) > -1) {
|
369 |
+
$is_from_safe_referer = true;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
if (!$is_from_safe_referer) {
|
373 |
+
if ($_GET['debug'] == '1') {
|
374 |
+
echo "Invalid Referer:" . $http_referer;
|
375 |
+
}
|
376 |
+
die("Invalid request. Error 3001.");
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
|
381 |
+
//Security Check #4 - is the request SSL-encrypted?
|
382 |
+
if ($require_signed_request) {
|
383 |
+
$hv = $reference_id = $_GET['hv'];
|
384 |
+
$qs = $_SERVER['QUERY_STRING'];
|
385 |
+
$toBeHashed = substr($qs, strrpos($qs, 'reference_id='));
|
386 |
+
$toBeHashed = substr($toBeHashed, 0, strrpos($toBeHashed, '&hv='));
|
387 |
+
$hash = md5($signed_request_secret . $toBeHashed . $signed_request_secret);
|
388 |
+
if ($hash != $hv) {
|
389 |
+
if ($_GET['debug'] == '1') {
|
390 |
+
echo "<br>Preparing: " . $toBeHashed;
|
391 |
+
echo "<br>Computed: " . $hash;
|
392 |
+
echo "<br>HV: " . $hv;
|
393 |
+
}
|
394 |
+
die("Invalid request. Error 4001.");
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
//Get access to the cart
|
399 |
+
$cart = Mage::helper('checkout/cart')->getCart();
|
400 |
+
|
401 |
+
//Empty out cart first, in case the user clicked back and then tried again.
|
402 |
+
$items = $cart->getItems();
|
403 |
+
foreach ($items as $item) {
|
404 |
+
$cart->removeItem($item->getId());
|
405 |
+
}
|
406 |
+
|
407 |
+
//Loop through the querystring, find items and add them to bag.
|
408 |
+
for ($i = 1; $i <= 99; $i++) {
|
409 |
+
$item_quantity = $_GET['item_quantity_' . $i];
|
410 |
+
$item_sku = $_GET['item_sku_' . $i];
|
411 |
+
|
412 |
+
if (!empty($item_sku) && !empty($item_quantity)) {
|
413 |
+
$product_id = Mage::getModel('catalog/product')->getIdBySku($item_sku);
|
414 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
415 |
+
if (!$product) {
|
416 |
+
die("Invalid product added. Error 6002.");
|
417 |
+
} else if (!$product->isSalable()) {
|
418 |
+
//The product has sold out since the customer added it to cart on mobile, show friendly error message.
|
419 |
+
echo "<html><body style='font-family:Tahoma;color:#444444;text-align:center;padding-top:1em;'><h1>Out of stock</h1>";
|
420 |
+
echo $product->getName() . "<br/>";
|
421 |
+
echo $product->getSku() . "<br/><br/>";
|
422 |
+
echo "Please go back and try again.";
|
423 |
+
echo "</body></html>";
|
424 |
+
die();
|
425 |
+
} else {
|
426 |
+
//Seems legit, let's try and add it to the cart. Note that stock level control might stop it here, products often sell out.
|
427 |
+
try {
|
428 |
+
$visibility = $product->getVisibility();
|
429 |
+
if ($visibility != 4) {
|
430 |
+
//If the product is not individually visible, add its parent with the selected SKU as the configured attribute.
|
431 |
+
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($product_id);
|
432 |
+
$parent_product_id = $parentIds[0];
|
433 |
+
$parent_product = Mage::getModel('catalog/product')->load($parent_product_id);
|
434 |
+
$confAttributes = $parent_product->getTypeInstance(true)->getConfigurableAttributesAsArray($parent_product); //var_dump($confAttributes);
|
435 |
+
//Get the required attributes, and set them on the cart.
|
436 |
+
if (sizeof($confAttributes) > 0) {
|
437 |
+
$configurable_attribute_id = $confAttributes[0]["attribute_id"];
|
438 |
+
$configurable_attribute_code = $confAttributes[0]["attribute_code"];
|
439 |
+
$attribute_id = $product->getData($configurable_attribute_code);
|
440 |
+
|
441 |
+
//Construct attributes so the correct size will be selected in the cart.
|
442 |
+
$params = array(
|
443 |
+
'product' => $parent_product_id,
|
444 |
+
'super_attribute' => array(
|
445 |
+
$configurable_attribute_id => $attribute_id,
|
446 |
+
),
|
447 |
+
'qty' => $item_quantity,
|
448 |
+
);
|
449 |
+
|
450 |
+
|
451 |
+
$cart->addProduct($parent_product, $params);
|
452 |
+
$session->setLastAddedProductId($parent_product->getId());
|
453 |
+
} else {
|
454 |
+
//if the parent product has no configurable attributes, just add the simple product.
|
455 |
+
$cart->addProduct($product, $item_quantity);
|
456 |
+
$session->setLastAddedProductId($product->getId());
|
457 |
+
}
|
458 |
+
} else {
|
459 |
+
//If the simple product is visible directly, simpley add it to the bag.
|
460 |
+
$cart->addProduct($product, $item_quantity);
|
461 |
+
$session->setLastAddedProductId($product->getId());
|
462 |
+
}
|
463 |
+
} catch (Exception $e) {
|
464 |
+
//An error occurred when adding the product to the cart, such as ordering 2 of a product when only 1 is left in stock.
|
465 |
+
echo "<html><body style='font-family:Tahoma;color:#444444;text-align:center;padding-top:1em;'><h1>Out of stock</h1>";
|
466 |
+
echo "Please go back and try again.<br><br><em>";
|
467 |
+
echo $product->getName() . "<br/>";
|
468 |
+
echo $product->getSku() . "</em><br/><br/>";
|
469 |
+
echo $e->getMessage() . "<br/>";
|
470 |
+
echo "</body></html>";
|
471 |
+
die();
|
472 |
+
}
|
473 |
+
}
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
//Save changes
|
478 |
+
$session->setCartWasUpdated(true);
|
479 |
+
$cart->save();
|
480 |
+
|
481 |
+
if ($tracking_code != "") {
|
482 |
+
$tracking_code .= "&utm_medium=" . $_GET['channel'];
|
483 |
+
$tracking_code .= "&reference_id=" . $reference_id; //Add unique id to tracking code, so it's stored in analytics
|
484 |
+
if (strpos($next_url, "?") > -1) {
|
485 |
+
$next_url .= "&" . $tracking_code;
|
486 |
+
} else {
|
487 |
+
$next_url .= "?" . $tracking_code;
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
//Redirect to checkout page.
|
492 |
+
header("Location: " . $next_url);
|
493 |
+
die(); //stop execution of further scripts.
|
494 |
+
}
|
495 |
+
|
496 |
+
}
|
app/code/community/Poq/Integration/etc/adminhtml.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento admin config
|
5 |
+
*
|
6 |
+
* @author Poq Studio
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<all>
|
14 |
+
<title>Allow All</title>
|
15 |
+
</all>
|
16 |
+
<admin>
|
17 |
+
<children>
|
18 |
+
<system>
|
19 |
+
<children>
|
20 |
+
<config>
|
21 |
+
<children>
|
22 |
+
<integration>
|
23 |
+
<title>Poq Integration Settings</title>
|
24 |
+
</integration>
|
25 |
+
</children>
|
26 |
+
</config>
|
27 |
+
</children>
|
28 |
+
</system>
|
29 |
+
</children>
|
30 |
+
</admin>
|
31 |
+
</resources>
|
32 |
+
</acl>
|
33 |
+
</config>
|
app/code/community/Poq/Integration/etc/config.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Module configuration
|
5 |
+
*
|
6 |
+
* @author Poq Studio
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Poq_Integration>
|
12 |
+
<version>1.0.0.0.1</version>
|
13 |
+
</Poq_Integration>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<helpers>
|
17 |
+
<poq_integration>
|
18 |
+
<class>Poq_Integration_Helper</class>
|
19 |
+
</poq_integration>
|
20 |
+
</helpers>
|
21 |
+
</global>
|
22 |
+
<frontend>
|
23 |
+
<routers>
|
24 |
+
<poq_integration>
|
25 |
+
<use>standard</use>
|
26 |
+
<args>
|
27 |
+
<module>Poq_Integration</module>
|
28 |
+
<frontName>poq</frontName>
|
29 |
+
</args>
|
30 |
+
</poq_integration>
|
31 |
+
</routers>
|
32 |
+
</frontend>
|
33 |
+
<default>
|
34 |
+
<integration>
|
35 |
+
<integration_feed_group>
|
36 |
+
<integration_feed_taxrates_select>1</integration_feed_taxrates_select>
|
37 |
+
</integration_feed_group>
|
38 |
+
<integration_checkout_group>
|
39 |
+
<integration_checkout_checkout_input><![CDATA[/checkout/]]></integration_checkout_checkout_input>
|
40 |
+
<integration_checkout_requirehttps_select>0</integration_checkout_requirehttps_select>
|
41 |
+
<integration_checkout_requiresignedrequest_select>0</integration_checkout_requiresignedrequest_select>
|
42 |
+
<integration_checkout_limitreferrrer_select>0</integration_checkout_limitreferrrer_select>
|
43 |
+
<integration_checkout_safereferrerlist_input></integration_checkout_safereferrerlist_input>
|
44 |
+
<integration_checkout_trackingcode_input><![CDATA[tm_source=mobile&utm_campaign=poq]]></integration_checkout_trackingcode_input>
|
45 |
+
</integration_checkout_group>
|
46 |
+
</integration>
|
47 |
+
</default>
|
48 |
+
</config>
|
app/code/community/Poq/Integration/etc/system.xml
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<integrationconfig translate="label" module="poq_integration">
|
5 |
+
<label>POQ Studio</label>
|
6 |
+
<sort_order>99999</sort_order>
|
7 |
+
</integrationconfig>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<integration translate="label" module="poq_integration">
|
11 |
+
<label>Integration Settings</label>
|
12 |
+
<tab>integrationconfig</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</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 |
+
<groups>
|
19 |
+
<integration_feed_group translate="label" module="poq_integration">
|
20 |
+
<label>Feed Settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1000</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 |
+
<integration_feed_store_input translate="label">
|
28 |
+
<label>Store Id: </label>
|
29 |
+
<comment>Set store id if you prefer a specific store for feed integration. Otherwise, leave blank and let the default store will be used.</comment>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>20</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 |
+
</integration_feed_store_input>
|
36 |
+
<integration_feed_image_url_input translate="label">
|
37 |
+
<label>Image URL: </label>
|
38 |
+
<comment>Set to override images location. Will try to auto-detect this value if not set.</comment>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>21</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</integration_feed_image_url_input>
|
45 |
+
<integration_feed_image_ignore_input translate="label">
|
46 |
+
<label>Ignore Images: </label>
|
47 |
+
<comment>Comma-separated strings to filter out unwanted pictures.</comment>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>22</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</integration_feed_image_ignore_input>
|
54 |
+
<integration_feed_taxrates_select translate="label">
|
55 |
+
<label>Enable Tax Rate per Product</label>
|
56 |
+
<comment>Set to apply custom tax rates to product prices.</comment>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<sort_order>23</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
63 |
+
</integration_feed_taxrates_select>
|
64 |
+
</fields>
|
65 |
+
</integration_feed_group>
|
66 |
+
<integration_checkout_group translate="label" module="poq_integration">
|
67 |
+
<label>Checkout Settings</label>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<sort_order>1001</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
<fields>
|
74 |
+
<integration_checkout_checkout_input translate="label">
|
75 |
+
<label>Checkout URL </label>
|
76 |
+
<comment>After the products are added to bag, user is redirect to this url for checkout.</comment>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>20</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</integration_checkout_checkout_input>
|
83 |
+
<integration_checkout_trackingcode_input translate="label">
|
84 |
+
<label>Tracking Code</label>
|
85 |
+
<comment>If set, will be added to the checkout page URL.</comment>
|
86 |
+
<frontend_type>text</frontend_type>
|
87 |
+
<sort_order>26</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
</integration_checkout_trackingcode_input>
|
92 |
+
</fields>
|
93 |
+
</integration_checkout_group>
|
94 |
+
<integration_checkoutsecurity_group translate="label" module="poq_integration">
|
95 |
+
<label>Checkout Security Settings</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>1002</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
<fields>
|
102 |
+
<integration_checkout_requirehttps_select translate="label">
|
103 |
+
<label>Require HTTPS</label>
|
104 |
+
<comment>SSL-encrypted requests cannot be read by anyone else, and will not be stored in history.</comment>
|
105 |
+
<frontend_type>select</frontend_type>
|
106 |
+
<sort_order>21</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 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
111 |
+
</integration_checkout_requirehttps_select>
|
112 |
+
<integration_checkout_requiresignedrequest_select translate="label">
|
113 |
+
<label>Require Signed Request</label>
|
114 |
+
<comment>If enabled, will require the request to be signed for additional security.</comment>
|
115 |
+
<frontend_type>select</frontend_type>
|
116 |
+
<sort_order>22</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
121 |
+
</integration_checkout_requiresignedrequest_select>
|
122 |
+
<integration_checkout_signedrequeststring_input translate="label">
|
123 |
+
<label>Signed Request Phrase</label>
|
124 |
+
<comment>Please ask for this configuration value from Poq Studio</comment>
|
125 |
+
<frontend_type>text</frontend_type>
|
126 |
+
<sort_order>23</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
</integration_checkout_signedrequeststring_input>
|
131 |
+
<integration_checkout_limitreferrrer_select translate="label">
|
132 |
+
<label>Limit Referer</label>
|
133 |
+
<comment>Enable this to require the request to come from a trusted source. </comment>
|
134 |
+
<frontend_type>select</frontend_type>
|
135 |
+
<sort_order>24</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
+
</integration_checkout_limitreferrrer_select>
|
141 |
+
<integration_checkout_safereferrerlist_input translate="label">
|
142 |
+
<label>Safe Referer List</label>
|
143 |
+
<comment>Add comma-seperated mobile website domains here. Only use this if you enable Limit Referer option.</comment>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>25</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
</integration_checkout_safereferrerlist_input>
|
150 |
+
</fields>
|
151 |
+
</integration_checkoutsecurity_group>
|
152 |
+
</groups>
|
153 |
+
</integration>
|
154 |
+
</sections>
|
155 |
+
</config>
|
app/etc/modules/Poq_Integration.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Module initial config
|
5 |
+
*
|
6 |
+
* @author Poq Studio
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Poq_Integration>
|
12 |
+
<active>true</active>
|
13 |
+
<codePool>community</codePool>
|
14 |
+
<depends>
|
15 |
+
<Mage_Adminhtml />
|
16 |
+
</depends>
|
17 |
+
</Poq_Integration>
|
18 |
+
</modules>
|
19 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Poq_Integration</name>
|
4 |
+
<version>1.0.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Apache Software License (ASL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This integration forms a connection between the Magento and Poq Studio platforms. </summary>
|
10 |
+
<description>The extension has two main features: Exposing your catalogue information in the Poq Feed Format and Accepting a shopping cart transfer from the Poq Studio platform. </description>
|
11 |
+
<notes>Integration Settings tab added to System/Configuration.</notes>
|
12 |
+
<authors><author><name>Oyvind Henriksen</name><user>poqmagento</user><email>info@poqstudio.com</email></author></authors>
|
13 |
+
<date>2014-02-14</date>
|
14 |
+
<time>14:49:03</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Poq"><dir name="Integration"><dir name="Helper"><file name="Data.php" hash="2b539c77fd12d90480c851b1645c0431"/></dir><dir name="controllers"><file name="IndexController.php" hash="92f389cd176d045eafa401bb6d0e69da"/></dir><dir name="etc"><file name="adminhtml.xml" hash="545b50fa7d354adb75a6bc27ff2ef41e"/><file name="config.xml" hash="b1009e366da42a647bec68a5286647e7"/><file name="system.xml" hash="22e24622eee78398df04467814e54a86"/></dir></dir><file name=".DS_Store" hash="8f897c363150648e08d6a4dcfb47ac8c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="poqintegration"><file name="index.phtml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Poq_Integration.xml" hash="f735b9c01c16c559a05ba50185ef8a61"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|