Mashon_Sync - Version 1.4.0

Version Notes

developed on magento 1.5.1.0;

-Added new Editable attribute which allows Designed products to be edited further in Dabble
- added Custom Layout XML for Editable and Configured products
- product detail page for Synced Dabble products is now dynamically built using Custom Layout XML and individual dabble prefixed phtml files instead of all logic in the product/view.phtml

Download this release

Release Info

Developer brandonWargo
Extension Mashon_Sync
Version 1.4.0
Comparing to
See all releases


Code changes from version 1.3.4 to 1.4.0

app/code/community/Mashon/Sync/Helper/Data.php CHANGED
@@ -132,17 +132,77 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
132
  $product->setPrice($data->{'MSRP'});
133
  $product->setWeight($data->{'weight'});
134
  $product->setSku($data->{'clientSku'});
135
- if($designedProduct == "true"){
 
136
  $product->setProducttype('designed');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
  else {
139
- $product->setProducttype('configured');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
 
141
 
142
  Mage::dispatchEvent('catalog_product_prepare_save',array('product' => $product, 'request' => null));
143
  $product->save();
144
 
145
- $arrayOption = $this->_setCustomOptions($data,$designedProduct);
146
 
147
  foreach ($arrayOption as $options){
148
  foreach ($options as $option) {
@@ -173,7 +233,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
173
  //$dabbleUrl = null;
174
  //$dabbleUrl = Mage::getModel('core/variable')->loadByCode('dabble_server')->getValue('plain');
175
  //if(!$dabbleUrl){
176
- $dabbleUrl = "justdabble.com";
177
  //}
178
  if($designedProduct == 'true'){
179
 
@@ -199,7 +259,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
199
  $cartId = $params['cartId'];
200
  $hash = md5($cartId.'th9megenatas');
201
 
202
- //http://shop.mgm.com/scripts/processItems.php?cartId=4e9399c3e4b0c585927817f3&dataCallbackUrl=http://www.dabbleapp.com/magento/getCartItems&callback=jsonp1318295986466
203
  $data = json_decode(file_get_contents($params['dataCallbackUrl'].'?id='.$cartId.'&hash='.$hash), true);
204
  foreach($data as $productData) {
205
  $productsData[] = $this->_array_to_object($productData);
@@ -362,18 +422,74 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
362
  'inventory_use_config_max_sale_qty' => 1
363
  ));
364
  $product->setHasOptions(1);
365
-
366
- //had to comment this out for now, it's up to the shopowners to set up dabble in the product detail page
367
- //$product->setCustomDesign('default/dabble');
368
- //$product->setPageLayout('one_column');
369
 
370
  if($designedProduct == "true"){
371
  $product->setProducttype('designed');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  }
373
  else {
374
- $product->setProducttype('configured');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
 
376
 
 
377
  $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
378
  $product->setCreatedAt(strtotime('now'));
379
 
@@ -392,7 +508,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
392
  //
393
  // End of Store and Website logic provided by StoreFront Consulting, Inc.
394
  //
395
- $arrayOption = $this->_setCustomOptions($data,$designedProduct);
396
 
397
  $product = Mage::getModel("catalog/product")->load($productId);
398
 
@@ -435,9 +551,10 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
435
  *
436
  * @param Json $data - dabble data of template or design
437
  * @param String $designedProduct - whether it is a design or template
 
438
  * @return Array $arrayOption - array of Options to be set
439
  */
440
- public function _setCustomOptions($data,$designedProduct){
441
 
442
  $arrayOption = array();
443
 
@@ -484,10 +601,10 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
484
  }
485
  }
486
  } //end foreach
487
- if($designedProduct != "true"){
488
  #set Dabbleid and Thumbnail
489
- $arrayOption[] = $this->_setCustomOption("", "Dabbleid", "field", true, array(), 1);
490
- $arrayOption[] = $this->_setCustomOption("", "Thumbnail", "field", true, array(), 1);
491
  #build perspectives
492
  $magentoAreas = array();
493
  $magentoAreaPrices = array();
@@ -533,7 +650,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
533
  $is_required = $required;
534
  $sort_order = 0;
535
  $custom_options[] = array(
536
- 'is_delete' => 0 , 'title' => $title , 'previous_group' => '' , 'previous_type' => '' , 'type' => $type , 'is_require' => $is_required , 'sort_order' => $sort_order , 'values' => array()
537
  );
538
  //foreach ($values as $v) {;
539
  foreach (array_combine(array_values($values), array_values($prices)) as $v => $price){
@@ -552,12 +669,12 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
552
  }
553
  return $custom_options;
554
  }
555
- #If the custom option doesn't have options | Case: area and field
556
  else {
557
  $is_required = 0;
558
  $sort_order = '';
559
  $custom_options[] = array(
560
- "is_delete" => 0 , "title" => $title , "previous_group" => "text" , "price_type" => 'fixed' , "price" => intval($prices[0]) , "type" => $type , "is_required" => $is_required
561
  );
562
  return $custom_options;
563
  }
132
  $product->setPrice($data->{'MSRP'});
133
  $product->setWeight($data->{'weight'});
134
  $product->setSku($data->{'clientSku'});
135
+
136
+ if($designedProduct == "true"){
137
  $product->setProducttype('designed');
138
+ if($data->{'editable'} == 'true'){
139
+ $product->setEditable(1);
140
+ $product->setCustomLayoutUpdate('<reference name="head">
141
+ <block type="core/text" name="googleJQuery.js">
142
+ <action method="setText">
143
+ <text><![CDATA[<meta http-equiv="X-UA-Compatible" content="chrome=1"/> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript"> jQuery.noConflict();</script><script type="text/javascript">function changeTheProduct(productdata) {
144
+ //do whatever you want with the productdata
145
+ console.log("product changed")
146
+ console.log(productdata)
147
+ //console.log(productdata.description)
148
+ document.getElementById("product-name").innerHTML = "<h1>"+productdata.alias+"</h1>"
149
+ //document.getElementById("short-description").innerHTML = productdata.shortDescription
150
+ document.getElementById("description").innerHTML = productdata.description
151
+ document.getElementById("product-price").innerHTML = "MSRP:<span class=\'price\'>$"+productdata.MSRP+"</span>"
152
+ document.getElementById("product-sku").innerHTML = "<h2> SKU:"+productdata.internalSku+"</h2>"
153
+ } </script>]]></text>
154
+ </action>
155
+ </block>
156
+ <block type="core/text" name="mystuff.js">
157
+ <action method="setText">
158
+ <text><![CDATA[<script type="text/javascript" src="http://dabbleapp.com/loaders/instantiation.js?width=500&height=593&designedId='.$data->{'_id'}.'&new=true&productChangeCallback=changeTheProduct&frameborder=1"></script>]]></text>
159
+ </action>
160
+ </block>
161
+ </reference>
162
+
163
+ <reference name="product.info">
164
+
165
+ <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/dabble-media.phtml"/>
166
+ <reference name="product.info.options.wrapper">
167
+ <action method="setTemplate"><template>catalog/product/view/options/dabble-wrapper.phtml</template></action>
168
+ <reference name="product.info.options"><action method="setTemplate"><template>catalog/product/view/dabble-options.phtml</template></action></reference>
169
+ </reference>
170
+ <reference name="product.info.options.wrapper.bottom">
171
+ <action method="setTemplate"><template>catalog/product/view/options/wrapper/dabble-bottom.phtml</template></action>
172
+ </reference>
173
+ </reference>');
174
+
175
+ }
176
+ else{
177
+ $product->setEditable(0);
178
+ }
179
  }
180
  else {
181
+ $product->setProducttype('configured');
182
+ $product->setCustomLayoutUpdate('<reference name="head"><block type="core/text" name="googleJQuery.js">
183
+ <action method="setText">
184
+ <text><![CDATA[<meta http-equiv="X-UA-Compatible" content="chrome=1"/></script>]]></text>
185
+ </action>
186
+ </block>
187
+ <action method="addCss"><stylesheet>css/dabble-styles.css</stylesheet></action>
188
+ </reference> <reference name="product.info">
189
+
190
+ <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/dabble-media.phtml"/>
191
+ <reference name="product.info.options.wrapper">
192
+ <action method="setTemplate"><template>catalog/product/view/options/dabble-wrapper.phtml</template></action>
193
+ <reference name="product.info.options"><action method="setTemplate"><template>catalog/product/view/dabble-options.phtml</template></action></reference>
194
+ </reference>
195
+ <reference name="product.info.options.wrapper.bottom">
196
+ <action method="setTemplate"><template>catalog/product/view/options/wrapper/dabble-bottom.phtml</template></action>
197
+ </reference>
198
+ </reference>');
199
  }
200
+ $product->setPageLayout('one_column');
201
 
202
  Mage::dispatchEvent('catalog_product_prepare_save',array('product' => $product, 'request' => null));
203
  $product->save();
204
 
205
+ $arrayOption = $this->_setCustomOptions($data,$designedProduct,$data->{'editable'});
206
 
207
  foreach ($arrayOption as $options){
208
  foreach ($options as $option) {
233
  //$dabbleUrl = null;
234
  //$dabbleUrl = Mage::getModel('core/variable')->loadByCode('dabble_server')->getValue('plain');
235
  //if(!$dabbleUrl){
236
+ $dabbleUrl = "justdabble.com";
237
  //}
238
  if($designedProduct == 'true'){
239
 
259
  $cartId = $params['cartId'];
260
  $hash = md5($cartId.'th9megenatas');
261
 
262
+ //http://localhost/scripts/processItems.php?cartId=4e9399c3e4b0c585927817f3&dataCallbackUrl=http://www.dabbleapp.com/magento/getCartItems&callback=jsonp1318295986466
263
  $data = json_decode(file_get_contents($params['dataCallbackUrl'].'?id='.$cartId.'&hash='.$hash), true);
264
  foreach($data as $productData) {
265
  $productsData[] = $this->_array_to_object($productData);
422
  'inventory_use_config_max_sale_qty' => 1
423
  ));
424
  $product->setHasOptions(1);
 
 
 
 
425
 
426
  if($designedProduct == "true"){
427
  $product->setProducttype('designed');
428
+ if($data->{'editable'} == 'true'){
429
+ $product->setEditable(1);
430
+ $product->setCustomLayoutUpdate('<reference name="head">
431
+ <block type="core/text" name="googleJQuery.js">
432
+ <action method="setText">
433
+ <text><![CDATA[<meta http-equiv="X-UA-Compatible" content="chrome=1"/> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript"> jQuery.noConflict();</script><script type="text/javascript">function changeTheProduct(productdata) {
434
+ //do whatever you want with the productdata
435
+ console.log("product changed")
436
+ console.log(productdata)
437
+ //console.log(productdata.description)
438
+ document.getElementById("product-name").innerHTML = "<h1>"+productdata.alias+"</h1>"
439
+ //document.getElementById("short-description").innerHTML = productdata.shortDescription
440
+ document.getElementById("description").innerHTML = productdata.description
441
+ document.getElementById("product-price").innerHTML = "MSRP:<span class=\'price\'>$"+productdata.MSRP+"</span>"
442
+ document.getElementById("product-sku").innerHTML = "<h2> SKU:"+productdata.internalSku+"</h2>"
443
+ } </script>]]></text>
444
+ </action>
445
+ </block>
446
+ <block type="core/text" name="mystuff.js">
447
+ <action method="setText">
448
+ <text><![CDATA[<script type="text/javascript" src="http://dabbleapp:8080/loaders/instantiation.js?width=500&height=593&designedId='.$data->{'_id'}.'&new=true&productChangeCallback=changeTheProduct&frameborder=1"></script>]]></text>
449
+ </action>
450
+ </block>
451
+ </reference>
452
+
453
+ <reference name="product.info">
454
+
455
+ <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/dabble-media.phtml"/>
456
+ <reference name="product.info.options.wrapper">
457
+ <action method="setTemplate"><template>catalog/product/view/options/dabble-wrapper.phtml</template></action>
458
+ <reference name="product.info.options"><action method="setTemplate"><template>catalog/product/view/dabble-options.phtml</template></action></reference>
459
+ </reference>
460
+ <reference name="product.info.options.wrapper.bottom">
461
+ <action method="setTemplate"><template>catalog/product/view/options/wrapper/dabble-bottom.phtml</template></action>
462
+ </reference>
463
+ </reference>');
464
+
465
+ }
466
+ else{
467
+ $product->setEditable(0);
468
+ }
469
  }
470
  else {
471
+ $product->setProducttype('configured');
472
+ $product->setCustomLayoutUpdate('<reference name="head"><block type="core/text" name="googleJQuery.js">
473
+ <action method="setText">
474
+ <text><![CDATA[<meta http-equiv="X-UA-Compatible" content="chrome=1"/></script>]]></text>
475
+ </action>
476
+ </block>
477
+ <action method="addCss"><stylesheet>css/dabble-styles.css</stylesheet></action>
478
+ </reference> <reference name="product.info">
479
+
480
+ <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/dabble-media.phtml"/>
481
+ <reference name="product.info.options.wrapper">
482
+ <action method="setTemplate"><template>catalog/product/view/options/dabble-wrapper.phtml</template></action>
483
+ <reference name="product.info.options"><action method="setTemplate"><template>catalog/product/view/dabble-options.phtml</template></action></reference>
484
+ </reference>
485
+ <reference name="product.info.options.wrapper.bottom">
486
+ <action method="setTemplate"><template>catalog/product/view/options/wrapper/dabble-bottom.phtml</template></action>
487
+ </reference>
488
+ </reference>');
489
  }
490
+ $product->setPageLayout('one_column');
491
 
492
+
493
  $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
494
  $product->setCreatedAt(strtotime('now'));
495
 
508
  //
509
  // End of Store and Website logic provided by StoreFront Consulting, Inc.
510
  //
511
+ $arrayOption = $this->_setCustomOptions($data,$designedProduct,$data->{'editable'});
512
 
513
  $product = Mage::getModel("catalog/product")->load($productId);
514
 
551
  *
552
  * @param Json $data - dabble data of template or design
553
  * @param String $designedProduct - whether it is a design or template
554
+ * @param String $editable - whether design is editable or not
555
  * @return Array $arrayOption - array of Options to be set
556
  */
557
+ public function _setCustomOptions($data,$designedProduct,$editable){
558
 
559
  $arrayOption = array();
560
 
601
  }
602
  }
603
  } //end foreach
604
+ if($designedProduct != "true" || $editable == "true"){
605
  #set Dabbleid and Thumbnail
606
+ $arrayOption[] = $this->_setCustomOption("", "Dabbleid", "field", true, array(), 0);
607
+ $arrayOption[] = $this->_setCustomOption("", "Thumbnail", "field", true, array(), 0);
608
  #build perspectives
609
  $magentoAreas = array();
610
  $magentoAreaPrices = array();
650
  $is_required = $required;
651
  $sort_order = 0;
652
  $custom_options[] = array(
653
+ 'is_delete' => 0 , 'title' => $title , 'previous_group' => '' , 'previous_type' => '' , 'type' => $type , 'is_require' => $is_required , 'sort_order' => $sort_order , 'values' => array(),'visible_on_front' => 0
654
  );
655
  //foreach ($values as $v) {;
656
  foreach (array_combine(array_values($values), array_values($prices)) as $v => $price){
669
  }
670
  return $custom_options;
671
  }
672
+ #If the custom option doesn't have options | Case: dabbleid and thumbnail
673
  else {
674
  $is_required = 0;
675
  $sort_order = '';
676
  $custom_options[] = array(
677
+ 'is_delete' => 0 , 'title' => $title , 'previous_group' => '' , 'previous_type' => '', 'type' => $type , 'is_require' => $is_required, 'price_type' => 'fixed' , 'price' => intval($prices[0]),'visible_on_front' => 0
678
  );
679
  return $custom_options;
680
  }
app/code/community/Mashon/Sync/etc/config.xml CHANGED
@@ -11,7 +11,7 @@
11
  <config>
12
  <modules>
13
  <Mashon_Sync>
14
- <version>1.3.4</version>
15
  </Mashon_Sync>
16
  </modules>
17
  <global>
11
  <config>
12
  <modules>
13
  <Mashon_Sync>
14
+ <version>1.4.0</version>
15
  </Mashon_Sync>
16
  </modules>
17
  <global>
app/code/community/Mashon/Sync/sql/mashon_setup/mysql4-install-1.0.php CHANGED
@@ -24,7 +24,7 @@ $this->startSetup();
24
  'label' => 'DabbleId',
25
  'required' => 0,
26
  'user_defined' => 1,
27
- 'group' => 'General',
28
  );
29
 
30
  $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
24
  'label' => 'DabbleId',
25
  'required' => 0,
26
  'user_defined' => 1,
27
+ 'group' => 'General'
28
  );
29
 
30
  $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
app/code/community/Mashon/Sync/sql/mashon_setup/mysql4-upgrade-1.3.4-1.4.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mashon Sync Update for Dabble Attributes
4
+ *
5
+ * @category Mashon
6
+ * @package Mashon_Sync
7
+ * @copyright Mashon
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ $this->startSetup();
11
+
12
+
13
+ /**
14
+ * Create the editable attribute in the General Attribute Group
15
+ * This determines which Pre-designed products (Magento attribute productType = designed) can be loaded and further edited in Dabble
16
+ */
17
+ $code = 'editable';
18
+
19
+ $attr = array(
20
+ 'entity_type_id' => 'catalog_product',
21
+ 'backend_type' => 'int',
22
+ 'is_user_defined' => 1,
23
+ 'frontend_input' => 'boolean',
24
+ 'input' => 'boolean',
25
+ 'is_visible' => 0,
26
+ 'label' => 'Editable',
27
+ 'required' => 0,
28
+ 'user_defined' => 1,
29
+ 'group' => 'General',
30
+ 'source' => 'eav/entity_attribute_source_boolean'
31
+ );
32
+
33
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
34
+ $setup->addAttribute('catalog_product', $code, $attr);
35
+
36
+ $this->endSetup();
app/design/frontend/default/dabble/template/catalog/product/view/createyourown.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @category default_dabble
5
+ * @package Mage
6
+ */
7
+ ?>
8
+ <?php
9
+ $_product = $this->getProduct();
10
+ $_helper = $this->helper('catalog/output');
11
+ $prodName = $_helper->productAttribute($_product, $this->htmlEscape($_product->getName()), 'name');
12
+ $prodAttrSet = $_helper->productAttribute($_product, $this->htmlEscape($_product->getAttributeSetModel()), 'name');
13
+ ?>
14
+
15
+ <fieldset class="create-your-own-box">
16
+ <div id="createOwnBtn" style="background-color: #FFD500;background-image:gradient(center bottom , #FFD500 13%, #FFF200 82%);cursor:pointer;">
17
+ <span><?php echo $this->__('Create Your Own') ?></span></div>
18
+ <?php echo $this->getChildHtml('addto') ?>
19
+ </fieldset>
app/design/frontend/default/default/template/catalog/product/view/dabble-media.phtml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 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
+ /**
28
+ * Product media data template
29
+ *
30
+ * @see Mage_Catalog_Block_Product_View_Media
31
+ */
32
+ ?>
33
+ <?php
34
+ $_product = $this->getProduct();
35
+ $_helper = $this->helper('catalog/output');
36
+ ?>
37
+ <?php if($_product->getProducttype() == 'configured'): ?>
38
+ <script type="text/javascript"src="http://localhost:8080/loaders/instantiation.js?width=500&height=593&templateId=<?php echo $_product->getTemplateid(); ?>&new=true&productChangeCallback=changeTheProduct&frameborder=1"></script>
39
+ <?php else: ?>
40
+ <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
41
+ <p class="product-image product-image-zoom">
42
+ <?php
43
+ $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
44
+ echo $_helper->productAttribute($_product, $_img, 'image');
45
+ ?>
46
+ </p>
47
+ <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
48
+ <div class="zoom">
49
+ <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
50
+ <div id="track">
51
+ <div id="handle"></div>
52
+ </div>
53
+ <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
54
+ </div>
55
+ <script type="text/javascript">
56
+ //<![CDATA[
57
+ Event.observe(window, 'load', function() {
58
+ product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
59
+ });
60
+ //]]>
61
+ </script>
62
+ <?php else: ?>
63
+ <p class="product-image">
64
+ <?php
65
+ $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
66
+ echo $_helper->productAttribute($_product, $_img, 'image');
67
+ ?>
68
+ </p>
69
+ <?php endif; ?>
70
+ <?php if (count($this->getGalleryImages()) > 0): ?>
71
+ <div class="more-views">
72
+ <h2><?php echo $this->__('More Views') ?></h2>
73
+ <ul>
74
+ <?php foreach ($this->getGalleryImages() as $_image): ?>
75
+ <li>
76
+ <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
77
+ </li>
78
+ <?php endforeach; ?>
79
+ </ul>
80
+ </div>
81
+ <?php endif; ?>
82
+ <?php endif; ?>
app/design/frontend/default/default/template/catalog/product/view/dabble-options.phtml ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @category design
5
+ * @package base_default
6
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+
11
+ <?php $_options = Mage::helper('core')->decorateArray($this->getOptions()) ?>
12
+ <?php if (count($_options)):?>
13
+ <script type="text/javascript">
14
+ //<![CDATA[
15
+ var optionFileUpload = {
16
+ productForm : $('product_addtocart_form'),
17
+ formAction : '',
18
+ formElements : {},
19
+ upload : function(element){
20
+ this.formElements = this.productForm.select('input', 'select', 'textarea', 'button');
21
+ this.removeRequire(element.readAttribute('id').sub('option_', ''));
22
+
23
+ template = '<iframe id="upload_target" name="upload_target" style="width:0; height:0; border:0;"><\/iframe>';
24
+
25
+ Element.insert($('option_'+element.readAttribute('id').sub('option_', '')+'_uploaded_file'), {after: template});
26
+
27
+ this.formAction = this.productForm.action;
28
+
29
+ var baseUrl = '<?php echo $this->getUrl('*/product/upload') ?>';
30
+ var urlExt = 'option_id/'+element.readAttribute('id').sub('option_', '');
31
+
32
+ this.productForm.action = parseSidUrl(baseUrl, urlExt);
33
+ this.productForm.target = 'upload_target';
34
+ this.productForm.submit();
35
+ this.productForm.target = '';
36
+ this.productForm.action = this.formAction;
37
+ },
38
+ removeRequire : function(skipElementId){
39
+ for(var i=0; i<this.formElements.length; i++){
40
+ if (this.formElements[i].readAttribute('id') != 'option_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
41
+ this.formElements[i].disabled='disabled';
42
+ }
43
+ }
44
+ },
45
+ addRequire : function(skipElementId){
46
+ for(var i=0; i<this.formElements.length; i++){
47
+ if (this.formElements[i].readAttribute('name') != 'options_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
48
+ this.formElements[i].disabled='';
49
+ }
50
+ }
51
+ },
52
+ uploadCallback : function(data){
53
+ this.addRequire(data.optionId);
54
+ $('upload_target').remove();
55
+
56
+ if (data.error) {
57
+
58
+ } else {
59
+ $('option_'+data.optionId+'_uploaded_file').value = data.fileName;
60
+ $('option_'+data.optionId+'_file').value = '';
61
+ $('option_'+data.optionId+'_file').hide();
62
+ $('option_'+data.optionId+'').hide();
63
+ template = '<div id="option_'+data.optionId+'_file_box"><a href="#"><img src="var/options/'+data.fileName+'" alt=""><\/a><a href="#" onclick="optionFileUpload.removeFile('+data.optionId+')" title="Remove file" \/>Remove file<\/a>';
64
+
65
+ Element.insert($('option_'+data.optionId+'_uploaded_file'), {after: template});
66
+ }
67
+ },
68
+ removeFile : function(optionId)
69
+ {
70
+ $('option_'+optionId+'_uploaded_file').value= '';
71
+ $('option_'+optionId+'_file').show();
72
+ $('option_'+optionId+'').show();
73
+
74
+ $('option_'+optionId+'_file_box').remove();
75
+ }
76
+ }
77
+ var optionTextCounter = {
78
+ count : function(field,cntfield,maxlimit){
79
+ if (field.value.length > maxlimit){
80
+ field.value = field.value.substring(0, maxlimit);
81
+ } else {
82
+ cntfield.innerHTML = maxlimit - field.value.length;
83
+ }
84
+ }
85
+ }
86
+
87
+ Product.Options = Class.create();
88
+ Product.Options.prototype = {
89
+ initialize : function(config){
90
+ this.config = config;
91
+ this.reloadPrice();
92
+ document.observe("dom:loaded", this.reloadPrice.bind(this));
93
+ },
94
+ reloadPrice : function(){
95
+ price = new Number();
96
+ config = this.config;
97
+ skipIds = [];
98
+ $$('.product-custom-option').each(function(element){
99
+ var optionId = 0;
100
+ element.name.sub(/[0-9]+/, function(match){
101
+ optionId = match[0];
102
+ });
103
+ if (this.config[optionId]) {
104
+ if (element.type == 'checkbox' || element.type == 'radio') {
105
+ if (element.checked) {
106
+ if (config[optionId][element.getValue()]) {
107
+ price += parseFloat(config[optionId][element.getValue()]);
108
+ }
109
+ }
110
+ } else if(element.hasClassName('datetime-picker') && !skipIds.include(optionId)) {
111
+ dateSelected = true;
112
+ $$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){
113
+ if (dt.getValue() == '') {
114
+ dateSelected = false;
115
+ }
116
+ });
117
+ if (dateSelected) {
118
+ price += parseFloat(this.config[optionId]);
119
+ skipIds[optionId] = optionId;
120
+ }
121
+ } else if(element.type == 'select-one' || element.type == 'select-multiple') {
122
+ if (element.options) {
123
+ $A(element.options).each(function(selectOption){
124
+ if (selectOption.selected) {
125
+ if (this.config[optionId][selectOption.value]) {
126
+ price += parseFloat(this.config[optionId][selectOption.value]);
127
+ }
128
+ }
129
+ });
130
+ }
131
+ } else {
132
+ if (element.getValue().strip() != '') {
133
+ price += parseFloat(this.config[optionId]);
134
+ }
135
+ }
136
+ }
137
+ });
138
+ try {
139
+ optionsPrice.changePrice('options', price);
140
+ optionsPrice.changePrice('optionsPriceInclTax', price);
141
+ optionsPrice.reload();
142
+ } catch (e) {
143
+
144
+ }
145
+ }
146
+ }
147
+ function validateOptionsCallback(elmId, result){
148
+ var container = $(elmId).up('ul.options-list');
149
+ if (result == 'failed') {
150
+ container.removeClassName('validation-passed');
151
+ container.addClassName('validation-failed');
152
+ } else {
153
+ container.removeClassName('validation-failed');
154
+ container.addClassName('validation-passed');
155
+ }
156
+ }
157
+ var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);
158
+ //]]>
159
+ </script>
160
+ <dl>
161
+ <?php foreach($_options as $_option): ?>
162
+ <?php if(strtolower($_option['title']) == 'dabbleid' || strtolower($_option['title']) == 'thumbnail' || strtolower($_option['title']) == 'area'): ?>
163
+ <?php else: ?>
164
+ <?php echo $this->getOptionHtml($_option) ?>
165
+ <?php endif; ?>
166
+ <?php endforeach; ?>
167
+ </dl>
168
+ <?php endif; ?>
app/design/frontend/default/default/template/catalog/product/view/options/dabble-wrapper.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @category design
5
+ * @package base_default
6
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+
11
+ <?php
12
+ $_product = $this->getProduct();
13
+ $_helper = $this->helper('catalog/output'); ?>
14
+ <?php if($_product->getProducttype() == 'configured'):?>
15
+ <?php else:?>
16
+ <div class="product-options" id="product-options-wrapper">
17
+ <?php echo $this->getChildHtml('', true, true);?>
18
+ <?php if ($this->hasRequiredOptions()):?>
19
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
20
+ <?php endif;?>
21
+ </div>
22
+ <script type="text/javascript">decorateGeneric($$('#product-options-wrapper dl'), ['last']);</script>
23
+ <?php endif; ?>
24
+ <?php if($_product->getEditable() && $_product->getProducttype() == 'designed') :?>
25
+ <fieldset class="create-your-own-box">
26
+ <div id="createOwnBtn" style="background-color: #FFD500;background-image:gradient(center bottom , #FFD500 13%, #FFF200 82%);cursor:pointer;float:right;">
27
+ <span><?php echo $this->__('Create Your Own') ?></span></div>
28
+ <!-- <?php echo $this->getChildHtml('addto') ?>-->
29
+ </fieldset>
30
+ <?php endif; ?>
app/design/frontend/default/default/template/catalog/product/view/options/wrapper/createyourown.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @category default_dabble
5
+ * @package Mage
6
+ */
7
+ ?>
8
+ <?php
9
+ $_product = $this->getProduct();
10
+ $_helper = $this->helper('catalog/output');
11
+ $prodName = $_helper->productAttribute($_product, $this->htmlEscape($_product->getName()), 'name');
12
+ $prodAttrSet = $_helper->productAttribute($_product, $this->htmlEscape($_product->getAttributeSetModel()), 'name');
13
+ ?>
14
+
15
+ <fieldset class="create-your-own-box">
16
+ <div id="createOwnBtn" style="background-color: #FFD500;background-image:gradient(center bottom , #FFD500 13%, #FFF200 82%);cursor:pointer;">
17
+ <span><?php echo $this->__('Create Your Own') ?></span></div>
18
+ <?php echo $this->getChildHtml('addto') ?>
19
+ </fieldset>
app/design/frontend/default/default/template/catalog/product/view/options/wrapper/dabble-bottom.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @category design
5
+ * @package base_default
6
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ */
9
+ ?>
10
+
11
+ <?php
12
+ $_product = $this->getProduct();
13
+ $_helper = $this->helper('catalog/output'); ?>
14
+ <?php if($_product->getProducttype() == 'configured'):?>
15
+ <?php else:?>
16
+ <div class="product-options-bottom">
17
+ <?php echo $this->getChildHtml('', true, true);?>
18
+ </div>
19
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mashon_Sync</name>
4
- <version>1.3.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -10,11 +10,14 @@
10
  <description>Mashon_Sync allows the Magento shop owner to easily integrate Dabble into their Magento version 1.5.1.0 shop. This extension allows you to sync your Dabble Templates and Designed Products into Magento.</description>
