Version Notes
Print_Science_Designer_Web_to_Print
Download this release
Release Info
Developer | John Weissberg |
Extension | Print_Science_Designer_Web_to_Print |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.24 to 1.1.2
- app/code/local/PrintScience/Personalization/Block/Adminhtml/Test.php +42 -0
- app/code/local/PrintScience/Personalization/Block/Checkout/Cart/Item/Renderer.php +172 -157
- app/code/local/PrintScience/Personalization/Helper/Data.php +22 -22
- app/code/local/PrintScience/Personalization/Helper/Output.php +76 -76
- app/code/local/PrintScience/Personalization/Model/ApiGateway.php +269 -192
- app/code/local/PrintScience/Personalization/Model/Observer.php +26 -9
- app/code/local/PrintScience/Personalization/Model/Override/Sales/Quote.php +16 -16
- app/code/local/PrintScience/Personalization/Model/Resource/Eav/Mysql4/Setup.php +101 -101
- app/code/local/PrintScience/Personalization/Model/System/Config/Source/WindowType.php +15 -15
- app/code/local/PrintScience/Personalization/controllers/IndexController.php +374 -345
- app/code/local/PrintScience/Personalization/controllers/TestController.php +97 -0
- app/code/local/PrintScience/Personalization/etc/config.xml +1 -1
- app/code/local/PrintScience/Personalization/etc/system.xml +25 -16
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-install-1.0.18.php +1 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-install-1.1.1.php +40 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.15-1.0.16.php +1 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.16-1.0.17.php +1 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.17-1.0.18.php +1 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.18-1.0.23.php +15 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.23-1.0.24.php +15 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.24-1.1.1.php +37 -0
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.1.1-1.1.2.php +40 -0
- app/design/frontend/base/default/layout/printscience_personalization.xml +6 -0
- app/design/frontend/base/default/template/printscience_personalization/catalog/product/list.phtml +472 -233
- app/design/frontend/base/default/template/printscience_personalization/catalog/product/view.phtml +4 -1
- app/design/frontend/base/default/template/printscience_personalization/catalog/product/view/addtocart.phtml +77 -79
- app/design/frontend/base/default/template/printscience_personalization/checkout/cart.phtml +10 -3
- app/design/frontend/base/default/template/printscience_personalization/checkout/cart/item/default.phtml +8 -3
- package.xml +4 -4
- skin/frontend/base/default/printscience_personalization/checkdevice.js +17 -0
- {js → skin/frontend/base/default}/printscience_personalization/gallery.js +6 -3
app/code/local/PrintScience/Personalization/Block/Adminhtml/Test.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This is the Self test Button
|
5 |
+
*
|
6 |
+
* @author Ashley Schroder (aschroder.com)
|
7 |
+
* @copyright Copyright (c) 2014 Ashley Schroder
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Printscience_Personalization_Block_Adminhtml_Test extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
+
|
14 |
+
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$this->setElement($element);
|
18 |
+
$buttonHtml = $this->_getAddRowButtonHtml($this->__('Test Connection'));
|
19 |
+
return $buttonHtml;
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
protected function _getAddRowButtonHtml($title)
|
24 |
+
{
|
25 |
+
|
26 |
+
$buttonBlock = $this->getElement()->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
|
27 |
+
|
28 |
+
//$url = Mage::helper('adminhtml')->getUrl("*/admin_test/index", $params);
|
29 |
+
$url = Mage::helper("adminhtml")->getUrl("printscience_personalization/test/index");
|
30 |
+
|
31 |
+
$buttonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
|
32 |
+
->setType('button')
|
33 |
+
->setLabel($this->__($title))
|
34 |
+
->setOnClick("window.location.href='".$url."'")
|
35 |
+
->toHtml();
|
36 |
+
|
37 |
+
return $buttonHtml;
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
}
|
app/code/local/PrintScience/Personalization/Block/Checkout/Cart/Item/Renderer.php
CHANGED
@@ -1,158 +1,173 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Custom shopping cart item render block
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class PrintScience_Personalization_Block_Checkout_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Get personalization api session key of the cart item
|
10 |
-
*
|
11 |
-
* @return unknown
|
12 |
-
*/
|
13 |
-
public function getPersonalizationApiSessionKey()
|
14 |
-
{
|
15 |
-
|
16 |
-
->getItemData($this->getItem());
|
17 |
-
if (!$data) {
|
18 |
-
return false;
|
19 |
-
}
|
20 |
-
return $data['apiSessionKey'];
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
* Get personalization
|
25 |
-
*
|
26 |
-
* @return
|
27 |
-
*/
|
28 |
-
public function
|
29 |
-
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
*
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
*
|
117 |
-
*
|
118 |
-
* @
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
*
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
*
|
148 |
-
*
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom shopping cart item render block
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class PrintScience_Personalization_Block_Checkout_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Get personalization api session key of the cart item
|
10 |
+
*
|
11 |
+
* @return unknown
|
12 |
+
*/
|
13 |
+
public function getPersonalizationApiSessionKey()
|
14 |
+
{
|
15 |
+
$data = Mage::helper('printscience_personalization/quote')
|
16 |
+
->getItemData($this->getItem());
|
17 |
+
if (!$data) {
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
return $data['apiSessionKey'];
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get personalization api user version desktop or mobile
|
25 |
+
*
|
26 |
+
* @return unknown
|
27 |
+
*/
|
28 |
+
public function getPersonalizationUserVersion()
|
29 |
+
{
|
30 |
+
$data = Mage::helper('printscience_personalization/quote')
|
31 |
+
->getItemData($this->getItem());
|
32 |
+
if (!$data) {
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
return $data['userVersion'];
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get personalization URL for cart item
|
40 |
+
*
|
41 |
+
* @return string | false
|
42 |
+
*/
|
43 |
+
public function getPersonalizationUrl()
|
44 |
+
{
|
45 |
+
$apiSessionKey = $this->getPersonalizationApiSessionKey();
|
46 |
+
if (!$apiSessionKey) {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
$url = Mage::getUrl('personalization/index/startShoppingCart', array(
|
50 |
+
'api_session_key' => $apiSessionKey
|
51 |
+
));
|
52 |
+
return $url;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Get resume personalization URL for cart item in checkout page
|
57 |
+
*
|
58 |
+
* @return string | false
|
59 |
+
*/
|
60 |
+
public function getResumePersonalizationUrl($productId)
|
61 |
+
{
|
62 |
+
$apiSessionKey = $this->getPersonalizationApiSessionKey();
|
63 |
+
if (!$apiSessionKey) {
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
$item = $this->getItem();
|
67 |
+
// get simple product of configurable
|
68 |
+
if($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE){
|
69 |
+
$quoteItemId = $this->getItem()->getId();
|
70 |
+
$mQuote = $this->getItem()->getQuote();
|
71 |
+
$aChildQuoteItem = Mage::getModel("sales/quote_item")
|
72 |
+
->getCollection()
|
73 |
+
->setQuote($mQuote)
|
74 |
+
->addFieldToFilter("parent_item_id", $quoteItemId)->getFirstItem();
|
75 |
+
if($aChildQuoteItem){
|
76 |
+
if($aChildQuoteItem->getId()){
|
77 |
+
$productId = $aChildQuoteItem->getProductId();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
$url = Mage::getUrl('personalization/index/resumeShoppingCart', array(
|
83 |
+
'api_session_key' => $apiSessionKey,
|
84 |
+
'product' => $productId
|
85 |
+
));
|
86 |
+
return $url;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get URLs of personalization preview images
|
91 |
+
*
|
92 |
+
* @return array | false
|
93 |
+
*/
|
94 |
+
public function getPersonalizationPreviews()
|
95 |
+
{
|
96 |
+
$default = array();
|
97 |
+
$apiSessionKey = $this->getPersonalizationApiSessionKey();
|
98 |
+
|
99 |
+
$apiResponse = Mage::getModel('printscience_personalization/apiGateway')
|
100 |
+
->getPreview($apiSessionKey);
|
101 |
+
if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
|
102 |
+
$item = $this->getItem();
|
103 |
+
|
104 |
+
if($personalizationInfo = $item->getData('personalization_info')){
|
105 |
+
$personalizationInfo = unserialize($personalizationInfo);
|
106 |
+
if(!empty($personalizationInfo['product_images'])){
|
107 |
+
$default = $personalizationInfo['product_images'];
|
108 |
+
}
|
109 |
+
}
|
110 |
+
return $default;
|
111 |
+
}
|
112 |
+
return $apiResponse->getPeviewUrls();
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Accept option value and return its formatted view
|
117 |
+
*
|
118 |
+
* @param mixed $optionValue
|
119 |
+
* Method works well with these $optionValue format:
|
120 |
+
* 1. String
|
121 |
+
* 2. Indexed array e.g. array(val1, val2, ...)
|
122 |
+
* 3. Associative array, containing additional option info, including option value, e.g.
|
123 |
+
* array
|
124 |
+
* (
|
125 |
+
* [label] => ...,
|
126 |
+
* [value] => ...,
|
127 |
+
* [print_value] => ...,
|
128 |
+
* [option_id] => ...,
|
129 |
+
* [option_type] => ...,
|
130 |
+
* [custom_view] =>...,
|
131 |
+
* )
|
132 |
+
*
|
133 |
+
* @return array
|
134 |
+
*/
|
135 |
+
public function getFormatedOptionValue($optionValue)
|
136 |
+
{
|
137 |
+
/* @var $helper Mage_Catalog_Helper_Product_Configuration */
|
138 |
+
$helper = Mage::helper('catalog/product_configuration');
|
139 |
+
$params = array(
|
140 |
+
'max_length' => 55,
|
141 |
+
'cut_replacer' => ' <a href="#" class="dots" onclick="return false">...</a>'
|
142 |
+
);
|
143 |
+
return $helper->getFormattedOptionValue($optionValue, $params);
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get list of all otions for product
|
148 |
+
*
|
149 |
+
* @return array
|
150 |
+
*/
|
151 |
+
public function getOptionList()
|
152 |
+
{
|
153 |
+
if($this->getItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE){
|
154 |
+
return Mage::helper('bundle/catalog_product_configuration')->getOptions($this->getItem());
|
155 |
+
} else {
|
156 |
+
return $this->getProductOptions();
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Get product customize options
|
162 |
+
*
|
163 |
+
* @return array || false
|
164 |
+
*/
|
165 |
+
public function getProductOptions()
|
166 |
+
{
|
167 |
+
//echo "<br>22222222222-----".$this->getItem()->getProduct()->getId();
|
168 |
+
//echo "<pre>".print_r($this->getItem())."</pre>";
|
169 |
+
/* @var $helper Mage_Catalog_Helper_Product_Configuration */
|
170 |
+
$helper = Mage::helper('catalog/product_configuration');
|
171 |
+
return $helper->getCustomOptions($this->getItem());
|
172 |
+
}
|
173 |
}
|
app/code/local/PrintScience/Personalization/Helper/Data.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Print Science personalization data helper
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class PrintScience_Personalization_Helper_Data extends Mage_Core_Helper_Abstract
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Personalization redirect action handler.
|
10 |
-
*
|
11 |
-
* @return boolean
|
12 |
-
*/
|
13 |
-
public function _redirectToUrl($url, $params='0') {
|
14 |
-
$str="";
|
15 |
-
if($params=='1') {
|
16 |
-
$str = "?added=1";
|
17 |
-
//echo "ininini";
|
18 |
-
//exit;
|
19 |
-
}
|
20 |
-
echo '<html><head><script type="text/javascript">window.parent.location.href = "'.$url.$str.'";</script></head><body></body></html';
|
21 |
-
return false;
|
22 |
-
}
|
23 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Print Science personalization data helper
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class PrintScience_Personalization_Helper_Data extends Mage_Core_Helper_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Personalization redirect action handler.
|
10 |
+
*
|
11 |
+
* @return boolean
|
12 |
+
*/
|
13 |
+
public function _redirectToUrl($url, $params='0') {
|
14 |
+
$str="";
|
15 |
+
if($params=='1') {
|
16 |
+
$str = "?added=1";
|
17 |
+
//echo "ininini";
|
18 |
+
//exit;
|
19 |
+
}
|
20 |
+
echo '<html><head><script type="text/javascript">window.parent.location.href = "'.$url.$str.'";</script></head><body></body></html';
|
21 |
+
return false;
|
22 |
+
}
|
23 |
}
|
app/code/local/PrintScience/Personalization/Helper/Output.php
CHANGED
@@ -1,76 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
|
5 |
-
* Print Science personalization quote helper
|
6 |
-
|
7 |
-
*
|
8 |
-
|
9 |
-
*/
|
10 |
-
|
11 |
-
class PrintScience_Personalization_Helper_Output extends Mage_Core_Helper_Abstract
|
12 |
-
|
13 |
-
{
|
14 |
-
|
15 |
-
/**
|
16 |
-
|
17 |
-
* Check if personalization is enabled for this product
|
18 |
-
|
19 |
-
*
|
20 |
-
|
21 |
-
* @param Mage_Catalog_Model_Product $product
|
22 |
-
|
23 |
-
* @return boolean
|
24 |
-
|
25 |
-
*/
|
26 |
-
|
27 |
-
public function isPersonalizationEnabled($product)
|
28 |
-
|
29 |
-
{
|
30 |
-
$pId = $product->getId();
|
31 |
-
|
32 |
-
$product = Mage::getModel('catalog/product');
|
33 |
-
$product->load($pId);
|
34 |
-
|
35 |
-
$productTypeId = $product->getTypeId();
|
36 |
-
|
37 |
-
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
38 |
-
|
39 |
-
return $product->getPersonalizationEnabled();
|
40 |
-
|
41 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
42 |
-
|
43 |
-
$subproducts = $product->getTypeInstance()->getUsedProducts();
|
44 |
-
|
45 |
-
foreach ($subproducts as $product) {
|
46 |
-
|
47 |
-
if (!$product->getPersonalizationEnabled()) {
|
48 |
-
|
49 |
-
return false;
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
return true;
|
56 |
-
|
57 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
58 |
-
|
59 |
-
return $product->getPersonalizationEnabled();
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
public function getFrontendParams() {
|
68 |
-
|
69 |
-
$addedtoCart = (int) $_REQUEST['added'];
|
70 |
-
|
71 |
-
return $addedtoCart;
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
}
|
76 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
|
5 |
+
* Print Science personalization quote helper
|
6 |
+
|
7 |
+
*
|
8 |
+
|
9 |
+
*/
|
10 |
+
|
11 |
+
class PrintScience_Personalization_Helper_Output extends Mage_Core_Helper_Abstract
|
12 |
+
|
13 |
+
{
|
14 |
+
|
15 |
+
/**
|
16 |
+
|
17 |
+
* Check if personalization is enabled for this product
|
18 |
+
|
19 |
+
*
|
20 |
+
|
21 |
+
* @param Mage_Catalog_Model_Product $product
|
22 |
+
|
23 |
+
* @return boolean
|
24 |
+
|
25 |
+
*/
|
26 |
+
|
27 |
+
public function isPersonalizationEnabled($product)
|
28 |
+
|
29 |
+
{
|
30 |
+
$pId = $product->getId();
|
31 |
+
|
32 |
+
$product = Mage::getModel('catalog/product');
|
33 |
+
$product->load($pId);
|
34 |
+
|
35 |
+
$productTypeId = $product->getTypeId();
|
36 |
+
|
37 |
+
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
38 |
+
|
39 |
+
return $product->getPersonalizationEnabled();
|
40 |
+
|
41 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
42 |
+
|
43 |
+
$subproducts = $product->getTypeInstance()->getUsedProducts();
|
44 |
+
|
45 |
+
foreach ($subproducts as $product) {
|
46 |
+
|
47 |
+
if (!$product->getPersonalizationEnabled()) {
|
48 |
+
|
49 |
+
return false;
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
return true;
|
56 |
+
|
57 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
58 |
+
|
59 |
+
return $product->getPersonalizationEnabled();
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
public function getFrontendParams() {
|
68 |
+
|
69 |
+
$addedtoCart = (int) $_REQUEST['added'];
|
70 |
+
|
71 |
+
return $addedtoCart;
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
76 |
+
|
app/code/local/PrintScience/Personalization/Model/ApiGateway.php
CHANGED
@@ -1,193 +1,270 @@
|
|
1 |
-
<?php
|
2 |
-
require_once 'xmlrpc/xmlrpc.inc';
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Gateway to Print Science personalization API
|
6 |
-
*
|
7 |
-
*/
|
8 |
-
class PrintScience_Personalization_Model_ApiGateway
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Calls beginPersonalization API function and returns response.
|
12 |
-
*
|
13 |
-
* @param int $templateId
|
14 |
-
* @param string $successUrl
|
15 |
-
* @param string $failUrl
|
16 |
-
* @param string $cancelUrl
|
17 |
-
* @return PrintScience_Personalization_Model_ApiGateway_Response_Begin
|
18 |
-
*/
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$
|
23 |
-
|
24 |
-
$
|
25 |
-
$
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
php_xmlrpc_encode(
|
38 |
-
php_xmlrpc_encode(
|
39 |
-
php_xmlrpc_encode(
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
php_xmlrpc_encode(
|
49 |
-
php_xmlrpc_encode(
|
50 |
-
php_xmlrpc_encode(
|
51 |
-
php_xmlrpc_encode(
|
52 |
-
php_xmlrpc_encode(
|
53 |
-
php_xmlrpc_encode(
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
php_xmlrpc_encode(
|
64 |
-
php_xmlrpc_encode(''),
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
php_xmlrpc_encode('')
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
php_xmlrpc_encode(
|
182 |
-
php_xmlrpc_encode(
|
183 |
-
php_xmlrpc_encode($
|
184 |
-
php_xmlrpc_encode($
|
185 |
-
php_xmlrpc_encode(
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
1 |
+
<?php
|
2 |
+
require_once 'xmlrpc/xmlrpc.inc';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Gateway to Print Science personalization API
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
class PrintScience_Personalization_Model_ApiGateway
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Calls beginPersonalization API function and returns response.
|
12 |
+
*
|
13 |
+
* @param int $templateId
|
14 |
+
* @param string $successUrl
|
15 |
+
* @param string $failUrl
|
16 |
+
* @param string $cancelUrl
|
17 |
+
* @return PrintScience_Personalization_Model_ApiGateway_Response_Begin
|
18 |
+
*/
|
19 |
+
|
20 |
+
public function beginPersonalization($productId, $templateId, $successUrl, $failUrl, $cancelUrl)
|
21 |
+
{
|
22 |
+
$apiUrl = Mage::getStoreConfig('catalog/personalization/api_url');
|
23 |
+
$apiVersion = Mage::getStoreConfig('catalog/personalization/api_version');
|
24 |
+
$magelocale = Mage::app()->getLocale()->getLocaleCode();
|
25 |
+
$localeParts = explode('_',$magelocale);
|
26 |
+
$locale=$localeParts[0];
|
27 |
+
$client = new xmlrpc_client($apiUrl);
|
28 |
+
$function = null;
|
29 |
+
if($templateId!='') {
|
30 |
+
$templateXml = php_xmlrpc_encode($templateId);
|
31 |
+
}
|
32 |
+
// check api version
|
33 |
+
switch($apiVersion)
|
34 |
+
{
|
35 |
+
case '1.0.0':
|
36 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
37 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
38 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
39 |
+
php_xmlrpc_encode($productId),
|
40 |
+
php_xmlrpc_encode($successUrl),
|
41 |
+
php_xmlrpc_encode($failUrl),
|
42 |
+
php_xmlrpc_encode($cancelUrl),
|
43 |
+
php_xmlrpc_encode('')
|
44 |
+
));
|
45 |
+
break;
|
46 |
+
case '2.0.0':
|
47 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
48 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
49 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
50 |
+
php_xmlrpc_encode($productId),
|
51 |
+
php_xmlrpc_encode($successUrl),
|
52 |
+
php_xmlrpc_encode($failUrl),
|
53 |
+
php_xmlrpc_encode($cancelUrl),
|
54 |
+
php_xmlrpc_encode(''),
|
55 |
+
php_xmlrpc_encode('en'),
|
56 |
+
php_xmlrpc_encode(''),
|
57 |
+
php_xmlrpc_encode(''),
|
58 |
+
$templateXml
|
59 |
+
));
|
60 |
+
break;
|
61 |
+
case '4.0.0':
|
62 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
63 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
64 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
65 |
+
php_xmlrpc_encode($productId),
|
66 |
+
php_xmlrpc_encode($successUrl),
|
67 |
+
php_xmlrpc_encode($failUrl),
|
68 |
+
php_xmlrpc_encode($cancelUrl),
|
69 |
+
php_xmlrpc_encode(''),
|
70 |
+
php_xmlrpc_encode($locale),
|
71 |
+
$templateXml
|
72 |
+
));
|
73 |
+
break;
|
74 |
+
default:
|
75 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
76 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
77 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
78 |
+
php_xmlrpc_encode($templateId),
|
79 |
+
php_xmlrpc_encode($successUrl),
|
80 |
+
php_xmlrpc_encode($failUrl),
|
81 |
+
php_xmlrpc_encode($cancelUrl),
|
82 |
+
php_xmlrpc_encode(''),
|
83 |
+
$templateXml
|
84 |
+
));
|
85 |
+
break;
|
86 |
+
}
|
87 |
+
$response = $client->send($function);
|
88 |
+
|
89 |
+
return new PrintScience_Personalization_Model_ApiGateway_Response_Begin($response);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Calls getPreview API function and returns response.
|
94 |
+
*
|
95 |
+
* @param string $sessionKey
|
96 |
+
* @return PrintScience_Personalization_Model_ApiGateway_Response_GetPreview
|
97 |
+
*/
|
98 |
+
public function getPreview($sessionKey)
|
99 |
+
{
|
100 |
+
$client = new xmlrpc_client(Mage::getStoreConfig('catalog/personalization/api_url'));
|
101 |
+
|
102 |
+
$function = new xmlrpcmsg('getPreview', array(
|
103 |
+
php_xmlrpc_encode($sessionKey)
|
104 |
+
));
|
105 |
+
|
106 |
+
$response = $client->send($function);
|
107 |
+
|
108 |
+
return new PrintScience_Personalization_Model_ApiGateway_Response_GetPreview($response);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Calls endPersonalization API function.
|
113 |
+
*
|
114 |
+
* @param string $sessionKey
|
115 |
+
*/
|
116 |
+
public function endPersonalization($sessionKey)
|
117 |
+
{
|
118 |
+
$client = new xmlrpc_client(Mage::getStoreConfig('catalog/personalization/api_url'));
|
119 |
+
|
120 |
+
$function = new xmlrpcmsg('endPersonalization', array(
|
121 |
+
php_xmlrpc_encode($sessionKey)
|
122 |
+
));
|
123 |
+
|
124 |
+
$client->send($function);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Calls endPersonalization API function.
|
129 |
+
*
|
130 |
+
* @param string $sessionKey
|
131 |
+
*/
|
132 |
+
public function getPersonalizationVersion()
|
133 |
+
{
|
134 |
+
|
135 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
136 |
+
//$sessionHelper->unsetData('dummy_user_version');
|
137 |
+
$dummyuserVersion = $sessionHelper->getData('dummy_user_version');
|
138 |
+
if($dummyuserVersion) {
|
139 |
+
return $dummyuserVersion;
|
140 |
+
} else {
|
141 |
+
return 'desktop';
|
142 |
+
}
|
143 |
+
/*$apiUrl = Mage::getStoreConfig('catalog/personalization/api_url');
|
144 |
+
|
145 |
+
$apiUrl .= "get_version/product/1";
|
146 |
+
|
147 |
+
$fileContent = file_get_contents($apiUrl);
|
148 |
+
|
149 |
+
//return 'mobile';
|
150 |
+
|
151 |
+
if($fileContent) {
|
152 |
+
$response = json_decode($fileContent);
|
153 |
+
return $response->app_type;
|
154 |
+
}
|
155 |
+
return 'desktop';*/
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Calls resumePersonalization API function and returns response.
|
160 |
+
*
|
161 |
+
* @param int $templateId
|
162 |
+
* @param string $successUrl
|
163 |
+
* @param string $failUrl
|
164 |
+
* @param string $cancelUrl
|
165 |
+
* @return PrintScience_Personalization_Model_ApiGateway_Response_Begin
|
166 |
+
*/
|
167 |
+
public function resumePersonalization($sessionKey, $productId, $templateId, $successUrl, $failUrl, $cancelUrl)
|
168 |
+
{
|
169 |
+
$apiUrl = Mage::getStoreConfig('catalog/personalization/api_url');
|
170 |
+
$apiVersion = Mage::getStoreConfig('catalog/personalization/api_version');
|
171 |
+
$client = new xmlrpc_client($apiUrl);
|
172 |
+
$function = null;
|
173 |
+
if($templateId!='') {
|
174 |
+
$templateXml = php_xmlrpc_encode($templateId);
|
175 |
+
}
|
176 |
+
// check api version
|
177 |
+
switch($apiVersion)
|
178 |
+
{
|
179 |
+
case '1.0.0':
|
180 |
+
$function = new xmlrpcmsg('resumePersonalization', array(
|
181 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
182 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
183 |
+
php_xmlrpc_encode($sessionKey),
|
184 |
+
php_xmlrpc_encode($productId),
|
185 |
+
php_xmlrpc_encode($successUrl),
|
186 |
+
php_xmlrpc_encode($failUrl),
|
187 |
+
php_xmlrpc_encode($cancelUrl),
|
188 |
+
php_xmlrpc_encode('')
|
189 |
+
));
|
190 |
+
break;
|
191 |
+
case '2.0.0':
|
192 |
+
$function = new xmlrpcmsg('resumePersonalization', array(
|
193 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
194 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
195 |
+
php_xmlrpc_encode($sessionKey),
|
196 |
+
php_xmlrpc_encode($productId),
|
197 |
+
php_xmlrpc_encode($successUrl),
|
198 |
+
php_xmlrpc_encode($failUrl),
|
199 |
+
php_xmlrpc_encode($cancelUrl),
|
200 |
+
php_xmlrpc_encode(''),
|
201 |
+
$templateXml
|
202 |
+
));
|
203 |
+
break;
|
204 |
+
case '4.0.0':
|
205 |
+
$function = new xmlrpcmsg('resumePersonalization', array(
|
206 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
207 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
208 |
+
php_xmlrpc_encode($sessionKey),
|
209 |
+
php_xmlrpc_encode($productId),
|
210 |
+
php_xmlrpc_encode($successUrl),
|
211 |
+
php_xmlrpc_encode($failUrl),
|
212 |
+
php_xmlrpc_encode($cancelUrl),
|
213 |
+
php_xmlrpc_encode(''),
|
214 |
+
$templateXml
|
215 |
+
));
|
216 |
+
break;
|
217 |
+
default:
|
218 |
+
$function = new xmlrpcmsg('resumePersonalization', array(
|
219 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
220 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
221 |
+
php_xmlrpc_encode($sessionKey),
|
222 |
+
php_xmlrpc_encode($productId),
|
223 |
+
php_xmlrpc_encode($successUrl),
|
224 |
+
php_xmlrpc_encode($failUrl),
|
225 |
+
php_xmlrpc_encode($cancelUrl),
|
226 |
+
php_xmlrpc_encode(''),
|
227 |
+
$templateXml
|
228 |
+
));
|
229 |
+
break;
|
230 |
+
}
|
231 |
+
$response = $client->send($function);
|
232 |
+
|
233 |
+
return new PrintScience_Personalization_Model_ApiGateway_Response_Begin($response);
|
234 |
+
}
|
235 |
+
public function sendCurlRequest($url, $parameter=array()) {
|
236 |
+
try {
|
237 |
+
/* initialize curl handle */
|
238 |
+
$ch = curl_init();
|
239 |
+
/* set url to send post request */
|
240 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
241 |
+
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
|
242 |
+
/* allow redirects */
|
243 |
+
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
244 |
+
/* return a response into a variable */
|
245 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
246 |
+
/* times out after 30s */
|
247 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
248 |
+
curl_setopt($ch,CURLOPT_FAILONERROR,true);
|
249 |
+
/* set POST method */
|
250 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
251 |
+
/*false to SSL*/
|
252 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
253 |
+
/* add POST fields parameters */
|
254 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameter);
|
255 |
+
/* execute the cURL */
|
256 |
+
$result = curl_exec($ch);
|
257 |
+
|
258 |
+
// Analyse result
|
259 |
+
if ($result === false) {
|
260 |
+
throw new Exception(sprintf("CURL error (#%d) \"%s\". Requested URL was \"%s\".", curl_errno($ch), curl_error($ch), $url));
|
261 |
+
}
|
262 |
+
|
263 |
+
curl_close($ch);
|
264 |
+
return $result;
|
265 |
+
} catch (Exception $exception) {
|
266 |
+
echo 'Exception Message: ' . $exception->getMessage() . '<br/>';
|
267 |
+
echo 'Exception Trace: ' . $exception->getTraceAsString();
|
268 |
+
}
|
269 |
+
}
|
270 |
}
|
app/code/local/PrintScience/Personalization/Model/Observer.php
CHANGED
@@ -20,7 +20,17 @@ class PrintScience_Personalization_Model_Observer
|
|
20 |
public function checkForCheckoutCartAddAction($observer)
|
21 |
{
|
22 |
$this->_observer = $observer;
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
$controller = $observer->getControllerAction();
|
25 |
$sessionHelper = Mage::helper('printscience_personalization/session');
|
26 |
$request = Mage::app()->getRequest();
|
@@ -86,8 +96,9 @@ class PrintScience_Personalization_Model_Observer
|
|
86 |
|
87 |
// check if template ID is valid
|
88 |
$templateId = $product->getPersonalizationTemplateId();
|
89 |
-
|
90 |
-
|
|
|
91 |
$response->setRedirect($errorUrl)->sendHeaders();
|
92 |
//$datasHelper->_redirectToUrl($errorUrl);
|
93 |
exit();
|
@@ -101,17 +112,20 @@ class PrintScience_Personalization_Model_Observer
|
|
101 |
unset($buyRequestParams['uenc']);
|
102 |
}
|
103 |
$returnUrlParams['_query'] = $buyRequestParams;
|
|
|
104 |
if (isset($returnUrlParams['uenc'])) {
|
105 |
unset($returnUrlParams['uenc']);
|
106 |
}
|
107 |
$returnUrlParams['personalization_session_key'] = $sessionKey;
|
108 |
-
|
109 |
-
|
|
|
110 |
$failUrl = Mage::getUrl('personalization/index/fail', $returnUrlParams);
|
111 |
$cancelUrl = Mage::getUrl('personalization/index/cancel', $returnUrlParams);
|
|
|
112 |
// begin personalization
|
113 |
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
114 |
-
$apiResponse = $apiGateway->beginPersonalization($templateId, $successUrl, $failUrl, $cancelUrl);
|
115 |
if (!$apiResponse) {
|
116 |
$session->addError($controller->__('Unable to start personalization: API response was empty.'));
|
117 |
$response->setRedirect($errorUrl)->sendHeaders();
|
@@ -125,12 +139,15 @@ class PrintScience_Personalization_Model_Observer
|
|
125 |
exit();
|
126 |
}
|
127 |
$apiSessionKey = $apiResponse->getSessionKey();
|
|
|
|
|
128 |
$appUrl = $apiResponse->getAppUrl();
|
129 |
|
130 |
$sessionHelper->addData($sessionKey, array(
|
131 |
'apiSessionKey' => $apiSessionKey,
|
132 |
'appUrl' => $appUrl,
|
133 |
-
'buyRequest' => serialize($buyRequestParams)
|
|
|
134 |
));
|
135 |
|
136 |
$response->setRedirect($appUrl)->sendHeaders();
|
@@ -286,7 +303,7 @@ class PrintScience_Personalization_Model_Observer
|
|
286 |
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.js')
|
287 |
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox.pack.js')
|
288 |
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox.css')
|
289 |
-
|
290 |
->addItem('js_css', 'printscience_personalization/gallery.css');
|
291 |
}
|
292 |
else
|
@@ -295,7 +312,7 @@ class PrintScience_Personalization_Model_Observer
|
|
295 |
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.js')
|
296 |
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox.pack.js')
|
297 |
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox.css')
|
298 |
-
|
299 |
->addItem('js_css', 'printscience_personalization/gallery.css');
|
300 |
|
301 |
}
|
20 |
public function checkForCheckoutCartAddAction($observer)
|
21 |
{
|
22 |
$this->_observer = $observer;
|
23 |
+
|
24 |
+
/*CALL TO CHECK USER DEVICE*/
|
25 |
+
//$sessionHelper = Mage::helper('printscience_personalization/session');
|
26 |
+
//$sessionHelper->unsetData('dummy_user_version');
|
27 |
+
//$dummyuserVersion = $sessionHelper->getData('dummy_user_version');
|
28 |
+
//if(!$dummyuserVersion) {
|
29 |
+
//$dummyapiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
30 |
+
//$userVersion = $dummyapiGateway->getPersonalizationVersion();
|
31 |
+
//$sessionHelper->addData('dummy_user_version', $userVersion);
|
32 |
+
//}
|
33 |
+
/*CALL TO CHECK USER DEVICE*/
|
34 |
$controller = $observer->getControllerAction();
|
35 |
$sessionHelper = Mage::helper('printscience_personalization/session');
|
36 |
$request = Mage::app()->getRequest();
|
96 |
|
97 |
// check if template ID is valid
|
98 |
$templateId = $product->getPersonalizationTemplateId();
|
99 |
+
$productId = $product->getPersonalizationProductId();
|
100 |
+
if (!$productId) {
|
101 |
+
$session->addError($controller->__('Unable to start personalization: product ID is empty.'));
|
102 |
$response->setRedirect($errorUrl)->sendHeaders();
|
103 |
//$datasHelper->_redirectToUrl($errorUrl);
|
104 |
exit();
|
112 |
unset($buyRequestParams['uenc']);
|
113 |
}
|
114 |
$returnUrlParams['_query'] = $buyRequestParams;
|
115 |
+
|
116 |
if (isset($returnUrlParams['uenc'])) {
|
117 |
unset($returnUrlParams['uenc']);
|
118 |
}
|
119 |
$returnUrlParams['personalization_session_key'] = $sessionKey;
|
120 |
+
$returnUrlParams['_secure'] = true;
|
121 |
+
|
122 |
+
$successUrl = Mage::getUrl('personalization/index/success', $returnUrlParams);
|
123 |
$failUrl = Mage::getUrl('personalization/index/fail', $returnUrlParams);
|
124 |
$cancelUrl = Mage::getUrl('personalization/index/cancel', $returnUrlParams);
|
125 |
+
|
126 |
// begin personalization
|
127 |
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
128 |
+
$apiResponse = $apiGateway->beginPersonalization($productId, $templateId, $successUrl, $failUrl, $cancelUrl);
|
129 |
if (!$apiResponse) {
|
130 |
$session->addError($controller->__('Unable to start personalization: API response was empty.'));
|
131 |
$response->setRedirect($errorUrl)->sendHeaders();
|
139 |
exit();
|
140 |
}
|
141 |
$apiSessionKey = $apiResponse->getSessionKey();
|
142 |
+
|
143 |
+
$userVersion = $apiGateway->getPersonalizationVersion($apiSessionKey);
|
144 |
$appUrl = $apiResponse->getAppUrl();
|
145 |
|
146 |
$sessionHelper->addData($sessionKey, array(
|
147 |
'apiSessionKey' => $apiSessionKey,
|
148 |
'appUrl' => $appUrl,
|
149 |
+
'buyRequest' => serialize($buyRequestParams),
|
150 |
+
'userVersion' => $userVersion,
|
151 |
));
|
152 |
|
153 |
$response->setRedirect($appUrl)->sendHeaders();
|
303 |
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.js')
|
304 |
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox.pack.js')
|
305 |
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox.css')
|
306 |
+
//->addJs('printscience_personalization/gallery.js')
|
307 |
->addItem('js_css', 'printscience_personalization/gallery.css');
|
308 |
}
|
309 |
else
|
312 |
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.js')
|
313 |
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox.pack.js')
|
314 |
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox.css')
|
315 |
+
//->addJs('printscience_personalization/gallery.js')
|
316 |
->addItem('js_css', 'printscience_personalization/gallery.css');
|
317 |
|
318 |
}
|
app/code/local/PrintScience/Personalization/Model/Override/Sales/Quote.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
class PrintScience_Personalization_Model_Override_Sales_Quote extends Mage_Sales_Model_Quote
|
3 |
-
{
|
4 |
-
public function updateItem($itemId, $buyRequest, $params = null)
|
5 |
-
{
|
6 |
-
$item = $this->getItemById($itemId);
|
7 |
-
$personalization_session_key = $item->getBuyRequest()->getData('personalization_session_key');
|
8 |
-
if(!empty($personalization_session_key)){
|
9 |
-
$item->setQty($buyRequest->getQty());
|
10 |
-
return $item;
|
11 |
-
}
|
12 |
-
else{
|
13 |
-
return parent::updateItem($itemId, $buyRequest, $params);
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}
|
1 |
+
<?php
|
2 |
+
class PrintScience_Personalization_Model_Override_Sales_Quote extends Mage_Sales_Model_Quote
|
3 |
+
{
|
4 |
+
public function updateItem($itemId, $buyRequest, $params = null)
|
5 |
+
{
|
6 |
+
$item = $this->getItemById($itemId);
|
7 |
+
$personalization_session_key = $item->getBuyRequest()->getData('personalization_session_key');
|
8 |
+
if(!empty($personalization_session_key)){
|
9 |
+
$item->setQty($buyRequest->getQty());
|
10 |
+
return $item;
|
11 |
+
}
|
12 |
+
else{
|
13 |
+
return parent::updateItem($itemId, $buyRequest, $params);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
app/code/local/PrintScience/Personalization/Model/Resource/Eav/Mysql4/Setup.php
CHANGED
@@ -1,102 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Print Science Product Personalization setup
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class PrintScience_Personalization_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Prepare personalization attribute values to save
|
10 |
-
*
|
11 |
-
* @param array $attr
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
protected function _prepareValues($attr)
|
15 |
-
{
|
16 |
-
$data = parent::_prepareValues($attr);
|
17 |
-
$data = array_merge($data, array(
|
18 |
-
'frontend_input_renderer' => $this->_getValue($attr, 'input_renderer', ''),
|
19 |
-
'is_global' => $this->_getValue($attr, 'global', 1),
|
20 |
-
'is_visible' => $this->_getValue($attr, 'visible', 1),
|
21 |
-
'is_searchable' => $this->_getValue($attr, 'searchable', 0),
|
22 |
-
'is_filterable' => $this->_getValue($attr, 'filterable', 0),
|
23 |
-
'is_comparable' => $this->_getValue($attr, 'comparable', 0),
|
24 |
-
'is_visible_on_front' => $this->_getValue($attr, 'visible_on_front', 0),
|
25 |
-
'is_wysiwyg_enabled' => $this->_getValue($attr, 'wysiwyg_enabled', 0),
|
26 |
-
'is_html_allowed_on_front' => $this->_getValue($attr, 'is_html_allowed_on_front', 0),
|
27 |
-
'is_visible_in_advanced_search'
|
28 |
-
=> $this->_getValue($attr, 'visible_in_advanced_search', 0),
|
29 |
-
'is_filterable_in_search' => $this->_getValue($attr, 'filterable_in_search', 0),
|
30 |
-
'used_in_product_listing' => $this->_getValue($attr, 'used_in_product_listing', 0),
|
31 |
-
'used_for_sort_by' => $this->_getValue($attr, 'used_for_sort_by', 0),
|
32 |
-
'apply_to' => $this->_getValue($attr, 'apply_to', ''),
|
33 |
-
'position' => $this->_getValue($attr, 'position', 0),
|
34 |
-
'is_configurable' => $this->_getValue($attr, 'is_configurable', 1),
|
35 |
-
'is_used_for_promo_rules' => $this->_getValue($attr, 'used_for_promo_rules', 0)
|
36 |
-
));
|
37 |
-
return $data;
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Get entities to setup
|
42 |
-
*
|
43 |
-
* @return array
|
44 |
-
*/
|
45 |
-
public function getDefaultEntities()
|
46 |
-
{
|
47 |
-
return array(
|
48 |
-
'catalog_product' => array(
|
49 |
-
'entity_model' => 'catalog/product',
|
50 |
-
'attribute_model' => 'catalog/resource_eav_attribute',
|
51 |
-
'table' => 'catalog/product',
|
52 |
-
'additional_attribute_table' => 'catalog/eav_attribute',
|
53 |
-
'entity_attribute_collection' => 'catalog/product_attribute_collection',
|
54 |
-
'attributes' => array(
|
55 |
-
'personalization_enabled' => array(
|
56 |
-
'group' => 'Personalization',
|
57 |
-
'type' => 'int',
|
58 |
-
'backend' => '',
|
59 |
-
'frontend' => '',
|
60 |
-
'label' => 'Enable Personalization',
|
61 |
-
'input' => 'boolean',
|
62 |
-
'class' => '',
|
63 |
-
'source' => '',
|
64 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
65 |
-
'visible' => true,
|
66 |
-
'required' => false,
|
67 |
-
'user_defined' => false,
|
68 |
-
'default' => '',
|
69 |
-
'searchable' => false,
|
70 |
-
'filterable' => false,
|
71 |
-
'comparable' => false,
|
72 |
-
'visible_on_front' => false,
|
73 |
-
'unique' => false,
|
74 |
-
'apply_to' => 'simple',
|
75 |
-
'used_in_product_listing' => 1
|
76 |
-
),
|
77 |
-
'personalization_template_id' => array(
|
78 |
-
'group' => 'Personalization',
|
79 |
-
'type' => 'varchar',
|
80 |
-
'backend' => '',
|
81 |
-
'frontend' => '',
|
82 |
-
'label' => '
|
83 |
-
'input' => 'text',
|
84 |
-
'class' => '',
|
85 |
-
'source' => '',
|
86 |
-
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
87 |
-
'visible' => true,
|
88 |
-
'required' => false,
|
89 |
-
'user_defined' => false,
|
90 |
-
'default' => '',
|
91 |
-
'searchable' => false,
|
92 |
-
'filterable' => false,
|
93 |
-
'comparable' => false,
|
94 |
-
'visible_on_front' => false,
|
95 |
-
'unique' => false,
|
96 |
-
'apply_to' => 'simple'
|
97 |
-
)
|
98 |
-
)
|
99 |
-
)
|
100 |
-
);
|
101 |
-
}
|
102 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Print Science Product Personalization setup
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class PrintScience_Personalization_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Prepare personalization attribute values to save
|
10 |
+
*
|
11 |
+
* @param array $attr
|
12 |
+
* @return array
|
13 |
+
*/
|
14 |
+
protected function _prepareValues($attr)
|
15 |
+
{
|
16 |
+
$data = parent::_prepareValues($attr);
|
17 |
+
$data = array_merge($data, array(
|
18 |
+
'frontend_input_renderer' => $this->_getValue($attr, 'input_renderer', ''),
|
19 |
+
'is_global' => $this->_getValue($attr, 'global', 1),
|
20 |
+
'is_visible' => $this->_getValue($attr, 'visible', 1),
|
21 |
+
'is_searchable' => $this->_getValue($attr, 'searchable', 0),
|
22 |
+
'is_filterable' => $this->_getValue($attr, 'filterable', 0),
|
23 |
+
'is_comparable' => $this->_getValue($attr, 'comparable', 0),
|
24 |
+
'is_visible_on_front' => $this->_getValue($attr, 'visible_on_front', 0),
|
25 |
+
'is_wysiwyg_enabled' => $this->_getValue($attr, 'wysiwyg_enabled', 0),
|
26 |
+
'is_html_allowed_on_front' => $this->_getValue($attr, 'is_html_allowed_on_front', 0),
|
27 |
+
'is_visible_in_advanced_search'
|
28 |
+
=> $this->_getValue($attr, 'visible_in_advanced_search', 0),
|
29 |
+
'is_filterable_in_search' => $this->_getValue($attr, 'filterable_in_search', 0),
|
30 |
+
'used_in_product_listing' => $this->_getValue($attr, 'used_in_product_listing', 0),
|
31 |
+
'used_for_sort_by' => $this->_getValue($attr, 'used_for_sort_by', 0),
|
32 |
+
'apply_to' => $this->_getValue($attr, 'apply_to', ''),
|
33 |
+
'position' => $this->_getValue($attr, 'position', 0),
|
34 |
+
'is_configurable' => $this->_getValue($attr, 'is_configurable', 1),
|
35 |
+
'is_used_for_promo_rules' => $this->_getValue($attr, 'used_for_promo_rules', 0)
|
36 |
+
));
|
37 |
+
return $data;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get entities to setup
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function getDefaultEntities()
|
46 |
+
{
|
47 |
+
return array(
|
48 |
+
'catalog_product' => array(
|
49 |
+
'entity_model' => 'catalog/product',
|
50 |
+
'attribute_model' => 'catalog/resource_eav_attribute',
|
51 |
+
'table' => 'catalog/product',
|
52 |
+
'additional_attribute_table' => 'catalog/eav_attribute',
|
53 |
+
'entity_attribute_collection' => 'catalog/product_attribute_collection',
|
54 |
+
'attributes' => array(
|
55 |
+
'personalization_enabled' => array(
|
56 |
+
'group' => 'Personalization',
|
57 |
+
'type' => 'int',
|
58 |
+
'backend' => '',
|
59 |
+
'frontend' => '',
|
60 |
+
'label' => 'Enable Personalization',
|
61 |
+
'input' => 'boolean',
|
62 |
+
'class' => '',
|
63 |
+
'source' => '',
|
64 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
65 |
+
'visible' => true,
|
66 |
+
'required' => false,
|
67 |
+
'user_defined' => false,
|
68 |
+
'default' => '',
|
69 |
+
'searchable' => false,
|
70 |
+
'filterable' => false,
|
71 |
+
'comparable' => false,
|
72 |
+
'visible_on_front' => false,
|
73 |
+
'unique' => false,
|
74 |
+
'apply_to' => 'simple',
|
75 |
+
'used_in_product_listing' => 1
|
76 |
+
),
|
77 |
+
'personalization_template_id' => array(
|
78 |
+
'group' => 'Personalization',
|
79 |
+
'type' => 'varchar',
|
80 |
+
'backend' => '',
|
81 |
+
'frontend' => '',
|
82 |
+
'label' => 'Template ID',
|
83 |
+
'input' => 'text',
|
84 |
+
'class' => '',
|
85 |
+
'source' => '',
|
86 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
87 |
+
'visible' => true,
|
88 |
+
'required' => false,
|
89 |
+
'user_defined' => false,
|
90 |
+
'default' => '',
|
91 |
+
'searchable' => false,
|
92 |
+
'filterable' => false,
|
93 |
+
'comparable' => false,
|
94 |
+
'visible_on_front' => false,
|
95 |
+
'unique' => false,
|
96 |
+
'apply_to' => 'simple'
|
97 |
+
)
|
98 |
+
)
|
99 |
+
)
|
100 |
+
);
|
101 |
+
}
|
102 |
}
|
app/code/local/PrintScience/Personalization/Model/System/Config/Source/WindowType.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Personalization API URL backend
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class PrintScience_Personalization_Model_System_Config_Source_WindowType
|
7 |
-
{
|
8 |
-
public function toOptionArray()
|
9 |
-
{
|
10 |
-
return array(
|
11 |
-
array('value'=>'1', 'label'=>Mage::helper('printscience_personalization')->__('New Window')),
|
12 |
-
array('value'=>'2', 'label'=>Mage::helper('printscience_personalization')->__('Modal Pop-up window')),
|
13 |
-
);
|
14 |
-
}
|
15 |
-
}
|
16 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Personalization API URL backend
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class PrintScience_Personalization_Model_System_Config_Source_WindowType
|
7 |
+
{
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value'=>'1', 'label'=>Mage::helper('printscience_personalization')->__('New Window')),
|
12 |
+
array('value'=>'2', 'label'=>Mage::helper('printscience_personalization')->__('Modal Pop-up window')),
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
16 |
?>
|
app/code/local/PrintScience/Personalization/controllers/IndexController.php
CHANGED
@@ -1,346 +1,375 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Personalization controller
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class PrintScience_Personalization_IndexController extends Mage_Core_Controller_Front_Action
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Personalization startShoppingCart action handler
|
10 |
-
*
|
11 |
-
* @return boolean
|
12 |
-
*/
|
13 |
-
public function startShoppingCartAction()
|
14 |
-
{
|
15 |
-
$session = Mage::getSingleton('core/session');
|
16 |
-
$sessionHelper = Mage::helper('printscience_personalization/session');
|
17 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
18 |
-
$datasHelper = Mage::helper('printscience_personalization/data');
|
19 |
-
$homeUrl = Mage::getUrl('home');
|
20 |
-
$request = $this->getRequest();
|
21 |
-
|
22 |
-
$apiSessionKey = $request->getParam('api_session_key');
|
23 |
-
$isValidRequest = false;
|
24 |
-
if ($apiSessionKey) {
|
25 |
-
$cartItem = $quoteHelper->getCartItemByApiSessionKey($apiSessionKey);
|
26 |
-
if ($cartItem) {
|
27 |
-
$isValidRequest = true;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
if (!$isValidRequest) {
|
31 |
-
$session->addError($this->__('Invalid request.'));
|
32 |
-
//$this->_redirect('home');
|
33 |
-
$datasHelper->_redirectToUrl($homeUrl);
|
34 |
-
return false;
|
35 |
-
}
|
36 |
-
|
37 |
-
$cartItemData = $quoteHelper->getItemData($cartItem);
|
38 |
-
|
39 |
-
$sessionHelper->addData($cartItemData['sessionKey'], array(
|
40 |
-
'apiSessionKey' => $cartItemData['apiSessionKey'],
|
41 |
-
));
|
42 |
-
|
43 |
-
//$this->_redirectUrl($cartItemData['appUrl']);
|
44 |
-
$datasHelper->_redirectToUrl($cartItemData['appUrl']);
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Personalization startShoppingCart action handler
|
49 |
-
*
|
50 |
-
* @return boolean
|
51 |
-
*/
|
52 |
-
public function resumeShoppingCartAction()
|
53 |
-
{
|
54 |
-
$session = Mage::getSingleton('core/session');
|
55 |
-
$sessionHelper = Mage::helper('printscience_personalization/session');
|
56 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
57 |
-
$datasHelper = Mage::helper('printscience_personalization/data');
|
58 |
-
$request = $this->getRequest();
|
59 |
-
$errorUrl = Mage::getUrl('checkout/cart');
|
60 |
-
|
61 |
-
$apiSessionKey = $request->getParam('api_session_key');
|
62 |
-
$productId = intval($request->getParam('product'));
|
63 |
-
$product = Mage::getModel('catalog/product')
|
64 |
-
->setStoreId(Mage::app()->getStore()->getId())
|
65 |
-
->load($productId);
|
66 |
-
if (!$product->getId()) {
|
67 |
-
$session->addError($this->__('Invalid request.'));
|
68 |
-
//$this->_redirect($errorUrl);
|
69 |
-
$datasHelper->_redirectToUrl($errorUrl);
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Check if personalization is enabled for this product.
|
75 |
-
* If this is simple product then we need to check its 'personalization_enabled' attribute.
|
76 |
-
* If this is configurable product then we need to check 'personalization_enabled' attribute of its subproduct.
|
77 |
-
* No other product types are supported.
|
78 |
-
*/
|
79 |
-
$isValidProduct = true;
|
80 |
-
|
81 |
-
$productTypeId = $product->getTypeId();
|
82 |
-
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
83 |
-
if (!$product->getPersonalizationEnabled()) {
|
84 |
-
$isValidProduct = false;
|
85 |
-
}
|
86 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
87 |
-
$attributes = $request->getParam('super_attribute');
|
88 |
-
$product = $product->getTypeInstance()->getProductByAttributes($attributes);
|
89 |
-
if ((!$product) || (!$product->getPersonalizationEnabled())) {
|
90 |
-
$isValidProduct = false;
|
91 |
-
}
|
92 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
93 |
-
if (!$product->getPersonalizationEnabled()) {
|
94 |
-
$isValidProduct = false;
|
95 |
-
}
|
96 |
-
} else {
|
97 |
-
$isValidProduct = false;
|
98 |
-
}
|
99 |
-
|
100 |
-
if (!$isValidProduct) {
|
101 |
-
$session->addError($this->__('Invalid Product.'));
|
102 |
-
//$this->_redirect($errorUrl);
|
103 |
-
$datasHelper->_redirectToUrl($errorUrl);
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
// check if template ID is valid
|
107 |
-
$templateId = $product->getPersonalizationTemplateId();
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
$sessionKey
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$returnUrlParams['
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
$
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
$
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
$
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
}
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Personalization controller
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class PrintScience_Personalization_IndexController extends Mage_Core_Controller_Front_Action
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Personalization startShoppingCart action handler
|
10 |
+
*
|
11 |
+
* @return boolean
|
12 |
+
*/
|
13 |
+
public function startShoppingCartAction()
|
14 |
+
{
|
15 |
+
$session = Mage::getSingleton('core/session');
|
16 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
17 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
18 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
19 |
+
$homeUrl = Mage::getUrl('home');
|
20 |
+
$request = $this->getRequest();
|
21 |
+
|
22 |
+
$apiSessionKey = $request->getParam('api_session_key');
|
23 |
+
$isValidRequest = false;
|
24 |
+
if ($apiSessionKey) {
|
25 |
+
$cartItem = $quoteHelper->getCartItemByApiSessionKey($apiSessionKey);
|
26 |
+
if ($cartItem) {
|
27 |
+
$isValidRequest = true;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
if (!$isValidRequest) {
|
31 |
+
$session->addError($this->__('Invalid request.'));
|
32 |
+
//$this->_redirect('home');
|
33 |
+
$datasHelper->_redirectToUrl($homeUrl);
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
$cartItemData = $quoteHelper->getItemData($cartItem);
|
38 |
+
|
39 |
+
$sessionHelper->addData($cartItemData['sessionKey'], array(
|
40 |
+
'apiSessionKey' => $cartItemData['apiSessionKey'],
|
41 |
+
));
|
42 |
+
|
43 |
+
//$this->_redirectUrl($cartItemData['appUrl']);
|
44 |
+
$datasHelper->_redirectToUrl($cartItemData['appUrl']);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Personalization startShoppingCart action handler
|
49 |
+
*
|
50 |
+
* @return boolean
|
51 |
+
*/
|
52 |
+
public function resumeShoppingCartAction()
|
53 |
+
{
|
54 |
+
$session = Mage::getSingleton('core/session');
|
55 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
56 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
57 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
58 |
+
$request = $this->getRequest();
|
59 |
+
$errorUrl = Mage::getUrl('checkout/cart');
|
60 |
+
|
61 |
+
$apiSessionKey = $request->getParam('api_session_key');
|
62 |
+
$productId = intval($request->getParam('product'));
|
63 |
+
$product = Mage::getModel('catalog/product')
|
64 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
65 |
+
->load($productId);
|
66 |
+
if (!$product->getId()) {
|
67 |
+
$session->addError($this->__('Invalid request.'));
|
68 |
+
//$this->_redirect($errorUrl);
|
69 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Check if personalization is enabled for this product.
|
75 |
+
* If this is simple product then we need to check its 'personalization_enabled' attribute.
|
76 |
+
* If this is configurable product then we need to check 'personalization_enabled' attribute of its subproduct.
|
77 |
+
* No other product types are supported.
|
78 |
+
*/
|
79 |
+
$isValidProduct = true;
|
80 |
+
|
81 |
+
$productTypeId = $product->getTypeId();
|
82 |
+
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
83 |
+
if (!$product->getPersonalizationEnabled()) {
|
84 |
+
$isValidProduct = false;
|
85 |
+
}
|
86 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
87 |
+
$attributes = $request->getParam('super_attribute');
|
88 |
+
$product = $product->getTypeInstance()->getProductByAttributes($attributes);
|
89 |
+
if ((!$product) || (!$product->getPersonalizationEnabled())) {
|
90 |
+
$isValidProduct = false;
|
91 |
+
}
|
92 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
93 |
+
if (!$product->getPersonalizationEnabled()) {
|
94 |
+
$isValidProduct = false;
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$isValidProduct = false;
|
98 |
+
}
|
99 |
+
|
100 |
+
if (!$isValidProduct) {
|
101 |
+
$session->addError($this->__('Invalid Product.'));
|
102 |
+
//$this->_redirect($errorUrl);
|
103 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
104 |
+
return false;
|
105 |
+
}
|
106 |
+
// check if template ID is valid
|
107 |
+
$templateId = $product->getPersonalizationTemplateId();
|
108 |
+
$productId = $product->getPersonalizationProductId();
|
109 |
+
if (!$productId) {
|
110 |
+
$session->addError($controller->__('Unable to start personalization: product ID is empty.'));
|
111 |
+
//$this->_redirect($errorUrl);
|
112 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
|
116 |
+
$isValidRequest = false;
|
117 |
+
if ($apiSessionKey) {
|
118 |
+
$cartItem = $quoteHelper->getCartItemByApiSessionKey($apiSessionKey);
|
119 |
+
if ($cartItem) {
|
120 |
+
$isValidRequest = true;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
if (!$isValidRequest) {
|
124 |
+
$session->addError($this->__('Invalid request.'));
|
125 |
+
//$this->_redirect($errorUrl);
|
126 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
$cartItemData = $quoteHelper->getItemData($cartItem);
|
131 |
+
|
132 |
+
$sessionHelper->addData($cartItemData['sessionKey'], array(
|
133 |
+
'apiSessionKey' => $cartItemData['apiSessionKey'],
|
134 |
+
));
|
135 |
+
$sessionKey = $cartItemData['sessionKey'];
|
136 |
+
$sessionKey = $sessionHelper->generateKey();
|
137 |
+
|
138 |
+
$buyRequestParams = $request->getParams();
|
139 |
+
if (isset($buyRequestParams['uenc'])) {
|
140 |
+
unset($buyRequestParams['uenc']);
|
141 |
+
}
|
142 |
+
$returnUrlParams['_query'] = $buyRequestParams;
|
143 |
+
$returnUrlParams['personalization_session_key'] = $apiSessionKey;
|
144 |
+
$returnUrlParams['_secure'] = true;
|
145 |
+
|
146 |
+
$successUrl = Mage::getUrl('personalization/index/success', $returnUrlParams);
|
147 |
+
$failUrl = Mage::getUrl('personalization/index/fail', $returnUrlParams);
|
148 |
+
$cancelUrl = Mage::getUrl('personalization/index/cancel', $returnUrlParams);
|
149 |
+
|
150 |
+
// begin personalization
|
151 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
152 |
+
$apiResponse = $apiGateway->resumePersonalization($apiSessionKey, $productId, $templateId, $successUrl, $failUrl, $cancelUrl);
|
153 |
+
if (!$apiResponse) {
|
154 |
+
$session->addError($this->__('Unable to start personalization: API response was empty.'));
|
155 |
+
//$this->_redirect($errorUrl);
|
156 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
if ($apiResponse->getFaultCode()) {
|
160 |
+
$session->addError($this->__('Unable to start personalization: ' . $apiResponse->getFaultString()));
|
161 |
+
//$this->_redirect($errorUrl);
|
162 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
163 |
+
return false;
|
164 |
+
}
|
165 |
+
$apiSessionKey = $apiResponse->getSessionKey();
|
166 |
+
|
167 |
+
$userVersion = $apiGateway->getPersonalizationVersion();
|
168 |
+
|
169 |
+
$appUrl = $apiResponse->getAppUrl();
|
170 |
+
|
171 |
+
$sessionHelper->addData($apiSessionKey, array(
|
172 |
+
'apiSessionKey' => $apiSessionKey,
|
173 |
+
'appUrl' => $appUrl,
|
174 |
+
'buyRequest' => serialize($buyRequestParams),
|
175 |
+
'userVersion' => $userVersion,
|
176 |
+
));
|
177 |
+
|
178 |
+
$this->_redirectUrl($appUrl);
|
179 |
+
//$datasHelper->_redirectToUrl($appUrl);
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Personalization success action handler.
|
185 |
+
*
|
186 |
+
* @return boolean
|
187 |
+
*/
|
188 |
+
public function successAction()
|
189 |
+
{
|
190 |
+
$session = Mage::getSingleton('core/session');
|
191 |
+
$request = $this->getRequest();
|
192 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
193 |
+
$homeUrl = Mage::getUrl('home');
|
194 |
+
|
195 |
+
if (!$this->_isValidRequest()) {
|
196 |
+
$session->addError($this->__('Invalid request.'));
|
197 |
+
//$this->_redirect('home');
|
198 |
+
$datasHelper->_redirectToUrl($homeUrl);
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
|
202 |
+
$product = $this->_initProduct();
|
203 |
+
if (!$product) {
|
204 |
+
$session->addError($this->__('Personalization error: product not found.'));
|
205 |
+
//$this->_redirect('home');
|
206 |
+
$datasHelper->_redirectToUrl($homeUrl);
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
211 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
212 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
213 |
+
|
214 |
+
$sessionKey = $request->getParam('personalization_session_key');
|
215 |
+
$sessionData = $sessionHelper->getData($sessionKey);
|
216 |
+
$apiSessionKey = $sessionData['apiSessionKey'];
|
217 |
+
|
218 |
+
// is item with this API session key already in cart?
|
219 |
+
$cartItem = $quoteHelper->getCartItemByApiSessionKey($apiSessionKey);
|
220 |
+
|
221 |
+
if (!$cartItem) {
|
222 |
+
$errorUrl = $product->getProductUrl();
|
223 |
+
} else {
|
224 |
+
$errorUrl = Mage::getUrl('checkout/cart');
|
225 |
+
}
|
226 |
+
|
227 |
+
$apiResponse = $apiGateway->getPreview($apiSessionKey);
|
228 |
+
if ($apiResponse->getFaultCode()) {
|
229 |
+
$session->addError($this->__('Personalization was not completed.'));
|
230 |
+
//$this->_redirectUrl($errorUrl);
|
231 |
+
$datasHelper->_redirectToUrl($errorUrl);
|
232 |
+
return false;
|
233 |
+
}
|
234 |
+
if (!$cartItem) {
|
235 |
+
Mage::register('PrintScience_Personalization_calledFromSuccessAction', true);
|
236 |
+
$this->_forward('add', 'cart', 'checkout');
|
237 |
+
} else {
|
238 |
+
$checkOutUrl = Mage::getUrl('checkout/cart');
|
239 |
+
$datasHelper->_redirectToUrl($checkOutUrl);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Personalization cancel action handler
|
245 |
+
*
|
246 |
+
* @return boolean
|
247 |
+
*/
|
248 |
+
public function cancelAction()
|
249 |
+
{
|
250 |
+
$session = Mage::getSingleton('core/session');
|
251 |
+
$request = $this->getRequest();
|
252 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
253 |
+
$homeUrl = Mage::getUrl('home');
|
254 |
+
|
255 |
+
if (!$this->_isValidRequest()) {
|
256 |
+
$session->addError($this->__('Invalid request.'));
|
257 |
+
//$this->_redirect('home');
|
258 |
+
$datasHelper->_redirectToUrl($homeUrl);
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
|
262 |
+
$product = $this->_initProduct();
|
263 |
+
if (!$product) {
|
264 |
+
$session->addError($this->__('Personalization error: product not found.'));
|
265 |
+
//$this->_redirect('home');
|
266 |
+
$datasHelper->_redirectToUrl($homeUrl);
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
|
270 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
271 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
272 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
273 |
+
|
274 |
+
$sessionKey = $request->getParam('personalization_session_key');
|
275 |
+
$sessionData = $sessionHelper->getData($sessionKey);
|
276 |
+
$apiSessionKey = $sessionData['apiSessionKey'];
|
277 |
+
|
278 |
+
// is item with this API session key already in cart?
|
279 |
+
$cartItem = $quoteHelper->getCartItemByApiSessionKey($apiSessionKey);
|
280 |
+
|
281 |
+
if (!$cartItem) {
|
282 |
+
$apiGateway->endPersonalization($apiSessionKey);
|
283 |
+
$sessionHelper->unsetData($sessionKey);
|
284 |
+
$redirectUrl = $product->getProductUrl();
|
285 |
+
} else {
|
286 |
+
$redirectUrl = Mage::getUrl('checkout/cart');
|
287 |
+
}
|
288 |
+
|
289 |
+
//$this->_redirectUrl($redirectUrl);
|
290 |
+
$datasHelper->_redirectToUrl($redirectUrl);
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Personalization fail action handler
|
295 |
+
*
|
296 |
+
*/
|
297 |
+
public function failAction()
|
298 |
+
{
|
299 |
+
$this->_forward('cancel');
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Initialize product instance from request data
|
304 |
+
*
|
305 |
+
* @return Mage_Catalog_Model_Product | false
|
306 |
+
*/
|
307 |
+
private function _initProduct()
|
308 |
+
{
|
309 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
310 |
+
if ($productId) {
|
311 |
+
$product = Mage::getModel('catalog/product')
|
312 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
313 |
+
->load($productId);
|
314 |
+
if ($product->getId()) {
|
315 |
+
return $product;
|
316 |
+
}
|
317 |
+
}
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Check if current request to Success, Cancel or Fail action is valid
|
323 |
+
*
|
324 |
+
* @return boolean
|
325 |
+
*/
|
326 |
+
private function _isValidRequest()
|
327 |
+
{
|
328 |
+
$request = $this->getRequest();
|
329 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
330 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
331 |
+
|
332 |
+
$sessionKey = $request->getParam('personalization_session_key');
|
333 |
+
|
334 |
+
if ($sessionKey) {
|
335 |
+
$sessionData = $sessionHelper->getData($sessionKey);
|
336 |
+
if ($sessionData) {
|
337 |
+
// no need to validate buyRequest params if item is already in cart
|
338 |
+
$cartItem = $quoteHelper->getCartItemByApiSessionKey($sessionData['apiSessionKey']);
|
339 |
+
if ($cartItem) {
|
340 |
+
return true;
|
341 |
+
} else {
|
342 |
+
$buyRequestParams = $request->getParams();
|
343 |
+
unset($buyRequestParams['personalization_session_key']);
|
344 |
+
if (unserialize($sessionData['buyRequest']) == $buyRequestParams) {
|
345 |
+
return true;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
}
|
350 |
+
return false;
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Personalization fail action handler
|
355 |
+
*
|
356 |
+
*/
|
357 |
+
public function setversionAction()
|
358 |
+
{
|
359 |
+
$version = $this->getRequest()->getParam('version');
|
360 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
361 |
+
$sessionHelper->addData('dummy_user_version', $version);
|
362 |
+
}
|
363 |
+
|
364 |
+
public function getversionAction()
|
365 |
+
{
|
366 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
367 |
+
//$sessionHelper->unsetData('dummy_user_version');
|
368 |
+
$dummyuserVersion = $sessionHelper->getData('dummy_user_version');
|
369 |
+
if($dummyuserVersion) {
|
370 |
+
echo $dummyuserVersion;
|
371 |
+
} else {
|
372 |
+
return false;
|
373 |
+
}
|
374 |
+
}
|
375 |
}
|
app/code/local/PrintScience/Personalization/controllers/TestController.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'xmlrpc/xmlrpc.inc';
|
3 |
+
/**
|
4 |
+
* Test the connection
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class PrintScience_Personalization_TestController extends Mage_Adminhtml_Controller_Action
|
8 |
+
{
|
9 |
+
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$success = true;
|
13 |
+
try {
|
14 |
+
$_helper = Mage::helper('printscience_personalization/data');
|
15 |
+
|
16 |
+
$apiUrl = Mage::getStoreConfig('catalog/personalization/api_url');
|
17 |
+
$apiVersion = Mage::getStoreConfig('catalog/personalization/api_version');
|
18 |
+
$magelocale = Mage::app()->getLocale()->getLocaleCode();
|
19 |
+
$localeParts = explode('_',$magelocale);
|
20 |
+
$locale=$localeParts[0];
|
21 |
+
$client = new xmlrpc_client($apiUrl);
|
22 |
+
$function = null;
|
23 |
+
switch($apiVersion)
|
24 |
+
{
|
25 |
+
case '1.0.0':
|
26 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
27 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
28 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
29 |
+
php_xmlrpc_encode(''),
|
30 |
+
php_xmlrpc_encode(''),
|
31 |
+
php_xmlrpc_encode(''),
|
32 |
+
php_xmlrpc_encode(''),
|
33 |
+
php_xmlrpc_encode('')
|
34 |
+
));
|
35 |
+
break;
|
36 |
+
case '2.0.0':
|
37 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
38 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
39 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
40 |
+
php_xmlrpc_encode(''),
|
41 |
+
php_xmlrpc_encode(''),
|
42 |
+
php_xmlrpc_encode(''),
|
43 |
+
php_xmlrpc_encode(''),
|
44 |
+
php_xmlrpc_encode(''),
|
45 |
+
php_xmlrpc_encode('en'),
|
46 |
+
php_xmlrpc_encode(''),
|
47 |
+
php_xmlrpc_encode('')
|
48 |
+
));
|
49 |
+
break;
|
50 |
+
case '4.0.0':
|
51 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
52 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
53 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
54 |
+
php_xmlrpc_encode(''),
|
55 |
+
php_xmlrpc_encode(''),
|
56 |
+
php_xmlrpc_encode(''),
|
57 |
+
php_xmlrpc_encode(''),
|
58 |
+
php_xmlrpc_encode(''),
|
59 |
+
php_xmlrpc_encode($locale)
|
60 |
+
));
|
61 |
+
break;
|
62 |
+
default:
|
63 |
+
$function = new xmlrpcmsg('beginPersonalization', array(
|
64 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_username')),
|
65 |
+
php_xmlrpc_encode(Mage::getStoreConfig('catalog/personalization/api_password')),
|
66 |
+
php_xmlrpc_encode(''),
|
67 |
+
php_xmlrpc_encode(''),
|
68 |
+
php_xmlrpc_encode(''),
|
69 |
+
php_xmlrpc_encode(''),
|
70 |
+
php_xmlrpc_encode('')
|
71 |
+
));
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
$response = $client->send($function);
|
75 |
+
$APIErrorCode = $response->errno;
|
76 |
+
/********************** CHECK FOR API CONNECTION *************/
|
77 |
+
|
78 |
+
if ($APIErrorCode == '3' || $APIErrorCode == '1') {
|
79 |
+
$success = false;
|
80 |
+
}
|
81 |
+
} catch (Exception $e) {
|
82 |
+
|
83 |
+
$success = false;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($success) {
|
87 |
+
$msg = $msg . $_helper->__("Your API credentials are working fine.");
|
88 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($msg);
|
89 |
+
} else {
|
90 |
+
$msg = $msg . $_helper->__("Your API credentials are wrong, please check and try again.");
|
91 |
+
Mage::getSingleton('adminhtml/session')->addError($msg);
|
92 |
+
}
|
93 |
+
$this->_redirectReferer();
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
|
app/code/local/PrintScience/Personalization/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<PrintScience_Personalization>
|
5 |
-
<version>1.
|
6 |
</PrintScience_Personalization>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<PrintScience_Personalization>
|
5 |
+
<version>1.1.2</version>
|
6 |
</PrintScience_Personalization>
|
7 |
</modules>
|
8 |
<frontend>
|
app/code/local/PrintScience/Personalization/etc/system.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<show_in_store>0</show_in_store>
|
29 |
</api_password>
|
30 |
<api_version translate="label">
|
31 |
-
<label>
|
32 |
<frontend_type>select</frontend_type>
|
33 |
<sort_order>3</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
@@ -45,17 +45,8 @@
|
|
45 |
<show_in_website>0</show_in_website>
|
46 |
<show_in_store>0</show_in_store>
|
47 |
</api_url>
|
48 |
-
<api_image_url transalte="label">
|
49 |
-
<label>API Image URL</label>
|
50 |
-
<frontend_type>text</frontend_type>
|
51 |
-
<backend_model>printscience_personalization/system_config_backend_apiUrl</backend_model>
|
52 |
-
<sort_order>5</sort_order>
|
53 |
-
<show_in_default>1</show_in_default>
|
54 |
-
<show_in_website>0</show_in_website>
|
55 |
-
<show_in_store>0</show_in_store>
|
56 |
-
</api_image_url>
|
57 |
<window_type transalte="label">
|
58 |
-
<label>Window
|
59 |
<frontend_type>select</frontend_type>
|
60 |
<sort_order>6</sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
@@ -63,6 +54,15 @@
|
|
63 |
<show_in_store>1</show_in_store>
|
64 |
<source_model>printscience_personalization/system_config_source_windowType</source_model>
|
65 |
</window_type>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
<background_color transalte="label">
|
67 |
<label>Background color of Margin surround the modal window</label>
|
68 |
<frontend_type>text</frontend_type>
|
@@ -74,22 +74,22 @@
|
|
74 |
<comment>Specify the background color.</comment>
|
75 |
</background_color>
|
76 |
<margin_width transalte="label">
|
77 |
-
<label>Width of Margin surround the modal window</label>
|
78 |
<frontend_type>text</frontend_type>
|
79 |
<sort_order>8</sort_order>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>0</show_in_website>
|
82 |
<show_in_store>0</show_in_store>
|
83 |
-
|
84 |
</margin_width>
|
85 |
-
|
86 |
<label>Modal window opacity</label>
|
87 |
<frontend_type>text</frontend_type>
|
88 |
<sort_order>8</sort_order>
|
89 |
<show_in_default>1</show_in_default>
|
90 |
<show_in_website>0</show_in_website>
|
91 |
<show_in_store>0</show_in_store>
|
92 |
-
|
93 |
</window_opacity>
|
94 |
<jquery_enabled transalte="label">
|
95 |
<label>Designer extension loads jquery</label>
|
@@ -99,8 +99,17 @@
|
|
99 |
<show_in_default>1</show_in_default>
|
100 |
<show_in_website>0</show_in_website>
|
101 |
<show_in_store>0</show_in_store>
|
102 |
-
|
103 |
</jquery_enabled>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</fields>
|
105 |
</personalization>
|
106 |
</groups>
|
28 |
<show_in_store>0</show_in_store>
|
29 |
</api_password>
|
30 |
<api_version translate="label">
|
31 |
+
<label>API Version</label>
|
32 |
<frontend_type>select</frontend_type>
|
33 |
<sort_order>3</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
45 |
<show_in_website>0</show_in_website>
|
46 |
<show_in_store>0</show_in_store>
|
47 |
</api_url>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<window_type transalte="label">
|
49 |
+
<label>Window style for desktop users</label>
|
50 |
<frontend_type>select</frontend_type>
|
51 |
<sort_order>6</sort_order>
|
52 |
<show_in_default>1</show_in_default>
|
54 |
<show_in_store>1</show_in_store>
|
55 |
<source_model>printscience_personalization/system_config_source_windowType</source_model>
|
56 |
</window_type>
|
57 |
+
<window_type_mobile transalte="label">
|
58 |
+
<label>Window style for mobile users</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<sort_order>6</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
<source_model>printscience_personalization/system_config_source_windowType</source_model>
|
65 |
+
</window_type_mobile>
|
66 |
<background_color transalte="label">
|
67 |
<label>Background color of Margin surround the modal window</label>
|
68 |
<frontend_type>text</frontend_type>
|
74 |
<comment>Specify the background color.</comment>
|
75 |
</background_color>
|
76 |
<margin_width transalte="label">
|
77 |
+
<label>Width of Margin surround the modal window(desktop)</label>
|
78 |
<frontend_type>text</frontend_type>
|
79 |
<sort_order>8</sort_order>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>0</show_in_website>
|
82 |
<show_in_store>0</show_in_store>
|
83 |
+
<comment>(px)</comment>
|
84 |
</margin_width>
|
85 |
+
<window_opacity transalte="label">
|
86 |
<label>Modal window opacity</label>
|
87 |
<frontend_type>text</frontend_type>
|
88 |
<sort_order>8</sort_order>
|
89 |
<show_in_default>1</show_in_default>
|
90 |
<show_in_website>0</show_in_website>
|
91 |
<show_in_store>0</show_in_store>
|
92 |
+
<comment>(%)</comment>
|
93 |
</window_opacity>
|
94 |
<jquery_enabled transalte="label">
|
95 |
<label>Designer extension loads jquery</label>
|
99 |
<show_in_default>1</show_in_default>
|
100 |
<show_in_website>0</show_in_website>
|
101 |
<show_in_store>0</show_in_store>
|
102 |
+
<comment>Set to "No" if your theme loads jquery.</comment>
|
103 |
</jquery_enabled>
|
104 |
+
<test translate="label comment">
|
105 |
+
<comment>Save settings before running this test.</comment>
|
106 |
+
<frontend_type>select</frontend_type>
|
107 |
+
<frontend_model>printscience_personalization/adminhtml_test</frontend_model>
|
108 |
+
<sort_order>10</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>0</show_in_website>
|
111 |
+
<show_in_store>0</show_in_store>
|
112 |
+
</test>
|
113 |
</fields>
|
114 |
</personalization>
|
115 |
</groups>
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-install-1.0.18.php
CHANGED
@@ -9,6 +9,7 @@ if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COL
|
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
|
|
12 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
14 |
$installer->endSetup();
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
14 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
15 |
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-install-1.1.1.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->installEntities();
|
4 |
+
|
5 |
+
if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$this->getTable('sales/quote_item')}' AND COLUMN_NAME = 'personalization_info'")) {
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `personalization_info` TEXT NULL
|
8 |
+
");
|
9 |
+
}
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->addAttribute('catalog_product', 'personalization_product_id', array(
|
13 |
+
'group' => 'Personalization',
|
14 |
+
'type' => 'varchar',
|
15 |
+
'backend' => '',
|
16 |
+
'frontend' => '',
|
17 |
+
'label' => 'Product ID',
|
18 |
+
'input' => 'text',
|
19 |
+
'class' => '',
|
20 |
+
'source' => '',
|
21 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
22 |
+
'visible' => true,
|
23 |
+
'required' => false,
|
24 |
+
'user_defined' => false,
|
25 |
+
'default' => '',
|
26 |
+
'searchable' => false,
|
27 |
+
'filterable' => false,
|
28 |
+
'comparable' => false,
|
29 |
+
'visible_on_front' => false,
|
30 |
+
'unique' => false,
|
31 |
+
'apply_to' => implode(',',array('simple','configurable','bundle')),
|
32 |
+
|
33 |
+
));
|
34 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
35 |
+
|
36 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'label', 'Template ID');
|
37 |
+
|
38 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
39 |
+
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
40 |
+
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.15-1.0.16.php
CHANGED
@@ -9,6 +9,7 @@ if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COL
|
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
|
|
12 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
$installer->endSetup();
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
15 |
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.16-1.0.17.php
CHANGED
@@ -9,6 +9,7 @@ if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COL
|
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
|
|
12 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
$installer->endSetup();
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
15 |
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.17-1.0.18.php
CHANGED
@@ -9,6 +9,7 @@ if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COL
|
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
|
|
12 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
14 |
$installer->endSetup();
|
9 |
}
|
10 |
|
11 |
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
14 |
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
15 |
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.18-1.0.23.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->installEntities();
|
4 |
+
|
5 |
+
if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$this->getTable('sales/quote_item')}' AND COLUMN_NAME = 'personalization_info'")) {
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `personalization_info` TEXT NULL
|
8 |
+
");
|
9 |
+
}
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
+
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
15 |
+
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.23-1.0.24.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->installEntities();
|
4 |
+
|
5 |
+
if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$this->getTable('sales/quote_item')}' AND COLUMN_NAME = 'personalization_info'")) {
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `personalization_info` TEXT NULL
|
8 |
+
");
|
9 |
+
}
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
13 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
14 |
+
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
15 |
+
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.24-1.1.1.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->installEntities();
|
4 |
+
|
5 |
+
if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$this->getTable('sales/quote_item')}' AND COLUMN_NAME = 'personalization_info'")) {
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `personalization_info` TEXT NULL
|
8 |
+
");
|
9 |
+
}
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
|
13 |
+
$installer->addAttribute('catalog_product', 'personalization_product_id', array(
|
14 |
+
'group' => 'Personalization',
|
15 |
+
'type' => 'varchar',
|
16 |
+
'backend' => '',
|
17 |
+
'frontend' => '',
|
18 |
+
'label' => 'Template ID',
|
19 |
+
'input' => 'text',
|
20 |
+
'class' => '',
|
21 |
+
'source' => '',
|
22 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
23 |
+
'visible' => true,
|
24 |
+
'required' => false,
|
25 |
+
'user_defined' => false,
|
26 |
+
'default' => '',
|
27 |
+
'searchable' => false,
|
28 |
+
'filterable' => false,
|
29 |
+
'comparable' => false,
|
30 |
+
'visible_on_front' => false,
|
31 |
+
'unique' => false,
|
32 |
+
'apply_to' => implode(',',array('simple','configurable','bundle')),
|
33 |
+
|
34 |
+
));
|
35 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
36 |
+
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
37 |
+
$installer->endSetup();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.1.1-1.1.2.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->installEntities();
|
4 |
+
|
5 |
+
if (!$installer->getConnection()->fetchOne("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$this->getTable('sales/quote_item')}' AND COLUMN_NAME = 'personalization_info'")) {
|
6 |
+
$installer->run("
|
7 |
+
ALTER TABLE {$this->getTable('sales/quote_item')} ADD `personalization_info` TEXT NULL
|
8 |
+
");
|
9 |
+
}
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->addAttribute('catalog_product', 'personalization_product_id', array(
|
13 |
+
'group' => 'Personalization',
|
14 |
+
'type' => 'varchar',
|
15 |
+
'backend' => '',
|
16 |
+
'frontend' => '',
|
17 |
+
'label' => 'Product ID',
|
18 |
+
'input' => 'text',
|
19 |
+
'class' => '',
|
20 |
+
'source' => '',
|
21 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
22 |
+
'visible' => true,
|
23 |
+
'required' => false,
|
24 |
+
'user_defined' => false,
|
25 |
+
'default' => '',
|
26 |
+
'searchable' => false,
|
27 |
+
'filterable' => false,
|
28 |
+
'comparable' => false,
|
29 |
+
'visible_on_front' => false,
|
30 |
+
'unique' => false,
|
31 |
+
'apply_to' => implode(',',array('simple','configurable','bundle')),
|
32 |
+
|
33 |
+
));
|
34 |
+
$installer->updateAttribute('catalog_product', 'personalization_product_id', 'apply_to', implode(',',array('simple','configurable','bundle')));
|
35 |
+
|
36 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'label', 'Template ID');
|
37 |
+
|
38 |
+
$installer->updateAttribute('catalog_product', 'personalization_template_id', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
39 |
+
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','bundle','configurable')));
|
40 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/printscience_personalization.xml
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
|
|
|
|
|
|
|
|
|
|
3 |
<catalog_product_view>
|
4 |
<reference name="head">
|
5 |
<action method="addItem"><type>skin_css</type><name>printscience_personalization/modalPopLite.css</name></action>
|
@@ -17,6 +22,7 @@
|
|
17 |
<reference name="head">
|
18 |
<action method="addItem"><type>skin_css</type><name>printscience_personalization/modalPopLite.css</name></action>
|
19 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/modalPopLite.min.js</name></action>
|
|
|
20 |
</reference>
|
21 |
<reference name="checkout.cart">
|
22 |
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem"><type>skin_js</type><name>printscience_personalization/checkdevice.js</name></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
<catalog_product_view>
|
9 |
<reference name="head">
|
10 |
<action method="addItem"><type>skin_css</type><name>printscience_personalization/modalPopLite.css</name></action>
|
22 |
<reference name="head">
|
23 |
<action method="addItem"><type>skin_css</type><name>printscience_personalization/modalPopLite.css</name></action>
|
24 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/modalPopLite.min.js</name></action>
|
25 |
+
<action method="addItem"><type>skin_js</type><name>printscience_personalization/gallery.js</name></action>
|
26 |
</reference>
|
27 |
<reference name="checkout.cart">
|
28 |
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
|
app/design/frontend/base/default/template/printscience_personalization/catalog/product/list.phtml
CHANGED
@@ -1,234 +1,473 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
*
|
6 |
-
|
7 |
-
*
|
8 |
-
|
9 |
-
*
|
10 |
-
|
11 |
-
*
|
12 |
-
|
13 |
-
*
|
14 |
-
|
15 |
-
*
|
16 |
-
|
17 |
-
*
|
18 |
-
|
19 |
-
*
|
20 |
-
|
21 |
-
*
|
22 |
-
|
23 |
-
*
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
*
|
30 |
-
|
31 |
-
*
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
<?php
|
107 |
-
|
108 |
-
<
|
109 |
-
|
110 |
-
<?php
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
<
|
121 |
-
|
122 |
-
<
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
<?php if
|
129 |
-
|
130 |
-
<?php
|
131 |
-
|
132 |
-
<?php endif; ?>
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
<?php
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
|
5 |
+
* Magento
|
6 |
+
|
7 |
+
*
|
8 |
+
|
9 |
+
* NOTICE OF LICENSE
|
10 |
+
|
11 |
+
*
|
12 |
+
|
13 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
14 |
+
|
15 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
16 |
+
|
17 |
+
* It is also available through the world-wide-web at this URL:
|
18 |
+
|
19 |
+
* http://opensource.org/licenses/afl-3.0.php
|
20 |
+
|
21 |
+
* If you did not receive a copy of the license and are unable to
|
22 |
+
|
23 |
+
* obtain it through the world-wide-web, please send an email
|
24 |
+
|
25 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
26 |
+
|
27 |
+
*
|
28 |
+
|
29 |
+
* DISCLAIMER
|
30 |
+
|
31 |
+
*
|
32 |
+
|
33 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
34 |
+
|
35 |
+
* versions in the future. If you wish to customize Magento for your
|
36 |
+
|
37 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
38 |
+
|
39 |
+
*
|
40 |
+
|
41 |
+
* @category design
|
42 |
+
|
43 |
+
* @package base_default
|
44 |
+
|
45 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
46 |
+
|
47 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
48 |
+
|
49 |
+
*/
|
50 |
+
|
51 |
+
?>
|
52 |
+
|
53 |
+
<?php
|
54 |
+
|
55 |
+
/**
|
56 |
+
|
57 |
+
* Product list template
|
58 |
+
|
59 |
+
*
|
60 |
+
|
61 |
+
* @see Mage_Catalog_Block_Product_List
|
62 |
+
|
63 |
+
*/
|
64 |
+
|
65 |
+
?>
|
66 |
+
|
67 |
+
<?php
|
68 |
+
|
69 |
+
$_productCollection = $this->getLoadedProductCollection();
|
70 |
+
|
71 |
+
$_helper = $this->helper('catalog/output');
|
72 |
+
|
73 |
+
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
74 |
+
|
75 |
+
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
76 |
+
|
77 |
+
$window_type_mobile = Mage::getStoreConfig('catalog/personalization/window_type_mobile');
|
78 |
+
|
79 |
+
$background_color = Mage::getStoreConfig('catalog/personalization/background_color');
|
80 |
+
|
81 |
+
$margin_width = Mage::getStoreConfig('catalog/personalization/margin_width');
|
82 |
+
|
83 |
+
$window_opacity = Mage::getStoreConfig('catalog/personalization/window_opacity');
|
84 |
+
|
85 |
+
$_personalizationsessionHelper = Mage::helper('printscience_personalization/session');
|
86 |
+
|
87 |
+
$dummyuserVersion = $_personalizationsessionHelper->getData('dummy_user_version');
|
88 |
+
?>
|
89 |
+
|
90 |
+
<form action="" method="post">
|
91 |
+
|
92 |
+
<?php if(!$_productCollection->count()): ?>
|
93 |
+
|
94 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
95 |
+
|
96 |
+
<?php else: ?>
|
97 |
+
|
98 |
+
<div class="category-products">
|
99 |
+
|
100 |
+
<?php echo $this->getToolbarHtml() ?>
|
101 |
+
|
102 |
+
<?php // List mode ?>
|
103 |
+
|
104 |
+
<?php if($this->getMode()!='grid'): ?>
|
105 |
+
|
106 |
+
<?php $_iterator = 0; ?>
|
107 |
+
|
108 |
+
<ol class="products-list" id="products-list">
|
109 |
+
|
110 |
+
<?php foreach ($_productCollection as $_product): ?>
|
111 |
+
|
112 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
113 |
+
|
114 |
+
<?php // Product Image ?>
|
115 |
+
|
116 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
117 |
+
|
118 |
+
<?php // Product description ?>
|
119 |
+
|
120 |
+
<div class="product-shop">
|
121 |
+
|
122 |
+
<div class="f-fix">
|
123 |
+
|
124 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
125 |
+
|
126 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
127 |
+
|
128 |
+
<?php if($_product->getRatingSummary()): ?>
|
129 |
+
|
130 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
131 |
+
|
132 |
+
<?php endif; ?>
|
133 |
+
|
134 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
135 |
+
|
136 |
+
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product) && $_product->getTypeID() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE): ?>
|
137 |
+
|
138 |
+
<?php $buttonTitle = $this->__('Personalize'); ?>
|
139 |
+
|
140 |
+
<?php else: ?>
|
141 |
+
|
142 |
+
<?php $buttonTitle = $this->__('Add to Cart'); ?>
|
143 |
+
|
144 |
+
<?php endif; ?>
|
145 |
+
|
146 |
+
<?php if($_product->isSaleable()): ?>
|
147 |
+
|
148 |
+
|
149 |
+
|
150 |
+
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product) && $_product->getTypeID() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE): ?>
|
151 |
+
|
152 |
+
<?php if (($window_type=='2' && $dummyuserVersion == 'desktop') || ($window_type_mobile=='2' && $dummyuserVersion == 'mobile')):?>
|
153 |
+
|
154 |
+
<?php if(strpos($this->getAddToCartUrl($_product), "uenc")!==false): ?>
|
155 |
+
|
156 |
+
<p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setPersonalizeLocation('<?php echo $this->getAddToCartUrl($_product) ?>', jQuery(this.form))"><span><span><?php echo $buttonTitle ?></span></span></button></p>
|
157 |
+
|
158 |
+
<?php else: ?>
|
159 |
+
|
160 |
+
<p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $buttonTitle ?></span></span></button></p>
|
161 |
+
|
162 |
+
<?php endif; ?>
|
163 |
+
|
164 |
+
<?php else: ?>
|
165 |
+
|
166 |
+
<p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>'"><span><span><?php echo $buttonTitle ?></span></span></button></p>
|
167 |
+
|
168 |
+
<?php endif; ?>
|
169 |
+
|
170 |
+
<?php else: ?>
|
171 |
+
|
172 |
+
<p><button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>'"><span><span><?php echo $buttonTitle ?></span></span></button></p>
|
173 |
+
|
174 |
+
<?php endif; ?>
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
<?php else: ?>
|
179 |
+
|
180 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
181 |
+
|
182 |
+
<?php endif; ?>
|
183 |
+
|
184 |
+
<div class="desc std">
|
185 |
+
|
186 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
187 |
+
|
188 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
189 |
+
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<ul class="add-to-links">
|
193 |
+
|
194 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
195 |
+
|
196 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
197 |
+
|
198 |
+
<?php endif; ?>
|
199 |
+
|
200 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
201 |
+
|
202 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
203 |
+
|
204 |
+
<?php endif; ?>
|
205 |
+
|
206 |
+
</ul>
|
207 |
+
|
208 |
+
</div>
|
209 |
+
|
210 |
+
</div>
|
211 |
+
|
212 |
+
</li>
|
213 |
+
|
214 |
+
<?php endforeach; ?>
|
215 |
+
|
216 |
+
</ol>
|
217 |
+
|
218 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
<?php else: ?>
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
<?php // Grid Mode ?>
|
227 |
+
|
228 |
+
|
229 |
+
|
230 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
231 |
+
|
232 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
233 |
+
|
234 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
235 |
+
|
236 |
+
<?php if ($i++%$_columnCount==0): ?>
|
237 |
+
|
238 |
+
<ul class="products-grid">
|
239 |
+
|
240 |
+
<?php endif ?>
|
241 |
+
|
242 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
243 |
+
|
244 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
245 |
+
|
246 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
247 |
+
|
248 |
+
<?php if($_product->getRatingSummary()): ?>
|
249 |
+
|
250 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
251 |
+
|
252 |
+
<?php endif; ?>
|
253 |
+
|
254 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
255 |
+
|
256 |
+
<div class="actions">
|
257 |
+
|
258 |
+
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product) && $_product->getTypeID() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE): ?>
|
259 |
+
|
260 |
+
<?php $buttonTitle = $this->__('Personalize'); ?>
|
261 |
+
|
262 |
+
<?php else: ?>
|
263 |
+
|
264 |
+
<?php $buttonTitle = $this->__('Add to Cart'); ?>
|
265 |
+
|
266 |
+
<?php endif; ?>
|
267 |
+
|
268 |
+
<?php if($_product->isSaleable()): ?>
|
269 |
+
|
270 |
+
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product) && $_product->getTypeID() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE): ?>
|
271 |
+
|
272 |
+
<?php if (($window_type=='2' && $dummyuserVersion == 'desktop') || ($window_type_mobile=='2' && $dummyuserVersion == 'mobile')):?>
|
273 |
+
|
274 |
+
<?php if(strpos($this->getAddToCartUrl($_product), "uenc")!==false): ?>
|
275 |
+
|
276 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setPersonalizeLocation('<?php echo $this->getAddToCartUrl($_product) ?>', jQuery(this.form))"><span><span><?php echo $buttonTitle ?></span></span></button>
|
277 |
+
|
278 |
+
<?php else: ?>
|
279 |
+
|
280 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $buttonTitle ?></span></span></button>
|
281 |
+
|
282 |
+
<?php endif; ?>
|
283 |
+
|
284 |
+
<?php else: ?>
|
285 |
+
|
286 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $buttonTitle ?></span></span></button>
|
287 |
+
|
288 |
+
<?php endif; ?>
|
289 |
+
|
290 |
+
<?php else: ?>
|
291 |
+
|
292 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $buttonTitle ?></span></span></button>
|
293 |
+
|
294 |
+
<?php endif; ?>
|
295 |
+
|
296 |
+
<?php else: ?>
|
297 |
+
|
298 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
299 |
+
|
300 |
+
<?php endif; ?>
|
301 |
+
|
302 |
+
<ul class="add-to-links">
|
303 |
+
|
304 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
305 |
+
|
306 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
307 |
+
|
308 |
+
<?php endif; ?>
|
309 |
+
|
310 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
311 |
+
|
312 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
313 |
+
|
314 |
+
<?php endif; ?>
|
315 |
+
|
316 |
+
</ul>
|
317 |
+
|
318 |
+
</div>
|
319 |
+
|
320 |
+
</li>
|
321 |
+
|
322 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
323 |
+
|
324 |
+
</ul>
|
325 |
+
|
326 |
+
<?php endif ?>
|
327 |
+
|
328 |
+
<?php endforeach ?>
|
329 |
+
|
330 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
331 |
+
|
332 |
+
<?php endif; ?>
|
333 |
+
|
334 |
+
|
335 |
+
|
336 |
+
<div class="toolbar-bottom">
|
337 |
+
|
338 |
+
<?php echo $this->getToolbarHtml() ?>
|
339 |
+
|
340 |
+
</div>
|
341 |
+
|
342 |
+
</div>
|
343 |
+
|
344 |
+
<?php endif; ?>
|
345 |
+
|
346 |
+
</form>
|
347 |
+
|
348 |
+
<?php
|
349 |
+
|
350 |
+
if($window_type=='2'):
|
351 |
+
|
352 |
+
?>
|
353 |
+
|
354 |
+
<a id="openpoup"></a>
|
355 |
+
|
356 |
+
<a id="close-btn"></a>
|
357 |
+
|
358 |
+
<style>
|
359 |
+
|
360 |
+
.modalPopLite-mask {
|
361 |
+
|
362 |
+
background-color:#<?php echo (isset($background_color)?$background_color:"#000000") ?> !important;
|
363 |
+
|
364 |
+
}
|
365 |
+
|
366 |
+
#popup-wrapper
|
367 |
+
|
368 |
+
{
|
369 |
+
|
370 |
+
width:1150px;
|
371 |
+
|
372 |
+
height:600px;
|
373 |
+
|
374 |
+
left:0!important;top:0!important;
|
375 |
+
|
376 |
+
background-color: #<?php echo $background_color; ?> !important;
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
.modalPopLite-wrapper
|
381 |
+
|
382 |
+
{
|
383 |
+
|
384 |
+
border:none!important;
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
.modalPopLite-mask {
|
389 |
+
|
390 |
+
opacity:<?php echo ($window_opacity!=''?($window_opacity/100):"0.6") ?> !important;
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
#popup_frame{
|
395 |
+
|
396 |
+
border:0px;
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
</style>
|
401 |
+
|
402 |
+
<script type="text/javascript">
|
403 |
+
|
404 |
+
jQuery(function (){
|
405 |
+
|
406 |
+
var maskWidth = document.body.clientWidth;
|
407 |
+
|
408 |
+
var maskHeight = jQuery(window).height();
|
409 |
+
<?php if($dummyuserVersion == 'mobile') {?>
|
410 |
+
var margin = '0';
|
411 |
+
<?php } else { ?>
|
412 |
+
var margin = '<?php if(isset($margin_width) && $margin_width > 0) { echo $margin_width; } else { echo "0"; } ?>';
|
413 |
+
<?php } ?>
|
414 |
+
|
415 |
+
jQuery("#popup-wrapper").css("width",(maskWidth - (2*margin)));
|
416 |
+
|
417 |
+
jQuery("#popup-wrapper").css("height",(maskHeight - 2*margin));
|
418 |
+
|
419 |
+
jQuery("#popup_frame").css("width",(maskWidth - 2*margin));
|
420 |
+
|
421 |
+
jQuery("#popup_frame").css("height",(maskHeight - 2*margin));
|
422 |
+
|
423 |
+
jQuery("#header").css("z-index","10");
|
424 |
+
|
425 |
+
jQuery(".personalize_btn_link").attr("target","popup_frame");
|
426 |
+
|
427 |
+
jQuery('#popup-wrapper').modalPopLite({ openButton: '#openpoup', closeButton: '#close-btn', isModal: true });
|
428 |
+
|
429 |
+
//jQuery('#modalPopLite-mask1').attr("style","opacity: 0.9");
|
430 |
+
|
431 |
+
});
|
432 |
+
|
433 |
+
function closethepopup(){
|
434 |
+
|
435 |
+
jQuery('#popup_frame').attr("src", "");
|
436 |
+
|
437 |
+
jQuery('#close-btn').trigger('click');
|
438 |
+
|
439 |
+
}
|
440 |
+
|
441 |
+
function setPersonalizeLocation(url, formObj) {
|
442 |
+
|
443 |
+
jQuery("#header").css("z-index","1");
|
444 |
+
|
445 |
+
if (jQuery(formObj).length > 0)
|
446 |
+
|
447 |
+
{
|
448 |
+
|
449 |
+
jQuery(formObj).attr("action",url);
|
450 |
+
|
451 |
+
jQuery(formObj).attr("target","popup_frame");
|
452 |
+
|
453 |
+
jQuery(formObj).submit();
|
454 |
+
|
455 |
+
}
|
456 |
+
|
457 |
+
jQuery('#openpoup').trigger('click');
|
458 |
+
|
459 |
+
return false;
|
460 |
+
|
461 |
+
}
|
462 |
+
|
463 |
+
</script>
|
464 |
+
|
465 |
+
<div id="popup-wrapper"><iframe name="popup_frame" id="popup_frame"></iframe>
|
466 |
+
|
467 |
+
</div>
|
468 |
+
|
469 |
+
<?php
|
470 |
+
|
471 |
+
endif;
|
472 |
+
|
473 |
?>
|
app/design/frontend/base/default/template/printscience_personalization/catalog/product/view.phtml
CHANGED
@@ -32,6 +32,9 @@
|
|
32 |
*/
|
33 |
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
34 |
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
|
|
|
|
|
|
35 |
?>
|
36 |
<?php $_helper = $this->helper('catalog/output'); ?>
|
37 |
<?php $_product = $this->getProduct(); ?>
|
@@ -134,7 +137,7 @@ $window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
|
134 |
}
|
135 |
var e = null;
|
136 |
try {
|
137 |
-
<?php if ($window_type=='2' && $_personalizationHelper->isPersonalizationEnabled($_product)): ?>
|
138 |
jQuery("#header").css("z-index","1");
|
139 |
jQuery("#product_addtocart_form").attr("target","popup_frame");
|
140 |
this.form.submit();
|
32 |
*/
|
33 |
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
34 |
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
35 |
+
$window_type_mobile = Mage::getStoreConfig('catalog/personalization/window_type_mobile');
|
36 |
+
$_personalizationsessionHelper = Mage::helper('printscience_personalization/session');
|
37 |
+
$dummyuserVersion = $_personalizationsessionHelper->getData('dummy_user_version');
|
38 |
?>
|
39 |
<?php $_helper = $this->helper('catalog/output'); ?>
|
40 |
<?php $_product = $this->getProduct(); ?>
|
137 |
}
|
138 |
var e = null;
|
139 |
try {
|
140 |
+
<?php if (($window_type=='2' || $window_type_mobile=='2') && $_personalizationHelper->isPersonalizationEnabled($_product)): ?>
|
141 |
jQuery("#header").css("z-index","1");
|
142 |
jQuery("#product_addtocart_form").attr("target","popup_frame");
|
143 |
this.form.submit();
|
app/design/frontend/base/default/template/printscience_personalization/catalog/product/view/addtocart.phtml
CHANGED
@@ -1,80 +1,78 @@
|
|
1 |
-
<?php
|
2 |
-
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
3 |
-
$_product = $this->getProduct();
|
4 |
-
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
5 |
-
$background_color = Mage::getStoreConfig('catalog/personalization/background_color');
|
6 |
-
$margin_width = Mage::getStoreConfig('catalog/personalization/margin_width');
|
7 |
-
$window_opacity = Mage::getStoreConfig('catalog/personalization/window_opacity');
|
8 |
-
?>
|
9 |
-
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product)): ?>
|
10 |
-
<?php $buttonTitle = $this->__('Personalize'); ?>
|
11 |
-
<?php else: ?>
|
12 |
-
<?php $buttonTitle = $this->__('Add to Cart'); ?>
|
13 |
-
<?php endif; ?>
|
14 |
-
<?php if($_product->isSaleable()): ?>
|
15 |
-
<div class="add-to-cart">
|
16 |
-
<?php if(!$_product->isGrouped()): ?>
|
17 |
-
<label for="qty"><?php echo $this->__('Qty:') ?></label>
|
18 |
-
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
|
19 |
-
<?php endif; ?>
|
20 |
-
<?php if($window_type=='0'): ?>
|
21 |
-
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart exclusive personalize_btn"><span><span><?php echo $buttonTitle ?></span></span></button>
|
22 |
-
<?php else: ?>
|
23 |
-
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart exclusive personalize_btn" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
|
24 |
-
<?php endif; ?>
|
25 |
-
<?php echo $this->getChildHtml('', true, true) ?>
|
26 |
-
</div>
|
27 |
-
<?php endif; ?>
|
28 |
-
<?php
|
29 |
-
|
30 |
-
|
31 |
-
<
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
var
|
58 |
-
|
59 |
-
|
60 |
-
jQuery("#
|
61 |
-
jQuery("#
|
62 |
-
|
63 |
-
jQuery("#
|
64 |
-
|
65 |
-
jQuery("
|
66 |
-
jQuery(
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
</
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
<?php
|
79 |
-
endif;
|
80 |
?>
|
1 |
+
<?php
|
2 |
+
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
3 |
+
$_product = $this->getProduct();
|
4 |
+
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
5 |
+
$background_color = Mage::getStoreConfig('catalog/personalization/background_color');
|
6 |
+
$margin_width = Mage::getStoreConfig('catalog/personalization/margin_width');
|
7 |
+
$window_opacity = Mage::getStoreConfig('catalog/personalization/window_opacity'); $window_type_mobile = Mage::getStoreConfig('catalog/personalization/window_type_mobile'); $_personalizationsessionHelper = Mage::helper('printscience_personalization/session'); $dummyuserVersion = $_personalizationsessionHelper->getData('dummy_user_version');
|
8 |
+
?>
|
9 |
+
<?php if ($_personalizationHelper->isPersonalizationEnabled($_product)): ?>
|
10 |
+
<?php $buttonTitle = $this->__('Personalize'); ?>
|
11 |
+
<?php else: ?>
|
12 |
+
<?php $buttonTitle = $this->__('Add to Cart'); ?>
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php if($_product->isSaleable()): ?>
|
15 |
+
<div class="add-to-cart">
|
16 |
+
<?php if(!$_product->isGrouped()): ?>
|
17 |
+
<label for="qty"><?php echo $this->__('Qty:') ?></label>
|
18 |
+
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
|
19 |
+
<?php endif; ?>
|
20 |
+
<?php if($window_type=='0'): ?>
|
21 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart exclusive personalize_btn"><span><span><?php echo $buttonTitle ?></span></span></button>
|
22 |
+
<?php else: ?>
|
23 |
+
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart exclusive personalize_btn" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
|
24 |
+
<?php endif; ?>
|
25 |
+
<?php echo $this->getChildHtml('', true, true) ?>
|
26 |
+
</div>
|
27 |
+
<?php endif; ?>
|
28 |
+
<?php if (($window_type=='2' && $dummyuserVersion == 'desktop') || ($window_type_mobile=='2' && $dummyuserVersion == 'mobile')):?>
|
29 |
+
<a id="openpoup"></a>
|
30 |
+
<a id="close-btn"></a>
|
31 |
+
<style>
|
32 |
+
.modalPopLite-mask {
|
33 |
+
background-color:#<?php echo (isset($background_color)?$background_color:"#000000") ?> !important;
|
34 |
+
}
|
35 |
+
#popup-wrapper
|
36 |
+
{
|
37 |
+
width:1150px;
|
38 |
+
height:600px;
|
39 |
+
left:0!important;top:0!important;
|
40 |
+
background-color: #<?php echo $background_color; ?> !important;
|
41 |
+
}
|
42 |
+
.modalPopLite-wrapper
|
43 |
+
{
|
44 |
+
border:none!important;
|
45 |
+
}
|
46 |
+
.modalPopLite-mask {
|
47 |
+
opacity:<?php echo ($window_opacity!=''?($window_opacity/100):"0.6") ?> !important;
|
48 |
+
}
|
49 |
+
#popup_frame{
|
50 |
+
border:0px;
|
51 |
+
}
|
52 |
+
</style>
|
53 |
+
<script type="text/javascript">
|
54 |
+
jQuery(function (){
|
55 |
+
var maskWidth = document.body.clientWidth;
|
56 |
+
var maskHeight = jQuery(window).height();
|
57 |
+
<?php if($dummyuserVersion == 'mobile') {?> var margin = '0'; <?php } else { ?> var margin = '<?php if(isset($margin_width) && $margin_width > 0) { echo $margin_width; } else { echo "0"; } ?>'; <?php } ?>
|
58 |
+
jQuery("#popup-wrapper").css("width",(maskWidth - (2*margin)));
|
59 |
+
jQuery("#popup-wrapper").css("height",(maskHeight - 2*margin));
|
60 |
+
jQuery("#popup_frame").css("width",(maskWidth - 2*margin));
|
61 |
+
jQuery("#popup_frame").css("height",(maskHeight - 2*margin));
|
62 |
+
|
63 |
+
jQuery("#header").css("z-index","10");
|
64 |
+
jQuery(".anchoreditlink").attr("target","popup_frame");
|
65 |
+
jQuery(".personalize_btn_link").attr("target","popup_frame");
|
66 |
+
jQuery('#popup-wrapper').modalPopLite({ openButton: '#openpoup', closeButton: '#close-btn', isModal: true });
|
67 |
+
});
|
68 |
+
function closethepopup(){
|
69 |
+
jQuery('#popup_frame').attr("src", "");
|
70 |
+
jQuery('#close-btn').trigger('click');
|
71 |
+
}
|
72 |
+
</script>
|
73 |
+
<div id="popup-wrapper"><iframe name="popup_frame" id="popup_frame"></iframe>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<?php
|
77 |
+
endif;
|
|
|
|
|
78 |
?>
|
app/design/frontend/base/default/template/printscience_personalization/checkout/cart.phtml
CHANGED
@@ -168,7 +168,10 @@ $window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
|
168 |
$background_color = Mage::getStoreConfig('catalog/personalization/background_color');
|
169 |
$margin_width = Mage::getStoreConfig('catalog/personalization/margin_width');
|
170 |
$window_opacity = Mage::getStoreConfig('catalog/personalization/window_opacity');
|
171 |
-
|
|
|
|
|
|
|
172 |
?>
|
173 |
<a id="openpoup"></a>
|
174 |
<a id="close-btn"></a>
|
@@ -188,7 +191,7 @@ if($window_type=='2'):
|
|
188 |
border:none!important;
|
189 |
}
|
190 |
.modalPopLite-mask {
|
191 |
-
opacity:<?php echo ($window_opacity!=''
|
192 |
}
|
193 |
#popup_frame{
|
194 |
border:0px;
|
@@ -198,7 +201,11 @@ if($window_type=='2'):
|
|
198 |
jQuery(function (){
|
199 |
var maskWidth = document.body.clientWidth;
|
200 |
var maskHeight = jQuery(window).height();
|
201 |
-
|
|
|
|
|
|
|
|
|
202 |
jQuery("#popup-wrapper").css("width",(maskWidth - (2*margin)));
|
203 |
jQuery("#popup-wrapper").css("height",(maskHeight - 2*margin));
|
204 |
jQuery("#popup_frame").css("width",(maskWidth - 2*margin));
|
168 |
$background_color = Mage::getStoreConfig('catalog/personalization/background_color');
|
169 |
$margin_width = Mage::getStoreConfig('catalog/personalization/margin_width');
|
170 |
$window_opacity = Mage::getStoreConfig('catalog/personalization/window_opacity');
|
171 |
+
$window_type_mobile = Mage::getStoreConfig('catalog/personalization/window_type_mobile');
|
172 |
+
$_personalizationsessionHelper = Mage::helper('printscience_personalization/session');
|
173 |
+
$dummyuserVersion = $_personalizationsessionHelper->getData('dummy_user_version');
|
174 |
+
if($window_type=='2' || $window_type_mobile=='2'):
|
175 |
?>
|
176 |
<a id="openpoup"></a>
|
177 |
<a id="close-btn"></a>
|
191 |
border:none!important;
|
192 |
}
|
193 |
.modalPopLite-mask {
|
194 |
+
opacity:<?php echo ($window_opacity!=''?($window_opacity/100):"0.6") ?> !important;
|
195 |
}
|
196 |
#popup_frame{
|
197 |
border:0px;
|
201 |
jQuery(function (){
|
202 |
var maskWidth = document.body.clientWidth;
|
203 |
var maskHeight = jQuery(window).height();
|
204 |
+
<?php if($dummyuserVersion == 'mobile') {?>
|
205 |
+
var margin = '0';
|
206 |
+
<?php } else { ?>
|
207 |
+
var margin = '<?php if(isset($margin_width) && $margin_width > 0) { echo $margin_width; } else { echo "0"; } ?>';
|
208 |
+
<?php } ?>
|
209 |
jQuery("#popup-wrapper").css("width",(maskWidth - (2*margin)));
|
210 |
jQuery("#popup-wrapper").css("height",(maskHeight - 2*margin));
|
211 |
jQuery("#popup_frame").css("width",(maskWidth - 2*margin));
|
app/design/frontend/base/default/template/printscience_personalization/checkout/cart/item/default.phtml
CHANGED
@@ -3,6 +3,9 @@ $_item = $this->getItem();
|
|
3 |
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
4 |
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
5 |
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
|
|
|
|
|
|
6 |
?>
|
7 |
<tr>
|
8 |
<td>
|
@@ -11,17 +14,19 @@ $window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
|
11 |
<?php $personalizationPreviews = $this->getPersonalizationPreviews() ?>
|
12 |
<?php //echo "<pre>"; print_r($personalizationPreviews); echo "</pre>";?>
|
13 |
<div class="personalizationGallery">
|
14 |
-
<?php $class = '' ?>
|
15 |
<?php foreach ($personalizationPreviews as $previewImage):
|
16 |
-
|
17 |
?>
|
18 |
<a href="<?php echo $previewImage ?>" rel="fancybox[<?php echo $apiSessionKey ?>]" class="pgImg" target="_blank"><img src="<?php echo $previewImage ?>" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" <?php echo $class ?> /></a>
|
|
|
|
|
19 |
<?php endforeach; ?>
|
20 |
</div>
|
21 |
|
22 |
<div>
|
23 |
<?php if ($apiSessionKey):?>
|
24 |
-
<?php if ($window_type=='2'):?>
|
25 |
<button type="button" title="<?php echo $this->__('Re-edit') ?>" class="button btn-cart personalize_btn_link" onclick="setPersonalizeLocation('<?php echo $this->getResumePersonalizationUrl($_item->getProduct()->getId()) ?>', this.form)"><span><span><?php echo $this->__('Re-edit') ?></span></span></button>
|
26 |
<?php else: ?>
|
27 |
<button type="button" title="<?php echo $this->__('Re-edit') ?>" class="button btn-cart personalize_btn_link" onclick="setLocation('<?php echo $this->getResumePersonalizationUrl($_item->getProduct()->getId()) ?>')"><span><span><?php echo $this->__('Re-edit') ?></span></span></button>
|
3 |
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
4 |
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
5 |
$window_type = Mage::getStoreConfig('catalog/personalization/window_type');
|
6 |
+
$window_type_mobile = Mage::getStoreConfig('catalog/personalization/window_type_mobile');
|
7 |
+
$_personalizationsessionHelper = Mage::helper('printscience_personalization/session');
|
8 |
+
$dummyuserVersion = $_personalizationsessionHelper->getData('dummy_user_version');
|
9 |
?>
|
10 |
<tr>
|
11 |
<td>
|
14 |
<?php $personalizationPreviews = $this->getPersonalizationPreviews() ?>
|
15 |
<?php //echo "<pre>"; print_r($personalizationPreviews); echo "</pre>";?>
|
16 |
<div class="personalizationGallery">
|
17 |
+
<?php $class = 'class="first"'; ?>
|
18 |
<?php foreach ($personalizationPreviews as $previewImage):
|
19 |
+
$previewImage = str_replace("http:", "https:", $previewImage);
|
20 |
?>
|
21 |
<a href="<?php echo $previewImage ?>" rel="fancybox[<?php echo $apiSessionKey ?>]" class="pgImg" target="_blank"><img src="<?php echo $previewImage ?>" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" <?php echo $class ?> /></a>
|
22 |
+
|
23 |
+
<?php $class = ''; ?>
|
24 |
<?php endforeach; ?>
|
25 |
</div>
|
26 |
|
27 |
<div>
|
28 |
<?php if ($apiSessionKey):?>
|
29 |
+
<?php if (($window_type=='2' && $dummyuserVersion == 'desktop') || ($window_type_mobile=='2' && $dummyuserVersion == 'mobile')):?>
|
30 |
<button type="button" title="<?php echo $this->__('Re-edit') ?>" class="button btn-cart personalize_btn_link" onclick="setPersonalizeLocation('<?php echo $this->getResumePersonalizationUrl($_item->getProduct()->getId()) ?>', this.form)"><span><span><?php echo $this->__('Re-edit') ?></span></span></button>
|
31 |
<?php else: ?>
|
32 |
<button type="button" title="<?php echo $this->__('Re-edit') ?>" class="button btn-cart personalize_btn_link" onclick="setLocation('<?php echo $this->getResumePersonalizationUrl($_item->getProduct()->getId()) ?>')"><span><span><?php echo $this->__('Re-edit') ?></span></span></button>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Print_Science_Designer_Web_to_Print</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Print_Science_Designer_Web_to_Print</description>
|
11 |
<notes>Print_Science_Designer_Web_to_Print</notes>
|
12 |
<authors><author><name>John Weissberg</name><user>johnwwweissberg</user><email>jw@print-science.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>13:
|
15 |
-
<contents><target name="magelocal"><dir><dir name="PrintScience"><dir name="Personalization"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Items"><file name="Renderer.php" hash="e9a0dcb549311ea6f4e3992bbc9a4b5c"/></dir></dir></dir></dir
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Print_Science_Designer_Web_to_Print</name>
|
4 |
+
<version>1.1.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Print_Science_Designer_Web_to_Print</description>
|
11 |
<notes>Print_Science_Designer_Web_to_Print</notes>
|
12 |
<authors><author><name>John Weissberg</name><user>johnwwweissberg</user><email>jw@print-science.com</email></author></authors>
|
13 |
+
<date>2016-02-25</date>
|
14 |
+
<time>13:32:10</time>
|
15 |
+
<contents><target name="magelocal"><dir><dir name="PrintScience"><dir name="Personalization"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Items"><file name="Renderer.php" hash="e9a0dcb549311ea6f4e3992bbc9a4b5c"/></dir></dir></dir></dir><file name="Test.php" hash="5f50c3273ad28f5cc4f8954a5b78452d"/></dir><dir name="Checkout"><dir name="Cart"><dir name="Item"><file name="Renderer.php" hash="fed0f0eb45c6dec622233718326cf001"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="01a988d01405340f6527cd9cbb359ca3"/><file name="Order.php" hash="ba50cbfb5f647cbca2deae91153db9b7"/><file name="Output.php" hash="7f039eed45d1db6f3723d067b2ae970d"/><file name="Quote.php" hash="d14fbe62e2a96e4aede13082c16dda30"/><file name="Session.php" hash="0236f26208780df75ca780d40edbe351"/></dir><dir name="Model"><dir name="ApiGateway"><dir name="Response"><file name="Abstract.php" hash="66667fce4c92782faf1d1a92f4c3e339"/><file name="Begin.php" hash="451d64c86ef6aa542ae7cf5949b1b627"/><file name="GetPreview.php" hash="5801403f4c511aa0a97b8273a712e407"/></dir></dir><file name="ApiGateway.php" hash="58a2850c8099ab68f09272ef779d8577"/><file name="Observer.php" hash="aa56410e94deb2e932ed8dff74434966"/><dir name="Override"><dir name="Checkout"><file name="Cart.php" hash="ccece0a4e9fffd6d4b7f1b1a8a97dbd3"/></dir><dir name="Sales"><file name="Quote.php" hash="efb0e7814b593185fc62f0fcaeb84935"/></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="0b1f152cf26c58a92efe4165dc9b3803"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="ApiUrl.php" hash="34eb488ef178104966397f425625534d"/></dir><dir name="Source"><file name="ApiVersion.php" hash="e0248a29ebc88171b7fb51bdbabaca8b"/><file name="WindowType.php" hash="d266f141e63a17c3d68de1a23a31deb6"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="86005b3402128265bafe9ffe095688e6"/><file name="TestController.php" hash="a13070470e636b068e434d60a9a42476"/></dir><dir name="etc"><file name="config.xml" hash="f4f47fccd6db6a82fd8a0921a4a3992f"/><file name="system.xml" hash="d994c0db968386b5a0a1664c36cc5e28"/></dir><dir name="sql"><dir name="printscience_personalization_setup"><file name="mysql4-install-1.0.18.php" hash="8c7277e4675ef22ba3bc7ada3af71a2e"/><file name="mysql4-install-1.1.1.php" hash="03b9a55f535b49e14530f921948b2cfa"/><file name="mysql4-upgrade-1.0.15-1.0.16.php" hash="a18bc9195fff6b40619f44a8eb6e587b"/><file name="mysql4-upgrade-1.0.16-1.0.17.php" hash="a18bc9195fff6b40619f44a8eb6e587b"/><file name="mysql4-upgrade-1.0.17-1.0.18.php" hash="8c7277e4675ef22ba3bc7ada3af71a2e"/><file name="mysql4-upgrade-1.0.18-1.0.23.php" hash="a18bc9195fff6b40619f44a8eb6e587b"/><file name="mysql4-upgrade-1.0.23-1.0.24.php" hash="a18bc9195fff6b40619f44a8eb6e587b"/><file name="mysql4-upgrade-1.0.24-1.1.1.php" hash="82727316a603b057ac84b556212f56d3"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="03b9a55f535b49e14530f921948b2cfa"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="PrintScience_Personalization.xml" hash="5f5c39c5b01e828137125d057d04a655"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="printscience_personalization"><dir name="catalog"><dir name="product"><file name="list.phtml" hash="62ba9a43781828e25c1e265f417db9db"/><dir name="view"><file name="addtocart.phtml" hash="a2b8a23bd490798f59fab3c77d77be0c"/><file name="media.phtml" hash="d0526045eca0891155f83aa067484178"/></dir><file name="view.phtml" hash="8b8da3a547a816942bb41cd5b0e10280"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="da6d47bb5d36d381e6d33b4f6fe1ce69"/></dir></dir><file name="cart.phtml" hash="661c4c4fcd0be9b709d0c337a3bf336b"/></dir></dir></dir><dir name="layout"><file name="printscience_personalization.xml" hash="4472f61c3bd3a450639b2f4a2ef3f2d5"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="printscience_personalization"><dir name="sales"><dir name="order"><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="5b6bcdd9bd94afda867429707dd786d3"/></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="printscience_personalization.xml" hash="d0934cc5cfaca9e2d6c687f2fb866943"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="PrintScience_Personalization.csv" hash="fc8365124f21bddca4dfac3d3dbf5b7f"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="printscience_personalization"><file name="checkdevice.js" hash="6072832eaf96a9a18ed30f557ed86f98"/><file name="gallery.js" hash="48e8c27701beb67eb1898bb858585058"/><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><file name="modalPopLite.css" hash="2739dac0ae24cc8d94b29c053971627c"/><file name="modalPopLite.min.js" hash="0966787a372628f9d6df762dff0f193b"/></dir></dir></dir></dir></dir></target><target name="mage"><dir><dir name="js"><dir name="printscience_personalization"><file name="gallery.css" hash="eccacd49a35d68ef25bc1bf8e292fe98"/><dir name="jquery"><dir name="fancybox"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancybox_loading.gif" hash="328cc0f6c78211485058d460e80f4fa8"/><file name="fancybox_loading@2x.gif" hash="f92938639fa894a0e8ded1c3368abe98"/><file name="fancybox_overlay.png" hash="77aeaa52715b898b73c74d68c630330e"/><file name="fancybox_sprite.png" hash="783d4031fe50c3d83c960911e1fbc705"/><file name="fancybox_sprite@2x.png" hash="ed9970ce22242421e66ff150aa97fe5f"/><file name="jquery.fancybox.css" hash="6c55951ce1e3115711f63f99b7501f3a"/><file name="jquery.fancybox.js" hash="921e9cb04ad6e2559869ec845c5be39b"/><file name="jquery.fancybox.pack.js" hash="cc9e759f24ba773aeef8a131889d3728"/></dir><dir name="helpers"><file name="fancybox_buttons.png" hash="b448080f8615e664b7788c7003803b59"/><file name="jquery.fancybox-buttons.css" hash="cac75538c2e3ddfadef839feaca8e356"/><file name="jquery.fancybox-buttons.js" hash="f53c246661fb995a3f12e67fa38e0fa0"/><file name="jquery.fancybox-media.js" hash="c017067f48d97ec4a077ccdf056e6a2e"/><file name="jquery.fancybox-thumbs.css" hash="52ddd84a9f42c1d4cd86d518a7f7e8bc"/><file name="jquery.fancybox-thumbs.js" hash="cf1fc1df534eede4cb460c5cbd71aba6"/></dir><file name="jquery-1.10.1.min.js" hash="33d85132f0154466fc017dd05111873d"/><dir name="jquery.cycle"><file name="jquery.cycle.lite.js" hash="3bfb845276cc77bfa5f051b56e207be5"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir><dir name="xmlrpc"><file name="xmlrpc.inc" hash="55ecb2a9f7fc20d53a7b4da9d885e26b"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/printscience_personalization/checkdevice.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
$(document).ready(function() {
|
3 |
+
//$.ajax({dataType: 'json',url: "//"+window.location.host+"/index.php/personalization/index/getversion/"}).success(function(data){
|
4 |
+
//alert("<br>---------"+data);
|
5 |
+
//if(data == '') {
|
6 |
+
var productId = 1;
|
7 |
+
$.ajax("http://he11.printscience.net/pdf_admin/rpc_api_v_4_0_0/get_version/product/" + productId + "/").success(function(data) {
|
8 |
+
var loc = window.location.href;
|
9 |
+
var dir = loc.substring(0, loc.lastIndexOf('/'));
|
10 |
+
$.ajax(dir+"/index.php/personalization/index/setversion/version/" + data.app_type + "/").success(function(data){
|
11 |
+
//alert("version set");
|
12 |
+
});
|
13 |
+
});
|
14 |
+
//}
|
15 |
+
//});
|
16 |
+
});
|
17 |
+
})(jQuery);
|
{js → skin/frontend/base/default}/printscience_personalization/gallery.js
RENAMED
@@ -1,10 +1,13 @@
|
|
1 |
(function($) {
|
|
|
|
|
|
|
2 |
$(window).load(function() {
|
3 |
$('.personalizationGallery').each(function(index, el) {
|
4 |
var imgHeightList = [];
|
5 |
-
|
6 |
-
$(el).find('img').each(function(index, el) {
|
7 |
-
|
8 |
imgHeightList.push($(el).height());
|
9 |
});
|
10 |
|
1 |
(function($) {
|
2 |
+
$.fn.cycle.defaults = $.extend($.fn.cycle.defaults, {
|
3 |
+
'slides' : '> a',
|
4 |
+
});
|
5 |
$(window).load(function() {
|
6 |
$('.personalizationGallery').each(function(index, el) {
|
7 |
var imgHeightList = [];
|
8 |
+
var ctr =1;
|
9 |
+
$(el).find('img').each(function(index, el) {
|
10 |
+
$(el).css('display', 'block');
|
11 |
imgHeightList.push($(el).height());
|
12 |
});
|
13 |
|