Print_Science_Designer_Web_to_Print - Version 1.0.2

Version Notes

-

Download this release

Release Info

Developer John Weissberg
Extension Print_Science_Designer_Web_to_Print
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/local/PrintScience/Personalization/Block/Adminhtml/Sales/Order/View/Items/Renderer.php CHANGED
@@ -13,16 +13,9 @@ extends Mage_Adminhtml_Block_Sales_Order_View_Items_Renderer_Default
13
  */
14
  public function getPersonalizationPreviewPdfUrl()
15
  {
16
- $quoteItemOptions = Mage::getModel('sales/quote_item_option')->getCollection()
17
- ->addItemFilter($this->getItem()->getQuoteItemId());
18
- if (!count($quoteItemOptions)) {
19
- return false;
20
- }
21
- $quoteItem = Mage::getModel('sales/quote_item')->load($this->getItem()->getQuoteItemId())
22
- ->setOptions($quoteItemOptions);
23
- $data = Mage::helper('printscience_personalization/quote')
24
- ->getItemData($quoteItem);
25
- if (!$data) {
26
  return false;
27
  }
28
  return $data['preview_pdf_url'];
13
  */
14
  public function getPersonalizationPreviewPdfUrl()
15
  {
16
+ $orderHelper = Mage::helper('printscience_personalization/order');
17
+ $data = $orderHelper->getItemData($this->getItem());
18
+ if (empty($data['preview_pdf_url'])) {
 
 
 
 
 
 
 
19
  return false;
20
  }
21
  return $data['preview_pdf_url'];
app/code/local/PrintScience/Personalization/Helper/Order.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Print Science personalization quote helper
4
+ *
5
+ */
6
+ class PrintScience_Personalization_Helper_Order extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * Get personalization data of the order item
10
+ *
11
+ * @param Mage_Sales_Model_Order_Item $item
12
+ * @return array | false
13
+ */
14
+ public function getItemData($item)
15
+ {
16
+ $data = $item->getProductOptionByCode('personalization');
17
+ if (!$data) {
18
+ return false;
19
+ }
20
+ return $data;
21
+ }
22
+
23
+ /**
24
+ * Add personalization data to the order item
25
+ *
26
+ * @param Mage_Sales_Model_Order_Item $item
27
+ * @param array $data
28
+ */
29
+ public function addItemData($item, $data)
30
+ {
31
+ $options = $item->getProductOptions();
32
+ $options += array(
33
+ 'personalization' => $data
34
+ );
35
+ $item->setProductOptions($options);
36
+ }
37
+ }
app/code/local/PrintScience/Personalization/Helper/Output.php CHANGED
@@ -6,8 +6,7 @@
6
  class PrintScience_Personalization_Helper_Output extends Mage_Core_Helper_Abstract
7
  {
8
  /**
9
- * Check if personalization is enabled for this product or
10
- * for at least one of its subproducts.
11
  *
12
  * @param Mage_Catalog_Model_Product $product
13
  * @return boolean
6
  class PrintScience_Personalization_Helper_Output extends Mage_Core_Helper_Abstract
7
  {
8
  /**
9
+ * Check if personalization is enabled for this product
 
10
  *
11
  * @param Mage_Catalog_Model_Product $product
12
  * @return boolean
app/code/local/PrintScience/Personalization/Model/Observer.php CHANGED
@@ -185,26 +185,43 @@ class PrintScience_Personalization_Model_Observer
185
  $this->_observer = $observer;
186
 
187
  $quoteHelper = Mage::helper('printscience_personalization/quote');
 
188
  $apiGateway = Mage::getModel('printscience_personalization/apiGateway');
189
 
190
  $order = $observer->getEvent()->getData('order');
191
- $qouteItems = $order->getQuote()->getItemsCollection();
192
- foreach ($qouteItems as $item) {
193
- $itemData = $quoteHelper->getItemData($item);
194
- if (!$itemData) {
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  continue;
196
  }
197
- $apiResponse = $apiGateway->getPreview($itemData['apiSessionKey']);
 
198
  if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
199
  continue;
200
  }
201
- $quoteHelper->addItemData($item, array(
 
202
  'preview_pdf_url' => $apiResponse->getPdfUrl()
203
  ));
204
- $apiGateway->endPersonalization($itemData['apiSessionKey']);
205
- }
 
206
  }
207
-
208
  /**
209
  * Intialize personalization gallery on shopping cart
210
  *
185
  $this->_observer = $observer;
186
 
187
  $quoteHelper = Mage::helper('printscience_personalization/quote');
188
+ $orderHelper = Mage::helper('printscience_personalization/order');
189
  $apiGateway = Mage::getModel('printscience_personalization/apiGateway');
190
 
191
  $order = $observer->getEvent()->getData('order');
192
+ $orderItems = $order->getItemsCollection();
193
+ foreach ($orderItems as $orderItem) {
194
+ $quoteItemOptions = Mage::getModel('sales/quote_item_option')
195
+ ->getCollection()
196
+ ->addItemFilter($orderItem->getQuoteItemId());
197
+ if (!count($quoteItemOptions)) {
198
+ return false;
199
+ }
200
+ $quoteItem = Mage::getModel('sales/quote_item')
201
+ ->load($orderItem->getQuoteItemId())
202
+ ->setOptions($quoteItemOptions);
203
+ if (!$quoteItem->getId()) {
204
+ continue;
205
+ }
206
+
207
+ $quoteItemData = $quoteHelper->getItemData($quoteItem);
208
+ if (!$quoteItemData) {
209
  continue;
210
  }
211
+
212
+ $apiResponse = $apiGateway->getPreview($quoteItemData['apiSessionKey']);
213
  if ((!$apiResponse) || ($apiResponse->getFaultCode())) {
214
  continue;
215
  }
216
+
217
+ $orderHelper->addItemData($orderItem, array(
218
  'preview_pdf_url' => $apiResponse->getPdfUrl()
219
  ));
220
+
221
+ $apiGateway->endPersonalization($quoteItemData['apiSessionKey']);
222
+ }
223
  }
224
+
225
  /**
226
  * Intialize personalization gallery on shopping cart
227
  *
app/code/local/PrintScience/Personalization/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <PrintScience_Personalization>
5
- <version>0.1.0</version>
6
  </PrintScience_Personalization>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <PrintScience_Personalization>
5
+ <version>1.0.2</version>
6
  </PrintScience_Personalization>
7
  </modules>
8
  <frontend>
app/code/local/PrintScience/Personalization/sql/printscience_personalization_setup/{Mysql4-install-0.1.0.php → Mysql4-install-1.0.2.php} RENAMED
File without changes
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.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Print Science designer component</description>
11
  <notes>-</notes>
12
  <authors><author><name>John Weissberg</name><user>johnwwweissberg</user><email>jw@print-science.com</email></author></authors>
13
- <date>2011-07-23</date>
14
- <time>13:22:10</time>
15
- <contents><target name="magelocal"><dir name="PrintScience"><dir><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="a95c2f0db7c89b611b36b22daa88dbcb"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Cart"><dir name="Item"><file name="Renderer.php" hash="f9245751c49c5373dd0a73530478980c"/></dir></dir></dir></dir><dir name="Helper"><file name="Output.php" hash="a85fc623811e1f749f42a6a290fd840f"/><file name="Quote.php" hash="b9f7a8d51f11602746963ee19366c541"/><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="bbf2885274837015a49787f7685a2bd6"/></dir></dir><file name="ApiGateway.php" hash="e47fcab5f5ac4a71962a3e13a3acaaee"/><file name="Observer.php" hash="bf727431970a35d6f2b28b96bc0a28f2"/><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></dir></dir><dir name="controllers"><file name="IndexController.php" hash="740659b1a6f85789fe68fe963d0d8643"/></dir><dir name="etc"><file name="config.xml" hash="c080f22e1017d3089f75722c258276a3"/><file name="system.xml" hash="9808dd3a40e7a7c24e210b5d95f78507"/></dir><dir name="sql"><dir name="printscience_personalization_setup"><file name="Mysql4-install-0.1.0.php" hash="7895f0369177cb6dab9911d7820647b4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PrintScience_Personalization.xml" hash="5f5c39c5b01e828137125d057d04a655"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="printscience_personalization.xml" hash="6dbb5084dc5bce33ee476dae547795f4"/></dir><dir name="template"><dir name="printscience_personalization"><dir><dir name="catalog"><dir name="product"><file name="list.phtml" hash="ed9facdc48754e923c89b206003abe8a"/><dir name="view"><file name="addtocart.phtml" hash="c46ece2a25fa12658938f3f2be6a6790"/></dir></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="c56ff26e1f96fa068f2e143fa6805872"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="printscience_personalization.xml" hash="02bbc420d579eceee5b83b3fb41a73af"/></dir><dir name="template"><dir name="printscience_personalization"><dir><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></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="2157199d26c64a051f3b62530e068401"/><dir><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></dir></target></contents>
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.2</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>Print Science designer component</description>
11
  <notes>-</notes>
12
  <authors><author><name>John Weissberg</name><user>johnwwweissberg</user><email>jw@print-science.com</email></author></authors>
13
+ <date>2011-08-27</date>
14
+ <time>20:35:07</time>
15
+ <contents><target name="magelocal"><dir name="PrintScience"><dir><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="f9245751c49c5373dd0a73530478980c"/></dir></dir></dir></dir><dir name="Helper"><file name="Order.php" hash="ba50cbfb5f647cbca2deae91153db9b7"/><file name="Output.php" hash="850a4a708a2dd67a5f3f71ee93087740"/><file name="Quote.php" hash="b9f7a8d51f11602746963ee19366c541"/><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="bbf2885274837015a49787f7685a2bd6"/></dir></dir><file name="ApiGateway.php" hash="e47fcab5f5ac4a71962a3e13a3acaaee"/><file name="Observer.php" hash="776470494233dddbc1437dae26835b1e"/><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></dir></dir><dir name="controllers"><file name="IndexController.php" hash="740659b1a6f85789fe68fe963d0d8643"/></dir><dir name="etc"><file name="config.xml" hash="857febec15425da5d9eadd02577b41b7"/><file name="system.xml" hash="9808dd3a40e7a7c24e210b5d95f78507"/></dir><dir name="sql"><dir name="printscience_personalization_setup"><file name="Mysql4-install-1.0.2.php" hash="7895f0369177cb6dab9911d7820647b4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PrintScience_Personalization.xml" hash="5f5c39c5b01e828137125d057d04a655"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="printscience_personalization.xml" hash="6dbb5084dc5bce33ee476dae547795f4"/></dir><dir name="template"><dir name="printscience_personalization"><dir><dir name="catalog"><dir name="product"><file name="list.phtml" hash="ed9facdc48754e923c89b206003abe8a"/><dir name="view"><file name="addtocart.phtml" hash="c46ece2a25fa12658938f3f2be6a6790"/></dir></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="c56ff26e1f96fa068f2e143fa6805872"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="printscience_personalization.xml" hash="02bbc420d579eceee5b83b3fb41a73af"/></dir><dir name="template"><dir name="printscience_personalization"><dir><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></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="2157199d26c64a051f3b62530e068401"/><dir><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></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>