11
  <notes>developed on magento 1.5.1.0;&#xD;
12
  &#xD;
13
- - fixed bug so that updating a product does not check for duplicate sku</notes>
 
 
 
14
  <authors><author><name>brandonWargo</name><user>brandonWargo</user><email>brandon.wargo@mashon.com</email></author></authors>
15
- <date>2012-03-20</date>
16
- <time>01:35:17</time>
17
- <contents><target name="magecommunity"><dir name="Mashon"><dir name="Sync"><dir name="Block"><file name="Sync.php" hash="d880873f5863ac7d2e627edad0289266"/></dir><dir name="Helper"><file name="Data.php" hash="4c49a5384f558bf9b8b39d60a7ef4586"/></dir><dir name="controllers"><file name="CartController.php" hash="56a3e95f9fe636a1c77567effa2dae0f"/><file name="OrderController.php" hash="5a834a5d4980b05f8684e7d10739e20a"/><file name="ProductController.php" hash="1558404804f2174b04d7163059522bf0"/></dir><dir name="etc"><file name="config.xml" hash="2f671f2a521dbf4df204de784c490a4b"/></dir><dir name="sql"><dir name="mashon_setup"><file name="mysql4-install-1.0.php" hash="68360fce812822c6b9b802c629288c46"/><file name="mysql4-upgrade-1.0-1.1.php" hash="46e3030b6acf2a66aaa843924a8af710"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mashon_All.xml" hash="2929381275448f2ea1409a08703b6349"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="dabble"><dir name="template"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="1883d9ac26da40bfbba351448d0997cc"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="7cb8b98411059ecd0651cc116fa973e3"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mashon_Sync</name>
4
+ <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>Mashon_Sync allows the Magento shop owner to easily integrate Dabble into their Magento version 1.5.1.0 shop. This extension allows you to sync your Dabble Templates and Designed Products into Magento.</description>
11
  <notes>developed on magento 1.5.1.0;&#xD;
