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.0.18 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.17 to 1.0.18
- app/code/local/PrintScience/Personalization/Model/Observer.php +324 -348
- app/code/local/PrintScience/Personalization/etc/config.xml +186 -194
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/{mysql4-install-1.0.17.php → mysql4-install-1.0.18.php} +2 -2
- app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.17-1.0.18.php +14 -0
- app/design/frontend/base/default/layout/printscience_personalization.xml +7 -11
- app/design/frontend/base/default/template/printscience_personalization/checkout/cart.phtml +235 -234
- package.xml +4 -4
app/code/local/PrintScience/Personalization/Model/Observer.php
CHANGED
|
@@ -1,349 +1,325 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Print Science personalization observer
|
| 4 |
-
*
|
| 5 |
-
*/
|
| 6 |
-
class PrintScience_Personalization_Model_Observer
|
| 7 |
-
{
|
| 8 |
-
/**
|
| 9 |
-
* Event observer
|
| 10 |
-
*
|
| 11 |
-
* @var Varien_Event_Observer
|
| 12 |
-
*/
|
| 13 |
-
private $_observer;
|
| 14 |
-
|
| 15 |
-
/**
|
| 16 |
-
* Check if current action is 'checkout_cart_add' and start personalization process
|
| 17 |
-
*
|
| 18 |
-
* @param Varien_Event_Observer $observer
|
| 19 |
-
*/
|
| 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();
|
| 27 |
-
|
| 28 |
-
$sessionKey = $request->getParam('api_session_key');
|
| 29 |
-
|
| 30 |
-
if (($controller->getFullActionName() == 'checkout_cart_add')
|
| 31 |
-
&& (!Mage::registry('PrintScience_Personalization_calledFromSuccessAction'))) {
|
| 32 |
-
$this->startPersonalization();
|
| 33 |
-
}elseif($sessionKey !='' && strcasecmp($controller->getFullActionName(), 'printscience_personalization_index_resumeShoppingCart') === 0){
|
| 34 |
-
//$this->startPersonalization();
|
| 35 |
-
}
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/**
|
| 39 |
-
* Start personalization process
|
| 40 |
-
*
|
| 41 |
-
* @param Mage_Core_Controller_Request_Http $product
|
| 42 |
-
*/
|
| 43 |
-
private function startPersonalization()
|
| 44 |
-
{
|
| 45 |
-
$controller = $this->_observer->getControllerAction();
|
| 46 |
-
$request = Mage::app()->getRequest();
|
| 47 |
-
$response = Mage::app()->getResponse();
|
| 48 |
-
$session = Mage::getSingleton('core/session');
|
| 49 |
-
$datasHelper = Mage::helper('printscience_personalization/data');
|
| 50 |
-
|
| 51 |
-
$productId = intval($request->getParam('product'));
|
| 52 |
-
$product = Mage::getModel('catalog/product')
|
| 53 |
-
->setStoreId(Mage::app()->getStore()->getId())
|
| 54 |
-
->load($productId);
|
| 55 |
-
if (!$product->getId()) {
|
| 56 |
-
return false;
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
$errorUrl = $product->getProductUrl();
|
| 60 |
-
|
| 61 |
-
/**
|
| 62 |
-
* Check if personalization is enabled for this product.
|
| 63 |
-
* If this is simple product then we need to check its 'personalization_enabled' attribute.
|
| 64 |
-
* If this is configurable product then we need to check 'personalization_enabled' attribute of its subproduct.
|
| 65 |
-
* No other product types are supported.
|
| 66 |
-
*/
|
| 67 |
-
$productTypeId = $product->getTypeId();
|
| 68 |
-
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
| 69 |
-
if (!$product->getPersonalizationEnabled()) {
|
| 70 |
-
return false;
|
| 71 |
-
}
|
| 72 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
| 73 |
-
$attributes = $request->getParam('super_attribute');
|
| 74 |
-
$product = $product->getTypeInstance()->getProductByAttributes($attributes);
|
| 75 |
-
$product = Mage::getModel('catalog/product')->load($product->getId());
|
| 76 |
-
if ((!$product) || (!$product->getPersonalizationEnabled())) {
|
| 77 |
-
return false;
|
| 78 |
-
}
|
| 79 |
-
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
| 80 |
-
if (!$product->getPersonalizationEnabled()) {
|
| 81 |
-
return false;
|
| 82 |
-
}
|
| 83 |
-
} else {
|
| 84 |
-
return false;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
// check if template ID is valid
|
| 88 |
-
$templateId = $product->getPersonalizationTemplateId();
|
| 89 |
-
if (!$templateId) {
|
| 90 |
-
$session->addError($controller->__('Unable to start personalization: template ID is empty.'));
|
| 91 |
-
$response->setRedirect($errorUrl)->sendHeaders();
|
| 92 |
-
//$datasHelper->_redirectToUrl($errorUrl);
|
| 93 |
-
exit();
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
$sessionHelper = Mage::helper('printscience_personalization/session');
|
| 97 |
-
$sessionKey = $sessionHelper->generateKey();
|
| 98 |
-
|
| 99 |
-
$buyRequestParams = $request->getParams();
|
| 100 |
-
if (isset($buyRequestParams['uenc'])) {
|
| 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 |
-
$successUrl = Mage::getUrl('personalization/index/success', $returnUrlParams);
|
| 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();
|
| 118 |
-
//$datasHelper->_redirectToUrl($errorUrl);
|
| 119 |
-
exit();
|
| 120 |
-
}
|
| 121 |
-
if ($apiResponse->getFaultCode()) {
|
| 122 |
-
$session->addError($controller->__('Unable to start personalization: ' . $apiResponse->getFaultString()));
|
| 123 |
-
$response->setRedirect($errorUrl)->sendHeaders();
|
| 124 |
-
//$datasHelper->_redirectToUrl($errorUrl);
|
| 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();
|
| 137 |
-
|
| 138 |
-
//$datasHelper->_redirectToUrl($appUrl);
|
| 139 |
-
exit();
|
| 140 |
-
}
|
| 141 |
-
|
| 142 |
-
/**
|
| 143 |
-
* End personalization process when item is deleted from shopping cart
|
| 144 |
-
*
|
| 145 |
-
* @param Varien_Event_Observer $observer
|
| 146 |
-
*/
|
| 147 |
-
public function endPersonalization($observer)
|
| 148 |
-
{
|
| 149 |
-
$this->_observer = $observer;
|
| 150 |
-
|
| 151 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 152 |
-
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 153 |
-
|
| 154 |
-
$quoteItem = $observer->getEvent()->getData('quote_item');
|
| 155 |
-
$data = $quoteHelper->getItemData($quoteItem);
|
| 156 |
-
if ($data) {
|
| 157 |
-
$apiGateway->endPersonalization($data['apiSessionKey']);
|
| 158 |
-
}
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
/**
|
| 162 |
-
* Add personalization options to cart item
|
| 163 |
-
*
|
| 164 |
-
* @param Varien_Event_Observer $observer
|
| 165 |
-
*/
|
| 166 |
-
public function addOptionsToCartItem($observer)
|
| 167 |
-
{
|
| 168 |
-
$this->_observer = $observer;
|
| 169 |
-
|
| 170 |
-
$request = Mage::app()->getRequest();
|
| 171 |
-
|
| 172 |
-
$sessionKey = $request->getParam('personalization_session_key');
|
| 173 |
-
|
| 174 |
-
$quoteItem = $observer->getEvent()->getData('quote_item');
|
| 175 |
-
$productItem = Mage::getModel('catalog/product')->load($quoteItem->getProduct()->getId());
|
| 176 |
-
if (!$sessionKey) {
|
| 177 |
-
//if ((!$productItem->getPersonalizationEnabled()) || (!$sessionKey)) {
|
| 178 |
-
return false;
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
$sessionHelper = Mage::helper('printscience_personalization/session');
|
| 182 |
-
$sessionData = $sessionHelper->getData($sessionKey);
|
| 183 |
-
if (!$sessionData) {
|
| 184 |
-
return false;
|
| 185 |
-
}
|
| 186 |
-
unset($sessionData['buyRequest']);
|
| 187 |
-
$sessionData['sessionKey'] = $sessionKey;
|
| 188 |
-
|
| 189 |
-
$parentItem = $quoteItem->getParentItem();
|
| 190 |
-
if ($parentItem) {
|
| 191 |
-
$quoteItem = $parentItem;
|
| 192 |
-
}
|
| 193 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
$quoteHelper->addItemData($quoteItem, $sessionData);
|
| 197 |
-
}
|
| 198 |
-
|
| 199 |
-
/**
|
| 200 |
-
* Add personalization options to order items
|
| 201 |
-
*
|
| 202 |
-
* @param Varien_Event_Observer $observer
|
| 203 |
-
*/
|
| 204 |
-
public function addOptionsToOrderItems($observer)
|
| 205 |
-
{
|
| 206 |
-
$this->_observer = $observer;
|
| 207 |
-
|
| 208 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 209 |
-
$orderHelper = Mage::helper('printscience_personalization/order');
|
| 210 |
-
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 211 |
-
|
| 212 |
-
$order = $observer->getEvent()->getData('order');
|
| 213 |
-
$orderItems = $order->getItemsCollection();
|
| 214 |
-
foreach ($orderItems as $orderItem) {
|
| 215 |
-
$quoteItemOptions = Mage::getModel('sales/quote_item_option')
|
| 216 |
-
->getCollection()
|
| 217 |
-
->addItemFilter($orderItem->getQuoteItemId());
|
| 218 |
-
if (!count($quoteItemOptions)) {
|
| 219 |
-
return false;
|
| 220 |
-
}
|
| 221 |
-
$quoteItem = Mage::getModel('sales/quote_item')
|
| 222 |
-
->load($orderItem->getQuoteItemId())
|
| 223 |
-
->setOptions($quoteItemOptions);
|
| 224 |
-
if (!$quoteItem->getId()) {
|
| 225 |
-
continue;
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
if($personalizationInfo = $quoteItem->getData('personalization_info')){
|
| 229 |
-
$personalizationInfo = unserialize($personalizationInfo);
|
| 230 |
-
if(!empty($personalizationInfo)){
|
| 231 |
-
$orderHelper->addItemData($orderItem,$personalizationInfo);
|
| 232 |
-
}
|
| 233 |
-
continue;
|
| 234 |
-
}
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
$quoteItemData = $quoteHelper->getItemData($quoteItem);
|
| 238 |
-
if (!$quoteItemData) {
|
| 239 |
-
continue;
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
$apiResponse = $apiGateway->getPreview($quoteItemData['apiSessionKey']);
|
| 243 |
-
if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
|
| 244 |
-
continue;
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
$orderHelper->addItemData($orderItem, array(
|
| 248 |
-
'preview_pdf_url' => $apiResponse->getPdfUrl(),
|
| 249 |
-
'product_images' =>$apiResponse->getPeviewUrls()
|
| 250 |
-
));
|
| 251 |
-
|
| 252 |
-
$apiGateway->endPersonalization($quoteItemData['apiSessionKey']);
|
| 253 |
-
}
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
-
/**
|
| 257 |
-
* Intialize personalization gallery on shopping cart
|
| 258 |
-
*
|
| 259 |
-
* @param Varien_Event_Observer $observer
|
| 260 |
-
* @return boolean
|
| 261 |
-
*/
|
| 262 |
-
public function initGallery($observer)
|
| 263 |
-
{
|
| 264 |
-
$this->_observer = $observer;
|
| 265 |
-
|
| 266 |
-
$layout = Mage::app()->getLayout();
|
| 267 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 268 |
-
|
| 269 |
-
$cartItems = Mage::getModel('checkout/cart')->getItems();
|
| 270 |
-
if (!$cartItems) {
|
| 271 |
-
return false;
|
| 272 |
-
}
|
| 273 |
-
$containsPersonalizedItems = false;
|
| 274 |
-
foreach ($cartItems as $item) {
|
| 275 |
-
if ($quoteHelper->getItemData($item)) {
|
| 276 |
-
$containsPersonalizedItems = true;
|
| 277 |
-
break;
|
| 278 |
-
}
|
| 279 |
-
}
|
| 280 |
-
//if ($containsPersonalizedItems) {
|
| 281 |
-
$layout->getBlock('head')
|
| 282 |
-
->addJs('printscience_personalization/jquery/jquery-1.4.2.min.js')
|
| 283 |
-
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.min.js')
|
| 284 |
-
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox-1.3.4.pack.js')
|
| 285 |
-
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox-1.3.4.css')
|
| 286 |
-
->addJs('printscience_personalization/gallery.js')
|
| 287 |
-
->addItem('js_css', 'printscience_personalization/gallery.css');
|
| 288 |
-
//}
|
| 289 |
-
}
|
| 290 |
-
|
| 291 |
-
/**
|
| 292 |
-
* Ensure that all personalized items in shopping cart have proper API session key
|
| 293 |
-
*
|
| 294 |
-
* @param Varien_Event_Observer $observer
|
| 295 |
-
*/
|
| 296 |
-
public function checkCartItems($observer)
|
| 297 |
-
{
|
| 298 |
-
$this->_observer = $observer;
|
| 299 |
-
|
| 300 |
-
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 301 |
-
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 302 |
-
|
| 303 |
-
$quote = $observer->getEvent()->getData('data_object');
|
| 304 |
-
$quoteItems = $quote->getItemsCollection();
|
| 305 |
-
foreach ($quoteItems as $item) {
|
| 306 |
-
$data = $quoteHelper->getItemData($item);
|
| 307 |
-
if (($data) && (isset($data['apiSessionKey']))) {
|
| 308 |
-
$apiResponse = $apiGateway->getPreview($data['apiSessionKey']);
|
| 309 |
-
if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
|
| 310 |
-
// remove by hieptq
|
| 311 |
-
//$quote->removeItem($item->getItemId());
|
| 312 |
-
}
|
| 313 |
-
}
|
| 314 |
-
}
|
| 315 |
-
}
|
| 316 |
-
public function addToCartComplete(Varien_Event_Observer $observer) {
|
| 317 |
-
// Send the user to the Item added page
|
| 318 |
-
$response = $observer->getResponse();
|
| 319 |
-
$request = $observer->getRequest();
|
| 320 |
-
$datasHelper = Mage::helper('printscience_personalization/data');
|
| 321 |
-
$checkOutUrl = Mage::getUrl('checkout/cart');
|
| 322 |
-
$datasHelper->_redirectToUrl($checkOutUrl, "1");
|
| 323 |
-
exit;
|
| 324 |
-
}
|
| 325 |
-
|
| 326 |
-
/**
|
| 327 |
-
* Converts attribute set name of current product to nice name ([a-z0-9_]+).
|
| 328 |
-
* Adds layout handle PRODUCT_ATTRIBUTE_SET_<attribute_set_nicename> after
|
| 329 |
-
* PRODUCT_TYPE_<product_type_id> handle
|
| 330 |
-
*
|
| 331 |
-
* Event: controller_action_layout_load_before
|
| 332 |
-
*
|
| 333 |
-
* @param Varien_Event_Observer $observer
|
| 334 |
-
*/
|
| 335 |
-
public function addAttributeSetHandle(Varien_Event_Observer $observer)
|
| 336 |
-
{
|
| 337 |
-
$product = Mage::registry('current_product');
|
| 338 |
-
$datasHelper = Mage::helper('printscience_personalization/output');
|
| 339 |
-
|
| 340 |
-
if (!($product instanceof Mage_Catalog_Model_Product)) {
|
| 341 |
-
return;
|
| 342 |
-
}
|
| 343 |
-
|
| 344 |
-
if($datasHelper->isPersonalizationEnabled($product)) {
|
| 345 |
-
Mage::app()->getLayout()->getUpdate()->addHandle('catalog_product_view_personalization_handle');
|
| 346 |
-
Mage::app()->getLayout()->getUpdate()->addHandle('catalog_product_addtocart_personalization_handle');
|
| 347 |
-
}
|
| 348 |
-
}
|
| 349 |
}
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Print Science personalization observer
|
| 4 |
+
*
|
| 5 |
+
*/
|
| 6 |
+
class PrintScience_Personalization_Model_Observer
|
| 7 |
+
{
|
| 8 |
+
/**
|
| 9 |
+
* Event observer
|
| 10 |
+
*
|
| 11 |
+
* @var Varien_Event_Observer
|
| 12 |
+
*/
|
| 13 |
+
private $_observer;
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Check if current action is 'checkout_cart_add' and start personalization process
|
| 17 |
+
*
|
| 18 |
+
* @param Varien_Event_Observer $observer
|
| 19 |
+
*/
|
| 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();
|
| 27 |
+
|
| 28 |
+
$sessionKey = $request->getParam('api_session_key');
|
| 29 |
+
|
| 30 |
+
if (($controller->getFullActionName() == 'checkout_cart_add')
|
| 31 |
+
&& (!Mage::registry('PrintScience_Personalization_calledFromSuccessAction'))) {
|
| 32 |
+
$this->startPersonalization();
|
| 33 |
+
}elseif($sessionKey !='' && strcasecmp($controller->getFullActionName(), 'printscience_personalization_index_resumeShoppingCart') === 0){
|
| 34 |
+
//$this->startPersonalization();
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Start personalization process
|
| 40 |
+
*
|
| 41 |
+
* @param Mage_Core_Controller_Request_Http $product
|
| 42 |
+
*/
|
| 43 |
+
private function startPersonalization()
|
| 44 |
+
{
|
| 45 |
+
$controller = $this->_observer->getControllerAction();
|
| 46 |
+
$request = Mage::app()->getRequest();
|
| 47 |
+
$response = Mage::app()->getResponse();
|
| 48 |
+
$session = Mage::getSingleton('core/session');
|
| 49 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
| 50 |
+
|
| 51 |
+
$productId = intval($request->getParam('product'));
|
| 52 |
+
$product = Mage::getModel('catalog/product')
|
| 53 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
| 54 |
+
->load($productId);
|
| 55 |
+
if (!$product->getId()) {
|
| 56 |
+
return false;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
$errorUrl = $product->getProductUrl();
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Check if personalization is enabled for this product.
|
| 63 |
+
* If this is simple product then we need to check its 'personalization_enabled' attribute.
|
| 64 |
+
* If this is configurable product then we need to check 'personalization_enabled' attribute of its subproduct.
|
| 65 |
+
* No other product types are supported.
|
| 66 |
+
*/
|
| 67 |
+
$productTypeId = $product->getTypeId();
|
| 68 |
+
if ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
| 69 |
+
if (!$product->getPersonalizationEnabled()) {
|
| 70 |
+
return false;
|
| 71 |
+
}
|
| 72 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
| 73 |
+
$attributes = $request->getParam('super_attribute');
|
| 74 |
+
$product = $product->getTypeInstance()->getProductByAttributes($attributes);
|
| 75 |
+
$product = Mage::getModel('catalog/product')->load($product->getId());
|
| 76 |
+
if ((!$product) || (!$product->getPersonalizationEnabled())) {
|
| 77 |
+
return false;
|
| 78 |
+
}
|
| 79 |
+
} elseif ($productTypeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
| 80 |
+
if (!$product->getPersonalizationEnabled()) {
|
| 81 |
+
return false;
|
| 82 |
+
}
|
| 83 |
+
} else {
|
| 84 |
+
return false;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
// check if template ID is valid
|
| 88 |
+
$templateId = $product->getPersonalizationTemplateId();
|
| 89 |
+
if (!$templateId) {
|
| 90 |
+
$session->addError($controller->__('Unable to start personalization: template ID is empty.'));
|
| 91 |
+
$response->setRedirect($errorUrl)->sendHeaders();
|
| 92 |
+
//$datasHelper->_redirectToUrl($errorUrl);
|
| 93 |
+
exit();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
| 97 |
+
$sessionKey = $sessionHelper->generateKey();
|
| 98 |
+
|
| 99 |
+
$buyRequestParams = $request->getParams();
|
| 100 |
+
if (isset($buyRequestParams['uenc'])) {
|
| 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 |
+
$successUrl = Mage::getUrl('personalization/index/success', $returnUrlParams);
|
| 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();
|
| 118 |
+
//$datasHelper->_redirectToUrl($errorUrl);
|
| 119 |
+
exit();
|
| 120 |
+
}
|
| 121 |
+
if ($apiResponse->getFaultCode()) {
|
| 122 |
+
$session->addError($controller->__('Unable to start personalization: ' . $apiResponse->getFaultString()));
|
| 123 |
+
$response->setRedirect($errorUrl)->sendHeaders();
|
| 124 |
+
//$datasHelper->_redirectToUrl($errorUrl);
|
| 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();
|
| 137 |
+
|
| 138 |
+
//$datasHelper->_redirectToUrl($appUrl);
|
| 139 |
+
exit();
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
/**
|
| 143 |
+
* End personalization process when item is deleted from shopping cart
|
| 144 |
+
*
|
| 145 |
+
* @param Varien_Event_Observer $observer
|
| 146 |
+
*/
|
| 147 |
+
public function endPersonalization($observer)
|
| 148 |
+
{
|
| 149 |
+
$this->_observer = $observer;
|
| 150 |
+
|
| 151 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 152 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 153 |
+
|
| 154 |
+
$quoteItem = $observer->getEvent()->getData('quote_item');
|
| 155 |
+
$data = $quoteHelper->getItemData($quoteItem);
|
| 156 |
+
if ($data) {
|
| 157 |
+
$apiGateway->endPersonalization($data['apiSessionKey']);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
* Add personalization options to cart item
|
| 163 |
+
*
|
| 164 |
+
* @param Varien_Event_Observer $observer
|
| 165 |
+
*/
|
| 166 |
+
public function addOptionsToCartItem($observer)
|
| 167 |
+
{
|
| 168 |
+
$this->_observer = $observer;
|
| 169 |
+
|
| 170 |
+
$request = Mage::app()->getRequest();
|
| 171 |
+
|
| 172 |
+
$sessionKey = $request->getParam('personalization_session_key');
|
| 173 |
+
|
| 174 |
+
$quoteItem = $observer->getEvent()->getData('quote_item');
|
| 175 |
+
$productItem = Mage::getModel('catalog/product')->load($quoteItem->getProduct()->getId());
|
| 176 |
+
if (!$sessionKey) {
|
| 177 |
+
//if ((!$productItem->getPersonalizationEnabled()) || (!$sessionKey)) {
|
| 178 |
+
return false;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
$sessionHelper = Mage::helper('printscience_personalization/session');
|
| 182 |
+
$sessionData = $sessionHelper->getData($sessionKey);
|
| 183 |
+
if (!$sessionData) {
|
| 184 |
+
return false;
|
| 185 |
+
}
|
| 186 |
+
unset($sessionData['buyRequest']);
|
| 187 |
+
$sessionData['sessionKey'] = $sessionKey;
|
| 188 |
+
|
| 189 |
+
$parentItem = $quoteItem->getParentItem();
|
| 190 |
+
if ($parentItem) {
|
| 191 |
+
$quoteItem = $parentItem;
|
| 192 |
+
}
|
| 193 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
$quoteHelper->addItemData($quoteItem, $sessionData);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Add personalization options to order items
|
| 201 |
+
*
|
| 202 |
+
* @param Varien_Event_Observer $observer
|
| 203 |
+
*/
|
| 204 |
+
public function addOptionsToOrderItems($observer)
|
| 205 |
+
{
|
| 206 |
+
$this->_observer = $observer;
|
| 207 |
+
|
| 208 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 209 |
+
$orderHelper = Mage::helper('printscience_personalization/order');
|
| 210 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 211 |
+
|
| 212 |
+
$order = $observer->getEvent()->getData('order');
|
| 213 |
+
$orderItems = $order->getItemsCollection();
|
| 214 |
+
foreach ($orderItems as $orderItem) {
|
| 215 |
+
$quoteItemOptions = Mage::getModel('sales/quote_item_option')
|
| 216 |
+
->getCollection()
|
| 217 |
+
->addItemFilter($orderItem->getQuoteItemId());
|
| 218 |
+
if (!count($quoteItemOptions)) {
|
| 219 |
+
return false;
|
| 220 |
+
}
|
| 221 |
+
$quoteItem = Mage::getModel('sales/quote_item')
|
| 222 |
+
->load($orderItem->getQuoteItemId())
|
| 223 |
+
->setOptions($quoteItemOptions);
|
| 224 |
+
if (!$quoteItem->getId()) {
|
| 225 |
+
continue;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
if($personalizationInfo = $quoteItem->getData('personalization_info')){
|
| 229 |
+
$personalizationInfo = unserialize($personalizationInfo);
|
| 230 |
+
if(!empty($personalizationInfo)){
|
| 231 |
+
$orderHelper->addItemData($orderItem,$personalizationInfo);
|
| 232 |
+
}
|
| 233 |
+
continue;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
$quoteItemData = $quoteHelper->getItemData($quoteItem);
|
| 238 |
+
if (!$quoteItemData) {
|
| 239 |
+
continue;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
$apiResponse = $apiGateway->getPreview($quoteItemData['apiSessionKey']);
|
| 243 |
+
if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
|
| 244 |
+
continue;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
$orderHelper->addItemData($orderItem, array(
|
| 248 |
+
'preview_pdf_url' => $apiResponse->getPdfUrl(),
|
| 249 |
+
'product_images' =>$apiResponse->getPeviewUrls()
|
| 250 |
+
));
|
| 251 |
+
|
| 252 |
+
$apiGateway->endPersonalization($quoteItemData['apiSessionKey']);
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/**
|
| 257 |
+
* Intialize personalization gallery on shopping cart
|
| 258 |
+
*
|
| 259 |
+
* @param Varien_Event_Observer $observer
|
| 260 |
+
* @return boolean
|
| 261 |
+
*/
|
| 262 |
+
public function initGallery($observer)
|
| 263 |
+
{
|
| 264 |
+
$this->_observer = $observer;
|
| 265 |
+
|
| 266 |
+
$layout = Mage::app()->getLayout();
|
| 267 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 268 |
+
|
| 269 |
+
$cartItems = Mage::getModel('checkout/cart')->getItems();
|
| 270 |
+
if (!$cartItems) {
|
| 271 |
+
return false;
|
| 272 |
+
}
|
| 273 |
+
$containsPersonalizedItems = false;
|
| 274 |
+
foreach ($cartItems as $item) {
|
| 275 |
+
if ($quoteHelper->getItemData($item)) {
|
| 276 |
+
$containsPersonalizedItems = true;
|
| 277 |
+
break;
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
//if ($containsPersonalizedItems) {
|
| 281 |
+
$layout->getBlock('head')
|
| 282 |
+
->addJs('printscience_personalization/jquery/jquery-1.4.2.min.js')
|
| 283 |
+
->addJs('printscience_personalization/jquery/jquery.cycle/jquery.cycle.lite.min.js')
|
| 284 |
+
->addJs('printscience_personalization/jquery/fancybox/jquery.fancybox-1.3.4.pack.js')
|
| 285 |
+
->addItem('js_css', 'printscience_personalization/jquery/fancybox/jquery.fancybox-1.3.4.css')
|
| 286 |
+
->addJs('printscience_personalization/gallery.js')
|
| 287 |
+
->addItem('js_css', 'printscience_personalization/gallery.css');
|
| 288 |
+
//}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/**
|
| 292 |
+
* Ensure that all personalized items in shopping cart have proper API session key
|
| 293 |
+
*
|
| 294 |
+
* @param Varien_Event_Observer $observer
|
| 295 |
+
*/
|
| 296 |
+
public function checkCartItems($observer)
|
| 297 |
+
{
|
| 298 |
+
$this->_observer = $observer;
|
| 299 |
+
|
| 300 |
+
$quoteHelper = Mage::helper('printscience_personalization/quote');
|
| 301 |
+
$apiGateway = Mage::getModel('printscience_personalization/apiGateway');
|
| 302 |
+
|
| 303 |
+
$quote = $observer->getEvent()->getData('data_object');
|
| 304 |
+
$quoteItems = $quote->getItemsCollection();
|
| 305 |
+
foreach ($quoteItems as $item) {
|
| 306 |
+
$data = $quoteHelper->getItemData($item);
|
| 307 |
+
if (($data) && (isset($data['apiSessionKey']))) {
|
| 308 |
+
$apiResponse = $apiGateway->getPreview($data['apiSessionKey']);
|
| 309 |
+
if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
|
| 310 |
+
// remove by hieptq
|
| 311 |
+
//$quote->removeItem($item->getItemId());
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
public function addToCartComplete(Varien_Event_Observer $observer) {
|
| 317 |
+
// Send the user to the Item added page
|
| 318 |
+
$response = $observer->getResponse();
|
| 319 |
+
$request = $observer->getRequest();
|
| 320 |
+
$datasHelper = Mage::helper('printscience_personalization/data');
|
| 321 |
+
$checkOutUrl = Mage::getUrl('checkout/cart');
|
| 322 |
+
$datasHelper->_redirectToUrl($checkOutUrl, "1");
|
| 323 |
+
exit;
|
| 324 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
}
|
app/code/local/PrintScience/Personalization/etc/config.xml
CHANGED
|
@@ -1,195 +1,187 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<PrintScience_Personalization>
|
| 5 |
-
<version>1.0.
|
| 6 |
-
</PrintScience_Personalization>
|
| 7 |
-
</modules>
|
| 8 |
-
<frontend>
|
| 9 |
-
<routers>
|
| 10 |
-
<printscience_personalization>
|
| 11 |
-
<use>standard</use>
|
| 12 |
-
<args>
|
| 13 |
-
<module>PrintScience_Personalization</module>
|
| 14 |
-
<frontName>personalization</frontName>
|
| 15 |
-
</args>
|
| 16 |
-
</printscience_personalization>
|
| 17 |
-
</routers>
|
| 18 |
-
<layout>
|
| 19 |
-
<updates>
|
| 20 |
-
<printscience_personalization>
|
| 21 |
-
<file>printscience_personalization.xml</file>
|
| 22 |
-
</printscience_personalization>
|
| 23 |
-
</updates>
|
| 24 |
-
</layout>
|
| 25 |
-
<translate>
|
| 26 |
-
<modules>
|
| 27 |
-
<PrintScience_Personalization>
|
| 28 |
-
<files>
|
| 29 |
-
<default>PrintScience_Personalization.csv</default>
|
| 30 |
-
</files>
|
| 31 |
-
</PrintScience_Personalization>
|
| 32 |
-
</modules>
|
| 33 |
-
</translate>
|
| 34 |
-
<events>
|
| 35 |
-
<checkout_cart_add_product_complete>
|
| 36 |
-
<observers>
|
| 37 |
-
<printscience_personalization_observer>
|
| 38 |
-
<type>singleton</type>
|
| 39 |
-
<class>printscience_personalization/observer</class>
|
| 40 |
-
<method>addToCartComplete</method>
|
| 41 |
-
</printscience_personalization_observer>
|
| 42 |
-
</observers>
|
| 43 |
-
</checkout_cart_add_product_complete>
|
| 44 |
-
</events>
|
| 45 |
-
</frontend>
|
| 46 |
-
<adminhtml>
|
| 47 |
-
<layout>
|
| 48 |
-
<updates>
|
| 49 |
-
<printscience_personalization>
|
| 50 |
-
<file>printscience_personalization.xml</file>
|
| 51 |
-
</printscience_personalization>
|
| 52 |
-
<basket>
|
| 53 |
-
<file>picker.xml</file>
|
| 54 |
-
</basket>
|
| 55 |
-
</updates>
|
| 56 |
-
</layout>
|
| 57 |
-
<translate>
|
| 58 |
-
<modules>
|
| 59 |
-
<PrintScience_Personalization>
|
| 60 |
-
<files>
|
| 61 |
-
<default>PrintScience_Personalization.csv</default>
|
| 62 |
-
</files>
|
| 63 |
-
</PrintScience_Personalization>
|
| 64 |
-
</modules>
|
| 65 |
-
</translate>
|
| 66 |
-
</adminhtml>
|
| 67 |
-
<global>
|
| 68 |
-
<models>
|
| 69 |
-
<printscience_personalization>
|
| 70 |
-
<class>PrintScience_Personalization_Model</class>
|
| 71 |
-
</printscience_personalization>
|
| 72 |
-
<checkout>
|
| 73 |
-
<rewrite>
|
| 74 |
-
<cart>PrintScience_Personalization_Model_Override_Checkout_Cart</cart>
|
| 75 |
-
</rewrite>
|
| 76 |
-
</checkout>
|
| 77 |
-
<sales>
|
| 78 |
-
<rewrite>
|
| 79 |
-
<quote>PrintScience_Personalization_Model_Override_Sales_Quote</quote>
|
| 80 |
-
</rewrite>
|
| 81 |
-
</sales>
|
| 82 |
-
</models>
|
| 83 |
-
<helpers>
|
| 84 |
-
<printscience_personalization>
|
| 85 |
-
<class>PrintScience_Personalization_Helper</class>
|
| 86 |
-
</printscience_personalization>
|
| 87 |
-
</helpers>
|
| 88 |
-
<blocks>
|
| 89 |
-
<printscience_personalization>
|
| 90 |
-
<class>PrintScience_Personalization_Block</class>
|
| 91 |
-
</printscience_personalization>
|
| 92 |
-
</blocks>
|
| 93 |
-
<events>
|
| 94 |
-
<controller_action_predispatch>
|
| 95 |
-
<observers>
|
| 96 |
-
<printscience_personalization_model_observer>
|
| 97 |
-
<type>singleton</type>
|
| 98 |
-
<class>printscience_personalization/observer</class>
|
| 99 |
-
<method>checkForCheckoutCartAddAction</method>
|
| 100 |
-
</printscience_personalization_model_observer>
|
| 101 |
-
</observers>
|
| 102 |
-
</controller_action_predispatch>
|
| 103 |
-
<checkout_cart_product_add_after>
|
| 104 |
-
<observers>
|
| 105 |
-
<printscience_personalization_model_observer>
|
| 106 |
-
<type>singleton</type>
|
| 107 |
-
<class>printscience_personalization/observer</class>
|
| 108 |
-
<method>addOptionsToCartItem</method>
|
| 109 |
-
</printscience_personalization_model_observer>
|
| 110 |
-
</observers>
|
| 111 |
-
</checkout_cart_product_add_after>
|
| 112 |
-
<sales_order_place_before>
|
| 113 |
-
<observers>
|
| 114 |
-
<printscience_personalization_model_observer>
|
| 115 |
-
<type>singleton</type>
|
| 116 |
-
<class>printscience_personalization/observer</class>
|
| 117 |
-
<method>addOptionsToOrderItems</method>
|
| 118 |
-
</printscience_personalization_model_observer>
|
| 119 |
-
</observers>
|
| 120 |
-
</sales_order_place_before>
|
| 121 |
-
<controller_action_layout_render_before_checkout_cart_index>
|
| 122 |
-
<observers>
|
| 123 |
-
<printscience_personalization_model_observer>
|
| 124 |
-
<type>singleton</type>
|
| 125 |
-
<class>printscience_personalization/observer</class>
|
| 126 |
-
<method>initGallery</method>
|
| 127 |
-
</printscience_personalization_model_observer>
|
| 128 |
-
</observers>
|
| 129 |
-
</controller_action_layout_render_before_checkout_cart_index>
|
| 130 |
-
<controller_action_layout_render_before_checkout_cart_configure>
|
| 131 |
-
<observers>
|
| 132 |
-
<printscience_personalization_model_observer>
|
| 133 |
-
<type>singleton</type>
|
| 134 |
-
<class>printscience_personalization/observer</class>
|
| 135 |
-
<method>initGallery</method>
|
| 136 |
-
</printscience_personalization_model_observer>
|
| 137 |
-
</observers>
|
| 138 |
-
</controller_action_layout_render_before_checkout_cart_configure>
|
| 139 |
-
<sales_quote_remove_item>
|
| 140 |
-
<observers>
|
| 141 |
-
<printscience_personalization_model_observer>
|
| 142 |
-
<type>singleton</type>
|
| 143 |
-
<class>printscience_personalization/observer</class>
|
| 144 |
-
<method>endPersonalization</method>
|
| 145 |
-
</printscience_personalization_model_observer>
|
| 146 |
-
</observers>
|
| 147 |
-
</sales_quote_remove_item>
|
| 148 |
-
<sales_quote_load_after>
|
| 149 |
-
<observers>
|
| 150 |
-
<printscience_personalization_model_observer>
|
| 151 |
-
<type>singleton</type>
|
| 152 |
-
<class>printscience_personalization/observer</class>
|
| 153 |
-
<method>checkCartItems</method>
|
| 154 |
-
</printscience_personalization_model_observer>
|
| 155 |
-
</observers>
|
| 156 |
-
</sales_quote_load_after>
|
| 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 |
-
</global>
|
| 188 |
-
<default>
|
| 189 |
-
<catalog>
|
| 190 |
-
<personalization>
|
| 191 |
-
<api_version>1.0.0</api_version>
|
| 192 |
-
</personalization>
|
| 193 |
-
</catalog>
|
| 194 |
-
</default>
|
| 195 |
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<PrintScience_Personalization>
|
| 5 |
+
<version>1.0.18</version>
|
| 6 |
+
</PrintScience_Personalization>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<printscience_personalization>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>PrintScience_Personalization</module>
|
| 14 |
+
<frontName>personalization</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</printscience_personalization>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<printscience_personalization>
|
| 21 |
+
<file>printscience_personalization.xml</file>
|
| 22 |
+
</printscience_personalization>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
<translate>
|
| 26 |
+
<modules>
|
| 27 |
+
<PrintScience_Personalization>
|
| 28 |
+
<files>
|
| 29 |
+
<default>PrintScience_Personalization.csv</default>
|
| 30 |
+
</files>
|
| 31 |
+
</PrintScience_Personalization>
|
| 32 |
+
</modules>
|
| 33 |
+
</translate>
|
| 34 |
+
<events>
|
| 35 |
+
<checkout_cart_add_product_complete>
|
| 36 |
+
<observers>
|
| 37 |
+
<printscience_personalization_observer>
|
| 38 |
+
<type>singleton</type>
|
| 39 |
+
<class>printscience_personalization/observer</class>
|
| 40 |
+
<method>addToCartComplete</method>
|
| 41 |
+
</printscience_personalization_observer>
|
| 42 |
+
</observers>
|
| 43 |
+
</checkout_cart_add_product_complete>
|
| 44 |
+
</events>
|
| 45 |
+
</frontend>
|
| 46 |
+
<adminhtml>
|
| 47 |
+
<layout>
|
| 48 |
+
<updates>
|
| 49 |
+
<printscience_personalization>
|
| 50 |
+
<file>printscience_personalization.xml</file>
|
| 51 |
+
</printscience_personalization>
|
| 52 |
+
<basket>
|
| 53 |
+
<file>picker.xml</file>
|
| 54 |
+
</basket>
|
| 55 |
+
</updates>
|
| 56 |
+
</layout>
|
| 57 |
+
<translate>
|
| 58 |
+
<modules>
|
| 59 |
+
<PrintScience_Personalization>
|
| 60 |
+
<files>
|
| 61 |
+
<default>PrintScience_Personalization.csv</default>
|
| 62 |
+
</files>
|
| 63 |
+
</PrintScience_Personalization>
|
| 64 |
+
</modules>
|
| 65 |
+
</translate>
|
| 66 |
+
</adminhtml>
|
| 67 |
+
<global>
|
| 68 |
+
<models>
|
| 69 |
+
<printscience_personalization>
|
| 70 |
+
<class>PrintScience_Personalization_Model</class>
|
| 71 |
+
</printscience_personalization>
|
| 72 |
+
<checkout>
|
| 73 |
+
<rewrite>
|
| 74 |
+
<cart>PrintScience_Personalization_Model_Override_Checkout_Cart</cart>
|
| 75 |
+
</rewrite>
|
| 76 |
+
</checkout>
|
| 77 |
+
<sales>
|
| 78 |
+
<rewrite>
|
| 79 |
+
<quote>PrintScience_Personalization_Model_Override_Sales_Quote</quote>
|
| 80 |
+
</rewrite>
|
| 81 |
+
</sales>
|
| 82 |
+
</models>
|
| 83 |
+
<helpers>
|
| 84 |
+
<printscience_personalization>
|
| 85 |
+
<class>PrintScience_Personalization_Helper</class>
|
| 86 |
+
</printscience_personalization>
|
| 87 |
+
</helpers>
|
| 88 |
+
<blocks>
|
| 89 |
+
<printscience_personalization>
|
| 90 |
+
<class>PrintScience_Personalization_Block</class>
|
| 91 |
+
</printscience_personalization>
|
| 92 |
+
</blocks>
|
| 93 |
+
<events>
|
| 94 |
+
<controller_action_predispatch>
|
| 95 |
+
<observers>
|
| 96 |
+
<printscience_personalization_model_observer>
|
| 97 |
+
<type>singleton</type>
|
| 98 |
+
<class>printscience_personalization/observer</class>
|
| 99 |
+
<method>checkForCheckoutCartAddAction</method>
|
| 100 |
+
</printscience_personalization_model_observer>
|
| 101 |
+
</observers>
|
| 102 |
+
</controller_action_predispatch>
|
| 103 |
+
<checkout_cart_product_add_after>
|
| 104 |
+
<observers>
|
| 105 |
+
<printscience_personalization_model_observer>
|
| 106 |
+
<type>singleton</type>
|
| 107 |
+
<class>printscience_personalization/observer</class>
|
| 108 |
+
<method>addOptionsToCartItem</method>
|
| 109 |
+
</printscience_personalization_model_observer>
|
| 110 |
+
</observers>
|
| 111 |
+
</checkout_cart_product_add_after>
|
| 112 |
+
<sales_order_place_before>
|
| 113 |
+
<observers>
|
| 114 |
+
<printscience_personalization_model_observer>
|
| 115 |
+
<type>singleton</type>
|
| 116 |
+
<class>printscience_personalization/observer</class>
|
| 117 |
+
<method>addOptionsToOrderItems</method>
|
| 118 |
+
</printscience_personalization_model_observer>
|
| 119 |
+
</observers>
|
| 120 |
+
</sales_order_place_before>
|
| 121 |
+
<controller_action_layout_render_before_checkout_cart_index>
|
| 122 |
+
<observers>
|
| 123 |
+
<printscience_personalization_model_observer>
|
| 124 |
+
<type>singleton</type>
|
| 125 |
+
<class>printscience_personalization/observer</class>
|
| 126 |
+
<method>initGallery</method>
|
| 127 |
+
</printscience_personalization_model_observer>
|
| 128 |
+
</observers>
|
| 129 |
+
</controller_action_layout_render_before_checkout_cart_index>
|
| 130 |
+
<controller_action_layout_render_before_checkout_cart_configure>
|
| 131 |
+
<observers>
|
| 132 |
+
<printscience_personalization_model_observer>
|
| 133 |
+
<type>singleton</type>
|
| 134 |
+
<class>printscience_personalization/observer</class>
|
| 135 |
+
<method>initGallery</method>
|
| 136 |
+
</printscience_personalization_model_observer>
|
| 137 |
+
</observers>
|
| 138 |
+
</controller_action_layout_render_before_checkout_cart_configure>
|
| 139 |
+
<sales_quote_remove_item>
|
| 140 |
+
<observers>
|
| 141 |
+
<printscience_personalization_model_observer>
|
| 142 |
+
<type>singleton</type>
|
| 143 |
+
<class>printscience_personalization/observer</class>
|
| 144 |
+
<method>endPersonalization</method>
|
| 145 |
+
</printscience_personalization_model_observer>
|
| 146 |
+
</observers>
|
| 147 |
+
</sales_quote_remove_item>
|
| 148 |
+
<sales_quote_load_after>
|
| 149 |
+
<observers>
|
| 150 |
+
<printscience_personalization_model_observer>
|
| 151 |
+
<type>singleton</type>
|
| 152 |
+
<class>printscience_personalization/observer</class>
|
| 153 |
+
<method>checkCartItems</method>
|
| 154 |
+
</printscience_personalization_model_observer>
|
| 155 |
+
</observers>
|
| 156 |
+
</sales_quote_load_after>
|
| 157 |
+
</events>
|
| 158 |
+
<resources>
|
| 159 |
+
<printscience_personalization_setup>
|
| 160 |
+
<setup>
|
| 161 |
+
<module>PrintScience_Personalization</module>
|
| 162 |
+
<class>PrintScience_Personalization_Model_Resource_Eav_Mysql4_Setup</class>
|
| 163 |
+
</setup>
|
| 164 |
+
<connection>
|
| 165 |
+
<use>core_setup</use>
|
| 166 |
+
</connection>
|
| 167 |
+
</printscience_personalization_setup>
|
| 168 |
+
<printscience_personalization_write>
|
| 169 |
+
<connection>
|
| 170 |
+
<use>core_write</use>
|
| 171 |
+
</connection>
|
| 172 |
+
</printscience_personalization_write>
|
| 173 |
+
<printscience_personalization_read>
|
| 174 |
+
<connection>
|
| 175 |
+
<use>core_read</use>
|
| 176 |
+
</connection>
|
| 177 |
+
</printscience_personalization_read>
|
| 178 |
+
</resources>
|
| 179 |
+
</global>
|
| 180 |
+
<default>
|
| 181 |
+
<catalog>
|
| 182 |
+
<personalization>
|
| 183 |
+
<api_version>1.0.0</api_version>
|
| 184 |
+
</personalization>
|
| 185 |
+
</catalog>
|
| 186 |
+
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
</config>
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/{mysql4-install-1.0.17.php → mysql4-install-1.0.18.php}
RENAMED
|
@@ -9,6 +9,6 @@ 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')));
|
| 13 |
-
$installer->updateAttribute('catalog_product', 'personalization_enabled', 'apply_to', implode(',',array('simple','configurable')));
|
| 14 |
$installer->endSetup();
|
| 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();
|
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/mysql4-upgrade-1.0.17-1.0.18.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_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();
|
app/design/frontend/base/default/layout/printscience_personalization.xml
CHANGED
|
@@ -1,20 +1,16 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
-
|
| 4 |
-
<reference name="product.info">
|
| 5 |
-
<action method="setTemplate"><template>printscience_personalization/catalog/product/view.phtml</template></action>
|
| 6 |
-
</reference>
|
| 7 |
-
</catalog_product_view_personalization_handle>
|
| 8 |
-
<catalog_product_addtocart_personalization_handle>
|
| 9 |
-
<reference name="product.info.addtocart">
|
| 10 |
-
<action method="setTemplate"><template>printscience_personalization/catalog/product/view/addtocart.phtml</template></action>
|
| 11 |
-
</reference>
|
| 12 |
-
</catalog_product_addtocart_personalization_handle>
|
| 13 |
-
<catalog_product_view>
|
| 14 |
<reference name="head">
|
| 15 |
<action method="addItem"><type>skin_css</type><name>printscience_personalization/modalPopLite.css</name></action>
|
| 16 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/jquery-1.7.2.min.js</name></action>
|
| 17 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/modalPopLite.min.js</name></action>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</reference>
|
| 19 |
</catalog_product_view>
|
| 20 |
<checkout_cart_index>
|
| 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>
|
| 6 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/jquery-1.7.2.min.js</name></action>
|
| 7 |
<action method="addItem"><type>skin_js</type><name>printscience_personalization/modalPopLite.min.js</name></action>
|
| 8 |
+
</reference>
|
| 9 |
+
<reference name="product.info">
|
| 10 |
+
<action method="setTemplate"><template>printscience_personalization/catalog/product/view.phtml</template></action>
|
| 11 |
+
</reference>
|
| 12 |
+
<reference name="product.info.addtocart">
|
| 13 |
+
<action method="setTemplate"><template>printscience_personalization/catalog/product/view/addtocart.phtml</template></action>
|
| 14 |
</reference>
|
| 15 |
</catalog_product_view>
|
| 16 |
<checkout_cart_index>
|
app/design/frontend/base/default/template/printscience_personalization/checkout/cart.phtml
CHANGED
|
@@ -1,235 +1,236 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category design
|
| 22 |
-
* @package base_default
|
| 23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
?>
|
| 27 |
-
<?php
|
| 28 |
-
/**
|
| 29 |
-
* Shopping cart template
|
| 30 |
-
*
|
| 31 |
-
* @see Mage_Checkout_Block_Cart
|
| 32 |
-
*/
|
| 33 |
-
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
| 34 |
-
?>
|
| 35 |
-
<div class="cart">
|
| 36 |
-
<div class="page-title title-buttons">
|
| 37 |
-
<h1><?php echo $this->__('Shopping Cart') ?></h1>
|
| 38 |
-
<?php if(!$this->hasError()): ?>
|
| 39 |
-
<ul class="checkout-types">
|
| 40 |
-
<?php foreach ($this->getMethods('top_methods') as $method): ?>
|
| 41 |
-
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
| 42 |
-
<li><?php echo $methodHtml; ?></li>
|
| 43 |
-
<?php endif; ?>
|
| 44 |
-
<?php endforeach; ?>
|
| 45 |
-
</ul>
|
| 46 |
-
<?php endif; ?>
|
| 47 |
-
</div>
|
| 48 |
-
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 49 |
-
<?php echo $this->getChildHtml('form_before') ?>
|
| 50 |
-
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
<col />
|
| 55 |
-
<col
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
<?php
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
<?php
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
<?php
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
<th rowspan="<?php echo $mergedCells; ?>"
|
| 79 |
-
<th rowspan="<?php echo $mergedCells; ?>"></th>
|
| 80 |
-
<?php
|
| 81 |
-
|
| 82 |
-
<?php
|
| 83 |
-
|
| 84 |
-
<th
|
| 85 |
-
<th
|
| 86 |
-
<th
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(
|
| 92 |
-
<th
|
| 93 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
<button type="submit" name="update_cart_action" value="
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
<
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
$
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
$
|
| 119 |
-
$cartActionContainer.
|
| 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 |
-
<?php
|
| 147 |
-
<?php echo $this->getChildHtml('
|
| 148 |
-
<?php
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
<?php
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
</div>
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
$
|
| 168 |
-
$
|
| 169 |
-
$
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
<a id="
|
| 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 |
-
var
|
| 200 |
-
var
|
| 201 |
-
|
| 202 |
-
jQuery("#popup-wrapper").css("
|
| 203 |
-
jQuery("#
|
| 204 |
-
jQuery("#popup_frame").css("
|
| 205 |
-
jQuery("#
|
| 206 |
-
jQuery("
|
| 207 |
-
jQuery(
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
jQuery('#
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
jQuery(formObj).attr("
|
| 219 |
-
jQuery(formObj).
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
|
|
|
| 235 |
?>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package base_default
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<?php
|
| 28 |
+
/**
|
| 29 |
+
* Shopping cart template
|
| 30 |
+
*
|
| 31 |
+
* @see Mage_Checkout_Block_Cart
|
| 32 |
+
*/
|
| 33 |
+
$_personalizationHelper = $this->helper('printscience_personalization/output');
|
| 34 |
+
?>
|
| 35 |
+
<div class="cart">
|
| 36 |
+
<div class="page-title title-buttons">
|
| 37 |
+
<h1><?php echo $this->__('Shopping Cart') ?></h1>
|
| 38 |
+
<?php if(!$this->hasError()): ?>
|
| 39 |
+
<ul class="checkout-types">
|
| 40 |
+
<?php foreach ($this->getMethods('top_methods') as $method): ?>
|
| 41 |
+
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
| 42 |
+
<li><?php echo $methodHtml; ?></li>
|
| 43 |
+
<?php endif; ?>
|
| 44 |
+
<?php endforeach; ?>
|
| 45 |
+
</ul>
|
| 46 |
+
<?php endif; ?>
|
| 47 |
+
</div>
|
| 48 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 49 |
+
<?php echo $this->getChildHtml('form_before') ?>
|
| 50 |
+
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
|
| 51 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
| 52 |
+
<fieldset>
|
| 53 |
+
<table id="shopping-cart-table" class="data-table cart-table">
|
| 54 |
+
<col width="1" />
|
| 55 |
+
<col />
|
| 56 |
+
<col width="1" />
|
| 57 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
| 58 |
+
<col width="1" />
|
| 59 |
+
<?php endif ?>
|
| 60 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 61 |
+
<col width="1" />
|
| 62 |
+
<?php endif; ?>
|
| 63 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 64 |
+
<col width="1" />
|
| 65 |
+
<?php endif; ?>
|
| 66 |
+
<col width="1" />
|
| 67 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 68 |
+
<col width="1" />
|
| 69 |
+
<?php endif; ?>
|
| 70 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 71 |
+
<col width="1" />
|
| 72 |
+
<?php endif; ?>
|
| 73 |
+
<col width="1" />
|
| 74 |
+
|
| 75 |
+
<?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
|
| 76 |
+
<thead>
|
| 77 |
+
<tr>
|
| 78 |
+
<th rowspan="<?php echo $mergedCells; ?>"> </th>
|
| 79 |
+
<th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
|
| 80 |
+
<th rowspan="<?php echo $mergedCells; ?>"></th>
|
| 81 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
| 82 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
|
| 83 |
+
<?php endif ?>
|
| 84 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
|
| 85 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
| 86 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
|
| 87 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"> </th>
|
| 88 |
+
</tr>
|
| 89 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
| 90 |
+
<tr>
|
| 91 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
| 92 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
| 93 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
| 94 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
| 95 |
+
</tr>
|
| 96 |
+
<?php endif; ?>
|
| 97 |
+
</thead>
|
| 98 |
+
<tfoot>
|
| 99 |
+
<tr>
|
| 100 |
+
<td colspan="50" class="a-right">
|
| 101 |
+
<?php if($this->getContinueShoppingUrl()): ?>
|
| 102 |
+
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
| 103 |
+
<?php endif; ?>
|
| 104 |
+
<button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
|
| 105 |
+
<button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
|
| 106 |
+
<!--[if lt IE 8]>
|
| 107 |
+
<input type="hidden" id="update_cart_action_container" />
|
| 108 |
+
<script type="text/javascript">
|
| 109 |
+
//<![CDATA[
|
| 110 |
+
Event.observe(window, 'load', function()
|
| 111 |
+
{
|
| 112 |
+
// Internet Explorer (lt 8) does not support value attribute in button elements
|
| 113 |
+
$emptyCartButton = $('empty_cart_button');
|
| 114 |
+
$cartActionContainer = $('update_cart_action_container');
|
| 115 |
+
if ($emptyCartButton && $cartActionContainer) {
|
| 116 |
+
Event.observe($emptyCartButton, 'click', function()
|
| 117 |
+
{
|
| 118 |
+
$emptyCartButton.setAttribute('name', 'update_cart_action_temp');
|
| 119 |
+
$cartActionContainer.setAttribute('name', 'update_cart_action');
|
| 120 |
+
$cartActionContainer.setValue('empty_cart');
|
| 121 |
+
});
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
});
|
| 125 |
+
//]]>
|
| 126 |
+
</script>
|
| 127 |
+
<![endif]-->
|
| 128 |
+
</td>
|
| 129 |
+
</tr>
|
| 130 |
+
</tfoot>
|
| 131 |
+
<tbody>
|
| 132 |
+
<?php foreach($this->getItems() as $_item): ?>
|
| 133 |
+
<?php echo $this->getItemHtml($_item) ?>
|
| 134 |
+
<?php endforeach ?>
|
| 135 |
+
</tbody>
|
| 136 |
+
</table>
|
| 137 |
+
<script type="text/javascript">decorateTable('shopping-cart-table')</script>
|
| 138 |
+
</fieldset>
|
| 139 |
+
</form>
|
| 140 |
+
<div class="cart-collaterals">
|
| 141 |
+
<div class="col2-set">
|
| 142 |
+
<div class="col-1">
|
| 143 |
+
<?php echo $this->getChildHtml('crosssell') ?>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="col-2">
|
| 146 |
+
<?php /* Extensions placeholder */ ?>
|
| 147 |
+
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
| 148 |
+
<?php echo $this->getChildHtml('coupon') ?>
|
| 149 |
+
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
<div class="totals">
|
| 153 |
+
<?php echo $this->getChildHtml('totals'); ?>
|
| 154 |
+
<?php if(!$this->hasError()): ?>
|
| 155 |
+
<ul class="checkout-types">
|
| 156 |
+
<?php foreach ($this->getMethods('methods') as $method): ?>
|
| 157 |
+
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
|
| 158 |
+
<li><?php echo $methodHtml; ?></li>
|
| 159 |
+
<?php endif; ?>
|
| 160 |
+
<?php endforeach; ?>
|
| 161 |
+
</ul>
|
| 162 |
+
<?php endif; ?>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
<?php
|
| 167 |
+
$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 |
+
if($window_type=='2'):
|
| 172 |
+
?>
|
| 173 |
+
<a id="openpoup"></a>
|
| 174 |
+
<a id="close-btn"></a>
|
| 175 |
+
<style>
|
| 176 |
+
.modalPopLite-mask {
|
| 177 |
+
background-color:#<?php echo (isset($background_color)?$background_color:"#000000") ?> !important;
|
| 178 |
+
}
|
| 179 |
+
#popup-wrapper
|
| 180 |
+
{
|
| 181 |
+
width:1150px;
|
| 182 |
+
height:600px;
|
| 183 |
+
left:0!important;top:0!important;
|
| 184 |
+
background-color: #<?php echo $background_color; ?> !important;
|
| 185 |
+
}
|
| 186 |
+
.modalPopLite-wrapper
|
| 187 |
+
{
|
| 188 |
+
border:none!important;
|
| 189 |
+
}
|
| 190 |
+
.modalPopLite-mask {
|
| 191 |
+
opacity:<?php echo ($window_opacity!=''?$window_opacity:"0.6") ?> !important;
|
| 192 |
+
}
|
| 193 |
+
#popup_frame{
|
| 194 |
+
border:0px;
|
| 195 |
+
}
|
| 196 |
+
</style>
|
| 197 |
+
<script type="text/javascript">
|
| 198 |
+
jQuery(function (){
|
| 199 |
+
var maskWidth = document.body.clientWidth;
|
| 200 |
+
var maskHeight = jQuery(window).height();
|
| 201 |
+
var margin = '<?php if(isset($margin_width) && $margin_width > 0) { echo $margin_width; } else { echo "0"; } ?>';
|
| 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));
|
| 205 |
+
jQuery("#popup_frame").css("height",(maskHeight - 2*margin));
|
| 206 |
+
jQuery("#header").css("z-index","10");
|
| 207 |
+
jQuery(".personalize_btn_link").attr("target","popup_frame");
|
| 208 |
+
jQuery('#popup-wrapper').modalPopLite({ openButton: '#openpoup', closeButton: '#close-btn', isModal: true });
|
| 209 |
+
});
|
| 210 |
+
function closethepopup(){
|
| 211 |
+
jQuery('#popup_frame').attr("src", "");
|
| 212 |
+
jQuery('#close-btn').trigger('click');
|
| 213 |
+
}
|
| 214 |
+
function setPersonalizeLocation(url, formObj) {
|
| 215 |
+
jQuery("#header").css("z-index","1");
|
| 216 |
+
if (jQuery(formObj).length > 0)
|
| 217 |
+
{
|
| 218 |
+
jQuery(formObj).attr("action",url);
|
| 219 |
+
jQuery(formObj).attr("target","popup_frame");
|
| 220 |
+
jQuery(formObj).submit();
|
| 221 |
+
}
|
| 222 |
+
jQuery('#openpoup').trigger('click');
|
| 223 |
+
return false;
|
| 224 |
+
}
|
| 225 |
+
<?php
|
| 226 |
+
$checkValid = $_personalizationHelper->getFrontendParams();
|
| 227 |
+
if($checkValid=='1') : ?>
|
| 228 |
+
jQuery('.error-msg').css('display',"none");
|
| 229 |
+
<?php endif; ?>
|
| 230 |
+
</script>
|
| 231 |
+
<div id="popup-wrapper"><iframe name="popup_frame" id="popup_frame"></iframe>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<?php
|
| 235 |
+
endif;
|
| 236 |
?>
|
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.0.
|
| 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>2014-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magelocal"><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></dir><dir name="Checkout"><dir name="Cart"><dir name="Item"><file name="Renderer.php" hash="f656661efde7a2ee2c92ca8a9dc234a4"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="cd3c2c919469c3ad244bb412892a7462"/><file name="Order.php" hash="ba50cbfb5f647cbca2deae91153db9b7"/><file name="Output.php" hash="46e8310a1ea9bcbb46dda6bc973f6812"/><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="c88d8c42d0e3745596ca2a39471c73d3"/><file name="Observer.php" hash="
|
| 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.0.18</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>2014-04-15</date>
|
| 14 |
+
<time>05:07:18</time>
|
| 15 |
+
<contents><target name="magelocal"><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></dir><dir name="Checkout"><dir name="Cart"><dir name="Item"><file name="Renderer.php" hash="f656661efde7a2ee2c92ca8a9dc234a4"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="cd3c2c919469c3ad244bb412892a7462"/><file name="Order.php" hash="ba50cbfb5f647cbca2deae91153db9b7"/><file name="Output.php" hash="46e8310a1ea9bcbb46dda6bc973f6812"/><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="c88d8c42d0e3745596ca2a39471c73d3"/><file name="Observer.php" hash="3383f137cc7ef688b583cc26151cd21a"/><dir name="Override"><dir name="Checkout"><file name="Cart.php" hash="ccece0a4e9fffd6d4b7f1b1a8a97dbd3"/></dir><dir name="Sales"><file name="Quote.php" hash="58083e79ec32db5ea22e0fa61f3a4bd7"/></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="73bca1105b8c0fa4462823ac6aa2c59b"/></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="1af16df72f4fcfe959f6f091cd2f6821"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="b13503dcc1e142b8e7b5feebcbc0b63a"/></dir><dir name="etc"><file name="config.xml" hash="48ec9f6e5e5138b5643e47969338e245"/><file name="system.xml" hash="ea5d1935373ddfef8935d5cd26c53066"/></dir><dir name="sql"><dir name="printscience_personalization_setup"><file name="mysql4-install-1.0.18.php" hash="230e83f81659df712330db959ffbadca"/><file name="mysql4-upgrade-1.0.15-1.0.16.php" hash="e8ebb964b71df807e93a076758211c07"/><file name="mysql4-upgrade-1.0.16-1.0.17.php" hash="e8ebb964b71df807e93a076758211c07"/><file name="mysql4-upgrade-1.0.17-1.0.18.php" hash="230e83f81659df712330db959ffbadca"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PrintScience_Personalization.xml" hash="5f5c39c5b01e828137125d057d04a655"/></dir></target><target name="magelocale"><dir name="en_US"><file name="PrintScience_Personalization.csv" hash="fc8365124f21bddca4dfac3d3dbf5b7f"/></dir></target><target name="magedesign"><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="5564f09c0ceaa71db7412be727684d21"/><dir name="view"><file name="addtocart.phtml" hash="ee0af223cca8c873492e2e9624953879"/><file name="media.phtml" hash="d0526045eca0891155f83aa067484178"/></dir><file name="view.phtml" hash="bc39bfa989142e868f2283476c767c2a"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="09e95e8e1b8b10d65a19bc873aa0d637"/></dir></dir><file name="cart.phtml" hash="6988d41b3ebcbc35b6f1f585636fae7b"/></dir></dir></dir><dir name="layout"><file name="printscience_personalization.xml" hash="04fb01b76f7af6e5fb0616bd1f7d7bd4"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="printscience_personalization.xml" hash="d0934cc5cfaca9e2d6c687f2fb866943"/></dir><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></dir></dir></target><target name="magelib"><dir name="xmlrpc"><file name="xmlrpc.inc" hash="55ecb2a9f7fc20d53a7b4da9d885e26b"/></dir></target><target name="mage"><dir name="js"><dir name="printscience_personalization"><file name="gallery.css" hash="eccacd49a35d68ef25bc1bf8e292fe98"/><file name="gallery.js" hash="d1ce93b3cf8ef950fef1097636f3205e"/><dir name="jquery"><dir name="fancybox"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancy_close.png" hash="6e2879a324a76e9972ebc98201aae1d8"/><file name="fancy_loading.png" hash="b1d54c240cf06e7f41e372d56919b738"/><file name="fancy_nav_left.png" hash="3f3e406102152cd8236383568a40ba35"/><file name="fancy_nav_right.png" hash="216e4bde5bddeeaa60dc3d692890a68e"/><file name="fancy_shadow_e.png" hash="fd4f491080d29fade5080877f1ba4c8b"/><file name="fancy_shadow_n.png" hash="18cde16379b2ceadef714d9b346d09ec"/><file name="fancy_shadow_ne.png" hash="63adf788acf193d4e4f3642d7d793125"/><file name="fancy_shadow_nw.png" hash="c820c878aedb7a7f9ebd7135a58e7c65"/><file name="fancy_shadow_s.png" hash="9b9e5c888028aaef40fe5b6a363f1e29"/><file name="fancy_shadow_se.png" hash="a8afd5a008884380ee712d177105268f"/><file name="fancy_shadow_sw.png" hash="f81cc0fee5581d76ad3cebe47e7e791b"/><file name="fancy_shadow_w.png" hash="59b0e63eb059e58d932cfd53da4d87e6"/><file name="fancy_title_left.png" hash="1582ac2d3bef6a6445bf02ceca2741cd"/><file name="fancy_title_main.png" hash="38dad6c1ed4bdc81c0bec721b2deb8c2"/><file name="fancy_title_over.png" hash="b886fd165d4b7ac77d41fb52d87ffc60"/><file name="fancy_title_right.png" hash="6cbe0c935511e7f9a2555ccb6a7324c4"/><file name="fancybox-x.png" hash="168696d8a694214090ef90e029cdf393"/><file name="fancybox-y.png" hash="36a58859beb9a6b19322a37466b9f78e"/><file name="fancybox.png" hash="11e57e492ee0311540967cc7a1e6e3e2"/><file name="jquery.easing-1.3.pack.js" hash="def257dbb0ab805c4996fd8abb1a6b49"/><file name="jquery.fancybox-1.3.4.css" hash="4638ce99ef00cf62bfb22d230f9924b8"/><file name="jquery.fancybox-1.3.4.pack.js" hash="8bc36a08c46719377528d962966ce37c"/><file name="jquery.mousewheel-3.0.4.pack.js" hash="3b0a821567b463e70bcc1e90ed2bc9b6"/></dir><file name="jquery-1.4.2.min.js" hash="b80a2154ce061c8242031d9a4892c5a6"/><dir name="jquery.cycle"><file name="jquery.cycle.lite.min.js" hash="0c4a7571c05a6ada90b93e826e7f9f6e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="printscience_personalization"><file name="jquery-1.7.2.min.js" hash="acc0adc6c188845a409bf158d2de4451"/><file name="modalPopLite.css" hash="32dc2c9142fff0c6221c62e3f95b8275"/><file name="modalPopLite.min.js" hash="255d501be44d6c7ac54aa4226d1ce314"/></dir></dir></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>
|