12
  &#xD;
13
+ -Added new Editable attribute which allows Designed products to be edited further in Dabble&#xD;
14
+ - added Custom Layout XML for Editable and Configured products&#xD;
15
+ - product detail page for Synced Dabble products is now dynamically built using Custom Layout XML and individual dabble prefixed phtml files instead of all logic in the product/view.phtml&#xD;
16
+ </notes>
17
  <authors><author><name>brandonWargo</name><user>brandonWargo</user><email>brandon.wargo@mashon.com</email></author></authors>
18
+ <date>2012-05-18</date>
19
+ <time>17:20:44</time>
20
+ <contents><target name="magecommunity"><dir name="Mashon"><dir name="Sync"><dir name="Block"><file name="Sync.php" hash="d880873f5863ac7d2e627edad0289266"/></dir><dir name="Helper"><file name="Data.php" hash="8dbf8d3cf0726f51f0cf09e7fd0f41b1"/></dir><dir name="controllers"><file name="CartController.php" hash="56a3e95f9fe636a1c77567effa2dae0f"/><file name="OrderController.php" hash="5a834a5d4980b05f8684e7d10739e20a"/><file name="ProductController.php" hash="1558404804f2174b04d7163059522bf0"/></dir><dir name="etc"><file name="config.xml" hash="04f32bf3558fbd20d508df4fd06b2b21"/></dir><dir name="sql"><dir name="mashon_setup"><file name="mysql4-install-1.0.php" hash="8ffe4d77aa3131392caa80e891afe3f9"/><file name="mysql4-upgrade-1.0-1.1.php" hash="46e3030b6acf2a66aaa843924a8af710"/><file name="mysql4-upgrade-1.3.4-1.4.php" hash="bb8f8b6247d5fdd4ccc4b43334a2dca5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mashon_All.xml" hash="2929381275448f2ea1409a08703b6349"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="dabble"><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="createyourown.phtml" hash="0e79cd3ec104ca8dde52f2b60122d0c2"/></dir><file name="view.phtml" hash="1883d9ac26da40bfbba351448d0997cc"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="7cb8b98411059ecd0651cc116fa973e3"/></dir></dir></dir></dir></dir><dir name="default"><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="dabble-media.phtml" hash="03ff38ec5e72fd0f781020a993606053"/><file name="dabble-options.phtml" hash="c3565ab4bf3827231862617b1eab3c2b"/><dir name="options"><file name="dabble-wrapper.phtml" hash="2394c7f5b059b76848607535e5cb2925"/><dir name="wrapper"><file name="createyourown.phtml" hash="0e79cd3ec104ca8dde52f2b60122d0c2"/><file name="dabble-bottom.phtml" hash="2fca682fc852b7293b6e640ff3e523b5"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="dabble-styles.css" hash="f99b83b8fc9c194f64ae528b530e02ec"/></dir></dir></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
skin/frontend/default/default/css/dabble-styles.css ADDED
@@ -0,0 +1 @@
 
1
+ .col1-layout .product-view .product-shop { float:right; width:320px; }