zinc - Version 1.0.8

Version Notes

Code refactoring and bug fixing.

Download this release

Release Info

Developer ZincPlatform
Extension zinc
Version 1.0.8
Comparing to
See all releases


Code changes from version 1.0.7 to 1.0.8

Files changed (46) hide show
  1. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Catalog/Product/Grid.php +21 -21
  2. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Catalog/Product/Renderer/List.php +33 -0
  3. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Edit/Form.php +5 -5
  4. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Edit/Tab/Form.php +14 -14
  5. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Grid.php +150 -82
  6. app/code/local/Zinc/Carebyzinc/Block/Adminhtml/System/Config/Importorders.php +56 -0
  7. app/code/local/Zinc/Carebyzinc/Block/Carebyzinc.php +7 -8
  8. app/code/local/Zinc/Carebyzinc/Helper/Data.php +67 -47
  9. app/code/local/Zinc/Carebyzinc/Model/Carebyzinc.php +426 -241
  10. app/code/local/Zinc/Carebyzinc/Model/Checkout/Cart.php +128 -138
  11. app/code/local/Zinc/Carebyzinc/Model/Observer.php +57 -65
  12. app/code/local/Zinc/Carebyzinc/Model/Order.php +285 -52
  13. app/code/local/Zinc/Carebyzinc/Model/System/Config/Protocol.php +0 -23
  14. app/code/local/Zinc/Carebyzinc/Model/System/Config/Source.php +11 -3
  15. app/code/local/Zinc/Carebyzinc/controllers/Adminhtml/CarebyzincController.php +30 -16
  16. app/code/local/Zinc/Carebyzinc/controllers/Adminhtml/ProductController.php +143 -100
  17. app/code/local/Zinc/Carebyzinc/controllers/CartController.php +185 -3
  18. app/code/local/Zinc/Carebyzinc/controllers/Checkout/OnepageController.php +46 -0
  19. app/code/local/Zinc/Carebyzinc/controllers/IndexController.php +115 -115
  20. app/code/local/Zinc/Carebyzinc/etc/adminhtml.xml +5 -0
  21. app/code/local/Zinc/Carebyzinc/etc/config.xml +170 -155
  22. app/code/local/Zinc/Carebyzinc/etc/system.xml +157 -80
  23. app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.0-1.0.1.php +0 -12
  24. app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.6-1.0.7.php +4 -4
  25. app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.7-1.0.8.php +23 -0
  26. app/design/adminhtml/default/default/layout/zinc_carebyzinc.xml +11 -1
  27. app/design/adminhtml/default/default/template/carebyzinc/carebyzinc_massaction.phtml +122 -105
  28. app/design/adminhtml/default/default/template/carebyzinc/system/importorders.phtml +19 -0
  29. app/design/frontend/base/default/layout/zinc_carebyzinc.xml +336 -312
  30. app/design/frontend/base/default/template/carebyzinc/carebyzinc.phtml +161 -92
  31. app/design/frontend/base/default/template/carebyzinc/checkout/cart.phtml +122 -120
  32. app/design/frontend/base/default/template/carebyzinc/checkout/cart/item/default.phtml +306 -294
  33. app/design/frontend/base/default/template/carebyzinc/checkout/cart/minicart/default.phtml +84 -91
  34. app/design/frontend/base/default/template/carebyzinc/checkout/multishipping/item/default.phtml +1 -1
  35. app/design/frontend/base/default/template/carebyzinc/checkout/onepage/review/item.phtml +1 -1
  36. app/design/frontend/base/default/template/carebyzinc/checkout/success.phtml +85 -0
  37. app/design/frontend/base/default/template/carebyzinc/options/cart.phtml +34 -39
  38. app/design/frontend/base/default/template/carebyzinc/options/default.phtml +38 -46
  39. app/design/frontend/base/default/template/carebyzinc/sales/order/shipment/items/renderer/default.phtml +79 -0
  40. js/carebyzinc/functions.js +3 -0
  41. media/catalog/product/zinc/warranty.png +0 -0
  42. package.xml +8 -8
  43. skin/adminhtml/default/default/carebyzinc/carebyzinc.css +3 -0
  44. skin/frontend/base/default/carebyzinc/css/carebyzinc.css +355 -89
  45. skin/frontend/rwd/default/carebyzinc/css/carebyzinc.css +355 -89
  46. skin/frontend/rwd/default/carebyzinc/css/colorbox.css +29 -30
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Catalog/Product/Grid.php CHANGED
@@ -17,14 +17,14 @@ class Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtm
17
  protected function _prepareColumns()
18
  {
19
 
20
- $this->addColumnAfter('carebyzinc',
21
- array(
22
- 'header'=> Mage::helper('catalog')->__('Care by Zinc'),
23
- 'width' => '70px',
24
- 'index' => 'carebyzinc',
25
- 'type' => 'options',
26
- 'options' => array('1' => 'Enabled', '0' => 'Disabled'),
27
- ), 'visibility');
28
 
29
  return parent::_prepareColumns();
30
  }
@@ -59,19 +59,19 @@ class Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtm
59
 
60
  $carebyzinc = Mage::getSingleton('carebyzinc/carebyzinc')->getOptionArray();
61
 
62
- $this->getMassactionBlock()->addItem('zinc_carebyzinc', array(
63
- 'label'=> Mage::helper('carebyzinc')->__('Change Carebyzinc'),
64
- 'url' => $this->getUrl('adminhtml/product/massCarebyzinc', array('_current'=>true)),
65
- 'additional' => array(
66
- 'visibility' => array(
67
- 'name' => 'zinc_carebyzinc',
68
- 'type' => 'select',
69
- 'class' => 'required-entry',
70
- 'label' => Mage::helper('carebyzinc')->__('Care by Zinc'),
71
- 'values' => $carebyzinc
72
- )
73
- )
74
- ));
75
 
76
  if (Mage::getSingleton('admin/session')->isAllowed('catalog/update_attributes')){
77
  $this->getMassactionBlock()->addItem('attributes', array(
17
  protected function _prepareColumns()
18
  {
19
 
20
+ // $this->addColumnAfter('carebyzinc',
21
+ // array(
22
+ // 'header'=> Mage::helper('catalog')->__('Care by Zinc'),
23
+ // 'width' => '70px',
24
+ // 'index' => 'carebyzinc',
25
+ // 'type' => 'options',
26
+ // 'options' => array('1' => 'Enabled', '0' => 'Disabled'),
27
+ // ), 'visibility');
28
 
29
  return parent::_prepareColumns();
30
  }
59
 
60
  $carebyzinc = Mage::getSingleton('carebyzinc/carebyzinc')->getOptionArray();
61
 
62
+ // $this->getMassactionBlock()->addItem('zinc_carebyzinc', array(
63
+ // 'label'=> Mage::helper('carebyzinc')->__('Change Carebyzinc'),
64
+ // 'url' => $this->getUrl('adminhtml/product/massCarebyzinc', array('_current'=>true)),
65
+ // 'additional' => array(
66
+ // 'visibility' => array(
67
+ // 'name' => 'zinc_carebyzinc',
68
+ // 'type' => 'select',
69
+ // 'class' => 'required-entry',
70
+ // 'label' => Mage::helper('carebyzinc')->__('Care by Zinc'),
71
+ // 'values' => $carebyzinc
72
+ // )
73
+ // )
74
+ // ));
75
 
76
  if (Mage::getSingleton('admin/session')->isAllowed('catalog/update_attributes')){
77
  $this->getMassactionBlock()->addItem('attributes', array(
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Catalog/Product/Renderer/List.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ZincPlatform
4
+ * @package Zinc_Carebyzinc
5
+ * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Renderer_List extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $result = '';
14
+ $categoryCache = array();
15
+
16
+ $value = $row->getData($this->getColumn()->getIndex());
17
+ if(!empty($value)) {
18
+ $value = explode(",", $value);
19
+ foreach($value as $val) {
20
+ if(in_array($val, $categoryCache)) {
21
+ $result .= $categoryCache[$val] . '<br />';
22
+ } else {
23
+ $_category = Mage::getModel('catalog/category')->load($val);
24
+ $categoryName = $_category->getName();
25
+ $categoryCache[$val] = $_category->getName();
26
+ $result .= $categoryName . '<br />';
27
+ }
28
+ }
29
+ }
30
+
31
+ return $result;
32
+ }
33
+ }
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Edit/Form.php CHANGED
@@ -10,11 +10,11 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Form extends Mage_Adminhtml_B
10
  protected function _prepareForm()
11
  {
12
  $form = new Varien_Data_Form(array(
13
- 'id' => 'edit_form',
14
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
- 'method' => 'post',
16
- 'enctype' => 'multipart/form-data'
17
- )
18
  );
19
 
20
  $form->setUseContainer(true);
10
  protected function _prepareForm()
11
  {
12
  $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ )
18
  );
19
 
20
  $form->setUseContainer(true);
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Edit/Tab/Form.php CHANGED
@@ -13,7 +13,7 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Tab_Form extends Mage_Adminht
13
  $this->setForm($form);
14
  $fieldset = $form->addFieldset('carebyzinc_form', array('legend'=>Mage::helper('carebyzinc')->__('Care By Zinc')));
15
  $fieldset->addField('carebyzinc', 'select', array(
16
- 'label' => Mage::helper('carebyzinc')->__('Care by Zinc'),
17
  'class' => 'required-entry',
18
  'required' => true,
19
  'name' => 'carebyzinc',
@@ -32,7 +32,7 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Tab_Form extends Mage_Adminht
32
 
33
  ));
34
  $fieldset->addField('carebyzinc_category', 'select', array(
35
- 'label' => Mage::helper('carebyzinc')->__('Category'),
36
  'class' => 'required-entry',
37
  'required' => true,
38
  'name' => 'category',
@@ -61,7 +61,7 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Tab_Form extends Mage_Adminht
61
  $category = Mage::registry('carebyzinc_data')->getData('carebyzinc_category');
62
  if(($this->getRequest()->getParam('id')) && ($category)) {
63
  $fieldset->addField('carebyzinc_subcategory', 'select', array(
64
- 'label' => Mage::helper('carebyzinc')->__('Sub Category'),
65
  'class' => 'required-entry',
66
  'required' => true,
67
  'name' => 'subcategory',
@@ -70,7 +70,7 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Tab_Form extends Mage_Adminht
70
  }else{
71
 
72
  $fieldset->addField('carebyzinc_subcategory', 'select', array(
73
- 'label' => Mage::helper('carebyzinc')->__('Sub Category'),
74
  'class' => 'required-entry',
75
  'required' => true,
76
  'name' => 'subcategory',
@@ -93,16 +93,16 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Edit_Tab_Form extends Mage_Adminht
93
  ));
94
 
95
  $this->setChild('form_after', $this->getLayout()
96
- ->createBlock('adminhtml/widget_form_element_dependence')
97
- ->addFieldMap('carebyzinc', 'carebyzinc')
98
- ->addFieldMap('carebyzinc_category', 'carebyzinc_category')
99
- ->addFieldMap('carebyzinc_manufacturer', 'carebyzinc_manufacturer')
100
- ->addFieldMap('carebyzinc_model', 'carebyzinc_model')
101
- ->addFieldMap('carebyzinc_subcategory', 'carebyzinc_subcategory')
102
- ->addFieldDependence('carebyzinc_category', 'carebyzinc', 1)
103
- ->addFieldDependence('carebyzinc_subcategory', 'carebyzinc', 1)
104
- ->addFieldDependence('carebyzinc_model', 'carebyzinc_category', array((string)'Bicycle',(string)'Electronics'))
105
- ->addFieldDependence('carebyzinc_manufacturer', 'carebyzinc_category', array((string)'Bicycle',(string)'Electronics'))
106
  );
107
 
108
  if ( Mage::getSingleton('adminhtml/session')->getVendorData() )
13
  $this->setForm($form);
14
  $fieldset = $form->addFieldset('carebyzinc_form', array('legend'=>Mage::helper('carebyzinc')->__('Care By Zinc')));
15
  $fieldset->addField('carebyzinc', 'select', array(
16
+ 'label' => Mage::helper('carebyzinc')->__('Enable Zinc Quote'),
17
  'class' => 'required-entry',
18
  'required' => true,
19
  'name' => 'carebyzinc',
32
 
33
  ));
34
  $fieldset->addField('carebyzinc_category', 'select', array(
35
+ 'label' => Mage::helper('carebyzinc')->__('Zinc Category'),
36
  'class' => 'required-entry',
37
  'required' => true,
38
  'name' => 'category',
61
  $category = Mage::registry('carebyzinc_data')->getData('carebyzinc_category');
62
  if(($this->getRequest()->getParam('id')) && ($category)) {
63
  $fieldset->addField('carebyzinc_subcategory', 'select', array(
64
+ 'label' => Mage::helper('carebyzinc')->__('Zinc Subcategory'),
65
  'class' => 'required-entry',
66
  'required' => true,
67
  'name' => 'subcategory',
70
  }else{
71
 
72
  $fieldset->addField('carebyzinc_subcategory', 'select', array(
73
+ 'label' => Mage::helper('carebyzinc')->__('Zinc Subcategory'),
74
  'class' => 'required-entry',
75
  'required' => true,
76
  'name' => 'subcategory',
93
  ));
94
 
95
  $this->setChild('form_after', $this->getLayout()
96
+ ->createBlock('adminhtml/widget_form_element_dependence')
97
+ ->addFieldMap('carebyzinc', 'carebyzinc')
98
+ ->addFieldMap('carebyzinc_category', 'carebyzinc_category')
99
+ ->addFieldMap('carebyzinc_manufacturer', 'carebyzinc_manufacturer')
100
+ ->addFieldMap('carebyzinc_model', 'carebyzinc_model')
101
+ ->addFieldMap('carebyzinc_subcategory', 'carebyzinc_subcategory')
102
+ ->addFieldDependence('carebyzinc_category', 'carebyzinc', 1)
103
+ ->addFieldDependence('carebyzinc_subcategory', 'carebyzinc', 1)
104
+ ->addFieldDependence('carebyzinc_model', 'carebyzinc_category', array((string)'Bicycle',(string)'Electronics'))
105
+ ->addFieldDependence('carebyzinc_manufacturer', 'carebyzinc_category', array((string)'Bicycle',(string)'Electronics'))
106
  );
107
 
108
  if ( Mage::getSingleton('adminhtml/session')->getVendorData() )
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/Product/Grid.php CHANGED
@@ -8,103 +8,145 @@
8
  class Zinc_Carebyzinc_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
9
  {
10
  public function __construct()
11
- {
12
- parent::__construct();
13
- $this->setId('listGrid');
14
- $this->setDefaultSort('entity_id');
15
- $this->setDefaultDir('DESC');
16
- $this->setSaveParametersInSession(true);
17
- }
18
 
19
  public function setCollection($collection)
20
  {
21
-
22
- $collection->addAttributeToFilter('visibility',array('neq'=>1));
23
  $collection->addAttributeToSelect('carebyzinc');
24
- $collection->addAttributeToSelect('carebyzinc_category');
25
- //$collection->addAttributeToSelect('carebyzinc_subcategory');
26
  $collection->addExpressionAttributeToSelect('carebyzinc','round({{carebyzinc}},0)','carebyzinc');
27
- parent::setCollection($collection);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
 
30
- protected function _prepareColumns()
31
  {
32
- $this->addColumn('entity_id',
33
- array(
34
- 'header'=> Mage::helper('catalog')->__('ID'),
35
- 'width' => '50px',
36
- 'type' => 'number',
37
- 'index' => 'entity_id',
38
  ));
39
- $this->addColumn('name',
40
- array(
41
- 'header'=> Mage::helper('catalog')->__('Name'),
42
- 'index' => 'name',
 
43
  ));
44
 
45
  $store = $this->_getStore();
46
  if ($store->getId()) {
47
- $this->addColumn('custom_name',
48
- array(
49
- 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
50
- 'index' => 'custom_name',
51
  ));
52
  }
53
 
54
- $this->addColumn('sku',
55
- array(
56
- 'header'=> Mage::helper('catalog')->__('SKU'),
57
- 'width' => '80px',
58
- 'index' => 'sku',
59
  ));
60
 
61
- $store = $this->_getStore();
62
- $this->addColumn('price',
63
- array(
64
- 'header'=> Mage::helper('catalog')->__('Price'),
65
- 'type' => 'price',
66
- 'currency_code' => $store->getBaseCurrency()->getCode(),
67
- 'index' => 'price',
 
 
 
 
 
 
 
 
68
  ));
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
- $this->addColumn('carebyzinc',
71
- array(
72
- 'header'=> Mage::helper('catalog')->__('Care by Zinc'),
73
- 'width' => '150px',
74
- 'index' => 'carebyzinc',
75
- 'type' => 'options',
76
- 'options' => array('1' => 'Enable', '0' => 'Disable')
77
  ));
78
 
79
- $this->addColumn('carebyzinc_category',
80
- array(
81
- 'header'=> Mage::helper('catalog')->__('Category'),
82
- 'index' => 'carebyzinc_category',
 
 
 
 
 
 
83
  ));
84
- /* $this->addColumn('carebyzinc_subcategory',
85
- array(
86
- 'header'=> Mage::helper('catalog')->__('Subcategory'),
87
- 'index' => 'carebyzinc_subcategory',
88
- ));*/
89
 
90
  $this->addColumn('action', array(
91
- 'header' => Mage::helper('carebyzinc')->__('Action'),
92
- 'width' => '100',
93
- 'type' => 'action',
94
- 'getter' => 'getId',
95
- 'actions' => array(
96
- array(
97
- 'caption' => Mage::helper('carebyzinc')->__('Edit'),
98
- 'url' => array('base'=> '*/*/edit'),
99
- 'title' => 'Edit',
100
- 'field' => 'id'
101
- )
102
- ),
103
- 'filter' => false,
104
- 'sortable' => false,
105
- 'index' => 'stores',
106
- 'is_system' => true,
107
  ));
 
108
  return $this;
109
  }
110
 
@@ -113,10 +155,10 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_
113
  $this->setMassactionIdField('entity_id');
114
  $this->getMassactionBlock()->setFormFieldName('product');
115
 
116
- $carebyzinc = Mage::getSingleton('carebyzinc/carebyzinc')->getOptionArray();
117
 
118
  $this->getMassactionBlock()->addItem('zinc_carebyzinc', array(
119
- 'label'=> Mage::helper('carebyzinc')->__('Change Care by Zinc'),
120
  'url' => $this->getUrl('adminhtml/product/massCarebyzinc', array('_current'=>true,'pid'=>1)),
121
  'additional' => array(
122
  'visibility' => array(
@@ -127,8 +169,8 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_
127
  )
128
  )
129
  ));
130
- $this->getMassactionBlock()->addItem('carebyzinc_category', array(
131
- 'label'=> Mage::helper('carebyzinc')->__('Change Category'),
132
  'url' => $this->getUrl('adminhtml/product/massCategory', array('_current'=>true,'pid'=>1)),
133
  'additional' => array(
134
  'visibility' => array(
@@ -145,12 +187,38 @@ class Zinc_Carebyzinc_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_
145
  return $this;
146
  }
147
 
148
- public function getRowUrl($row)
149
- {
150
- return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
151
- }
152
- public function getGridUrl(){
153
- return $this->getUrl('*/*/grid', array('_current'=>true));
154
- }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
8
  class Zinc_Carebyzinc_Block_Adminhtml_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
9
  {
10
  public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('listGrid');
14
+ $this->setDefaultSort('entity_id');
15
+ $this->setDefaultDir('DESC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
 
19
  public function setCollection($collection)
20
  {
21
+ $collection->addAttributeToFilter('visibility',array('neq'=>1));
 
22
  $collection->addAttributeToSelect('carebyzinc');
23
+ $collection->addAttributeToSelect('carebyzinc_category');
24
+ $collection->addAttributeToSelect('carebyzinc_subcategory');
25
  $collection->addExpressionAttributeToSelect('carebyzinc','round({{carebyzinc}},0)','carebyzinc');
26
+
27
+ $select = $collection->getSelect();
28
+ $aliasCategory = 'catalog_category_product';
29
+
30
+ $subselect = $collection->getConnection()->select();
31
+ $subselect->from(
32
+ array(
33
+ 'main_table' => $collection->getTable('catalog/category_product'),
34
+ ),
35
+ array(
36
+ 'product_id',
37
+ )
38
+ );
39
+ $subselect->columns(array(
40
+ 'category_ids' => new Zend_Db_Expr("GROUP_CONCAT(`main_table`.`category_id`)")
41
+ ));
42
+ $subselect->group('main_table.product_id');
43
+
44
+ $select->joinLeft(
45
+ array($aliasCategory => $subselect),
46
+ "`e`.`entity_id` = `{$aliasCategory}`.`product_id`",
47
+ array('category_ids')
48
+ );
49
+
50
+ parent::setCollection($collection);
51
  }
52
 
53
+ protected function _prepareColumns()
54
  {
55
+ $this->addColumn('entity_id', array(
56
+ 'header'=> Mage::helper('catalog')->__('ID'),
57
+ 'width' => '30px',
58
+ 'type' => 'number',
59
+ 'index' => 'entity_id',
 
60
  ));
61
+
62
+ $this->addColumn('name', array(
63
+ 'header'=> Mage::helper('catalog')->__('Name'),
64
+ 'index' => 'name',
65
+ 'width' => '400px'
66
  ));
67
 
68
  $store = $this->_getStore();
69
  if ($store->getId()) {
70
+ $this->addColumn('custom_name', array(
71
+ 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
72
+ 'index' => 'custom_name',
 
73
  ));
74
  }
75
 
76
+ $this->addColumn('sku', array(
77
+ 'header'=> Mage::helper('catalog')->__('SKU'),
78
+ 'width' => '80px',
79
+ 'index' => 'sku',
 
80
  ));
81
 
82
+ $this->addColumn('price', array(
83
+ 'header'=> Mage::helper('catalog')->__('Price'),
84
+ 'type' => 'price',
85
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
86
+ 'index' => 'price',
87
+ ));
88
+
89
+ $this->addColumn('category_ids', array(
90
+ 'header'=> Mage::helper('catalog')->__('Category'),
91
+ 'type' => 'text',
92
+ 'width' => '150px',
93
+ 'index' => 'category_ids',
94
+ 'filter_index' => 'catalog_category_product.category_ids',
95
+ 'renderer' => 'Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Renderer_List',
96
+ 'filter_condition_callback' => array($this, '_categoryFilterCallback')
97
  ));
98
+
99
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
100
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
101
+ ->load()
102
+ ->toOptionHash();
103
+ $this->addColumnAfter('set_name', array(
104
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
105
+ 'width' => '120px',
106
+ 'index' => 'attribute_set_id',
107
+ 'type' => 'options',
108
+ 'options' => $sets,
109
+ ), 'name');
110
 
111
+ $this->addColumn('carebyzinc', array(
112
+ 'header'=> Mage::helper('catalog')->__('Enable Zinc Quote'),
113
+ 'width' => '120px',
114
+ 'index' => 'carebyzinc',
115
+ 'type' => 'options',
116
+ 'options' => array('1' => 'Enable', '0' => 'Disable')
 
117
  ));
118
 
119
+ $this->addColumn('carebyzinc_category', array(
120
+ 'header'=> Mage::helper('catalog')->__('Zinc Category'),
121
+ 'index' => 'carebyzinc_category',
122
+ 'width' => '120px'
123
+ ));
124
+
125
+ $this->addColumn('carebyzinc_subcategory', array(
126
+ 'header'=> Mage::helper('catalog')->__('Zinc Subcategory'),
127
+ 'index' => 'carebyzinc_subcategory',
128
+ 'width' => '120px'
129
  ));
 
 
 
 
 
130
 
131
  $this->addColumn('action', array(
132
+ 'header' => Mage::helper('carebyzinc')->__('Action'),
133
+ 'width' => '100',
134
+ 'type' => 'action',
135
+ 'getter' => 'getId',
136
+ 'actions' => array(
137
+ array(
138
+ 'caption' => Mage::helper('carebyzinc')->__('Edit'),
139
+ 'url' => array('base'=> '*/*/edit'),
140
+ 'title' => 'Edit',
141
+ 'field' => 'id'
142
+ )
143
+ ),
144
+ 'filter' => false,
145
+ 'sortable' => false,
146
+ 'index' => 'stores',
147
+ 'is_system' => true,
148
  ));
149
+
150
  return $this;
151
  }
152
 
155
  $this->setMassactionIdField('entity_id');
156
  $this->getMassactionBlock()->setFormFieldName('product');
157
 
158
+ $carebyzinc = Mage::getSingleton('carebyzinc/carebyzinc')->getOptionArray();
159
 
160
  $this->getMassactionBlock()->addItem('zinc_carebyzinc', array(
161
+ 'label'=> Mage::helper('carebyzinc')->__('Update Zinc Enablement'),
162
  'url' => $this->getUrl('adminhtml/product/massCarebyzinc', array('_current'=>true,'pid'=>1)),
163
  'additional' => array(
164
  'visibility' => array(
169
  )
170
  )
171
  ));
172
+ $this->getMassactionBlock()->addItem('carebyzinc_category', array(
173
+ 'label'=> Mage::helper('carebyzinc')->__('Update Zinc Category'),
174
  'url' => $this->getUrl('adminhtml/product/massCategory', array('_current'=>true,'pid'=>1)),
175
  'additional' => array(
176
  'visibility' => array(
187
  return $this;
188
  }
189
 
190
+ public function getRowUrl($row)
191
+ {
192
+ return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
193
+ }
 
 
 
194
 
195
+ public function getGridUrl()
196
+ {
197
+ return $this->getUrl('*/*/grid', array('_current'=>true));
198
+ }
199
+
200
+ protected function _categoryFilterCallback($collection, $column)
201
+ {
202
+ if (!$value = $column->getFilter()->getValue()) {
203
+ return $this;
204
+ }
205
+
206
+ $categories = Mage::getResourceModel('catalog/category_collection');
207
+
208
+ $categories->addAttributeToFilter('name', array('like' => '%' . $value . '%'));
209
+
210
+ $select = $categories->getSelect();
211
+
212
+ $select->reset(Zend_Db_Select::COLUMNS);
213
+
214
+ $select->joinLeft(
215
+ array('catalog_category_product' => $collection->getTable('catalog/category_product')),
216
+ 'e.entity_id = catalog_category_product.category_id',
217
+ array('product_id')
218
+ );
219
+
220
+ $collection->addAttributeToFilter($collection->getResource()->getIdFieldName(), array('in' => $select));
221
+
222
+ return $this;
223
+ }
224
  }
app/code/local/Zinc/Carebyzinc/Block/Adminhtml/System/Config/Importorders.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ZincPlatform
4
+ * @package Zinc_Carebyzinc
5
+ * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Zinc_Carebyzinc_Block_Adminhtml_System_Config_Importorders extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ /*
11
+ * Set template
12
+ */
13
+ protected function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->setTemplate('carebyzinc/system/importorders.phtml');
17
+ }
18
+
19
+ /**
20
+ * Return element html
21
+ *
22
+ * @param Varien_Data_Form_Element_Abstract $element
23
+ * @return string
24
+ */
25
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
26
+ {
27
+ return $this->_toHtml();
28
+ }
29
+
30
+ /**
31
+ * Return ajax url for button
32
+ *
33
+ * @return string
34
+ */
35
+ public function getAjaxCheckUrl()
36
+ {
37
+ return Mage::helper('adminhtml')->getUrl('adminhtml/carebyzinc/importorders');
38
+ }
39
+
40
+ /**
41
+ * Generate button html
42
+ *
43
+ * @return string
44
+ */
45
+ public function getButtonHtml()
46
+ {
47
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
48
+ ->setData(array(
49
+ 'id' => 'import_button',
50
+ 'label' => $this->helper('adminhtml')->__('Import Orders'),
51
+ 'onclick' => 'javascript:importOrders(); return false;'
52
+ ));
53
+
54
+ return $button->toHtml();
55
+ }
56
+ }
app/code/local/Zinc/Carebyzinc/Block/Carebyzinc.php CHANGED
@@ -1,23 +1,22 @@
1
  <?php
2
- /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  class Zinc_Carebyzinc_Block_Carebyzinc extends Mage_Core_Block_Template
9
  {
10
- public function _prepareLayout()
11
  {
12
- return parent::_prepareLayout();
13
  }
14
-
15
- public function getCarebyzinc()
16
- {
17
  if (!$this->hasData('carebyzinc')) {
18
  $this->setData('carebyzinc', Mage::registry('carebyzinc'));
19
  }
20
  return $this->getData('carebyzinc');
21
-
22
  }
23
  }
1
  <?php
2
+ /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
  class Zinc_Carebyzinc_Block_Carebyzinc extends Mage_Core_Block_Template
9
  {
10
+ public function _prepareLayout()
11
  {
12
+ return parent::_prepareLayout();
13
  }
14
+
15
+ public function getCarebyzinc()
16
+ {
17
  if (!$this->hasData('carebyzinc')) {
18
  $this->setData('carebyzinc', Mage::registry('carebyzinc'));
19
  }
20
  return $this->getData('carebyzinc');
 
21
  }
22
  }
app/code/local/Zinc/Carebyzinc/Helper/Data.php CHANGED
@@ -1,55 +1,75 @@
1
  <?php
2
- /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  class Zinc_Carebyzinc_Helper_Data extends Mage_Core_Helper_Abstract
9
  {
10
- public function getTitle(){
11
- $config = Mage::getStoreConfig('carebyzinc/general/carebytitle');
12
- return $config;
13
- }
14
- public function getZipCode(){
15
-
16
- $zip = '';
17
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
18
- $primaryAddress = Mage::getSingleton('customer/session')->getCustomer()->getPrimaryShippingAddress();
19
- if($primaryAddress){
20
- if($primaryAddress->getPostcode())
21
- $zip = $primaryAddress->getPostcode();
22
- }
23
- }
24
- if(! $zip){
25
- $url = 'http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR'];
26
- $response = $this->callApi($url);
27
- $responseArray = (array)json_decode($response);
28
- $zip = $responseArray['zip_code'];
29
- if(! $zip)
30
- $zip = Mage::getStoreConfig('carebyzinc/general/defaultzip');
31
- }
32
- return $zip;
33
- }
34
- public function getDeleteUrl($itemId){
35
-
36
- return Mage::getUrl('carebyzinc/index/removeWarranty', array('id' => $itemId));
37
-
38
- }
39
-
40
- public function callApi($url){
41
-
42
- $ch = curl_init($url);
43
- curl_setopt($ch, CURLOPT_URL, $url);
44
- curl_setopt($ch, CURLOPT_HEADER ,FALSE);
45
- curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json"));
46
- curl_setopt($ch, CURLOPT_RETURNTRANSFER ,TRUE);
47
- $result = curl_exec($ch);
48
- curl_close($ch);
49
- return $result;
50
- }
51
- public function checkQuoteVisibility(){
52
- return Mage::getStoreConfig('carebyzinc/general/showquote');
53
-
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
1
  <?php
2
+ /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
  class Zinc_Carebyzinc_Helper_Data extends Mage_Core_Helper_Abstract
9
  {
10
+ public function getZipCode()
11
+ {
12
+ $zip = '';
13
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
14
+ $primaryAddress = Mage::getSingleton('customer/session')->getCustomer()->getPrimaryShippingAddress();
15
+ if($primaryAddress) {
16
+ if($primaryAddress->getPostcode()) {
17
+ $zip = $primaryAddress->getPostcode();
18
+ }
19
+ }
20
+ }
21
+
22
+ if(!$zip) {
23
+ $url = 'http://freegeoip.net/json/' . $_SERVER['REMOTE_ADDR'];
24
+ $response = $this->callApi($url);
25
+ $responseArray = (array) json_decode($response);
26
+ $zip = $responseArray['zip_code'];
27
+ if (!$zip) {
28
+ $zip = Mage::getStoreConfig('carebyzinc/general/defaultzip');
29
+ }
30
+ }
31
+
32
+ return $zip;
33
+ }
34
+
35
+ public function getDeleteUrl($itemId)
36
+ {
37
+ return Mage::getUrl('carebyzinc/index/removeWarranty', array('id' => $itemId));
38
+ }
39
+
40
+ public function callApi($url)
41
+ {
42
+ $ch = curl_init($url);
43
+ curl_setopt($ch, CURLOPT_URL, $url);
44
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
45
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
46
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
47
+ $result = curl_exec($ch);
48
+ curl_close($ch);
49
+ return $result;
50
+ }
51
+
52
+ /**
53
+ * Check quote visability on frontend (for product and cart pages)
54
+ *
55
+ * @param string $type - page type
56
+ * @return boolean $result - show/hide care by zinc section
57
+ */
58
+ public function checkQuoteVisibility($type = 'product')
59
+ {
60
+ $result = false;
61
+ switch($type) {
62
+ case 'cart':
63
+ $result = Mage::getStoreConfig('carebyzinc/display/quotecart');
64
+ break;
65
+ case 'product':
66
+ $result = Mage::getStoreConfig('carebyzinc/display/quoteproduct');
67
+ break;
68
+ default:
69
+ break;
70
+ }
71
+
72
+ return $result;
73
+ }
74
+
75
  }
app/code/local/Zinc/Carebyzinc/Model/Carebyzinc.php CHANGED
@@ -1,267 +1,452 @@
1
  <?php
2
- /**
 
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  class Zinc_Carebyzinc_Model_Carebyzinc extends Mage_Core_Model_Abstract
9
  {
10
- const WARRANTY_ENABLED = 1;
11
- const WARRANTY_DISABLED = 0;
12
-
13
- public function _construct()
 
 
 
 
14
  {
15
  parent::_construct();
16
  $this->_init('carebyzinc/carebyzinc');
17
  }
18
-
19
- static public function getOptionArray()
 
 
 
 
 
20
  {
21
  return array(
22
- self::WARRANTY_ENABLED => Mage::helper('carebyzinc')->__('Enabled'),
23
- self::WARRANTY_DISABLED => Mage::helper('carebyzinc')->__('Disabled')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  );
25
- }
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- public function getPriceQuote($product,$zip,$optionPrice)
29
- {
30
- $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
31
- $price = $product->getFinalPrice();
32
- if($optionPrice)
33
- $price += $optionPrice;
34
- $data = array();
35
- $data['sku'] = array(
36
- 'merchant_sku_id' => $product->getId(),
37
- 'sku_name' => $product->getName(),
38
- 'variant_id' => '',
39
- 'category' => $product->getCarebyzincCategory(),
40
- 'subcategory' => $product->getCarebyzincSubcategory(),
41
- 'subcategory2' => '',
42
- 'description' => $product->getShortDescription(),
43
- 'price' => $price,
44
- 'currency' => $currencyCode
45
- );
46
- $catArray = array('bicycle','electronics');
47
- if(in_array(strtolower($product->getCarebyzincCategory()),$catArray)){
48
-
49
- if(($product->getCarebyzincModel()) && ($product->getCarebyzincManufacturer())){
50
- $additional = array('model'=>$product->getCarebyzincModel());
51
- $data['sku']['additional_info'] = json_encode($additional);
52
- $data['sku']['brand'] = $product->getCarebyzincManufacturer();
53
- }
54
 
55
- }
56
- if(! $zip){
57
- $helper = Mage::helper('carebyzinc');
58
- $zip = $helper->getZipCode();
59
- }
60
- $data['zip_code'] = $zip;
61
- $outData = $this->callApi($data, 'price_quotes/generate');
62
- if($outData['code'] == '200'){
63
- $response = $outData['response'];
64
- $quoteData = json_decode($response, true);
65
- $priceQuote = array();
66
- foreach($quoteData['price_quotes'] as $item):
67
- $priceQuote[$item['id']] = $item;
68
- endforeach;
69
- Mage::getSingleton('core/session')->setCareQuote($priceQuote);
70
- return $priceQuote;
71
 
72
- }else{
73
- $response = $outData['response'];
74
- $response = (array)json_decode($response, true);
75
- return 'No Quotes Available';
76
- }
77
-
78
- }
79
-
80
- public function getPriceQuoteinCart($product,$itemId,$zip)
81
- {
82
-
83
- $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
84
- $_item = Mage::getModel('sales/quote_item')->load($itemId);
85
- $data = array();
86
- $data['sku'] = array(
87
- 'merchant_sku_id' => $product->getId(),
88
- 'sku_name' => $product->getName(),
89
- 'variant_id' => '',
90
- 'category' => $product->getCarebyzincCategory(),
91
- 'subcategory' => $product->getCarebyzincSubcategory(),
92
- 'subcategory2' => '',
93
- 'description' => $product->getShortDescription(),
94
- 'price' => $_item->getPrice(),
95
- 'currency' => $currencyCode
96
- );
97
- $catArray = array('bicycle','electronics');
98
- if(in_array(strtolower($product->getCarebyzincCategory()),$catArray)){
99
-
100
- if(($product->getCarebyzincModel()) && ($product->getCarebyzincManufacturer())){
101
- $additional = array('model'=>$product->getCarebyzincModel());
102
- $data['sku']['additional_info'] = json_encode($additional);
103
- $data['sku']['brand'] = $product->getCarebyzincManufacturer();
104
- }
105
 
106
- }
107
- if(! $zip){
108
- $helper = Mage::helper('carebyzinc');
109
- $zip = $helper->getZipCode();
110
- }
111
- $data['zip_code'] = $zip;
112
- $outData = $this->callApi($data, 'price_quotes/generate');
113
- if($outData['code'] == '200'){
114
- $response = $outData['response'];
115
- $quoteData = json_decode($response, true);
116
- $priceQuote = array();
117
- if(! empty($quoteData['price_quotes'])){
118
- $priceQuote = Mage::getSingleton('core/session')->getCareByZincQuote();
119
- foreach($quoteData['price_quotes'] as $item):
120
- if($priceQuote[$itemId])
121
- unset($priceQuote[$itemId]);
122
- $priceQuote[$itemId][$item['id']] = $item;
123
- endforeach;
124
- Mage::getSingleton('core/session')->setCareByZincQuote($priceQuote);
125
- return $priceQuote;
126
- }else{
127
- return 'No Quotes Available';
128
- }
129
- }else{
130
- $response = $outData['response'];
131
- $response = (array)json_decode($response, true);
132
- return 'No Quotes Available';//return $response['errors'];
133
- }
134
-
135
- }
136
-
137
- public function getApiUrl($action)
138
- {
139
- $path = Mage::getStoreConfig('carebyzinc/api/url');
140
- if((Mage::getStoreConfig('carebyzinc/api/testmode')) == 'live')
141
- $path = Mage::getStoreConfig('carebyzinc/api/url');
142
- else
143
- $path = Mage::getStoreConfig('carebyzinc/api/test_url');
144
- if(Mage::getStoreConfig('carebyzinc/api/protocol') == 'https')
145
- $protocol = 'https://' ;
146
- else
147
- $protocol = 'http://' ;
148
- $url = $protocol.$path.'/'.$action;
149
- return $url;
150
- }
151
-
152
- public function getToken()
153
- {
154
-
155
- if((Mage::getStoreConfig('carebyzinc/api/testmode')) == 'live')
156
- $token = Mage::getStoreConfig('carebyzinc/api/xuser_token');
157
- else
158
- $token = Mage::getStoreConfig('carebyzinc/api/test_xuser_token');
159
- return $token;
160
- }
161
-
162
- public function callApi($data, $action, $method = 'post'){
163
- $outData = array();
164
- $values = json_encode($data);
165
- $url = $this->getApiUrl($action);
166
- $token = $this->getToken();
167
- $email = Mage::getStoreConfig('carebyzinc/api/xuser_email');
168
- if(($action =='price_quotes/generate') || ($action == 'policies' ))
169
- $header = array( "Content-Type: application/json","X-User-Token:$token","X-User-Email:$email","token-type:Bearer");
170
- elseif($action == 'token')
171
- $header = array( "Content-Type: application/json","X-User-Token:$token","X-User-Email:$email","token-type:Bearer");
172
 
173
- else
174
- $header = array( "Content-Type: application/json","token-type:Bearer");
175
-
176
- $ch = curl_init($url);
177
- curl_setopt($ch, CURLOPT_URL, $url);
178
- if($method == 'post'){
179
- curl_setopt($ch, CURLOPT_POST,TRUE);
180
- curl_setopt($ch, CURLOPT_POSTFIELDS,$values);
181
- }
182
- curl_setopt($ch, CURLOPT_HEADER ,FALSE);
183
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
184
- curl_setopt($ch, CURLOPT_RETURNTRANSFER ,TRUE);
185
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
186
- $outData['response'] = curl_exec($ch);
187
- $outData['code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
188
- curl_close($ch);
189
- return $outData;
190
- }
191
-
192
- public function getwarrantyStatus( $item_id,$warrentyitem )
193
- {
194
- if($item_id < 0){
195
- return '';
196
- }
197
- $cart = Mage::getModel('checkout/cart');
198
- $quoteItem = $cart->getQuote()->getItemById($item_id);
199
- if($quoteItem){
200
- $product = Mage::getModel('catalog/product')->load($quoteItem->getProductId());
201
- if(($product->getCarebyzinc() != 1) && ($quoteItem->getCarebyzincVariantid())){
202
-
203
- $quoteItem->setCarebyzincVariantid(NULL);
204
- $quoteItem->save();
205
- $cartHelper = Mage::helper('checkout/cart');
206
- $cartHelper->getCart()->removeItem($warrentyitem)->save();
207
- $cart->getQuote()->collectTotals()->save();
208
-
209
- }
210
- }
211
- return true;
212
  }
213
 
214
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  public function getCategoryArray()
216
- {
217
-
218
-
219
- $dataArray = $this->getCategoryJson();
220
- $category = array(''=>'Please Select');
221
- foreach($dataArray as $key => $value){
222
- $category[$key] = $key;
223
- }
224
- return $category;
225
 
226
- }
227
- public function getSubCategoryArray($category)
228
- {
229
- if($category)
230
- $dataArray = $this->getCategoryJson();
231
- $subcategory = array(''=>'Please Select');
232
- foreach($dataArray as $key => $value){
233
- if($key == $category){
234
- foreach($value as $val){
235
- $subcategory[$val] = $val;
236
- }
237
- }
238
- }
239
- return $subcategory;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
- }
242
- public function getCategoryJson()
243
- {
244
-
245
- $outData = $this->callApi('','categories','get');
246
- if($outData['code'] == '200')
247
- $response = $outData['response'];
248
- else
249
- $response = '{"Jewelry": ["Bracelet", "Necklace","Pendant","Brooch","Engagement Ring","Wedding Ring","Other Ring","Other"]}';
250
- $dataArray = json_decode($response);
251
- return $dataArray;
252
-
253
- }
254
-
255
- public function getWarrentyName($itemId)
256
- {
257
- $name = '';
258
- $orderItem = Mage::getModel('sales/quote_item')->load($itemId);
259
- $product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
260
- if($product)
261
- $name = ' for '. $product->getName();
262
- return $name;
263
-
264
- }
265
-
266
 
 
 
 
 
267
  }
1
  <?php
2
+
3
+ /**
4
  * ZincPlatform
5
  * @package Zinc_Carebyzinc
6
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
  class Zinc_Carebyzinc_Model_Carebyzinc extends Mage_Core_Model_Abstract
10
  {
11
+
12
+ const WARRANTY_ENABLED = 1;
13
+ const WARRANTY_DISABLED = 0;
14
+
15
+ const QUOTE_ADDITIONAL_PARAMS_SOURCE_PRODUCT = 'PRODUCT_PROFILE';
16
+ const QUOTE_ADDITIONAL_PARAMS_SOURCE_CART = 'CART';
17
+
18
+ public function _construct()
19
  {
20
  parent::_construct();
21
  $this->_init('carebyzinc/carebyzinc');
22
  }
23
+
24
+ /**
25
+ * Get Zinc Plugin enablement status
26
+ *
27
+ * @return string Enabled/Disabled
28
+ */
29
+ static public function getOptionArray()
30
  {
31
  return array(
32
+ self::WARRANTY_ENABLED => Mage::helper('carebyzinc')->__('Enabled'),
33
+ self::WARRANTY_DISABLED => Mage::helper('carebyzinc')->__('Disabled')
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Get Zinc Quote for product page
39
+ *
40
+ * @param object $product
41
+ * @param string $zip
42
+ * @param string $optionPrice
43
+ *
44
+ * @return mixed $result - price quoite / error message
45
+ */
46
+ public function getPriceQuote($product, $zip, $optionPrice)
47
+ {
48
+ $result = false;
49
+
50
+ $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
51
+ $price = $product->getFinalPrice();
52
+ if ($optionPrice) {
53
+ $price += $optionPrice;
54
+ }
55
+
56
+ $data = array();
57
+ $data['sku'] = array(
58
+ 'merchant_sku_id' => $product->getId(),
59
+ 'sku_name' => $product->getName(),
60
+ 'variant_id' => '',
61
+ 'category' => $product->getCarebyzincCategory(),
62
+ 'subcategory' => $product->getCarebyzincSubcategory(),
63
+ 'subcategory2' => '',
64
+ 'description' => $product->getShortDescription(),
65
+ 'price' => $price,
66
+ 'currency' => $currencyCode,
67
+ 'remote_image_url' => Mage::getUrl('media') . 'catalog/product' . $product->getImage()
68
+ );
69
+
70
+ $data['additional_params'] = array(
71
+ 'source' => self::QUOTE_ADDITIONAL_PARAMS_SOURCE_PRODUCT
72
+ );
73
+
74
+ $catArray = array('bicycle', 'electronics');
75
+ if (in_array(strtolower($product->getCarebyzincCategory()), $catArray)) {
76
+
77
+ if (($product->getCarebyzincModel()) && ($product->getCarebyzincManufacturer())) {
78
+ $additional = array('model' => $product->getCarebyzincModel());
79
+ $data['sku']['additional_info'] = json_encode($additional);
80
+ $data['sku']['brand'] = $product->getCarebyzincManufacturer();
81
+ }
82
+ }
83
+
84
+ if (!$zip) {
85
+ $helper = Mage::helper('carebyzinc');
86
+ $zip = $helper->getZipCode();
87
+ }
88
+
89
+ $data['zip_code'] = $zip;
90
+
91
+ $outData = $this->callApi($data, 'price_quotes/generate');
92
+ $response = $outData['response'];
93
+
94
+ switch($outData['code']) {
95
+ case '200':
96
+ $quoteData = json_decode($response, true);
97
+ $priceQuote = array();
98
+ foreach ($quoteData['price_quotes'] as $item) {
99
+ $priceQuote[$item['id']] = $item;
100
+ }
101
+ Mage::getSingleton('core/session')->setCareQuote($priceQuote);
102
+ $result['code'] = '200';
103
+ $result['price'] = $priceQuote;
104
+ break;
105
+ case '400':
106
+ $quoteData = (array) json_decode($response, true);
107
+ $result['code'] = '400';
108
+ if(isset($quoteData['errors'])) {
109
+ $result['title'] = $quoteData['errors'][0]['title'];
110
+ $result['details'] = $quoteData['errors'][0]['details'];
111
+ } else {
112
+ $result = 'No Quotes Available';
113
+ }
114
+ break;
115
+ }
116
+
117
+ return $result;
118
+ }
119
+
120
+ /**
121
+ * Get Zinc Quote for cart page
122
+ *
123
+ * @param object $product
124
+ * @param string $zip
125
+ * @param string $optionPrice
126
+ *
127
+ * @return mixed $result - price quoite / error message
128
+ */
129
+ public function getPriceQuoteinCart($product, $itemId, $zip)
130
+ {
131
+ $result = false;
132
+
133
+ $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
134
+ $_item = Mage::getModel('sales/quote_item')->load($itemId);
135
+
136
+ $data = array();
137
+ $data['sku'] = array(
138
+ 'merchant_sku_id' => $product->getId(),
139
+ 'sku_name' => $product->getName(),
140
+ 'variant_id' => '',
141
+ 'category' => $product->getCarebyzincCategory(),
142
+ 'subcategory' => $product->getCarebyzincSubcategory(),
143
+ 'subcategory2' => '',
144
+ 'description' => $product->getShortDescription(),
145
+ 'price' => $_item->getPrice(),
146
+ 'currency' => $currencyCode,
147
+ 'remote_image_url' => Mage::getUrl('media') . 'catalog/product' . $product->getImage()
148
+ );
149
+
150
+ $data['additional_params'] = array(
151
+ 'source' => self::QUOTE_ADDITIONAL_PARAMS_SOURCE_CART
152
  );
153
+
154
+ $catArray = array('bicycle', 'electronics');
155
+ if (in_array(strtolower($product->getCarebyzincCategory()), $catArray)) {
156
+ if (($product->getCarebyzincModel()) && ($product->getCarebyzincManufacturer())) {
157
+ $additional = array('model' => $product->getCarebyzincModel());
158
+ $data['sku']['additional_info'] = json_encode($additional);
159
+ $data['sku']['brand'] = $product->getCarebyzincManufacturer();
160
+ }
161
+ }
162
+
163
+ if (!$zip) {
164
+ $helper = Mage::helper('carebyzinc');
165
+ $zip = $helper->getZipCode();
166
+ }
167
+
168
+ $data['zip_code'] = $zip;
169
+
170
+ $outData = $this->callApi($data, 'price_quotes/generate');
171
+ $response = $outData['response'];
172
+
173
+ switch($outData['code']) {
174
+ case '200':
175
+ $quoteData = json_decode($response, true);
176
+ $priceQuote = array();
177
+ if (!empty($quoteData['price_quotes'])) {
178
+ $priceQuote = Mage::getSingleton('core/session')->getCareByZincQuote();
179
+ foreach ($quoteData['price_quotes'] as $item) {
180
+ if ($priceQuote[$itemId]) {
181
+ unset($priceQuote[$itemId]);
182
+ }
183
+ $priceQuote[$itemId][$item['id']] = $item;
184
+ }
185
+
186
+ Mage::getSingleton('core/session')->setCareByZincQuote($priceQuote);
187
+ $result['code'] = '200';
188
+ $result['price'] = $priceQuote;
189
+ } else {
190
+ return 'No Quotes Available';
191
+ }
192
+ break;
193
+ case '400':
194
+ $quoteData = (array) json_decode($response, true);
195
+ $result['code'] = '400';
196
+ if(isset($quoteData['errors'])) {
197
+ $result['title'] = $quoteData['errors'][0]['title'];
198
+ $result['details'] = $quoteData['errors'][0]['details'];
199
+ } else {
200
+ $result = 'No Quotes Available';
201
+ }
202
+ break;
203
+ }
204
+
205
+ return $result;
206
+ }
207
 
208
+ /**
209
+ * Get API URL based on selected application mode
210
+ *
211
+ * @param type $action
212
+ *
213
+ * @return string API URL
214
+ */
215
+ public function getApiUrl($action, $params = false)
216
+ {
217
+ $path = Mage::getStoreConfig('carebyzinc/api/url');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
+ switch (Mage::getStoreConfig('carebyzinc/api/testmode')) {
220
+ case 'live':
221
+ $path = Mage::getStoreConfig('carebyzinc/api/url');
222
+ break;
223
+ case 'sandbox':
224
+ $path = Mage::getStoreConfig('carebyzinc/api/sandbox_url');
225
+ break;
226
+ case 'staging':
227
+ $path = Mage::getStoreConfig('carebyzinc/api/staging_url');
228
+ break;
229
+ case 'test':
230
+ default:
231
+ $path = Mage::getStoreConfig('carebyzinc/api/test_url');
232
+ break;
233
+ }
 
234
 
235
+ $protocol = 'https://';
236
+ $url = $protocol . $path . '/' . $action;
237
+
238
+ if($params) {
239
+ $url .= '/' . $params;
240
+ }
241
+
242
+ return $url;
243
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
+ /*
246
+ * Get Token based on selected application mode
247
+ *
248
+ * @return string User Token
249
+ */
250
+ public function getToken()
251
+ {
252
+ $token = false;
253
+ switch (Mage::getStoreConfig('carebyzinc/api/testmode')) {
254
+ case 'live':
255
+ $token = Mage::getStoreConfig('carebyzinc/api/xuser_token');
256
+ break;
257
+ case 'sandbox':
258
+ $token = Mage::getStoreConfig('carebyzinc/api/sandbox_xuser_token');
259
+ break;
260
+ case 'staging':
261
+ $token = Mage::getStoreConfig('carebyzinc/api/staging_xuser_token');
262
+ break;
263
+ case 'test':
264
+ default:
265
+ $token = Mage::getStoreConfig('carebyzinc/api/test_xuser_token');
266
+ break;
267
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
 
269
+ return $token;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
 
272
+ /**
273
+ * Call Zinc API
274
+ *
275
+ * @param array $data - input data
276
+ * @param string $action
277
+ * @param string $method
278
+ *
279
+ * @return json $result - API response
280
+ */
281
+ public function callApi($data, $action, $method = 'post')
282
+ {
283
+ $result = array();
284
+ $urlParams = false;
285
+
286
+ if($action == 'interstitials') {
287
+ $urlParams = $data;
288
+ } else {
289
+ $values = json_encode($data);
290
+ }
291
+
292
+ $url = $this->getApiUrl($action, $urlParams);
293
+
294
+ $token = $this->getToken();
295
+ $email = Mage::getStoreConfig('carebyzinc/api/xuser_email');
296
+
297
+ if (($action == 'price_quotes/generate') || ($action == 'policies' ) || ($action == 'retarget/flow') || ($action == 'orders') || ($action == 'interstitials')) {
298
+ $header = array("Content-Type: application/json", "X-User-Token:$token", "X-User-Email:$email", "token-type:Bearer");
299
+ } elseif ($action == 'token') {
300
+ $header = array("Content-Type: application/json", "X-User-Token:$token", "X-User-Email:$email", "token-type:Bearer");
301
+ } else {
302
+ $header = array("Content-Type: application/json", "token-type:Bearer");
303
+ }
304
+
305
+ $ch = curl_init($url);
306
+ curl_setopt($ch, CURLOPT_URL, $url);
307
+ if ($method == 'post') {
308
+ curl_setopt($ch, CURLOPT_POST, TRUE);
309
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $values);
310
+ }
311
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
312
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
313
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
314
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
315
+
316
+ $result['response'] = curl_exec($ch);
317
+ $result['code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
318
+ curl_close($ch);
319
+
320
+ return $result;
321
+ }
322
+
323
+ /**
324
+ * Get warranty status
325
+ *
326
+ * @param type $itemId
327
+ * @param type $warrentyitem
328
+ * @return boolean|string
329
+ */
330
+ public function getwarrantyStatus($itemId, $warrantyItem)
331
+ {
332
+ if ($item_id < 0) {
333
+ return '';
334
+ }
335
+
336
+ $cart = Mage::getModel('checkout/cart');
337
+ $quoteItem = $cart->getQuote()->getItemById($itemId);
338
+ if ($quoteItem) {
339
+ $product = Mage::getModel('catalog/product')->load($quoteItem->getProductId());
340
+ if (($product->getCarebyzinc() != 1) && ($quoteItem->getCarebyzincVariantid())) {
341
+
342
+ $quoteItem->setCarebyzincVariantid(NULL);
343
+ $quoteItem->save();
344
+ $cartHelper = Mage::helper('checkout/cart');
345
+ $cartHelper->getCart()->removeItem($warrantyItem)->save();
346
+ $cart->getQuote()->collectTotals()->save();
347
+ }
348
+ }
349
+
350
+ return true;
351
+ }
352
+
353
+ /**
354
+ * Get Category list
355
+ *
356
+ * @return array $result - category list
357
+ */
358
  public function getCategoryArray()
359
+ {
360
+ $dataArray = $this->getCategoryJson();
361
+ $category = array('' => 'Please Select');
362
+ foreach ($dataArray as $key => $value) {
363
+ $category[$key] = $key;
364
+ }
365
+
366
+ return $category;
367
+ }
368
 
369
+ /**
370
+ * Get Subcategory list
371
+ *
372
+ * @return array $result - subcategory list
373
+ */
374
+ public function getSubCategoryArray($category)
375
+ {
376
+ if ($category)
377
+ $dataArray = $this->getCategoryJson();
378
+ $subcategory = array('' => 'Please Select');
379
+ foreach ($dataArray as $key => $value) {
380
+ if ($key == $category) {
381
+ foreach ($value as $val) {
382
+ $subcategory[$val] = $val;
383
+ }
384
+ }
385
+ }
386
+ return $subcategory;
387
+ }
388
+
389
+ /**
390
+ * Get Subcategory in json
391
+ *
392
+ * @return array $result - category list
393
+ */
394
+ public function getCategoryJson()
395
+ {
396
+ $result = false;
397
+
398
+ $outData = $this->callApi('', 'categories', 'get');
399
+ if ($outData['code'] == '200') {
400
+ $response = $outData['response'];
401
+ } else {
402
+ $response = '{"Jewelry": ["Bracelet", "Necklace","Pendant","Brooch","Engagement Ring","Wedding Ring","Other Ring","Other"]}';
403
+ }
404
+ $result = json_decode($response);
405
+
406
+ return $result;
407
+ }
408
+
409
+ /**
410
+ * Get subcategory suggestions
411
+ *
412
+ * @param string $category - category name
413
+ * @return array $result -subcategories suggestion
414
+ */
415
+ public function getSubCategorySuggestions($category)
416
+ {
417
+ $result = false;
418
+
419
+ $outData = $this->callApi('', 'category_suggestions', 'get');
420
+ if ($outData['code'] == '200'){
421
+ $response = $outData['response'];
422
+ $decode = json_decode($response);
423
+ $result = $decode->$category;
424
+ }
425
+
426
+ return $result;
427
+ }
428
+
429
+ /**
430
+ * Get warranty name
431
+ *
432
+ * @param int $itemId
433
+ * @return string $result - warranty name
434
+ */
435
+ public function getWarrantyName($itemId)
436
+ {
437
+ $result = '';
438
 
439
+ $orderItem = Mage::getModel('sales/quote_item')->load($itemId);
440
+ $product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
441
+ if ($product) {
442
+ $result = ' for ' . $product->getName();
443
+ }
444
+
445
+ return $result;
446
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
 
448
+ public function prepareZincQuoteLayer($product)
449
+ {
450
+
451
+ }
452
  }
app/code/local/Zinc/Carebyzinc/Model/Checkout/Cart.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php
2
- /**
 
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Zinc_Carebyzinc_Model_Checkout_Cart extends Mage_Checkout_Model_Cart
9
- {
10
  /**
11
  * Add product to shopping cart (quote)
12
  *
@@ -14,151 +15,140 @@ class Zinc_Carebyzinc_Model_Checkout_Cart extends Mage_Checkout_Model_Cart
14
  * @param mixed $requestInfo
15
  * @return Mage_Checkout_Model_Cart
16
  */
17
- public function addProduct($productInfo, $requestInfo=null)
18
- {
19
  $product = $this->_getProduct($productInfo);
20
- $request = $this->_getProductRequest($requestInfo);
21
-
22
  $productId = $product->getId();
23
- $flag = 0;$qty = 0;
 
24
  $productType = $product->getTypeId();
25
- if(($productType == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE || $productType == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) && ($product->getCarebyzinc() == 1))
26
- {
27
- $flag = 1;
28
- $qty = $request->getQty()?$request->getQty():1;
29
- $request['qty'] = 1;
30
- }
31
  if ($product->getStockItem()) {
32
  $minimumQty = $product->getStockItem()->getMinSaleQty();
33
  //If product was not found in cart and there is set minimal qty for it
34
- if ($minimumQty && $minimumQty > 0 && $request->getQty() < $minimumQty
35
- && !$this->getQuote()->hasProductId($productId)
36
- ){
37
  $request->setQty($minimumQty);
38
  }
39
  }
40
- if($flag){
41
-
42
- if ($productId) {
43
- try {
44
- for($i= 0;$i<$qty;$i++){
45
-
46
- $additionalOptions = array();
47
- $product = Mage::getModel('catalog/product')
48
- ->setStoreId(Mage::app()->getStore()->getId())
49
- ->load($productId);
50
- $result = $this->getQuote()->addProduct($product, $request);
51
- if(is_object($result)){
52
-
53
- $result = ( $result->getParentItem() ? $result->getParentItem() : $result );
54
-
55
- $carebyzincId = $request->getCarebyzincOption();
56
- $priceQuote = Mage::getSingleton('core/session')->getCareQuote();
57
- $carebyzincAry = $priceQuote[$carebyzincId];
58
- if(! empty($carebyzincAry)){
59
-
60
- $productPrice = $result->getProduct()->getFinalPrice();
61
-
62
- if($carebyzincId){
63
- $result->setCarebyzincVariantid($carebyzincId);
64
- $warrantPrdctId = Mage::getStoreConfig('carebyzinc/general/warranty_product');
65
- if($warrantPrdctId){
66
- $req = $this->_getProductRequest(array('product'=>$warrantPrdctId,'qty'=>1,'form_key'=>$request['form_key']));
67
-
68
- $this->getQuote()->save();
69
- $careParentId = $result->getId();
70
-
71
- $warrantyProduct = Mage::getModel('catalog/product')->load($warrantPrdctId);
72
- $productPrice = $warrantyProduct->getPrice();
73
- if($price = $carebyzincAry['price_per_year'])
74
- $newPrice = $productPrice + $price;
75
- $resultItem = $this->getQuote()->addProduct($warrantyProduct, $req);
76
- $resultItem->setCustomPrice($newPrice);
77
- $resultItem->setOriginalCustomPrice($newPrice);
78
- $resultItem->setCarebyzincPrice($price);
79
- $resultItem->setCarebyzincParentid((int)$careParentId);
80
- $resultItem->getProduct()->setIsSuperMode(true);
81
- if( $item = $priceQuote[$carebyzincId]){
82
- $additionalOptions[] = array(
83
- 'label' => 'carebyzinc',
84
- 'value' => $carebyzincId,
85
- );
86
- $resultItem->setCarebyzincOption(serialize($priceQuote[$carebyzincId]));
87
-
88
- }
89
- $resultItem->addOption(array(
90
- 'product_id' => $resultItem->getProductId(),
91
- 'code' => 'additional_options',
92
- 'value' => serialize($additionalOptions)
93
- ));
94
- $this->getQuote()->save();
95
- }
96
- }
97
-
98
 
99
- }
100
- }
101
- }
102
- } catch (Mage_Core_Exception $e) {
103
- $this->getCheckoutSession()->setUseNotice(false);
104
- $result = $e->getMessage();
105
- }
106
- /**
107
- * String we can get if prepare process has error
108
- */
109
- if (is_string($result)) {
110
- $redirectUrl = ($product->hasOptionsValidationFail())
111
- ? $product->getUrlModel()->getUrl(
112
- $product,
113
- array('_query' => array('startcustomization' => 1))
114
- )
115
- : $product->getProductUrl();
116
- $this->getCheckoutSession()->setRedirectUrl($redirectUrl);
117
- if ($this->getCheckoutSession()->getUseNotice() === null) {
118
- $this->getCheckoutSession()->setUseNotice(true);
119
- }
120
- Mage::throwException($result);
121
- }
122
- } else {
123
- Mage::throwException(Mage::helper('checkout')->__('The product does not exist.'));
124
- }
125
 
126
- Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
127
- $this->getCheckoutSession()->setLastAddedProductId($productId);
128
- Mage::getSingleton('core/session')->unsCareQuote();
129
- }else{
130
- if ($productId) {
131
- try {
132
- $result = $this->getQuote()->addProduct($product, $request);
133
-
134
- } catch (Mage_Core_Exception $e) {
135
- $this->getCheckoutSession()->setUseNotice(false);
136
- $result = $e->getMessage();
137
- }
138
- /**
139
- * String we can get if prepare process has error
140
- */
141
- if (is_string($result)) {
142
- $redirectUrl = ($product->hasOptionsValidationFail())
143
- ? $product->getUrlModel()->getUrl(
144
- $product,
145
- array('_query' => array('startcustomization' => 1))
146
- )
147
- : $product->getProductUrl();
148
- $this->getCheckoutSession()->setRedirectUrl($redirectUrl);
149
- if ($this->getCheckoutSession()->getUseNotice() === null) {
150
- $this->getCheckoutSession()->setUseNotice(true);
151
- }
152
- Mage::throwException($result);
153
- }
154
- }else {
155
- Mage::throwException(Mage::helper('checkout')->__('The product does not exist.'));
156
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
- Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
159
- $this->getCheckoutSession()->setLastAddedProductId($productId);
160
- }
161
-
162
  return $this;
163
- }
 
164
  }
1
  <?php
2
+
3
+ /**
4
  * ZincPlatform
5
  * @package Zinc_Carebyzinc
6
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
7
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ class Zinc_Carebyzinc_Model_Checkout_Cart extends Mage_Checkout_Model_Cart {
10
+
11
  /**
12
  * Add product to shopping cart (quote)
13
  *
15
  * @param mixed $requestInfo
16
  * @return Mage_Checkout_Model_Cart
17
  */
18
+ public function addProduct($productInfo, $requestInfo = null) {
 
19
  $product = $this->_getProduct($productInfo);
20
+ $request = $this->_getProductRequest($requestInfo);
21
+
22
  $productId = $product->getId();
23
+ $flag = 0;
24
+ $qty = 0;
25
  $productType = $product->getTypeId();
26
+
27
+ if (($productType == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE || $productType == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) && ($product->getCarebyzinc() == 1)) {
28
+ $flag = 1;
29
+ $qty = $request->getQty() ? $request->getQty() : 1;
30
+ $request['qty'] = 1;
31
+ }
32
  if ($product->getStockItem()) {
33
  $minimumQty = $product->getStockItem()->getMinSaleQty();
34
  //If product was not found in cart and there is set minimal qty for it
35
+ if ($minimumQty && $minimumQty > 0 && $request->getQty() < $minimumQty && !$this->getQuote()->hasProductId($productId)
36
+ ) {
 
37
  $request->setQty($minimumQty);
38
  }
39
  }
40
+ if ($flag) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
+ if ($productId) {
43
+ try {
44
+ for ($i = 0; $i < $qty; $i++) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ $additionalOptions = array();
47
+ $product = Mage::getModel('catalog/product')
48
+ ->setStoreId(Mage::app()->getStore()->getId())
49
+ ->load($productId);
50
+ $result = $this->getQuote()->addProduct($product, $request);
51
+ if (is_object($result)) {
52
+
53
+ $result = ( $result->getParentItem() ? $result->getParentItem() : $result );
54
+
55
+ $carebyzincId = $request->getCarebyzincOption();
56
+ $priceQuote = Mage::getSingleton('core/session')->getCareQuote();
57
+ $carebyzincAry = $priceQuote[$carebyzincId];
58
+ if (!empty($carebyzincAry)) {
59
+
60
+ $productPrice = $result->getProduct()->getFinalPrice();
61
+ if ($carebyzincId) {
62
+ $result->setCarebyzincVariantid($carebyzincId);
63
+ $warrantPrdctId = Mage::getStoreConfig('carebyzinc/general/warranty_product');
64
+ if ($warrantPrdctId) {
65
+ $req = $this->_getProductRequest(array('product' => $warrantPrdctId, 'qty' => 1, 'form_key' => $request['form_key']));
66
+
67
+ $this->getQuote()->save();
68
+ $careParentId = $result->getId();
69
+
70
+ $warrantyProduct = Mage::getModel('catalog/product')->load($warrantPrdctId);
71
+ $productPrice = $warrantyProduct->getPrice();
72
+ if ($price = $carebyzincAry['price_per_year'])
73
+ $newPrice = $productPrice + $price;
74
+ $resultItem = $this->getQuote()->addProduct($warrantyProduct, $req);
75
+ $resultItem->setCustomPrice($newPrice);
76
+ $resultItem->setOriginalCustomPrice($newPrice);
77
+ $resultItem->setCarebyzincPrice($price);
78
+ $resultItem->setCarebyzincParentid((int) $careParentId);
79
+ $resultItem->getProduct()->setIsSuperMode(true);
80
+ if ($item = $priceQuote[$carebyzincId]) {
81
+ $additionalOptions[] = array(
82
+ 'label' => 'carebyzinc',
83
+ 'value' => $carebyzincId,
84
+ );
85
+ $resultItem->setCarebyzincOption(serialize($priceQuote[$carebyzincId]));
86
+ }
87
+ $resultItem->addOption(array(
88
+ 'product_id' => $resultItem->getProductId(),
89
+ 'code' => 'additional_options',
90
+ 'value' => serialize($additionalOptions)
91
+ ));
92
+ $this->getQuote()->save();
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ } catch (Mage_Core_Exception $e) {
99
+ $this->getCheckoutSession()->setUseNotice(false);
100
+ $result = $e->getMessage();
101
+ }
102
+ /**
103
+ * String we can get if prepare process has error
104
+ */
105
+ if (is_string($result)) {
106
+ $redirectUrl = ($product->hasOptionsValidationFail()) ? $product->getUrlModel()->getUrl(
107
+ $product, array('_query' => array('startcustomization' => 1))
108
+ ) : $product->getProductUrl();
109
+ $this->getCheckoutSession()->setRedirectUrl($redirectUrl);
110
+ if ($this->getCheckoutSession()->getUseNotice() === null) {
111
+ $this->getCheckoutSession()->setUseNotice(true);
112
+ }
113
+ Mage::throwException($result);
114
+ }
115
+ } else {
116
+ Mage::throwException(Mage::helper('checkout')->__('The product does not exist.'));
117
+ }
118
+
119
+ Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
120
+ $this->getCheckoutSession()->setLastAddedProductId($productId);
121
+ Mage::getSingleton('core/session')->unsCareQuote();
122
+ } else {
123
+ if ($productId) {
124
+ try {
125
+ $result = $this->getQuote()->addProduct($product, $request);
126
+ } catch (Mage_Core_Exception $e) {
127
+ $this->getCheckoutSession()->setUseNotice(false);
128
+ $result = $e->getMessage();
129
+ }
130
+ /**
131
+ * String we can get if prepare process has error
132
+ */
133
+ if (is_string($result)) {
134
+ $redirectUrl = ($product->hasOptionsValidationFail()) ? $product->getUrlModel()->getUrl(
135
+ $product, array('_query' => array('startcustomization' => 1))
136
+ ) : $product->getProductUrl();
137
+ $this->getCheckoutSession()->setRedirectUrl($redirectUrl);
138
+ if ($this->getCheckoutSession()->getUseNotice() === null) {
139
+ $this->getCheckoutSession()->setUseNotice(true);
140
+ }
141
+ Mage::throwException($result);
142
+ }
143
+ } else {
144
+ Mage::throwException(Mage::helper('checkout')->__('The product does not exist.'));
145
+ }
146
+
147
+ Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item' => $result, 'product' => $product));
148
+ $this->getCheckoutSession()->setLastAddedProductId($productId);
149
+ }
150
 
 
 
 
 
151
  return $this;
152
+ }
153
+
154
  }
app/code/local/Zinc/Carebyzinc/Model/Observer.php CHANGED
@@ -5,81 +5,72 @@
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
- class Zinc_Carebyzinc_Model_Observer{
9
-
10
-
11
-
12
  public function saveCarebyzinc($observer)
13
  {
14
- if(!Mage::registry('carebyzinc_save')):
15
- $order = $observer->getEvent()->getOrder();
16
  $model = Mage::getModel('carebyzinc/order');
17
  $model->savePolicy($order);
18
  Mage::register('carebyzinc_save',true);
19
- endif;
20
-
 
21
  }
22
 
23
  public function setCarebyzinc($observer)
24
- {
25
- if(Mage::getStoreConfig('carebyzinc/general/enabled')){
26
- $order = $observer->getEvent()->getOrder();
27
- $orderId = $order->getId();
28
- $orderItems = $order->getAllItems();
29
- foreach($orderItems as $item){
30
- if(($item->getCarebyzincParentid()) && ($item->getCarebyzincOption())){
31
-
32
- $careParentId = 0;
33
- $orderItemCollection = Mage::getModel('sales/order_item')->getCollection()
34
- ->addFieldToFilter('quote_item_id', $item->getCarebyzincParentid())
35
- ->addFieldToFilter('order_id', $orderId);
36
- foreach($orderItemCollection as $col){
37
- $careParentId = $col->getItemId();
38
- }
39
- if($careParentId){
40
- $item->setCarebyzincParentid((int)$careParentId);
41
- $item->save();
42
- }
43
-
44
-
45
-
46
- }
47
-
48
- }
49
- }
50
-
51
  }
52
 
53
  public function cartLoad($observer)
54
  {
55
- if( ! Mage::getStoreConfig('carebyzinc/general/enabled')){
56
  $cartHelper = Mage::helper('checkout/cart');
57
  $cart = Mage::getModel('checkout/cart')->getQuote();
58
  $idArray = array();
59
  foreach ($cart->getAllItems() as $item) {
60
- if($item->getCarebyzincVariantid()){
61
  $item->setCarebyzincVariantid(NULL);
62
  $item->save();
63
  $idArray[] = $item->getId();
64
- }else{
65
  if(($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')) || (in_array($item->getCarebyzincParentid(),$idArray)) ){
66
  $cartHelper->getCart()->removeItem($item->getId())->save();
67
  }
68
  }
69
-
70
-
71
  }
72
- }else{
73
  $cart = Mage::getModel('checkout/cart')->getQuote();
74
  foreach ($cart->getAllItems() as $item) {
75
- if($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')){
76
  $model = Mage::getModel('carebyzinc/carebyzinc');
77
  $carebyStatus = $model->getwarrantyStatus($item->getCarebyzincParentid(),$item->getId());
78
  }
79
  }
80
-
81
  }
82
-
83
  }
84
 
85
  public function warrantyDelete($observer)
@@ -87,49 +78,50 @@ class Zinc_Carebyzinc_Model_Observer{
87
  $_item = $observer->getEvent()->getQuoteItem();
88
  $itemId = $_item->getId();
89
  $productId = $_item->getProductId();
90
- if(Mage::getStoreConfig('carebyzinc/general/enabled')){
91
  $cartHelper = Mage::helper('checkout/cart');
92
- if($_item->getCarebyzincVariantid()){
93
  $cart = Mage::getModel('checkout/cart')->getQuote();
94
  foreach ($cart->getAllItems() as $item) {
95
- if($item->getCarebyzincParentid() == $itemId)
96
- $cartHelper->getCart()->removeItem($item->getId())->save();
97
-
98
  }
99
- }else{
100
- if($productId == Mage::getStoreConfig('carebyzinc/general/warranty_product')){
101
  $itemId = $_item->getCarebyzincParentid();
102
  $cart = Mage::getSingleton('checkout/cart');
103
- $item = $cart->getQuote()->getItemById($itemId);
104
- if($item){
105
  $item->setCarebyzincVariantid(NULL);
106
  $item->save();
107
  }
108
  }
109
  }
110
-
111
  }
112
-
113
  }
114
- public function salesQuoteItemSetProduct(Varien_Event_Observer $observer)
 
115
  {
116
  /* @var $item Mage_Sales_Model_Quote_Item */
117
  $item = $observer->getQuoteItem();
118
  $name = '';
119
 
120
- if($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')){
121
  $quoteItem = Mage::getModel('sales/quote_item')->load($item->getCarebyzincParentid());
122
  $carebyzincAry = (array) unserialize($item->getCarebyzincOption());
123
 
124
- if($quoteItem)
125
- $name = $item->getName().' for '.$quoteItem->getName();
126
- if($name)
127
- $item->setName($name);
128
- if($carebyzincAry['quote_type'])
129
- $item->setSku($carebyzincAry['quote_type']);
 
 
 
130
  }
 
131
  return $this;
132
  }
133
-
134
-
135
  }
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
+ class Zinc_Carebyzinc_Model_Observer
9
+ {
 
 
10
  public function saveCarebyzinc($observer)
11
  {
12
+ if(!Mage::registry('carebyzinc_save')) {
13
+ $order = $observer->getEvent()->getOrder();
14
  $model = Mage::getModel('carebyzinc/order');
15
  $model->savePolicy($order);
16
  Mage::register('carebyzinc_save',true);
17
+
18
+ $model->recordOrderToZinc($order);
19
+ }
20
  }
21
 
22
  public function setCarebyzinc($observer)
23
+ {
24
+ if(Mage::getStoreConfig('carebyzinc/general/enabled')) {
25
+ $order = $observer->getEvent()->getOrder();
26
+ $orderId = $order->getId();
27
+ $orderItems = $order->getAllItems();
28
+ foreach($orderItems as $item) {
29
+ if(($item->getCarebyzincParentid()) && ($item->getCarebyzincOption())) {
30
+ $careParentId = 0;
31
+ $orderItemCollection = Mage::getModel('sales/order_item')->getCollection()
32
+ ->addFieldToFilter('quote_item_id', $item->getCarebyzincParentid())
33
+ ->addFieldToFilter('order_id', $orderId);
34
+
35
+ foreach($orderItemCollection as $col) {
36
+ $careParentId = $col->getItemId();
37
+ }
38
+
39
+ if($careParentId){
40
+ $item->setCarebyzincParentid((int)$careParentId);
41
+ $item->save();
42
+ }
43
+ }
44
+ }
45
+ }
 
 
 
 
46
  }
47
 
48
  public function cartLoad($observer)
49
  {
50
+ if(!Mage::getStoreConfig('carebyzinc/general/enabled')){
51
  $cartHelper = Mage::helper('checkout/cart');
52
  $cart = Mage::getModel('checkout/cart')->getQuote();
53
  $idArray = array();
54
  foreach ($cart->getAllItems() as $item) {
55
+ if($item->getCarebyzincVariantid()) {
56
  $item->setCarebyzincVariantid(NULL);
57
  $item->save();
58
  $idArray[] = $item->getId();
59
+ } else {
60
  if(($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')) || (in_array($item->getCarebyzincParentid(),$idArray)) ){
61
  $cartHelper->getCart()->removeItem($item->getId())->save();
62
  }
63
  }
 
 
64
  }
65
+ } else {
66
  $cart = Mage::getModel('checkout/cart')->getQuote();
67
  foreach ($cart->getAllItems() as $item) {
68
+ if($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')) {
69
  $model = Mage::getModel('carebyzinc/carebyzinc');
70
  $carebyStatus = $model->getwarrantyStatus($item->getCarebyzincParentid(),$item->getId());
71
  }
72
  }
 
73
  }
 
74
  }
75
 
76
  public function warrantyDelete($observer)
78
  $_item = $observer->getEvent()->getQuoteItem();
79
  $itemId = $_item->getId();
80
  $productId = $_item->getProductId();
81
+ if(Mage::getStoreConfig('carebyzinc/general/enabled')) {
82
  $cartHelper = Mage::helper('checkout/cart');
83
+ if($_item->getCarebyzincVariantid()) {
84
  $cart = Mage::getModel('checkout/cart')->getQuote();
85
  foreach ($cart->getAllItems() as $item) {
86
+ if($item->getCarebyzincParentid() == $itemId) {
87
+ $cartHelper->getCart()->removeItem($item->getId())->save();
88
+ }
89
  }
90
+ } else {
91
+ if($productId == Mage::getStoreConfig('carebyzinc/general/warranty_product')) {
92
  $itemId = $_item->getCarebyzincParentid();
93
  $cart = Mage::getSingleton('checkout/cart');
94
+ $item = $cart->getQuote()->getItemById($itemId);
95
+ if($item) {
96
  $item->setCarebyzincVariantid(NULL);
97
  $item->save();
98
  }
99
  }
100
  }
 
101
  }
 
102
  }
103
+
104
+ public function salesQuoteItemSetProduct(Varien_Event_Observer $observer)
105
  {
106
  /* @var $item Mage_Sales_Model_Quote_Item */
107
  $item = $observer->getQuoteItem();
108
  $name = '';
109
 
110
+ if($item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')) {
111
  $quoteItem = Mage::getModel('sales/quote_item')->load($item->getCarebyzincParentid());
112
  $carebyzincAry = (array) unserialize($item->getCarebyzincOption());
113
 
114
+ if($quoteItem) {
115
+ $name = $item->getName().' for '.$quoteItem->getName();
116
+ }
117
+ if($name) {
118
+ $item->setName($name);
119
+ }
120
+ if($carebyzincAry['quote_type']) {
121
+ $item->setSku($carebyzincAry['quote_type']);
122
+ }
123
  }
124
+
125
  return $this;
126
  }
 
 
127
  }
app/code/local/Zinc/Carebyzinc/Model/Order.php CHANGED
@@ -7,23 +7,22 @@
7
  */
8
  class Zinc_Carebyzinc_Model_Order extends Mage_Core_Model_Abstract
9
  {
10
-
11
  const PRODUCTION = 1;
12
  const SANDBOX = 0;
 
13
  public function _construct()
14
  {
15
  parent::_construct();
16
  $this->_init('carebyzinc/order');
17
  }
18
 
19
-
20
  public function savePolicy($order)
21
  {
22
  $data = array();
23
  $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
24
  $data['customer'] = $this->getUserAddress($order);
25
  $carebyItem = 0;$policyKeyArray = array();
26
- $orderItems = $order->getAllVisibleItems();
27
  $fromname = Mage::getStoreConfig('trans_email/ident_general/name');
28
  $fromemail = Mage::getStoreConfig('trans_email/ident_general/email');
29
  $translate = Mage::getSingleton('core/translate');
@@ -32,30 +31,33 @@ class Zinc_Carebyzinc_Model_Order extends Mage_Core_Model_Abstract
32
  $templateId = Mage::getStoreConfig('sales_email/order/template');
33
 
34
  $model = Mage::getModel('carebyzinc/carebyzinc');
35
- if((Mage::getStoreConfig('carebyzinc/api/testmode')) == 'live')
36
- $mode = 1;
37
- else
38
- $mode = 0;
 
 
39
  $orderId = $order->getId();
40
- foreach($orderItems as $item){
41
-
42
- if($item->getCarebyzincVariantid()){
43
- $policyNo = ''; $carezincOption = '';
44
  $orderItemCollection = Mage::getModel('sales/order_item')->getCollection()
45
- ->addFieldToFilter('carebyzinc_parentid', $item->getQuoteItemId())
46
- ->addFieldToFilter('order_id', $orderId);
47
 
48
- foreach($orderItemCollection as $col){
49
- $carezincOption = $col->getCarebyzincOption();
50
- }
51
- $carebyzincAry = (array) unserialize($carezincOption) ;
52
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
 
53
  $data['price_quote_id'] = $carebyzincAry['id'];
54
  $data['sku_id'] = $carebyzincAry['sku_id'];
55
  $result = $model->callApi($data, 'policies');
56
  $policyAry = $result['response'];
57
  if($result['code'] == 200){
58
- $policyArray = (array) json_decode($policyAry);
59
  $policyNo = $policyArray['policy_id'];
60
  }
61
  $policyKeyArray[] = $policyNo;
@@ -78,41 +80,36 @@ class Zinc_Carebyzinc_Model_Order extends Mage_Core_Model_Abstract
78
  $careOrder->setCreatedTime(now());
79
  $careOrder->setOrderCreatedMode($mode);
80
  $careOrder->save();
81
-
82
  }
83
  }
84
- if($carebyItem){
85
  $fromname = Mage::getStoreConfig('trans_email/ident_general/name');
86
  $fromemail = Mage::getStoreConfig('trans_email/ident_general/email');
87
  $translate = Mage::getSingleton('core/translate');
88
  $email = 'support@zincplatform.com';
89
  $name = 'Zinc';
90
  $templateId = Mage::getStoreConfig('sales_email/order/template');
91
- if($email){
92
- for($i =0;$i<count($policyKeyArray);$i++){
93
- $storeObj = Mage::getModel('core/store')->load($order->getStoreId());
94
- $anyDate = $order->getCreatedAt();
95
  $dateTimestamp = Mage::getModel('core/date')->timestamp(strtotime($anyDate));
96
  $date = date("Y-m-d",$dateTimestamp);
97
  $subject = $policyKeyArray[$i].'_'.$storeObj->getFrontendName().'_'.$date;
98
- $emailTemplate = Mage::getModel('core/email_template')->loadDefault('sales_email_order_template');
99
- $emailTemplateVariables = array();
100
- $emailTemplateVariables['order'] = $order;
101
- $emailTemplateVariables['store'] = $storeObj;
102
- $emailTemplate->setSenderName($fromname);
103
- $emailTemplate->setSenderEmail($fromemail);
104
- $emailTemplate->setType('html');
105
- $emailTemplate->setTemplateSubject($subject);
106
- $emailTemplate->send($email, $name, $emailTemplateVariables);
107
  }
108
-
109
  }
110
-
111
  }
112
  }
113
 
114
-
115
-
116
  public function getUserAddress($order)
117
  {
118
  $address ['first_name'] = $order->getCustomerFirstname();
@@ -123,24 +120,260 @@ class Zinc_Carebyzinc_Model_Order extends Mage_Core_Model_Abstract
123
  $address ['main_phone_number'] = $billingAddress->getTelephone();
124
  $address ['country'] = $billingAddress->getCountryId();
125
  $address ['address'] = array(
126
- "billing_city" => $billingAddress->getCity(),
127
- "billing_zip_code" => $billingAddress->getPostcode(),
128
- "billing_state" => $billingAddress->getRegion(),
129
- "billing_address1" => $billingAddress->getStreet(),
130
- );
131
-
 
 
 
 
 
 
132
  return $address;
133
-
134
  }
135
-
136
-
137
-
138
-
139
- static public function getOptionArray()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  {
141
  return array(
142
- self::PRODUCTION => Mage::helper('carebyzinc')->__('Production'),
143
- self::SANDBOX => Mage::helper('carebyzinc')->__('Sandbox')
144
  );
145
  }
146
  }
7
  */
8
  class Zinc_Carebyzinc_Model_Order extends Mage_Core_Model_Abstract
9
  {
 
10
  const PRODUCTION = 1;
11
  const SANDBOX = 0;
12
+
13
  public function _construct()
14
  {
15
  parent::_construct();
16
  $this->_init('carebyzinc/order');
17
  }
18
 
 
19
  public function savePolicy($order)
20
  {
21
  $data = array();
22
  $currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
23
  $data['customer'] = $this->getUserAddress($order);
24
  $carebyItem = 0;$policyKeyArray = array();
25
+ $orderItems = $order->getAllVisibleItems();
26
  $fromname = Mage::getStoreConfig('trans_email/ident_general/name');
27
  $fromemail = Mage::getStoreConfig('trans_email/ident_general/email');
28
  $translate = Mage::getSingleton('core/translate');
31
  $templateId = Mage::getStoreConfig('sales_email/order/template');
32
 
33
  $model = Mage::getModel('carebyzinc/carebyzinc');
34
+ if((Mage::getStoreConfig('carebyzinc/api/testmode')) == 'live') {
35
+ $mode = 1;
36
+ } else {
37
+ $mode = 0;
38
+ }
39
+
40
  $orderId = $order->getId();
41
+ foreach($orderItems as $item) {
42
+ if($item->getCarebyzincVariantid()) {
43
+ $policyNo = '';
44
+ $carezincOption = '';
45
  $orderItemCollection = Mage::getModel('sales/order_item')->getCollection()
46
+ ->addFieldToFilter('carebyzinc_parentid', $item->getQuoteItemId())
47
+ ->addFieldToFilter('order_id', $orderId);
48
 
49
+ foreach($orderItemCollection as $col) {
50
+ $carezincOption = $col->getCarebyzincOption();
51
+ }
52
+
53
+ $carebyzincAry = (array) unserialize($carezincOption);
54
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
55
  $data['price_quote_id'] = $carebyzincAry['id'];
56
  $data['sku_id'] = $carebyzincAry['sku_id'];
57
  $result = $model->callApi($data, 'policies');
58
  $policyAry = $result['response'];
59
  if($result['code'] == 200){
60
+ $policyArray = (array) json_decode($policyAry);
61
  $policyNo = $policyArray['policy_id'];
62
  }
63
  $policyKeyArray[] = $policyNo;
80
  $careOrder->setCreatedTime(now());
81
  $careOrder->setOrderCreatedMode($mode);
82
  $careOrder->save();
 
83
  }
84
  }
85
+ if($carebyItem) {
86
  $fromname = Mage::getStoreConfig('trans_email/ident_general/name');
87
  $fromemail = Mage::getStoreConfig('trans_email/ident_general/email');
88
  $translate = Mage::getSingleton('core/translate');
89
  $email = 'support@zincplatform.com';
90
  $name = 'Zinc';
91
  $templateId = Mage::getStoreConfig('sales_email/order/template');
92
+ if($email) {
93
+ for($i =0;$i<count($policyKeyArray);$i++) {
94
+ $storeObj = Mage::getModel('core/store')->load($order->getStoreId());
95
+ $anyDate = $order->getCreatedAt();
96
  $dateTimestamp = Mage::getModel('core/date')->timestamp(strtotime($anyDate));
97
  $date = date("Y-m-d",$dateTimestamp);
98
  $subject = $policyKeyArray[$i].'_'.$storeObj->getFrontendName().'_'.$date;
99
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('sales_email_order_template');
100
+ $emailTemplateVariables = array();
101
+ $emailTemplateVariables['order'] = $order;
102
+ $emailTemplateVariables['store'] = $storeObj;
103
+ $emailTemplate->setSenderName($fromname);
104
+ $emailTemplate->setSenderEmail($fromemail);
105
+ $emailTemplate->setType('html');
106
+ $emailTemplate->setTemplateSubject($subject);
107
+ $emailTemplate->send($email, $name, $emailTemplateVariables);
108
  }
 
109
  }
 
110
  }
111
  }
112
 
 
 
113
  public function getUserAddress($order)
114
  {
115
  $address ['first_name'] = $order->getCustomerFirstname();
120
  $address ['main_phone_number'] = $billingAddress->getTelephone();
121
  $address ['country'] = $billingAddress->getCountryId();
122
  $address ['address'] = array(
123
+ "billing_city" => $billingAddress->getCity(),
124
+ "billing_zip_code" => $billingAddress->getPostcode(),
125
+ "billing_state" => $billingAddress->getRegion()
126
+ );
127
+
128
+ $billingAddr = $billingAddress->getStreet();
129
+ if(is_array($billingAddr) && isset($billingAddr[0])) {
130
+ $address['address']["billing_address1"] = $billingAddr[0];
131
+ } else {
132
+ $address['address']["billing_address1"] = $billingAddr;
133
+ }
134
+
135
  return $address;
 
136
  }
137
+
138
+ public function recordOrderToZinc($order)
139
+ {
140
+ $result = false;
141
+
142
+ $model = Mage::getModel('carebyzinc/carebyzinc');
143
+
144
+ $data = array();
145
+ $data['order_id'] = $order->getId();
146
+
147
+ $anyDate = $order->getCreatedAt();
148
+ $dateTimestamp = Mage::getModel('core/date')->timestamp(strtotime($anyDate));
149
+ $date = date("Y-m-d H:i:s",$dateTimestamp);
150
+ $data['fulfilled_at'] = $date;
151
+
152
+ $data['customer'] = $this->getUserAddress($order);
153
+
154
+ $data['skus'] = array();
155
+ $quote = Mage::getModel('checkout/cart')->getQuote();
156
+ $data['skus'] = $this->_prepareProducts($order, $quote, 'cart');
157
+
158
+ $outData = $model->callApi($data, 'orders');
159
+ $response = $outData['response'];
160
+
161
+ switch($outData['code']) {
162
+ case '200':
163
+ $quoteData = json_decode($response, true);
164
+ $result['code'] = '200';
165
+ break;
166
+ default:
167
+ $quoteData = (array) json_decode($response, true);
168
+ $result['code'] = '400';
169
+ if(isset($quoteData['errors'])) {
170
+ $result['title'] = $quoteData['errors'][0]['title'];
171
+ $result['details'] = $quoteData['errors'][0]['details'];
172
+ } else {
173
+ $result = 'Unexpected error occured';
174
+ }
175
+ break;
176
+ }
177
+
178
+ return $result;
179
+ }
180
+
181
+ /**
182
+ * Prepare thank you page after successful purchase.
183
+ *
184
+ * @param object $quote
185
+ * @param object $order
186
+ * @return string $result - success page URL / error
187
+ */
188
+ public function prepareSuccessPage($quote, $order)
189
+ {
190
+ $result = false;
191
+
192
+ $model = Mage::getModel('carebyzinc/carebyzinc');
193
+
194
+ $data = array();
195
+ $data['customer'] = $this->getUserAddress($order);
196
+
197
+ $data['zip_code'] = $data['customer']['address']['billing_zip_code'];
198
+ $data['order_id'] = $order->getId();
199
+
200
+ $data['products'] = $this->_prepareProducts($order, $quote, 'success');
201
+
202
+ $outData = $model->callApi($data, 'retarget/flow');
203
+ $response = $outData['response'];
204
+
205
+ switch($outData['code']) {
206
+ case '200':
207
+ $quoteData = json_decode($response, true);
208
+ $result['code'] = '200';
209
+ $result['url'] = $quoteData['url'];
210
+ break;
211
+ default:
212
+ $quoteData = (array) json_decode($response, true);
213
+ $result['code'] = '400';
214
+ if(isset($quoteData['errors'])) {
215
+ $result['title'] = $quoteData['errors'][0]['title'];
216
+ $result['details'] = $quoteData['errors'][0]['details'];
217
+ } else {
218
+ $result = 'Unexpected error occured';
219
+ }
220
+ break;
221
+ }
222
+
223
+ return $result;
224
+ }
225
+
226
+ /**
227
+ * The Interstital API will provide you with an HTML snippet for a given category that you can show to your customers to add an extra explanation of what Zinc is offering
228
+ *
229
+ * @param string $category - product category
230
+ * @return array $result - html for layer / error
231
+ */
232
+ public function prepareInterstitials($category)
233
+ {
234
+ $result = false;
235
+
236
+ if($category) {
237
+ $model = Mage::getModel('carebyzinc/carebyzinc');
238
+
239
+ $outData = $model->callApi($category, 'interstitials', 'get');
240
+ $response = $outData['response'];
241
+
242
+ switch($outData['code']) {
243
+ case '200':
244
+ $quoteData = json_decode($response, true);
245
+ $result['code'] = '200';
246
+ $result['html'] = $quoteData['html'];
247
+ $result['stylesheet'] = $quoteData['stylesheet'];
248
+ break;
249
+ default:
250
+ $quoteData = (array) json_decode($response, true);
251
+ $result['code'] = '400';
252
+ if(isset($quoteData['errors'])) {
253
+ $result['title'] = $quoteData['errors'][0]['title'];
254
+ $result['details'] = $quoteData['errors'][0]['details'];
255
+ } else {
256
+ $result = 'Unexpected error occured';
257
+ }
258
+ break;
259
+ }
260
+ }
261
+
262
+ return $result;
263
+ }
264
+
265
+ /**
266
+ * Import historical orders from admin panel
267
+ *
268
+ * @return array $result - success / failure
269
+ */
270
+ public function massImportOrders()
271
+ {
272
+ $result = false;
273
+
274
+ $result['code'] == 200;
275
+
276
+ return $result;
277
+ }
278
+
279
+ /**
280
+ * Process purchase insurance on product detail page
281
+ *
282
+ * @param array $post - data send from the form
283
+ * @return json $result - redirection url
284
+ */
285
+ public function processPurchaseInsurance($post)
286
+ {
287
+ $result = false;
288
+
289
+ if(is_array($post)) {
290
+ $pId = (int)$post['pId'];
291
+ $product = Mage::getModel('catalog/product')->load($pId);
292
+ if(isset($post['action'])) {
293
+ switch($post['action']) {
294
+ case 'add':
295
+ if(Mage::getStoreConfig('checkout/cart/redirect_to_cart')) {
296
+ $result['url'] = Mage::getUrl("checkout/cart/");
297
+ $result['action'] = 'add';
298
+ }
299
+ break;
300
+ case 'cancel':
301
+ default:
302
+ if(Mage::getStoreConfig('checkout/cart/redirect_to_cart')) {
303
+ $result['url'] = Mage::getUrl("checkout/cart/");
304
+ $result['action'] = 'cancel';
305
+ }
306
+ break;
307
+ }
308
+ }
309
+ }
310
+
311
+ return $result;
312
+ }
313
+
314
+ protected function _prepareProducts($order, $quote = false, $type = 'cart')
315
+ {
316
+ $result = false;
317
+
318
+ $warrantyProductId = (int)Mage::getStoreConfig('carebyzinc/general/warranty_product');
319
+ $orderItems = $order->getAllVisibleItems();
320
+
321
+ $i = 0;
322
+ foreach($orderItems as $item) {
323
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
324
+
325
+ if($type == 'cart') {
326
+ if($product->getCarebyzinc() == '1') {
327
+ $result[$i]['sku_name'] = $product->getSku();
328
+ $result[$i]['category'] = $product->getCarebyzincCategory();
329
+ $result[$i]['subcategory'] = $product->getCarebyzincSubcategory();
330
+ $result[$i]['description'] = $product->getShortDescription();
331
+ $result[$i]['price'] = $product->getPrice();
332
+ $result[$i]['currency'] = $order->getOrderCurrencyCode();
333
+ $result[$i]['brand'] = $product->getAttributeText('manufacturer');
334
+ $result[$i]['remote_image_url'] = Mage::getUrl('media') . 'catalog/product' . $product->getImage();
335
+ $i++;
336
+ }
337
+ } elseif($type == 'success') {
338
+ if($product->getCarebyzinc() == '1' && $item->getCarebyzincVariantid() == null) {
339
+ $result[$i]['sku_name'] = $product->getSku();
340
+ $result[$i]['category'] = $product->getCarebyzincCategory();
341
+ $result[$i]['subcategory'] = $product->getCarebyzincSubcategory();
342
+ $result[$i]['description'] = $product->getShortDescription();
343
+ $result[$i]['price'] = $product->getPrice();
344
+ $result[$i]['currency'] = $order->getOrderCurrencyCode();
345
+ $result[$i]['brand'] = $product->getAttributeText('manufacturer');
346
+ $result[$i]['remote_image_url'] = Mage::getUrl('media') . 'catalog/product' . $product->getImage();
347
+ $i++;
348
+ }
349
+ }
350
+ }
351
+
352
+ if($quote && $type == 'cart') {
353
+ foreach ($quote->getAllVisibleItems() as $item) {
354
+ if($warrantyProductId == (int)$item->getProductId()) {
355
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
356
+ $result[$i]['sku_name'] = $item->getProduct()->getName();
357
+ $result[$i]['category'] = 'Insurance';
358
+ $result[$i]['subcategory'] = 'Insurance';
359
+ $result[$i]['description'] = $product->getShortDescription();
360
+ $result[$i]['price'] = $item->getPrice();
361
+ $result[$i]['currency'] = $order->getOrderCurrencyCode();
362
+ $result[$i]['brand'] = 'NA';
363
+ $result[$i]['remote_image_url'] = 'NA';
364
+ $i++;
365
+ }
366
+ }
367
+ }
368
+
369
+ return $result;
370
+ }
371
+
372
+ static public function getOptionArray()
373
  {
374
  return array(
375
+ self::PRODUCTION => Mage::helper('carebyzinc')->__('Production'),
376
+ self::SANDBOX => Mage::helper('carebyzinc')->__('Sandbox')
377
  );
378
  }
379
  }
app/code/local/Zinc/Carebyzinc/Model/System/Config/Protocol.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * ZincPlatform
4
- * @package Zinc_Carebyzinc
5
- * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Zinc_Carebyzinc_Model_System_Config_Protocol
9
- {
10
- public function toOptionArray()
11
- {
12
- return array(
13
- array(
14
- 'value' => 'http',
15
- 'label' => 'http',
16
- ),
17
- array(
18
- 'value' => 'https',
19
- 'label' => 'https',
20
- ),
21
- );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Zinc/Carebyzinc/Model/System/Config/Source.php CHANGED
@@ -7,16 +7,24 @@
7
  */
8
  class Zinc_Carebyzinc_Model_System_Config_Source
9
  {
10
- public function toOptionArray()
11
  {
12
  return array(
13
  array(
14
  'value' => 'test',
15
- 'label' => 'Test Mode',
 
 
 
 
 
 
 
 
16
  ),
17
  array(
18
  'value' => 'live',
19
- 'label' => 'Production Mode',
20
  ),
21
  );
22
  }
7
  */
8
  class Zinc_Carebyzinc_Model_System_Config_Source
9
  {
10
+ public function toOptionArray()
11
  {
12
  return array(
13
  array(
14
  'value' => 'test',
15
+ 'label' => 'Regression',
16
+ ),
17
+ array(
18
+ 'value' => 'sandbox',
19
+ 'label' => 'Sandbox',
20
+ ),
21
+ array(
22
+ 'value' => 'staging',
23
+ 'label' => 'Staging',
24
  ),
25
  array(
26
  'value' => 'live',
27
+ 'label' => 'Production',
28
  ),
29
  );
30
  }
app/code/local/Zinc/Carebyzinc/controllers/Adminhtml/CarebyzincController.php CHANGED
@@ -1,25 +1,39 @@
1
  <?php
2
- /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  class Zinc_Carebyzinc_Adminhtml_CarebyzincController extends Mage_Adminhtml_Controller_action
9
  {
10
- public function validateAction()
11
  {
12
- $model = Mage::getModel('carebyzinc/carebyzinc');
13
- $data['X-User-Token'] = $model->getToken();
14
- $data['X-User-Email'] = Mage::getStoreConfig('carebyzinc/api/xuser_email');
15
-
16
-
17
- $result = $model->callApi($data,'token','post');
18
- if($result['code'] == 200)
19
- $response = 'Success';
20
- else
21
- $response = 'Error';
22
- Mage::app()->getResponse()->setBody($response);
23
- }
24
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
1
  <?php
2
+ /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
  class Zinc_Carebyzinc_Adminhtml_CarebyzincController extends Mage_Adminhtml_Controller_action
9
  {
10
+ public function validateAction()
11
  {
12
+ $model = Mage::getModel('carebyzinc/carebyzinc');
13
+ $data['X-User-Token'] = $model->getToken();
14
+ $data['X-User-Email'] = Mage::getStoreConfig('carebyzinc/api/xuser_email');
15
+
16
+ $result = $model->callApi($data, 'token', 'post');
17
+ if ($result['code'] == 200) {
18
+ $response = 'Success';
19
+ } else {
20
+ $response = 'Error';
21
+ }
22
+
23
+ Mage::app()->getResponse()->setBody($response);
24
+ }
25
+
26
+ public function importordersAction()
27
+ {
28
+ $model = Mage::getModel('carebyzinc/order');
29
+ $result = $model->massImportOrders();
30
+
31
+ if ($result['code'] == 200) {
32
+ $response = 'Success';
33
+ } else {
34
+ $response = 'Error';
35
+ }
36
+
37
+ Mage::app()->getResponse()->setBody($response);
38
+ }
39
  }
app/code/local/Zinc/Carebyzinc/controllers/Adminhtml/ProductController.php CHANGED
@@ -7,35 +7,39 @@
7
  */
8
  class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Controller_action
9
  {
10
-
11
- protected function _initAction() {
12
  $this->loadLayout()
13
- ->_setActiveMenu('carebyzinc/product')
14
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Care by Zinc'), Mage::helper('adminhtml')->__('Care by Zinc'));
15
 
16
  return $this;
17
  }
18
 
19
- public function indexAction() {
 
20
  $this->_initAction()
21
- ->renderLayout();
22
  }
23
-
24
-
25
- public function orderAction() {
26
  $this->_initAction()
27
- ->renderLayout();
28
  }
29
- public function gridAction()
 
30
  {
31
- $this->loadLayout();
32
- $this->renderLayout();
33
  }
 
34
  /**
35
  * Edit Carebyzinc status action
36
  *
37
  */
38
- public function editAction() {
 
39
  $id = $this->getRequest()->getParam('id');
40
  $model = Mage::getModel('catalog/product')->load($id);
41
  if ($model->getId() || $id == 0) {
@@ -49,32 +53,35 @@ class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Control
49
  $this->_setActiveMenu('carebyzinc/products');
50
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
51
  $this->_addContent($this->getLayout()->createBlock('carebyzinc/adminhtml_product_edit'))
52
- ->_addLeft($this->getLayout()->createBlock('carebyzinc/adminhtml_product_edit_tabs'));
53
  $this->renderLayout();
54
  } else {
55
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('carebyzinc')->__('Item does not exist'));
56
  $this->_redirect('*/*/');
57
  }
58
  }
 
59
  /**
60
  * Update product(s) status action
61
  *
62
  */
63
  public function saveAction()
64
- {
65
- $post = $this->getRequest()->getPost();
66
- $id = $this->getRequest()->getParam('id');
67
- $model = Mage::getModel('catalog/product')->load($id);
68
- $model->setCarebyzincCategory($post['category']);
69
- $model->setCarebyzincSubcategory($post['subcategory']);
70
- $model->setCarebyzincManufacturer($post['carebyzinc_manufacturer']);
71
- $model->setCarebyzincModel($post['carebyzinc_model']);
72
- $model->setCarebyzinc($post['carebyzinc']);
73
- $model->save();
74
- $this->_redirect('*/*/');
75
- return;
76
-
77
- }
 
 
78
 
79
  /**
80
  * Update product(s) status action
@@ -84,6 +91,7 @@ class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Control
84
  {
85
  $productIds = (array)$this->getRequest()->getParam('product');
86
  $carebyzinc = (int)$this->getRequest()->getParam('zinc_carebyzinc');
 
87
  $this->_validateMassCarebyzinc($productIds, $carebyzinc);
88
  if($carebyzinc == 1){
89
  $this->loadLayout();
@@ -92,13 +100,20 @@ class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Control
92
  $block = $this->getLayout()->getBlock('carebyzinc_massaction');
93
  $block->setProductIds(implode(',',$productIds));
94
  $this->renderLayout();
95
- }else{
96
-
97
  try {
98
-
99
  Mage::getSingleton('catalog/product_action')
100
  ->updateAttributes($productIds, array('carebyzinc' => $carebyzinc));
101
-
 
 
 
 
 
 
 
 
 
102
  $this->_getSession()->addSuccess(
103
  $this->__('Total of %d record(s) have been updated.', count($productIds))
104
  );
@@ -125,53 +140,56 @@ class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Control
125
  public function massCategoryAction()
126
  {
127
  $productIds = (array)$this->getRequest()->getParam('product');
128
- $category = $this->getRequest()->getParam('carebyzinc_category');
129
- $subCat = 'Other';
130
- if(!is_array($productIds)) {
131
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('carebyzinc')->__('Please select Product(s).'));
132
- }else{
133
- try {
134
- $this->_validateMassCarebyzinc($productIds, $category);
135
- $subCategories = Mage::getModel('carebyzinc/carebyzinc')->getSubCategoryArray($category);
136
- foreach ($productIds as $product_id) {
137
- $productModel = Mage::getModel('catalog/product')->load($product_id);
138
- $name = $productModel->getName();
139
- foreach($subCategories as $subcat){
140
- if (stripos($name, $subcat) !== false) {
141
- $subCat = $subcat;
142
- break;
143
- }
144
- }
145
- $productModel->setCarebyzincCategory($category);
146
- $productModel->setCarebyzincSubcategory($subCat);
147
- $productModel->save();
148
-
149
- }
150
- $this->_getSession()->addSuccess(
151
- $this->__('Total of %d record(s) have been updated.', count($productIds))
152
- );
153
- }
154
- catch (Mage_Core_Model_Exception $e) {
155
- $this->_getSession()->addError($e->getMessage());
156
- } catch (Mage_Core_Exception $e) {
157
- $this->_getSession()->addError($e->getMessage());
158
- } catch (Exception $e) {
159
- $this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s)'));
160
- }
161
- }
162
- if($this->getRequest()->getParam('pid'))
163
- $this->_redirect('*/*/');
164
- else
165
- $this->_redirect('adminhtml/catalog_product/index');
 
 
 
166
  }
167
 
168
- public function _validateMassCarebyzinc(array $productIds, $carebyzinc)
169
  {
170
  if (!Mage::getModel('catalog/product')->isProductsHasSku($productIds)) {
171
- throw new Mage_Core_Exception(
172
- $this->__('Some of the processed products have no SKU value defined. Please fill it prior to performing operations on these products.')
173
- );
174
- }
175
  }
176
 
177
  public function getSubcategoriesAction()
@@ -181,41 +199,66 @@ class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Control
181
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($subCategories));
182
 
183
  }
184
- public function saveCarebyzincCategoryAction()
 
185
  {
186
  $post = $this->getRequest()->getPost();
187
  $subCategory = '';
188
  if($post['carebyzinc_subcategory']){
189
- $subCategory = $post['carebyzinc_subcategory'];
190
  }
191
- $category = $post['carebyzinc_category'];
 
192
  $productIds = explode(',',$post['product_ids']);
193
- $subCategories = Mage::getModel('carebyzinc/carebyzinc')->getSubCategoryArray($category);
194
- foreach ($productIds as $product_id) {
 
 
 
 
195
  $productModel = Mage::getModel('catalog/product')->load($product_id);
196
- $name = $productModel->getName();
197
- if(! $subCategory){
198
- foreach($subCategories as $subcat){
199
- if (stripos($name, $subcat) !== false) {
200
- $subCategory = $subcat;
201
- break;
202
- }
203
- }
204
- }
205
- if(! $subCategory){
206
- $subCategory = 'Other';
207
- }
208
- $productModel->setCarebyzincCategory($category);
209
- $productModel->setCarebyzincSubcategory($subCategory);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  $productModel->setCarebyzinc(1);
211
  $productModel->setCarebyzincManufacturer($post['carebyzinc_manufacturer']);
212
  $productModel->setCarebyzincModel($post['carebyzinc_model']);
213
  $productModel->save();
214
  }
215
- $this->_getSession()->addSuccess(
216
- $this->__('Total of %d record(s) have been updated.', count($productIds))
217
- );
218
- $this->_redirect('*/*/');
219
-
 
220
  }
221
  }
7
  */
8
  class Zinc_Carebyzinc_Adminhtml_ProductController extends Mage_Adminhtml_Controller_action
9
  {
10
+ protected function _initAction()
11
+ {
12
  $this->loadLayout()
13
+ ->_setActiveMenu('carebyzinc/product')
14
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Care by Zinc'), Mage::helper('adminhtml')->__('Care by Zinc'));
15
 
16
  return $this;
17
  }
18
 
19
+ public function indexAction()
20
+ {
21
  $this->_initAction()
22
+ ->renderLayout();
23
  }
24
+
25
+ public function orderAction()
26
+ {
27
  $this->_initAction()
28
+ ->renderLayout();
29
  }
30
+
31
+ public function gridAction()
32
  {
33
+ $this->loadLayout();
34
+ $this->renderLayout();
35
  }
36
+
37
  /**
38
  * Edit Carebyzinc status action
39
  *
40
  */
41
+ public function editAction()
42
+ {
43
  $id = $this->getRequest()->getParam('id');
44
  $model = Mage::getModel('catalog/product')->load($id);
45
  if ($model->getId() || $id == 0) {
53
  $this->_setActiveMenu('carebyzinc/products');
54
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
55
  $this->_addContent($this->getLayout()->createBlock('carebyzinc/adminhtml_product_edit'))
56
+ ->_addLeft($this->getLayout()->createBlock('carebyzinc/adminhtml_product_edit_tabs'));
57
  $this->renderLayout();
58
  } else {
59
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('carebyzinc')->__('Item does not exist'));
60
  $this->_redirect('*/*/');
61
  }
62
  }
63
+
64
  /**
65
  * Update product(s) status action
66
  *
67
  */
68
  public function saveAction()
69
+ {
70
+ $post = $this->getRequest()->getPost();
71
+ $id = $this->getRequest()->getParam('id');
72
+
73
+ $model = Mage::getModel('catalog/product')->load($id);
74
+ $model->setCarebyzincCategory($post['category']);
75
+ $model->setCarebyzincSubcategory($post['subcategory']);
76
+ $model->setCarebyzincManufacturer($post['carebyzinc_manufacturer']);
77
+ $model->setCarebyzincModel($post['carebyzinc_model']);
78
+ $model->setCarebyzinc($post['carebyzinc']);
79
+ $model->save();
80
+
81
+ $this->_redirect('*/*/');
82
+ return;
83
+
84
+ }
85
 
86
  /**
87
  * Update product(s) status action
91
  {
92
  $productIds = (array)$this->getRequest()->getParam('product');
93
  $carebyzinc = (int)$this->getRequest()->getParam('zinc_carebyzinc');
94
+
95
  $this->_validateMassCarebyzinc($productIds, $carebyzinc);
96
  if($carebyzinc == 1){
97
  $this->loadLayout();
100
  $block = $this->getLayout()->getBlock('carebyzinc_massaction');
101
  $block->setProductIds(implode(',',$productIds));
102
  $this->renderLayout();
103
+ } else {
 
104
  try {
 
105
  Mage::getSingleton('catalog/product_action')
106
  ->updateAttributes($productIds, array('carebyzinc' => $carebyzinc));
107
+
108
+ foreach($productIds as $id) {
109
+ $prod = Mage::getModel('catalog/product')->load($id);
110
+ $prod->setCarebyzincCategory(null);
111
+ $prod->setCarebyzincSubcategory(null);
112
+ $prod->setCarebyzincManufacturer(null);
113
+ $prod->setCarebyzincModel(null);
114
+ $prod->save();
115
+ }
116
+
117
  $this->_getSession()->addSuccess(
118
  $this->__('Total of %d record(s) have been updated.', count($productIds))
119
  );
140
  public function massCategoryAction()
141
  {
142
  $productIds = (array)$this->getRequest()->getParam('product');
143
+ $category = $this->getRequest()->getParam('carebyzinc_category');
144
+ $subCat = 'Other';
145
+
146
+ if(!is_array($productIds)) {
147
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('carebyzinc')->__('Please select Product(s).'));
148
+ } else {
149
+ try {
150
+ $this->_validateMassCarebyzinc($productIds, $category);
151
+ $subCategories = Mage::getModel('carebyzinc/carebyzinc')->getSubCategoryArray($category);
152
+
153
+ foreach ($productIds as $product_id) {
154
+ $productModel = Mage::getModel('catalog/product')->load($product_id);
155
+ $name = $productModel->getName();
156
+ foreach($subCategories as $subcat){
157
+ if (stripos($name, $subcat) !== false) {
158
+ $subCat = $subcat;
159
+ break;
160
+ }
161
+ }
162
+ $productModel->setCarebyzincCategory($category);
163
+ $productModel->setCarebyzincSubcategory($subCat);
164
+ $productModel->save();
165
+
166
+ }
167
+ $this->_getSession()->addSuccess(
168
+ $this->__('Total of %d record(s) have been updated.', count($productIds))
169
+ );
170
+ } catch (Mage_Core_Model_Exception $e) {
171
+ $this->_getSession()->addError($e->getMessage());
172
+ } catch (Mage_Core_Exception $e) {
173
+ $this->_getSession()->addError($e->getMessage());
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s)'));
176
+ }
177
+ }
178
+
179
+ if($this->getRequest()->getParam('pid')) {
180
+ $this->_redirect('*/*/');
181
+ } else {
182
+ $this->_redirect('adminhtml/catalog_product/index');
183
+ }
184
  }
185
 
186
+ public function _validateMassCarebyzinc(array $productIds, $carebyzinc)
187
  {
188
  if (!Mage::getModel('catalog/product')->isProductsHasSku($productIds)) {
189
+ throw new Mage_Core_Exception(
190
+ $this->__('Some of the processed products have no SKU value defined. Please fill it prior to performing operations on these products.')
191
+ );
192
+ }
193
  }
194
 
195
  public function getSubcategoriesAction()
199
  return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($subCategories));
200
 
201
  }
202
+
203
+ public function saveCarebyzincCategoryAction()
204
  {
205
  $post = $this->getRequest()->getPost();
206
  $subCategory = '';
207
  if($post['carebyzinc_subcategory']){
208
+ $subCategory = $post['carebyzinc_subcategory'];
209
  }
210
+
211
+ $category = $post['carebyzinc_category'];
212
  $productIds = explode(',',$post['product_ids']);
213
+
214
+ if(isset($post['guess_subcategory']) && $post['guess_subcategory'] == '1') {
215
+ $suggestions = Mage::getModel('carebyzinc/carebyzinc')->getSubCategorySuggestions($category);
216
+ }
217
+
218
+ foreach ($productIds as $product_id) {
219
  $productModel = Mage::getModel('catalog/product')->load($product_id);
220
+ $name = strtolower($productModel->getName());
221
+
222
+ $tmpSubCat = null;
223
+ if(!$subCategory) {
224
+ if(is_object($suggestions)) {
225
+ foreach($suggestions as $key => $subcat) {
226
+ $key = strtolower($key);
227
+ if (stripos($name, $key) !== false) {
228
+ $tmpSubCat = $subcat;
229
+ break;
230
+ } elseif($subcat == 'Sample') {
231
+ $tmpSubCat = 'Sample';
232
+ break;
233
+ }
234
+ }
235
+ } elseif($subcat == 'Sample') {
236
+ $tmpSubCat = 'Sample';
237
+ break;
238
+ } else {
239
+ $tmpSubCat = 'Other';
240
+ break;
241
+ }
242
+ } else {
243
+ $tmpSubCat = $subCategory;
244
+ }
245
+
246
+ if(!$tmpSubCat){
247
+ $tmpSubCat = 'Other';
248
+ }
249
+
250
+ $productModel->setCarebyzincCategory($category);
251
+ $productModel->setCarebyzincSubcategory($tmpSubCat);
252
  $productModel->setCarebyzinc(1);
253
  $productModel->setCarebyzincManufacturer($post['carebyzinc_manufacturer']);
254
  $productModel->setCarebyzincModel($post['carebyzinc_model']);
255
  $productModel->save();
256
  }
257
+
258
+ $this->_getSession()->addSuccess(
259
+ $this->__('Total of %d record(s) have been updated.', count($productIds))
260
+ );
261
+
262
+ $this->_redirect('*/*/');
263
  }
264
  }
app/code/local/Zinc/Carebyzinc/controllers/CartController.php CHANGED
@@ -12,11 +12,195 @@
12
  require_once 'Mage/Checkout/controllers/CartController.php';
13
  class Zinc_Carebyzinc_CartController extends Mage_Checkout_CartController
14
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * Update product configuration for a cart item
17
  */
18
  public function updateItemOptionsAction()
19
- {
20
  $cart = $this->_getCart();
21
  $id = (int) $this->getRequest()->getParam('id');
22
 
@@ -319,6 +503,4 @@ class Zinc_Carebyzinc_CartController extends Mage_Checkout_CartController
319
  $this->getResponse()->setHeader('Content-type', 'application/json');
320
  $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
321
  }
322
-
323
-
324
  }
12
  require_once 'Mage/Checkout/controllers/CartController.php';
13
  class Zinc_Carebyzinc_CartController extends Mage_Checkout_CartController
14
  {
15
+
16
+ /**
17
+ * Add product to shopping cart action
18
+ *
19
+ * @return Mage_Core_Controller_Varien_Action
20
+ * @throws Exception
21
+ */
22
+ public function addAction()
23
+ {
24
+ if (!$this->_validateFormKey()) {
25
+ $this->_goBack();
26
+ return;
27
+ }
28
+ $cart = $this->_getCart();
29
+ $params = $this->getRequest()->getParams();
30
+
31
+ try {
32
+ if (isset($params['qty'])) {
33
+ $filter = new Zend_Filter_LocalizedToNormalized(
34
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
35
+ );
36
+ $params['qty'] = $filter->filter($params['qty']);
37
+ }
38
+
39
+ $product = $this->_initProduct();
40
+ $related = $this->getRequest()->getParam('related_product');
41
+
42
+ /**
43
+ * Check product availability
44
+ */
45
+ if (!$product) {
46
+ $this->_goBack();
47
+ return;
48
+ }
49
+
50
+ $carebyzinc = $product->getCarebyzinc();
51
+ $isProduct = isset($params['isProduct']) && (int)$params['isProduct'] == 1 ? true : false;
52
+
53
+ if($carebyzinc == '1' && $isProduct) {
54
+ if(!isset($params['carebyzinc_option'])) {
55
+ $cbzCategory = $product->getCarebyzincCategory();
56
+
57
+ if($carebyzinc == '1' && !empty($cbzCategory)) {
58
+ $model = Mage::getModel('carebyzinc/order');
59
+ $result = $model->prepareInterstitials($cbzCategory);
60
+ $sess = Mage::getSingleton("core/session", array("name"=>"frontend"));
61
+ $sess->setData('interstitials', $result);
62
+
63
+ $url = $this->_getSession()->getRedirectUrl(true);
64
+ if ($url) {
65
+ $this->getResponse()->setRedirect($url);
66
+ } else {
67
+ $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
68
+ }
69
+ }
70
+ } else {
71
+ $cart->addProduct($product, $params);
72
+ if (!empty($related)) {
73
+ $cart->addProductsByIds(explode(',', $related));
74
+ }
75
+
76
+ $cart->save();
77
+ $this->_getSession()->setCartWasUpdated(true);
78
+
79
+ /**
80
+ * @todo remove wishlist observer processAddToCart
81
+ */
82
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
83
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
84
+ );
85
+
86
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
87
+ if (!$cart->getQuote()->getHasError()) {
88
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
89
+ $this->_getSession()->addSuccess($message);
90
+ }
91
+ $this->_goBack();
92
+ }
93
+ }
94
+ } else {
95
+ $cart->addProduct($product, $params);
96
+ if (!empty($related)) {
97
+ $cart->addProductsByIds(explode(',', $related));
98
+ }
99
+
100
+ $cart->save();
101
+ $this->_getSession()->setCartWasUpdated(true);
102
+
103
+ /**
104
+ * @todo remove wishlist observer processAddToCart
105
+ */
106
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
107
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
108
+ );
109
+
110
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
111
+ if (!$cart->getQuote()->getHasError()) {
112
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
113
+ $this->_getSession()->addSuccess($message);
114
+ }
115
+ $this->_goBack();
116
+ }
117
+ }
118
+ } catch (Mage_Core_Exception $e) {
119
+ if ($this->_getSession()->getUseNotice(true)) {
120
+ $this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
121
+ } else {
122
+ $messages = array_unique(explode("\n", $e->getMessage()));
123
+ foreach ($messages as $message) {
124
+ $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
125
+ }
126
+ }
127
+
128
+ $url = $this->_getSession()->getRedirectUrl(true);
129
+ if ($url) {
130
+ $this->getResponse()->setRedirect($url);
131
+ } else {
132
+ $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
133
+ }
134
+ } catch (Exception $e) {
135
+ $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
136
+ Mage::logException($e);
137
+ $this->_goBack();
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Process product adding to cart
143
+ */
144
+ public function ajaxProcessItemAction()
145
+ {
146
+ $response = false;
147
+ $cart = $this->_getCart();
148
+ $params = $this->getRequest()->getParams();
149
+ $post = $this->getRequest()->getPost();
150
+
151
+ if(is_array($post)) {
152
+ $pId = (int)$post['pId'];
153
+ $product = Mage::getModel('catalog/product')->load($pId);
154
+
155
+ /**
156
+ * Check product availability
157
+ */
158
+ if (!$product) {
159
+ $this->_goBack();
160
+ return;
161
+ }
162
+
163
+ $model = Mage::getModel('carebyzinc/order');
164
+ $response = $model->processPurchaseInsurance($post);
165
+
166
+ if($response) {
167
+ switch($response['action']) {
168
+ case 'cancel':
169
+ $cart->addProduct($product, $params);
170
+ if (!empty($related)) {
171
+ $cart->addProductsByIds(explode(',', $related));
172
+ }
173
+
174
+ $cart->save();
175
+ $this->_getSession()->setCartWasUpdated(true);
176
+
177
+ /**
178
+ * @todo remove wishlist observer processAddToCart
179
+ */
180
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
181
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
182
+ );
183
+
184
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
185
+ $this->_getSession()->addSuccess($message);
186
+ break;
187
+ case 'add':
188
+ break;
189
+ }
190
+ }
191
+
192
+ $sess = Mage::getSingleton("core/session", array("name"=>"frontend"));
193
+ $sess->unsetData('interstitials');
194
+ }
195
+
196
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response['url']));
197
+ }
198
+
199
  /**
200
  * Update product configuration for a cart item
201
  */
202
  public function updateItemOptionsAction()
203
+ {
204
  $cart = $this->_getCart();
205
  $id = (int) $this->getRequest()->getParam('id');
206
 
503
  $this->getResponse()->setHeader('Content-type', 'application/json');
504
  $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
505
  }
 
 
506
  }
app/code/local/Zinc/Carebyzinc/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ZincPlatform
4
+ * @package Zinc_Carebyzinc
5
+ * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+
10
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
11
+ class Zinc_Carebyzinc_Checkout_OnepageController extends Mage_Checkout_OnepageController
12
+ {
13
+ /**
14
+ * Order success action
15
+ */
16
+ public function successAction()
17
+ {
18
+ $session = $this->getOnepage()->getCheckout();
19
+ if (!$session->getLastSuccessQuoteId()) {
20
+ $this->_redirect('checkout/cart');
21
+ return;
22
+ }
23
+
24
+ $lastQuoteId = $session->getLastQuoteId();
25
+ $lastOrderId = $session->getLastOrderId();
26
+
27
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
28
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
29
+ $this->_redirect('checkout/cart');
30
+ return;
31
+ }
32
+
33
+ $model = Mage::getModel('carebyzinc/order');
34
+ $quote = Mage::getModel('sales/quote')->load($lastQuoteId);
35
+ $order = Mage::getModel('sales/order')->load($lastOrderId);
36
+
37
+ $success = $model->prepareSuccessPage($quote, $order);
38
+ Mage::register('zincSuccess', $success);
39
+
40
+ $session->clear();
41
+ $this->loadLayout();
42
+ $this->_initLayoutMessages('checkout/session');
43
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
44
+ $this->renderLayout();
45
+ }
46
+ }
app/code/local/Zinc/Carebyzinc/controllers/IndexController.php CHANGED
@@ -1,132 +1,132 @@
1
  <?php
2
- /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  class Zinc_Carebyzinc_IndexController extends Mage_Core_Controller_Front_Action
9
  {
 
10
  public function indexAction()
11
  {
12
- $this->loadLayout();
13
- $this->renderLayout();
14
  }
15
-
16
- public function priceQuoteAction()
17
  {
18
- $product_id = $this->getRequest()->getParam('pid');
19
- $configOptions = $this->getRequest()->getParam('configOptions');
20
- $customoptionPrice = $this->getRequest()->getParam('customoptionPrice');
21
-
22
- $configOptionsArray = (array)json_decode($configOptions);
23
- $zip = $this->getRequest()->getParam('zip');
24
- if($product_id < 0){
25
- return '';
26
- }
27
- $response = '';
28
- $this->loadLayout();
29
- $product = Mage::getModel('catalog/product')->load($product_id);
30
- $basePrice = $product->getPrice();
31
- if(! empty($configOptionsArray)){
32
- $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
33
- $priceVal = 0;
34
- foreach ($attributes as $attribute){
35
- $prices = $attribute->getPrices();
36
- foreach ($prices as $price){
37
- foreach($configOptionsArray as $key =>$value){
38
- if($price['value_index'] == $value ){
39
- if ($price['is_percent']){
40
- $priceVal += (float)$price['pricing_value'] * $basePrice / 100;
41
- }
42
- else {
43
- $priceVal += (float)$price['pricing_value'];
44
- }
45
- }
46
- }
47
- }
48
- }
49
- $customoptionPrice += $priceVal;
50
-
51
-
52
- }
53
-
54
- $model = Mage::getModel('carebyzinc/carebyzinc');
55
- $quoteBlock = $this->getLayout()->createBlock('carebyzinc/carebyzinc');
56
- $itemId = $this->getRequest()->getParam('itemId');
57
- if($itemId){
58
- $response = $model->getPriceQuoteinCart($product,$itemId,$zip);
59
- $response = is_array($response[$itemId])?$response[$itemId]:$response;
60
- $quoteBlock->setTemplate('carebyzinc/options/cart.phtml');
61
- $quoteBlock->setItemId($itemId);
62
- $quoteBlock->setZipData($zip);
63
- $quoteBlock->setPId($product->getId());
64
-
65
- } else {
66
- $response = $model->getPriceQuote($product,$zip,$customoptionPrice);
67
- $quoteBlock->setTemplate('carebyzinc/options/default.phtml');
68
- }
69
- $quoteBlock->setQuoteData($response);
70
-
71
- $html = $quoteBlock->toHtml();
72
- $this->getResponse()->setBody( Mage::helper('core')->jsonEncode($html));
 
 
 
 
73
  }
74
-
75
  public function updatePriceQuoteinCartAction()
76
- {
77
-
78
- $carebyzincId = $this->getRequest()->getParam('carebyzinc');
79
- $itemId = $this->getRequest()->getParam('itemId');
80
- $priceQuoteSession = Mage::getSingleton('core/session')->getCareByZincQuote();
81
- $priceQuote = $priceQuoteSession[$itemId];
82
- $additionalOptions = array();
83
- if($carebyzincItem = $priceQuote[$carebyzincId]){
84
-
85
- $cart = Mage::getSingleton('checkout/cart');
86
- $item = $cart->getQuote()->getItemById($itemId);
87
- $item->setCarebyzincVariantid($carebyzincId);
88
- $item->save();
89
- $warrantPrdctId = Mage::getStoreConfig('carebyzinc/general/warranty_product');
90
- if($warrantPrdctId){
91
-
92
- $req = array('qty'=>1);
93
- $careParentId = $itemId;
94
- $warrantyProduct = Mage::getModel('catalog/product')->load($warrantPrdctId);
95
- $productPrice = $warrantyProduct->getPrice();
96
-
97
- if($price = $carebyzincItem['price_per_year'])
98
- $newPrice = $productPrice + $price;
99
- $quote = Mage::getSingleton('checkout/session')->getQuote();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
- $quoteItem = $quote->addProduct($warrantyProduct,1);
102
- $quoteItem->setCustomPrice($newPrice);
103
- $quoteItem->setOriginalCustomPrice($newPrice);
104
- $quoteItem->setCarebyzincPrice($price);
105
- $quoteItem->setCarebyzincParentid((int)$careParentId);
106
- $quoteItem->getProduct()->setIsSuperMode(true);
107
-
108
- if( $item = $priceQuote[$carebyzincId]){
109
- $additionalOptions[] = array(
110
- 'label' => 'carebyzinc',
111
- 'value' => $carebyzincId,
112
- );
113
- $quoteItem->setCarebyzincOption(serialize($priceQuote[$carebyzincId]));
114
-
115
- }
116
- $quoteItem->addOption(array(
117
- 'product_id' => $quoteItem->getProductId(),
118
- 'code' => 'additional_options',
119
- 'value' => serialize($additionalOptions)
120
- ));
121
-
122
- $quote->collectTotals()->save();
123
 
124
- }
125
-
126
- Mage::getSingleton('core/session')->unsCareByZincQuote();
127
- }
128
- echo 'success';
129
  }
130
-
131
-
132
  }
1
  <?php
2
+ /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
  class Zinc_Carebyzinc_IndexController extends Mage_Core_Controller_Front_Action
9
  {
10
+
11
  public function indexAction()
12
  {
13
+ $this->loadLayout();
14
+ $this->renderLayout();
15
  }
16
+
17
+ public function priceQuoteAction()
18
  {
19
+ $product_id = $this->getRequest()->getParam('pid');
20
+ $configOptions = $this->getRequest()->getParam('configOptions');
21
+ $customoptionPrice = $this->getRequest()->getParam('customoptionPrice');
22
+
23
+ $configOptionsArray = (array) json_decode($configOptions);
24
+ $zip = $this->getRequest()->getParam('zip');
25
+
26
+ if ($product_id < 0) {
27
+ return '';
28
+ }
29
+
30
+ $response = '';
31
+ $this->loadLayout();
32
+ $product = Mage::getModel('catalog/product')->load($product_id);
33
+ $basePrice = $product->getPrice();
34
+
35
+ if (!empty($configOptionsArray)) {
36
+ $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
37
+ $priceVal = 0;
38
+ foreach ($attributes as $attribute) {
39
+ $prices = $attribute->getPrices();
40
+ foreach ($prices as $price) {
41
+ foreach ($configOptionsArray as $key => $value) {
42
+ if ($price['value_index'] == $value) {
43
+ if ($price['is_percent']) {
44
+ $priceVal += (float) $price['pricing_value'] * $basePrice / 100;
45
+ } else {
46
+ $priceVal += (float) $price['pricing_value'];
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ $customoptionPrice += $priceVal;
53
+ }
54
+
55
+ $model = Mage::getModel('carebyzinc/carebyzinc');
56
+
57
+ $model->prepareZincQuoteLayer($product);
58
+
59
+ $quoteBlock = $this->getLayout()->createBlock('carebyzinc/carebyzinc');
60
+
61
+ $itemId = $this->getRequest()->getParam('itemId');
62
+ if ($itemId) {
63
+ $response = $model->getPriceQuoteinCart($product, $itemId, $zip);
64
+ $response = is_array($response[$itemId]) ? $response[$itemId] : $response;
65
+ $quoteBlock->setTemplate('carebyzinc/options/cart.phtml');
66
+ $quoteBlock->setItemId($itemId);
67
+ $quoteBlock->setZipData($zip);
68
+ $quoteBlock->setPId($product->getId());
69
+ } else {
70
+ $response = $model->getPriceQuote($product, $zip, $customoptionPrice);
71
+ $quoteBlock->setTemplate('carebyzinc/options/default.phtml');
72
+ }
73
+
74
+ $quoteBlock->setQuoteData($response);
75
+
76
+ $html = $quoteBlock->toHtml();
77
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($html));
78
  }
79
+
80
  public function updatePriceQuoteinCartAction()
81
+ {
82
+ $carebyzincId = $this->getRequest()->getParam('carebyzinc');
83
+ $itemId = $this->getRequest()->getParam('itemId');
84
+ $priceQuoteSession = Mage::getSingleton('core/session')->getCareByZincQuote();
85
+ $priceQuote = $priceQuoteSession[$itemId];
86
+ $additionalOptions = array();
87
+
88
+ if ($carebyzincItem = $priceQuote[$carebyzincId]) {
89
+ $cart = Mage::getSingleton('checkout/cart');
90
+ $item = $cart->getQuote()->getItemById($itemId);
91
+ $item->setCarebyzincVariantid($carebyzincId);
92
+ $item->save();
93
+ $warrantPrdctId = Mage::getStoreConfig('carebyzinc/general/warranty_product');
94
+ if ($warrantPrdctId) {
95
+
96
+ $req = array('qty' => 1);
97
+ $careParentId = $itemId;
98
+ $warrantyProduct = Mage::getModel('catalog/product')->load($warrantPrdctId);
99
+ $productPrice = $warrantyProduct->getPrice();
100
+
101
+ if ($price = $carebyzincItem['price_per_year'])
102
+ $newPrice = $productPrice + $price;
103
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
104
+
105
+ $quoteItem = $quote->addProduct($warrantyProduct, 1);
106
+ $quoteItem->setCustomPrice($newPrice);
107
+ $quoteItem->setOriginalCustomPrice($newPrice);
108
+ $quoteItem->setCarebyzincPrice($price);
109
+ $quoteItem->setCarebyzincParentid((int) $careParentId);
110
+ $quoteItem->getProduct()->setIsSuperMode(true);
111
+
112
+ if ($item = $priceQuote[$carebyzincId]) {
113
+ $additionalOptions[] = array(
114
+ 'label' => 'carebyzinc',
115
+ 'value' => $carebyzincId,
116
+ );
117
+ $quoteItem->setCarebyzincOption(serialize($priceQuote[$carebyzincId]));
118
+ }
119
+ $quoteItem->addOption(array(
120
+ 'product_id' => $quoteItem->getProductId(),
121
+ 'code' => 'additional_options',
122
+ 'value' => serialize($additionalOptions)
123
+ ));
124
 
125
+ $quote->collectTotals()->save();
126
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
+ Mage::getSingleton('core/session')->unsCareByZincQuote();
129
+ }
130
+ echo 'success';
 
 
131
  }
 
 
132
  }
app/code/local/Zinc/Carebyzinc/etc/adminhtml.xml CHANGED
@@ -53,6 +53,11 @@
53
  <sort_order>20</sort_order>
54
  <action>adminhtml/order</action>
55
  </orders>
 
 
 
 
 
56
  </children>
57
  </carebyzinc>
58
  </menu>
53
  <sort_order>20</sort_order>
54
  <action>adminhtml/order</action>
55
  </orders>
56
+ <settings module="carebyzinc">
57
+ <title>Settings</title>
58
+ <sort_order>30</sort_order>
59
+ <action>adminhtml/system_config/edit/section/carebyzinc</action>
60
+ </settings>
61
  </children>
62
  </carebyzinc>
63
  </menu>
app/code/local/Zinc/Carebyzinc/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  <config>
11
  <modules>
12
  <Zinc_Carebyzinc>
13
- <version>1.0.7</version>
14
  </Zinc_Carebyzinc>
15
  </modules>
16
  <frontend>
@@ -22,6 +22,13 @@
22
  <frontName>carebyzinc</frontName>
23
  </args>
24
  </carebyzinc>
 
 
 
 
 
 
 
25
  </routers>
26
  <layout>
27
  <updates>
@@ -31,162 +38,160 @@
31
  </updates>
32
  </layout>
33
  </frontend>
34
-
35
  <admin>
36
- <routers>
37
- <adminhtml>
38
- <args>
39
- <modules>
40
- <zinc_carebyzinc before="Mage_Adminhtml">Zinc_Carebyzinc_Adminhtml</zinc_carebyzinc>
41
- </modules>
42
- </args>
43
- </adminhtml>
44
- </routers>
45
  </admin>
46
  <adminhtml>
47
- <layout>
48
- <updates>
49
- <carebyzinc>
50
- <file>zinc_carebyzinc.xml</file>
51
- </carebyzinc>
52
- </updates>
53
- </layout>
54
  </adminhtml>
55
  <global>
56
- <rewrite>
57
- <zinc_carebyzinc>
58
- <from><![CDATA[#^/checkout/cart/#]]></from>
59
- <to>/carebyzinc/cart/</to>
60
- </zinc_carebyzinc>
61
- <carebyzinc_order>
62
- <from><![CDATA[#^/sales/order/#]]></from>
63
- <to>/carebyzinc/sales_order/</to>
64
- </carebyzinc_order>
65
 
66
- </rewrite>
67
-
68
- <sales>
69
- <quote>
70
- <item>
71
- <product_attributes>
72
- <carebyzinc_option />
73
- <carebyzinc_price />
74
- <carebyzinc_variantid />
75
- <carebyzinc_parentid />
76
- </product_attributes>
77
- </item>
78
- </quote>
79
- </sales>
80
- <events>
81
- <controller_action_predispatch_checkout_cart_index>
82
- <observers>
83
- <modify_carebyzinc>
84
- <type>singleton</type>
85
- <class>Zinc_Carebyzinc_Model_Observer</class>
86
- <method>cartLoad</method>
87
- </modify_carebyzinc>
88
- </observers>
89
- </controller_action_predispatch_checkout_cart_index>
90
- <controller_action_predispatch_checkout_onepage_index>
91
- <observers>
92
- <modify_carebyzinc>
93
- <type>singleton</type>
94
- <class>Zinc_Carebyzinc_Model_Observer</class>
95
- <method>cartLoad</method>
96
- </modify_carebyzinc>
97
- </observers>
98
- </controller_action_predispatch_checkout_onepage_index>
99
- <sales_quote_remove_item>
100
- <observers>
101
- <delete_carebyzinc>
102
- <type>singleton</type>
103
- <class>Zinc_Carebyzinc_Model_Observer</class>
104
- <method>warrantyDelete</method>
105
- </delete_carebyzinc>
106
- </observers>
107
- </sales_quote_remove_item>
108
- <sales_model_service_quote_submit_after>
109
- <observers>
110
- <set_carebyzinc>
111
- <type>singleton</type>
112
- <class>Zinc_Carebyzinc_Model_Observer</class>
113
- <method>setCarebyzinc</method>
114
- </set_carebyzinc>
115
- </observers>
116
- </sales_model_service_quote_submit_after>
117
- <sales_order_save_after>
118
- <observers>
119
- <save_carebyzinc>
120
- <type>singleton</type>
121
- <class>Zinc_Carebyzinc_Model_Observer</class>
122
- <method>saveCarebyzinc</method>
123
- </save_carebyzinc>
124
- </observers>
125
- </sales_order_save_after>
126
- <sales_quote_item_set_product>
127
- <observers>
128
- <set_itemname>
129
- <type>singleton</type>
130
- <class>Zinc_Carebyzinc_Model_Observer</class>
131
- <method>salesQuoteItemSetProduct</method>
132
- </set_itemname>
133
- </observers>
134
- </sales_quote_item_set_product>
135
- </events>
136
- <fieldsets>
137
- <sales_convert_quote_item>
138
- <carebyzinc_option>
139
- <to_order_item>*</to_order_item>
140
- </carebyzinc_option>
141
- <carebyzinc_price>
142
- <to_order_item>*</to_order_item>
143
- </carebyzinc_price>
144
- <carebyzinc_variantid>
145
- <to_order_item>*</to_order_item>
146
- </carebyzinc_variantid>
147
- <carebyzinc_parentid>
148
- <to_order_item>*</to_order_item>
149
- </carebyzinc_parentid>
150
- </sales_convert_quote_item>
151
- <sales_convert_order_item>
152
- <carebyzinc_option>
153
- <to_quote_item>*</to_quote_item>
154
- </carebyzinc_option>
155
- <carebyzinc_price>
156
- <to_quote_item>*</to_quote_item>
157
- </carebyzinc_price>
158
- <carebyzinc_variantid>
159
- <to_quote_item>*</to_quote_item>
160
- </carebyzinc_variantid>
161
- <carebyzinc_parentid>
162
- <to_quote_item>*</to_quote_item>
163
- </carebyzinc_parentid>
164
- </sales_convert_order_item>
165
- </fieldsets>
166
- <models>
167
- <carebyzinc>
168
- <class>Zinc_Carebyzinc_Model</class>
169
- <resourceModel>carebyzinc_mysql4</resourceModel>
170
- </carebyzinc>
171
- <carebyzinc_mysql4>
172
- <class>Zinc_Carebyzinc_Model_Mysql4</class>
173
- <entities>
174
- <order>
175
- <table>zinc_carebyzinc_order</table>
176
- </order>
177
- </entities>
178
- </carebyzinc_mysql4>
179
- <checkout>
180
- <rewrite>
181
- <cart>Zinc_Carebyzinc_Model_Checkout_Cart</cart>
182
- <type_multishipping>Zinc_Carebyzinc_Model_Checkout_Multishipping</type_multishipping>
183
- </rewrite>
184
- </checkout>
185
- <sales>
186
- <rewrite>
187
- <quote>Zinc_Carebyzinc_Model_Sales_Quote</quote>
188
- </rewrite>
189
- </sales>
190
  </models>
191
  <resources>
192
  <carebyzinc_setup>
@@ -212,7 +217,7 @@
212
  <carebyzinc>
213
  <class>Zinc_Carebyzinc_Block</class>
214
  </carebyzinc>
215
- <adminhtml>
216
  <rewrite>
217
  <catalog_product_grid>Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
218
  </rewrite>
@@ -224,12 +229,22 @@
224
  </carebyzinc>
225
  </helpers>
226
  </global>
227
- <default>
228
  <carebyzinc>
229
  <general>
230
- <showquote>0</showquote>
231
- <carebytitle>Care by Zinc</carebytitle>
232
  </general>
 
 
 
 
 
 
 
 
 
 
233
  </carebyzinc>
234
  </default>
235
  </config>
10
  <config>
11
  <modules>
12
  <Zinc_Carebyzinc>
13
+ <version>1.0.8</version>
14
  </Zinc_Carebyzinc>
15
  </modules>
16
  <frontend>
22
  <frontName>carebyzinc</frontName>
23
  </args>
24
  </carebyzinc>
25
+ <checkout>
26
+ <args>
27
+ <modules>
28
+ <zinc_carebyzinc_checkout before="Mage_Checkout">Zinc_Carebyzinc_Checkout</zinc_carebyzinc_checkout>
29
+ </modules>
30
+ </args>
31
+ </checkout>
32
  </routers>
33
  <layout>
34
  <updates>
38
  </updates>
39
  </layout>
40
  </frontend>
 
41
  <admin>
42
+ <routers>
43
+ <adminhtml>
44
+ <args>
45
+ <modules>
46
+ <zinc_carebyzinc before="Mage_Adminhtml">Zinc_Carebyzinc_Adminhtml</zinc_carebyzinc>
47
+ </modules>
48
+ </args>
49
+ </adminhtml>
50
+ </routers>
51
  </admin>
52
  <adminhtml>
53
+ <layout>
54
+ <updates>
55
+ <carebyzinc>
56
+ <file>zinc_carebyzinc.xml</file>
57
+ </carebyzinc>
58
+ </updates>
59
+ </layout>
60
  </adminhtml>
61
  <global>
62
+ <rewrite>
63
+ <zinc_carebyzinc>
64
+ <from><![CDATA[#^/checkout/cart/#]]></from>
65
+ <to>/carebyzinc/cart/</to>
66
+ </zinc_carebyzinc>
67
+ <carebyzinc_order>
68
+ <from><![CDATA[#^/sales/order/#]]></from>
69
+ <to>/carebyzinc/sales_order/</to>
70
+ </carebyzinc_order>
71
 
72
+ </rewrite>
73
+ <sales>
74
+ <quote>
75
+ <item>
76
+ <product_attributes>
77
+ <carebyzinc_option />
78
+ <carebyzinc_price />
79
+ <carebyzinc_variantid />
80
+ <carebyzinc_parentid />
81
+ </product_attributes>
82
+ </item>
83
+ </quote>
84
+ </sales>
85
+ <events>
86
+ <controller_action_predispatch_checkout_cart_index>
87
+ <observers>
88
+ <modify_carebyzinc>
89
+ <type>singleton</type>
90
+ <class>Zinc_Carebyzinc_Model_Observer</class>
91
+ <method>cartLoad</method>
92
+ </modify_carebyzinc>
93
+ </observers>
94
+ </controller_action_predispatch_checkout_cart_index>
95
+ <controller_action_predispatch_checkout_onepage_index>
96
+ <observers>
97
+ <modify_carebyzinc>
98
+ <type>singleton</type>
99
+ <class>Zinc_Carebyzinc_Model_Observer</class>
100
+ <method>cartLoad</method>
101
+ </modify_carebyzinc>
102
+ </observers>
103
+ </controller_action_predispatch_checkout_onepage_index>
104
+ <sales_quote_remove_item>
105
+ <observers>
106
+ <delete_carebyzinc>
107
+ <type>singleton</type>
108
+ <class>Zinc_Carebyzinc_Model_Observer</class>
109
+ <method>warrantyDelete</method>
110
+ </delete_carebyzinc>
111
+ </observers>
112
+ </sales_quote_remove_item>
113
+ <sales_model_service_quote_submit_after>
114
+ <observers>
115
+ <set_carebyzinc>
116
+ <type>singleton</type>
117
+ <class>Zinc_Carebyzinc_Model_Observer</class>
118
+ <method>setCarebyzinc</method>
119
+ </set_carebyzinc>
120
+ </observers>
121
+ </sales_model_service_quote_submit_after>
122
+ <sales_order_save_after>
123
+ <observers>
124
+ <save_carebyzinc>
125
+ <type>singleton</type>
126
+ <class>Zinc_Carebyzinc_Model_Observer</class>
127
+ <method>saveCarebyzinc</method>
128
+ </save_carebyzinc>
129
+ </observers>
130
+ </sales_order_save_after>
131
+ <sales_quote_item_set_product>
132
+ <observers>
133
+ <set_itemname>
134
+ <type>singleton</type>
135
+ <class>Zinc_Carebyzinc_Model_Observer</class>
136
+ <method>salesQuoteItemSetProduct</method>
137
+ </set_itemname>
138
+ </observers>
139
+ </sales_quote_item_set_product>
140
+ </events>
141
+ <fieldsets>
142
+ <sales_convert_quote_item>
143
+ <carebyzinc_option>
144
+ <to_order_item>*</to_order_item>
145
+ </carebyzinc_option>
146
+ <carebyzinc_price>
147
+ <to_order_item>*</to_order_item>
148
+ </carebyzinc_price>
149
+ <carebyzinc_variantid>
150
+ <to_order_item>*</to_order_item>
151
+ </carebyzinc_variantid>
152
+ <carebyzinc_parentid>
153
+ <to_order_item>*</to_order_item>
154
+ </carebyzinc_parentid>
155
+ </sales_convert_quote_item>
156
+ <sales_convert_order_item>
157
+ <carebyzinc_option>
158
+ <to_quote_item>*</to_quote_item>
159
+ </carebyzinc_option>
160
+ <carebyzinc_price>
161
+ <to_quote_item>*</to_quote_item>
162
+ </carebyzinc_price>
163
+ <carebyzinc_variantid>
164
+ <to_quote_item>*</to_quote_item>
165
+ </carebyzinc_variantid>
166
+ <carebyzinc_parentid>
167
+ <to_quote_item>*</to_quote_item>
168
+ </carebyzinc_parentid>
169
+ </sales_convert_order_item>
170
+ </fieldsets>
171
+ <models>
172
+ <carebyzinc>
173
+ <class>Zinc_Carebyzinc_Model</class>
174
+ <resourceModel>carebyzinc_mysql4</resourceModel>
175
+ </carebyzinc>
176
+ <carebyzinc_mysql4>
177
+ <class>Zinc_Carebyzinc_Model_Mysql4</class>
178
+ <entities>
179
+ <order>
180
+ <table>zinc_carebyzinc_order</table>
181
+ </order>
182
+ </entities>
183
+ </carebyzinc_mysql4>
184
+ <checkout>
185
+ <rewrite>
186
+ <cart>Zinc_Carebyzinc_Model_Checkout_Cart</cart>
187
+ <type_multishipping>Zinc_Carebyzinc_Model_Checkout_Multishipping</type_multishipping>
188
+ </rewrite>
189
+ </checkout>
190
+ <sales>
191
+ <rewrite>
192
+ <quote>Zinc_Carebyzinc_Model_Sales_Quote</quote>
193
+ </rewrite>
194
+ </sales>
 
195
  </models>
196
  <resources>
197
  <carebyzinc_setup>
217
  <carebyzinc>
218
  <class>Zinc_Carebyzinc_Block</class>
219
  </carebyzinc>
220
+ <adminhtml>
221
  <rewrite>
222
  <catalog_product_grid>Zinc_Carebyzinc_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
223
  </rewrite>
229
  </carebyzinc>
230
  </helpers>
231
  </global>
232
+ <default>
233
  <carebyzinc>
234
  <general>
235
+ <quoteproduct>0</quoteproduct>
236
+ <quotecart>0</quotecart>
237
  </general>
238
+ <api>
239
+ <testmode>
240
+ <value>live</value>
241
+ </testmode>
242
+ </api>
243
+ <!--
244
+ <importorders>
245
+ <days>90</days>
246
+ </importorders>
247
+ -->
248
  </carebyzinc>
249
  </default>
250
  </config>
app/code/local/Zinc/Carebyzinc/etc/system.xml CHANGED
@@ -39,24 +39,7 @@
39
  <frontend_type>select</frontend_type>
40
  <source_model>adminhtml/system_config_source_Yesno</source_model>
41
  </enabled>
42
- <carebytitle>
43
- <label>Display Label</label>
44
- <sort_order>20</sort_order>
45
- <show_in_default>1</show_in_default>
46
- <show_in_website>1</show_in_website>
47
- <show_in_store>1</show_in_store>
48
- <frontend_type>text</frontend_type>
49
- </carebytitle>
50
- <showquote>
51
- <label>Show Quote on Product Page</label>
52
- <sort_order>30</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- <frontend_type>select</frontend_type>
57
- <source_model>adminhtml/system_config_source_Yesno</source_model>
58
- </showquote>
59
- <defaultzip>
60
  <label>Default Zipcode</label>
61
  <sort_order>40</sort_order>
62
  <show_in_default>1</show_in_default>
@@ -65,7 +48,7 @@
65
  <frontend_type>text</frontend_type>
66
  </defaultzip>
67
  <warranty_product>
68
- <label>Warranty Product Id</label>
69
  <sort_order>50</sort_order>
70
  <validate>required-entry validate-number</validate>
71
  <show_in_default>1</show_in_default>
@@ -73,108 +56,202 @@
73
  <show_in_store>1</show_in_store>
74
  <frontend_type>text</frontend_type>
75
  </warranty_product>
76
-
77
-
78
  </fields>
79
  </general>
80
- <api>
81
  <label>Configuration</label>
82
  <sort_order>20</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
  <fields>
87
- <protocol>
88
- <label>Protocol</label>
89
- <frontend_type>select</frontend_type>
90
- <sort_order>0</sort_order>
91
- <source_model>carebyzinc/system_config_protocol</source_model>
92
- <show_in_default>1</show_in_default>
93
- <show_in_website>1</show_in_website>
94
- <show_in_store>1</show_in_store>
95
- </protocol>
96
- <testmode>
97
- <label>Test / Production Mode</label>
98
- <frontend_type>select</frontend_type>
99
  <sort_order>1</sort_order>
100
  <source_model>carebyzinc/system_config_source</source_model>
101
  <show_in_default>1</show_in_default>
102
  <show_in_website>1</show_in_website>
103
  <show_in_store>1</show_in_store>
104
  </testmode>
105
- <test_url>
106
- <label>Test API URL</label>
107
- <frontend_type>text</frontend_type>
108
- <depends>
109
- <testmode>
110
- <value>test</value>
111
- </testmode>
112
- </depends>
113
  <sort_order>15</sort_order>
114
  <show_in_default>1</show_in_default>
115
  <show_in_website>1</show_in_website>
116
  <show_in_store>1</show_in_store>
117
  </test_url>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  <url>
119
  <label>Production API URL</label>
120
- <frontend_type>text</frontend_type>
121
- <depends>
122
- <testmode>
123
- <value>live</value>
124
- </testmode>
125
- </depends>
126
  <sort_order>10</sort_order>
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
  <show_in_store>1</show_in_store>
130
  </url>
131
-
132
  <xuser_token>
133
  <label>X-User-Token</label>
134
- <frontend_type>text</frontend_type>
135
- <depends>
136
- <testmode>
137
- <value>live</value>
138
- </testmode>
139
- </depends>
140
  <sort_order>30</sort_order>
141
  <show_in_default>1</show_in_default>
142
  <show_in_website>1</show_in_website>
143
  <show_in_store>1</show_in_store>
144
  </xuser_token>
145
-
146
- <test_xuser_token>
147
- <label>Test API X-User-Token</label>
148
- <frontend_type>text</frontend_type>
149
- <depends>
150
- <testmode>
151
- <value>test</value>
152
- </testmode>
153
- </depends>
154
- <sort_order>30</sort_order>
155
- <show_in_default>1</show_in_default>
156
- <show_in_website>1</show_in_website>
157
- <show_in_store>1</show_in_store>
158
- </test_xuser_token>
159
- <xuser_email>
160
  <label>X-User-Email</label>
161
- <frontend_type>text</frontend_type>
162
  <sort_order>40</sort_order>
163
  <show_in_default>1</show_in_default>
164
  <show_in_website>1</show_in_website>
165
- <show_in_store>1</show_in_store>
166
  </xuser_email>
167
- <validate translate="label" module="carebyzinc">
168
- <comment>Please save configuration value before validating.</comment>
169
- <frontend_type>button</frontend_type>
170
- <frontend_model>carebyzinc/adminhtml_system_config_tokenvalidate</frontend_model>
171
- <sort_order>120</sort_order>
172
- <show_in_default>1</show_in_default>
173
- <show_in_website>1</show_in_website>
174
- <show_in_store>0</show_in_store>
175
  </validate>
176
  </fields>
177
  </api>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </groups>
179
  </carebyzinc>
180
  </sections>
39
  <frontend_type>select</frontend_type>
40
  <source_model>adminhtml/system_config_source_Yesno</source_model>
41
  </enabled>
42
+ <defaultzip>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  <label>Default Zipcode</label>
44
  <sort_order>40</sort_order>
45
  <show_in_default>1</show_in_default>
48
  <frontend_type>text</frontend_type>
49
  </defaultzip>
50
  <warranty_product>
51
+ <label>Insurance Virtual Product ID</label>
52
  <sort_order>50</sort_order>
53
  <validate>required-entry validate-number</validate>
54
  <show_in_default>1</show_in_default>
56
  <show_in_store>1</show_in_store>
57
  <frontend_type>text</frontend_type>
58
  </warranty_product>
 
 
59
  </fields>
60
  </general>
61
+ <api>
62
  <label>Configuration</label>
63
  <sort_order>20</sort_order>
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
  <show_in_store>1</show_in_store>
67
  <fields>
68
+ <testmode>
69
+ <label>API Mode</label>
70
+ <frontend_type>select</frontend_type>
 
 
 
 
 
 
 
 
 
71
  <sort_order>1</sort_order>
72
  <source_model>carebyzinc/system_config_source</source_model>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
76
  </testmode>
77
+ <test_url>
78
+ <label>Regression API URL</label>
79
+ <frontend_type>text</frontend_type>
80
+ <depends>
81
+ <testmode>
82
+ <value>test</value>
83
+ </testmode>
84
+ </depends>
85
  <sort_order>15</sort_order>
86
  <show_in_default>1</show_in_default>
87
  <show_in_website>1</show_in_website>
88
  <show_in_store>1</show_in_store>
89
  </test_url>
90
+ <test_xuser_token>
91
+ <label>Regression API X-User-Token</label>
92
+ <frontend_type>text</frontend_type>
93
+ <depends>
94
+ <testmode>
95
+ <value>test</value>
96
+ </testmode>
97
+ </depends>
98
+ <sort_order>30</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </test_xuser_token>
103
+ <sandbox_url>
104
+ <label>Sandbox API URL</label>
105
+ <frontend_type>text</frontend_type>
106
+ <depends>
107
+ <testmode>
108
+ <value>sandbox</value>
109
+ </testmode>
110
+ </depends>
111
+ <sort_order>15</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </sandbox_url>
116
+ <sandbox_xuser_token>
117
+ <label>Sandbox API X-User-Token</label>
118
+ <frontend_type>text</frontend_type>
119
+ <depends>
120
+ <testmode>
121
+ <value>sandbox</value>
122
+ </testmode>
123
+ </depends>
124
+ <sort_order>30</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </sandbox_xuser_token>
129
+ <staging_url>
130
+ <label>Staging API URL</label>
131
+ <frontend_type>text</frontend_type>
132
+ <depends>
133
+ <testmode>
134
+ <value>staging</value>
135
+ </testmode>
136
+ </depends>
137
+ <sort_order>15</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ </staging_url>
142
+ <staging_xuser_token>
143
+ <label>Staging API X-User-Token</label>
144
+ <frontend_type>text</frontend_type>
145
+ <depends>
146
+ <testmode>
147
+ <value>staging</value>
148
+ </testmode>
149
+ </depends>
150
+ <sort_order>30</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ </staging_xuser_token>
155
  <url>
156
  <label>Production API URL</label>
157
+ <frontend_type>text</frontend_type>
158
+ <depends>
159
+ <testmode>
160
+ <value>live</value>
161
+ </testmode>
162
+ </depends>
163
  <sort_order>10</sort_order>
164
  <show_in_default>1</show_in_default>
165
  <show_in_website>1</show_in_website>
166
  <show_in_store>1</show_in_store>
167
  </url>
 
168
  <xuser_token>
169
  <label>X-User-Token</label>
170
+ <frontend_type>text</frontend_type>
171
+ <depends>
172
+ <testmode>
173
+ <value>live</value>
174
+ </testmode>
175
+ </depends>
176
  <sort_order>30</sort_order>
177
  <show_in_default>1</show_in_default>
178
  <show_in_website>1</show_in_website>
179
  <show_in_store>1</show_in_store>
180
  </xuser_token>
181
+ <xuser_email>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  <label>X-User-Email</label>
183
+ <frontend_type>text</frontend_type>
184
  <sort_order>40</sort_order>
185
  <show_in_default>1</show_in_default>
186
  <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
  </xuser_email>
189
+ <validate translate="label" module="carebyzinc">
190
+ <comment>Please save configuration value before validating.</comment>
191
+ <frontend_type>button</frontend_type>
192
+ <frontend_model>carebyzinc/adminhtml_system_config_tokenvalidate</frontend_model>
193
+ <sort_order>120</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>0</show_in_store>
197
  </validate>
198
  </fields>
199
  </api>
200
+ <display>
201
+ <label>Display (Quote Visibility)</label>
202
+ <sort_order>10</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ <fields>
207
+ <quoteproduct>
208
+ <label>Product Page</label>
209
+ <sort_order>10</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>1</show_in_website>
212
+ <show_in_store>1</show_in_store>
213
+ <frontend_type>select</frontend_type>
214
+ <source_model>adminhtml/system_config_source_Yesno</source_model>
215
+ </quoteproduct>
216
+ <quotecart>
217
+ <label>Cart</label>
218
+ <sort_order>20</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ <frontend_type>select</frontend_type>
223
+ <source_model>adminhtml/system_config_source_Yesno</source_model>
224
+ </quotecart>
225
+ </fields>
226
+ </display>
227
+ <!--
228
+ <importorders>
229
+ <label>Import Orders</label>
230
+ <sort_order>40</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>1</show_in_store>
234
+ <expanded>1</expanded>
235
+ <fields>
236
+ <days>
237
+ <label>Days</label>
238
+ <frontend_type>text</frontend_type>
239
+ <sort_order>10</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </days>
244
+ <import translate="label" module="carebyzinc">
245
+ <frontend_type>button</frontend_type>
246
+ <frontend_model>carebyzinc/adminhtml_system_config_importorders</frontend_model>
247
+ <sort_order>20</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>0</show_in_store>
251
+ </import>
252
+ </fields>
253
+ </importorders>
254
+ -->
255
  </groups>
256
  </carebyzinc>
257
  </sections>
app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.0-1.0.1.php CHANGED
@@ -20,15 +20,3 @@ $this->getConnection()
20
  ->addColumn($installer->getTable('zinc_carebyzinc_order'),'warrenty_price',"double COMMENT 'WarrentyPrice'");
21
  $this->getConnection()
22
  ->addColumn($installer->getTable('zinc_carebyzinc_order'),'product_price',"double COMMENT 'ProductPrice'");
23
-
24
-
25
- $switch = new Mage_Core_Model_Config();
26
-
27
- $switch->saveConfig('carebyzinc/general/carebytitle', "Care by Zinc", 'default', 0);
28
-
29
-
30
-
31
-
32
-
33
-
34
-
20
  ->addColumn($installer->getTable('zinc_carebyzinc_order'),'warrenty_price',"double COMMENT 'WarrentyPrice'");
21
  $this->getConnection()
22
  ->addColumn($installer->getTable('zinc_carebyzinc_order'),'product_price',"double COMMENT 'ProductPrice'");
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.6-1.0.7.php CHANGED
@@ -20,16 +20,16 @@ $product = Mage::getModel('catalog/product');
20
  $product->setWebsiteIds($websiteIds);
21
  $product->setTypeId('virtual');
22
  $product->addData(array(
23
- 'sku' => 'carebyzinc',
24
- 'name' => 'Warranty',
25
  'attribute_set_id' => $product->getDefaultAttributeSetId(),
26
  'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
27
  'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,
28
  'weight' => 1,
29
  'price' => 0.00,
30
  'tax_class_id' => 0,
31
- 'description' => 'Warranty',
32
- 'short_description' => 'Warranty',
33
 
34
 
35
  ));
20
  $product->setWebsiteIds($websiteIds);
21
  $product->setTypeId('virtual');
22
  $product->addData(array(
23
+ 'sku' => 'Care by Zinc',
24
+ 'name' => 'Care by Zinc Insurance Policy',
25
  'attribute_set_id' => $product->getDefaultAttributeSetId(),
26
  'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
27
  'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE,
28
  'weight' => 1,
29
  'price' => 0.00,
30
  'tax_class_id' => 0,
31
+ 'description' => 'Represent the Care by Zinc Insurance Policy',
32
+ 'short_description' => 'Represent the Care by Zinc Insurance Policy',
33
 
34
 
35
  ));
app/code/local/Zinc/Carebyzinc/sql/carebyzinc_setup/mysql4-upgrade-1.0.7-1.0.8.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ZincPlatform
4
+ * @package Zinc_Carebyzinc
5
+ * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ $sku = 'Care by Zinc';
14
+ $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
15
+ $productId = $product->getId();
16
+
17
+ Mage::getConfig()->saveConfig('carebyzinc/general/warranty_product', $product->getId(), 'default', 0);
18
+
19
+ $installer->endSetup();
20
+
21
+
22
+
23
+
app/design/adminhtml/default/default/layout/zinc_carebyzinc.xml CHANGED
@@ -1,5 +1,15 @@
1
  <?xml version="1.0"?>
2
- <layout version="0.1.0">
 
 
 
 
 
 
 
 
 
 
3
  <adminhtml_catalog_product_edit>
4
  <reference name="head">
5
  <action method="addJs" ifconfig="carebyzinc/general/enabled">
1
  <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <name>carebyzinc/carebyzinc.css</name>
7
+ </action>
8
+ <action method="addJs"><script>lib/jquery/jquery-1.10.2.min.js</script></action>
9
+ <action method="addJs"><script>lib/jquery/noconflict.js</script></action>
10
+ <action method="addJs"><script>carebyzinc/functions.js</script></action>
11
+ </reference>
12
+ </default>
13
  <adminhtml_catalog_product_edit>
14
  <reference name="head">
15
  <action method="addJs" ifconfig="carebyzinc/general/enabled">
app/design/adminhtml/default/default/template/carebyzinc/carebyzinc_massaction.phtml CHANGED
@@ -1,113 +1,130 @@
1
  <?php
2
  /*
3
- * Care by Zinc in Massaction Page
4
- */
5
-
6
  ?>
7
 
8
  <div class="main-col-inner">
9
- <div id="messages"></div>
10
  <div class="content-header">
11
- <h3 class="icon-head head-adminhtml-product"><?php echo $this->__('Select Care by Zinc Categories')?></h3>
12
- <p class="form-buttons">
13
- <button id="id_massedit_form_back" title="<?php echo $this->__('Back')?>" type="button" class="scalable back" onclick="setLocation('<?php echo $this->getUrl("*/*/index")?>')" style=""><span><span><span><?php echo $this->__('Back')?></span></span></span></button>
14
- <button id="id_massedit_form_save" title="<?php echo $this->__('Save')?>" type="button" class="scalable save" onclick="editForm.submit();" style=""><span><span><span><?php echo $this->__('Save')?></span></span></span></button>
15
- </p>
16
- </div>
17
- <div class="entry-edit">
18
- <form id="massedit_form" action="<?php echo $this->getUrl("*/*/saveCarebyzincCategory")?>" method="post" enctype="multipart/form-data">
19
- <?php echo $this->getBlockHtml('formkey') ?>
20
- <input name="product_ids" value="<?php echo $this->getProductIds();?>" type="hidden" />
21
- <div id="product_tabs_form_section_content" style="">
22
- <div class="entry-edit">
23
- <div class="entry-edit-head">
24
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Care By Zinc')?></h4>
25
- <div class="form-buttons"></div>
26
- </div>
27
- <div class="fieldset " id="carebyzinc_form">
28
- <div class="hor-scroll">
29
- <table class="form-list" cellspacing="0">
30
- <tbody>
31
-
32
- <tr>
33
- <td class="label"><label for="carebyzinc_category"><?php echo $this->__('Category')?>
34
- <span class="required">*</span></label></td>
35
- <?php $categories = Mage::getModel('carebyzinc/carebyzinc')->getCategoryArray();?>
36
- <td class="value">
37
- <select id="carebyzinc_category" name="carebyzinc_category" class="required-entry select" onchange="getSubcategories(this.value); ">
38
- <?php foreach($categories as $key => $value):?>
39
- <option value="<?php echo $key;?>"><?php echo $value;?></option>
40
- <?php endforeach;?>
41
- </select>
42
- </td>
43
- </tr>
44
- <tr>
45
- <td class="label"><label for="carebyzinc_subcategory"><?php echo $this->__('Sub Category')?> <span class="required">*</span></label></td>
46
- <td class="value">
47
- <select id="carebyzinc_subcategory" name="carebyzinc_subcategory" class="select">
48
- <option value="" selected="selected"><?php echo $this->__('Please Select')?></option>
49
- </select>
50
- </td>
51
-
52
- <td>
53
- <label for="guess_subcategory">
54
- <input type="checkbox" id="guess_subcategory" name="guess_subcategory" /> <?php echo $this->__('Guess a Sub Category')?>
55
- </label>
56
- </td>
57
- </tr>
58
- <tr style="display: none;" id="carebyzinc_manufacturer_tr" >
59
- <td class="label"><label for="carebyzinc_manufacturer"><?php echo $this->__('Manufacturer')?>' <span class="required">*</span></label></td>
60
- <td class="value">
61
- <input id="carebyzinc_manufacturer" name="carebyzinc_manufacturer" class="input-text" type="text">
62
- </td>
63
- </tr>
64
- <tr id="carebyzinc_model_tr" style="display: none;">
65
- <td class="label"><label for="carebyzinc_model"><?php echo $this->__('Model')?> <span class="required">*</span></label></td>
66
- <td class="value">
67
- <input id="carebyzinc_model" name="carebyzinc_model" type="text" class="input-text">
68
- </td>
69
- </tr>
70
- </tbody>
71
- </table>
72
- </div>
73
- </div>
74
- </div>
75
- </div></form></div>
76
- <script type="text/javascript">
77
- editForm = new varienForm('massedit_form', '');
78
- function getSubcategories(selectElement){
79
- var reloadurl = '<?php echo $this->getUrl("adminhtml/product/getSubcategories")?>';
80
- if(selectElement){
81
- var category = selectElement.toLowerCase();
82
- var subarray = ['bicycle','electronics'];
83
- if(subarray.indexOf(category) >= 0){
84
- $('carebyzinc_manufacturer_tr').show();
85
- $('carebyzinc_model_tr').show();
86
- document.getElementById('carebyzinc_manufacturer').className += ' required-entry validate-length maximum-length-30 minimum-length-1';
87
- document.getElementById('carebyzinc_model').className += ' required-entry validate-length maximum-length-30 minimum-length-1';
88
- }else{
89
- $('carebyzinc_manufacturer_tr').hide();
90
- $('carebyzinc_model_tr').hide();
91
- document.getElementById('carebyzinc_manufacturer').className = 'input-text';
92
- document.getElementById('carebyzinc_model').className = 'input-text';
93
- }
94
- new Ajax.Request(reloadurl, {parameters: { cat: selectElement},
95
- method: 'post',
96
- onComplete: function(transport) {
97
- var content = JSON.parse(transport.responseText);
98
- var i = 0;
99
- document.getElementById('carebyzinc_subcategory').options.length = 0;
100
- for (var key in content) {
101
- document.getElementById('carebyzinc_subcategory').options[i] = new Option(content[key],key);
102
- i++;
103
- }
104
-
105
- }
106
- });
107
- }else
108
- document.getElementById('carebyzinc_subcategory').innerHTML='';
109
- }
110
- </script>
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </div>
113
-
1
  <?php
2
  /*
3
+ * Care by Zinc in Massaction Page
4
+ */
 
5
  ?>
6
 
7
  <div class="main-col-inner">
8
+ <div id="messages"></div>
9
  <div class="content-header">
10
+ <h3 class="icon-head head-adminhtml-product"><?php echo $this->__('Select Care by Zinc Categories') ?></h3>
11
+ <p class="form-buttons">
12
+ <button id="id_massedit_form_back" title="<?php echo $this->__('Back') ?>" type="button" class="scalable back" onclick="setLocation('<?php echo $this->getUrl("*/*/index") ?>')" style=""><span><span><span><?php echo $this->__('Back') ?></span></span></span></button>
13
+ <button id="id_massedit_form_save" title="<?php echo $this->__('Save') ?>" type="button" class="scalable save" onclick="editForm.submit();" style=""><span><span><span><?php echo $this->__('Save') ?></span></span></span></button>
14
+ </p>
15
+ </div>
16
+ <div class="entry-edit">
17
+ <form id="massedit_form" action="<?php echo $this->getUrl("*/*/saveCarebyzincCategory") ?>" method="post" enctype="multipart/form-data">
18
+ <?php echo $this->getBlockHtml('formkey') ?>
19
+ <input name="product_ids" value="<?php echo $this->getProductIds(); ?>" type="hidden" />
20
+ <div id="product_tabs_form_section_content" style="">
21
+ <div class="entry-edit">
22
+ <div class="entry-edit-head">
23
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Care By Zinc') ?></h4>
24
+ <div class="form-buttons"></div>
25
+ </div>
26
+ <div class="fieldset " id="carebyzinc_form">
27
+ <div class="hor-scroll">
28
+ <table class="form-list" cellspacing="0">
29
+ <tbody>
30
+
31
+ <tr>
32
+ <td class="label"><label for="carebyzinc_category"><?php echo $this->__('Zinc Category') ?>
33
+ <span class="required">*</span></label></td>
34
+ <?php $categories = Mage::getModel('carebyzinc/carebyzinc')->getCategoryArray(); ?>
35
+ <td class="value">
36
+ <select id="carebyzinc_category" name="carebyzinc_category" class="required-entry select" onchange="getSubcategories(this.value);
37
+ ">
38
+ <?php foreach ($categories as $key => $value): ?>
39
+ <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
40
+ <?php endforeach; ?>
41
+ </select>
42
+ </td>
43
+ </tr>
44
+ <tr>
45
+ <td class="label"><label for="carebyzinc_subcategory"><?php echo $this->__('Zinc Subcategory') ?> <span class="required">*</span></label></td>
46
+ <td class="value">
47
+ <select id="carebyzinc_subcategory" name="carebyzinc_subcategory" class="select">
48
+ <option value="" selected="selected"><?php echo $this->__('Please Select') ?></option>
49
+ </select>
50
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ <td class="guess-select">
53
+ <label for="guess_subcategory">
54
+ <input type="checkbox" id="guess_subcategory" name="guess_subcategory" value="0" /> <?php echo $this->__('Guess a Subcategory') ?>
55
+ </label>
56
+ </td>
57
+ </tr>
58
+ <tr style="display: none;" id="carebyzinc_manufacturer_tr" >
59
+ <td class="label"><label for="carebyzinc_manufacturer"><?php echo $this->__('Manufacturer') ?>' <span class="required">*</span></label></td>
60
+ <td class="value">
61
+ <input id="carebyzinc_manufacturer" name="carebyzinc_manufacturer" class="input-text" type="text">
62
+ </td>
63
+ </tr>
64
+ <tr id="carebyzinc_model_tr" style="display: none;">
65
+ <td class="label"><label for="carebyzinc_model"><?php echo $this->__('Model') ?> <span class="required">*</span></label></td>
66
+ <td class="value">
67
+ <input id="carebyzinc_model" name="carebyzinc_model" type="text" class="input-text">
68
+ </td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div></form></div>
76
+ <script type="text/javascript">
77
+ editForm = new varienForm('massedit_form', '');
78
+ function getSubcategories(selectElement) {
79
+ var reloadurl = '<?php echo $this->getUrl("adminhtml/product/getSubcategories") ?>';
80
+ if (selectElement) {
81
+ var category = selectElement.toLowerCase();
82
+ var subarray = ['bicycle', 'electronics'];
83
+ if (subarray.indexOf(category) >= 0) {
84
+ $('carebyzinc_manufacturer_tr').show();
85
+ $('carebyzinc_model_tr').show();
86
+ document.getElementById('carebyzinc_manufacturer').className += ' required-entry validate-length maximum-length-30 minimum-length-1';
87
+ document.getElementById('carebyzinc_model').className += ' required-entry validate-length maximum-length-30 minimum-length-1';
88
+ } else {
89
+ $('carebyzinc_manufacturer_tr').hide();
90
+ $('carebyzinc_model_tr').hide();
91
+ document.getElementById('carebyzinc_manufacturer').className = 'input-text';
92
+ document.getElementById('carebyzinc_model').className = 'input-text';
93
+ }
94
+ new Ajax.Request(reloadurl, {parameters: {cat: selectElement},
95
+ method: 'post',
96
+ onComplete: function (transport) {
97
+ var content = JSON.parse(transport.responseText);
98
+ var i = 0;
99
+ document.getElementById('carebyzinc_subcategory').options.length = 0;
100
+ for (var key in content) {
101
+ document.getElementById('carebyzinc_subcategory').options[i] = new Option(content[key], key);
102
+ i++;
103
+ }
104
+
105
+ }
106
+ });
107
+ } else
108
+ document.getElementById('carebyzinc_subcategory').innerHTML = '';
109
+ }
110
+ </script>
111
+ <script>
112
+ //<![CDATA[
113
+ jQuery.noConflict();
114
+ jQuery(document).ready(function () {
115
+ var isChecked = 0;
116
+ jQuery('#guess_subcategory').change(function() {
117
+ isChecked = jQuery('#guess_subcategory').attr('value');
118
+ if(isChecked == '0') {
119
+ jQuery('#carebyzinc_subcategory').attr('disabled', 'disabled');
120
+ jQuery('#guess_subcategory').attr('value', '1');
121
+ } else {
122
+ jQuery('#carebyzinc_subcategory').removeAttr('disabled');
123
+ jQuery('#guess_subcategory').attr('value', '0');
124
+ }
125
+ });
126
+ });
127
+ //]]>
128
+ </script>
129
  </div>
130
+
app/design/adminhtml/default/default/template/carebyzinc/system/importorders.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ */
4
+ ?>
5
+ <script type="text/javascript">
6
+ //<![CDATA[
7
+ function importOrders() {
8
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
9
+ method: 'get',
10
+ onSuccess: function(transport){
11
+ data = transport.responseText;
12
+ alert(data)
13
+ }
14
+ });
15
+ }
16
+ //]]>
17
+ </script>
18
+
19
+ <?php echo $this->getButtonHtml() ?>
app/design/frontend/base/default/layout/zinc_carebyzinc.xml CHANGED
@@ -1,332 +1,356 @@
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
  <default>
4
- <reference name="head">
5
- <action method="addCss" ifconfig="carebyzinc/general/enabled"><stylesheet>carebyzinc/css/carebyzinc.css</stylesheet></action>
6
- </reference>
7
- <reference name="minicart_content">
8
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
9
- <type>default</type>
10
- <block>checkout/cart_item_renderer</block>
11
- <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
12
- </action>
13
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
14
- <type>simple</type>
15
- <block>checkout/cart_item_renderer</block>
16
- <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
17
- </action>
18
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
19
- <type>grouped</type>
20
- <block>checkout/cart_item_renderer_grouped</block>
21
- <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
22
- </action>
23
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
24
- <type>configurable</type>
25
- <block>checkout/cart_item_renderer_configurable</block>
26
- <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
27
- </action>
28
-
29
- </reference>
 
30
  </default>
 
31
  <carebyzinc_index_index>
32
  <reference name="content">
33
  <block type="carebyzinc/carebyzinc" name="carebyzinc" template="carebyzinc/carebyzinc.phtml" />
34
  </reference>
35
- </carebyzinc_index_index>
36
- <catalog_product_view translate="label">
37
- <reference name="head">
38
- <action method="addJs" ifconfig="carebyzinc/general/enabled"><script>carebyzinc/product.js</script></action>
39
- <action method="removeItem" ifconfig="carebyzinc/general/enabled"><type>js</type><name>varien/product.js</name></action>
40
- <action method="addJs" ifconfig="carebyzinc/general/enabled">
41
- <script>carebyzinc/jquery.colorbox.js</script>
42
- </action>
43
- <action method="addCss" ifconfig="carebyzinc/general/enabled">
44
- <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
45
- </action>
46
- </reference>
47
- <reference name="product.info.extrahint">
48
- <block type="carebyzinc/carebyzinc" name="carebyzinc" before="product.info.media">
49
- <action method="setTemplate" ifconfig="carebyzinc/general/enabled"><template>carebyzinc/carebyzinc.phtml</template></action>
50
- </block>
51
- </reference>
52
- </catalog_product_view>
53
- <checkout_cart_index>
54
- <reference name="head">
55
- <action method="addJs" ifconfig="carebyzinc/general/enabled">
56
- <script>carebyzinc/jquery.colorbox.js</script>
57
- </action>
58
- <action method="addCss" ifconfig="carebyzinc/general/enabled">
59
- <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
60
- </action>
61
- </reference>
62
- <reference name="checkout.cart">
63
- <action method="setCartTemplate" ifconfig="carebyzinc/general/enabled">
64
- <value>carebyzinc/checkout/cart.phtml</value>
65
- </action>
66
- <action method="setEmptyTemplate" ifconfig="carebyzinc/general/enabled">
67
- <value>checkout/cart/noItems.phtml</value>
68
- </action>
69
- <action method="chooseTemplate"/>
70
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
71
- <type>virtual</type>
72
- <block>checkout/cart_item_renderer</block>
73
- <template>carebyzinc/checkout/cart/item/default.phtml</template>
74
- </action>
75
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
76
- <type>simple</type>
77
- <block>checkout/cart_item_renderer</block>
78
- <template>carebyzinc/checkout/cart/item/default.phtml</template>
79
- </action>
80
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
81
- <type>configurable</type>
82
- <block>checkout/cart_item_renderer_configurable</block>
83
- <template>carebyzinc/checkout/cart/item/default.phtml</template>
84
- </action>
85
- </reference>
86
- </checkout_cart_index>
 
 
 
 
 
 
 
 
 
87
 
88
- <checkout_onepage_index>
89
- <reference name="head">
90
- <action method="addJs" ifconfig="carebyzinc/general/enabled">
91
- <script>carebyzinc/jquery.colorbox.js</script>
92
- </action>
93
- <action method="addCss" ifconfig="carebyzinc/general/enabled">
94
- <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
95
- </action>
96
- </reference>
97
- </checkout_onepage_index>
98
- <checkout_onepage_review>
99
-
100
- <reference name="root">
101
- <action method="setTemplate" ifconfig="carebyzinc/general/enabled">
102
- <template>carebyzinc/checkout/onepage/review/info.phtml</template>
103
- </action>
104
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
105
- <type>default</type>
106
- <block>checkout/cart_item_renderer</block>
107
- <template>carebyzinc/checkout/onepage/review/item.phtml</template>
108
- </action>
109
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
110
- <type>grouped</type>
111
- <block>checkout/cart_item_renderer_grouped</block>
112
- <template>carebyzinc/checkout/onepage/review/item.phtml</template>
113
- </action>
114
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
115
- <type>configurable</type>
116
- <block>checkout/cart_item_renderer_configurable</block>
117
- <template>carebyzinc/checkout/onepage/review/item.phtml</template>
118
- </action>
119
-
120
- </reference>
121
-
122
- </checkout_onepage_review>
123
- <checkout_multishipping_addresses>
124
- <reference name="checkout_addresses">
125
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
126
- <type>default</type>
127
- <block>checkout/cart_item_renderer</block>
128
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
129
- </action>
130
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
131
- <type>grouped</type>
132
- <block>checkout/cart_item_renderer_grouped</block>
133
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
134
- </action>
135
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
136
- <type>configurable</type>
137
- <block>checkout/cart_item_renderer_configurable</block>
138
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
139
- </action>
140
-
141
- </reference>
142
- </checkout_multishipping_addresses>
143
- <checkout_multishipping_shipping>
144
- <reference name="checkout_shipping">
145
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
146
- <type>default</type>
147
- <block>checkout/cart_item_renderer</block>
148
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
149
- </action>
150
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
151
- <type>grouped</type>
152
- <block>checkout/cart_item_renderer_grouped</block>
153
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
154
- </action>
155
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
156
- <type>configurable</type>
157
- <block>checkout/cart_item_renderer_configurable</block>
158
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
159
- </action>
160
-
161
- </reference>
162
- </checkout_multishipping_shipping>
163
- <checkout_multishipping_overview>
164
- <reference name="checkout_overview">
165
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
166
- <type>default</type>
167
- <block>checkout/cart_item_renderer</block>
168
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
169
- </action>
170
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
171
- <type>grouped</type>
172
- <block>checkout/cart_item_renderer_grouped</block>
173
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
174
- </action>
175
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
176
- <type>configurable</type>
177
- <block>checkout/cart_item_renderer_configurable</block>
178
- <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
179
- </action>
180
- <action method="addRowItemRender" ifconfig="carebyzinc/general/enabled">
181
- <type>grouped</type>
182
- <block>checkout/cart_item_renderer_grouped</block>
183
- <template>checkout/multishipping/overview/item.phtml</template>
184
- </action>
185
- <action method="addRowItemRender" ifconfig="carebyzinc/general/enabled">
186
- <type>configurable</type>
187
- <block>checkout/cart_item_renderer_configurable</block>
188
- <template>checkout/multishipping/overview/item.phtml</template>
189
- </action>
190
-
191
-
192
- </reference>
193
-
194
- </checkout_multishipping_overview>
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
- <sales_order_view>
197
- <reference name="order_items">
198
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
199
- <type>default</type>
200
- <block>sales/order_item_renderer_default</block>
201
- <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
202
- </action>
203
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
204
- <type>grouped</type>
205
- <block>sales/order_item_renderer_grouped</block>
206
- <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
207
- </action>
208
- </reference>
209
- </sales_order_view>
210
- <sales_order_print>
211
- <reference name="sales.order.print">
212
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
213
- <type>default</type>
214
- <block>sales/order_item_renderer_default</block>
215
- <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
216
- </action>
217
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
218
- <type>grouped</type>
219
- <block>sales/order_item_renderer_grouped</block>
220
- <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
221
- </action>
222
- </reference>
223
- </sales_order_print>
 
224
 
225
- <sales_order_invoice>
226
- <reference name="invoice_items">
227
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
228
- <type>default</type>
229
- <block>sales/order_item_renderer_default</block>
230
- <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
231
- </action>
232
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
233
- <type>grouped</type>
234
- <block>sales/order_item_renderer_grouped</block>
235
- <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
236
- </action>
237
- </reference>
238
- </sales_order_invoice>
239
- <sales_order_printinvoice>
240
- <reference name="sales.order.print.invoice">
241
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
242
- <type>default</type>
243
- <block>sales/order_item_renderer_default</block>
244
- <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
245
- </action>
246
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
247
- <type>grouped</type>
248
- <block>sales/order_item_renderer_grouped</block>
249
- <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
250
- </action>
251
- </reference>
252
- </sales_order_printinvoice>
 
253
 
254
- <sales_order_creditmemo>
255
- <reference name="creditmemo_items">
256
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
257
- <type>default</type>
258
- <block>sales/order_item_renderer_default</block>
259
- <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
260
- </action>
261
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
262
- <type>grouped</type>
263
- <block>sales/order_item_renderer_grouped</block>
264
- <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
265
- </action>
266
 
267
- </reference>
268
- </sales_order_creditmemo>
269
 
270
- <sales_order_printcreditmemo>
271
- <reference name="sales.order.print.creditmemo">
272
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
273
- <type>default</type>
274
- <block>sales/order_item_renderer_default</block>
275
- <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
276
- </action>
277
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
278
- <type>grouped</type>
279
- <block>sales/order_item_renderer_grouped</block>
280
- <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
281
- </action>
282
- </reference>
283
- </sales_order_printcreditmemo>
284
- <sales_email_order_items>
285
- <reference name="items">
286
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
287
- <type>default</type>
288
- <block>sales/order_email_items_order_default</block>
289
- <template>carebyzinc/email/order/items/order/default.phtml</template>
290
- </action>
291
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
292
- <type>grouped</type>
293
- <block>sales/order_email_items_order_grouped</block>
294
- <template>carebyzinc/email/order/items/order/default.phtml</template>
295
- </action>
296
- </reference>
297
- </sales_email_order_items>
 
298
 
299
- <sales_email_order_invoice_items>
300
- <reference name="items">
301
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
302
- <type>default</type>
303
- <block>sales/order_email_items_order_default</block>
304
- <template>carebyzinc/email/order/items/invoice/default.phtml</template>
305
- </action>
306
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
307
- <type>grouped</type>
308
- <block>sales/order_email_items_order_grouped</block>
309
- <template>carebyzinc/email/order/items/invoice/default.phtml</template>
310
- </action>
311
- </reference>
312
- </sales_email_order_invoice_items>
313
 
314
- <sales_email_order_creditmemo_items>
315
- <reference name="items">
316
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
317
- <type>default</type>
318
- <block>sales/order_email_items_order_default</block>
319
- <template>carebyzinc/email/order/items/creditmemo/default.phtml</template>
320
- </action>
321
- <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
322
- <type>grouped</type>
323
- <block>sales/order_email_items_order_grouped</block>
324
- <template>carebyzinc/email/order/items/creditmemo/default.phtml</template>
325
- </action>
326
 
327
- </reference>
328
 
329
  </sales_email_order_creditmemo_items>
330
-
331
-
332
  </layout>
1
  <?xml version="1.0"?>
2
  <layout version="0.1.0">
3
  <default>
4
+ <reference name="head">
5
+ <action method="addCss" ifconfig="carebyzinc/general/enabled">
6
+ <stylesheet>carebyzinc/css/carebyzinc.css</stylesheet>
7
+ </action>
8
+ </reference>
9
+ <reference name="minicart_content">
10
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
11
+ <type>default</type>
12
+ <block>checkout/cart_item_renderer</block>
13
+ <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
14
+ </action>
15
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
16
+ <type>simple</type>
17
+ <block>checkout/cart_item_renderer</block>
18
+ <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
19
+ </action>
20
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
21
+ <type>grouped</type>
22
+ <block>checkout/cart_item_renderer_grouped</block>
23
+ <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
24
+ </action>
25
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
26
+ <type>configurable</type>
27
+ <block>checkout/cart_item_renderer_configurable</block>
28
+ <template>carebyzinc/checkout/cart/minicart/default.phtml</template>
29
+ </action>
30
+ </reference>
31
  </default>
32
+
33
  <carebyzinc_index_index>
34
  <reference name="content">
35
  <block type="carebyzinc/carebyzinc" name="carebyzinc" template="carebyzinc/carebyzinc.phtml" />
36
  </reference>
37
+ </carebyzinc_index_index>
38
+
39
+ <catalog_product_view translate="label">
40
+ <reference name="head">
41
+ <action method="addJs" ifconfig="carebyzinc/general/enabled">
42
+ <script>carebyzinc/product.js</script>
43
+ </action>
44
+ <action method="removeItem" ifconfig="carebyzinc/general/enabled">
45
+ <type>js</type>
46
+ <name>varien/product.js</name>
47
+ </action>
48
+ <action method="addJs" ifconfig="carebyzinc/general/enabled">
49
+ <script>carebyzinc/jquery.colorbox.js</script>
50
+ </action>
51
+ <action method="addCss" ifconfig="carebyzinc/general/enabled">
52
+ <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
53
+ </action>
54
+ </reference>
55
+ <reference name="product.info.extrahint">
56
+ <block type="carebyzinc/carebyzinc" name="carebyzinc" before="product.info.media">
57
+ <action method="setTemplate" ifconfig="carebyzinc/general/enabled">
58
+ <template>carebyzinc/carebyzinc.phtml</template>
59
+ </action>
60
+ </block>
61
+ </reference>
62
+ </catalog_product_view>
63
+
64
+ <checkout_cart_index>
65
+ <reference name="head">
66
+ <action method="addJs" ifconfig="carebyzinc/general/enabled">
67
+ <script>carebyzinc/jquery.colorbox.js</script>
68
+ </action>
69
+ <action method="addCss" ifconfig="carebyzinc/general/enabled">
70
+ <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
71
+ </action>
72
+ </reference>
73
+ <reference name="checkout.cart">
74
+ <action method="setCartTemplate" ifconfig="carebyzinc/general/enabled">
75
+ <value>carebyzinc/checkout/cart.phtml</value>
76
+ </action>
77
+ <action method="setEmptyTemplate" ifconfig="carebyzinc/general/enabled">
78
+ <value>checkout/cart/noItems.phtml</value>
79
+ </action>
80
+ <action method="chooseTemplate"/>
81
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
82
+ <type>virtual</type>
83
+ <block>checkout/cart_item_renderer</block>
84
+ <template>carebyzinc/checkout/cart/item/default.phtml</template>
85
+ </action>
86
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
87
+ <type>simple</type>
88
+ <block>checkout/cart_item_renderer</block>
89
+ <template>carebyzinc/checkout/cart/item/default.phtml</template>
90
+ </action>
91
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
92
+ <type>configurable</type>
93
+ <block>checkout/cart_item_renderer_configurable</block>
94
+ <template>carebyzinc/checkout/cart/item/default.phtml</template>
95
+ </action>
96
+ </reference>
97
+ </checkout_cart_index>
98
 
99
+ <checkout_onepage_index>
100
+ <reference name="head">
101
+ <action method="addJs" ifconfig="carebyzinc/general/enabled">
102
+ <script>carebyzinc/jquery.colorbox.js</script>
103
+ </action>
104
+ <action method="addCss" ifconfig="carebyzinc/general/enabled">
105
+ <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
106
+ </action>
107
+ </reference>
108
+ </checkout_onepage_index>
109
+
110
+ <checkout_onepage_review>
111
+ <reference name="root">
112
+ <action method="setTemplate" ifconfig="carebyzinc/general/enabled">
113
+ <template>carebyzinc/checkout/onepage/review/info.phtml</template>
114
+ </action>
115
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
116
+ <type>default</type>
117
+ <block>checkout/cart_item_renderer</block>
118
+ <template>carebyzinc/checkout/onepage/review/item.phtml</template>
119
+ </action>
120
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
121
+ <type>grouped</type>
122
+ <block>checkout/cart_item_renderer_grouped</block>
123
+ <template>carebyzinc/checkout/onepage/review/item.phtml</template>
124
+ </action>
125
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
126
+ <type>configurable</type>
127
+ <block>checkout/cart_item_renderer_configurable</block>
128
+ <template>carebyzinc/checkout/onepage/review/item.phtml</template>
129
+ </action>
130
+ </reference>
131
+ </checkout_onepage_review>
132
+
133
+ <checkout_onepage_success translate="label">
134
+ <reference name="head">
135
+ <action method="addJs" ifconfig="carebyzinc/general/enabled">
136
+ <script>carebyzinc/jquery.colorbox.js</script>
137
+ </action>
138
+ <action method="addCss" ifconfig="carebyzinc/general/enabled">
139
+ <stylesheet>carebyzinc/css/colorbox.css</stylesheet>
140
+ </action>
141
+ </reference>
142
+ <reference name="content">
143
+ <reference name="checkout.success">
144
+ <action method="setTemplate"><template>carebyzinc/checkout/success.phtml</template></action>
145
+ </reference>
146
+ </reference>
147
+ </checkout_onepage_success>
148
+
149
+ <checkout_multishipping_addresses>
150
+ <reference name="checkout_addresses">
151
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
152
+ <type>default</type>
153
+ <block>checkout/cart_item_renderer</block>
154
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
155
+ </action>
156
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
157
+ <type>grouped</type>
158
+ <block>checkout/cart_item_renderer_grouped</block>
159
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
160
+ </action>
161
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
162
+ <type>configurable</type>
163
+ <block>checkout/cart_item_renderer_configurable</block>
164
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
165
+ </action>
166
+ </reference>
167
+ </checkout_multishipping_addresses>
168
+
169
+ <checkout_multishipping_shipping>
170
+ <reference name="checkout_shipping">
171
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
172
+ <type>default</type>
173
+ <block>checkout/cart_item_renderer</block>
174
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
175
+ </action>
176
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
177
+ <type>grouped</type>
178
+ <block>checkout/cart_item_renderer_grouped</block>
179
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
180
+ </action>
181
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
182
+ <type>configurable</type>
183
+ <block>checkout/cart_item_renderer_configurable</block>
184
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
185
+ </action>
186
+ </reference>
187
+ </checkout_multishipping_shipping>
188
+
189
+ <checkout_multishipping_overview>
190
+ <reference name="checkout_overview">
191
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
192
+ <type>default</type>
193
+ <block>checkout/cart_item_renderer</block>
194
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
195
+ </action>
196
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
197
+ <type>grouped</type>
198
+ <block>checkout/cart_item_renderer_grouped</block>
199
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
200
+ </action>
201
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
202
+ <type>configurable</type>
203
+ <block>checkout/cart_item_renderer_configurable</block>
204
+ <template>carebyzinc/checkout/multishipping/item/default.phtml</template>
205
+ </action>
206
+ <action method="addRowItemRender" ifconfig="carebyzinc/general/enabled">
207
+ <type>grouped</type>
208
+ <block>checkout/cart_item_renderer_grouped</block>
209
+ <template>checkout/multishipping/overview/item.phtml</template>
210
+ </action>
211
+ <action method="addRowItemRender" ifconfig="carebyzinc/general/enabled">
212
+ <type>configurable</type>
213
+ <block>checkout/cart_item_renderer_configurable</block>
214
+ <template>checkout/multishipping/overview/item.phtml</template>
215
+ </action>
216
+ </reference>
217
+ </checkout_multishipping_overview>
218
 
219
+ <sales_order_view>
220
+ <reference name="order_items">
221
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
222
+ <type>default</type>
223
+ <block>sales/order_item_renderer_default</block>
224
+ <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
225
+ </action>
226
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
227
+ <type>grouped</type>
228
+ <block>sales/order_item_renderer_grouped</block>
229
+ <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
230
+ </action>
231
+ </reference>
232
+ </sales_order_view>
233
+
234
+ <sales_order_print>
235
+ <reference name="sales.order.print">
236
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
237
+ <type>default</type>
238
+ <block>sales/order_item_renderer_default</block>
239
+ <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
240
+ </action>
241
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
242
+ <type>grouped</type>
243
+ <block>sales/order_item_renderer_grouped</block>
244
+ <template>carebyzinc/sales/order/items/renderer/default.phtml</template>
245
+ </action>
246
+ </reference>
247
+ </sales_order_print>
248
 
249
+ <sales_order_invoice>
250
+ <reference name="invoice_items">
251
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
252
+ <type>default</type>
253
+ <block>sales/order_item_renderer_default</block>
254
+ <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
255
+ </action>
256
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
257
+ <type>grouped</type>
258
+ <block>sales/order_item_renderer_grouped</block>
259
+ <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
260
+ </action>
261
+ </reference>
262
+ </sales_order_invoice>
263
+
264
+ <sales_order_printinvoice>
265
+ <reference name="sales.order.print.invoice">
266
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
267
+ <type>default</type>
268
+ <block>sales/order_item_renderer_default</block>
269
+ <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
270
+ </action>
271
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
272
+ <type>grouped</type>
273
+ <block>sales/order_item_renderer_grouped</block>
274
+ <template>carebyzinc/sales/order/invoice/items/renderer/default.phtml</template>
275
+ </action>
276
+ </reference>
277
+ </sales_order_printinvoice>
278
 
279
+ <sales_order_creditmemo>
280
+ <reference name="creditmemo_items">
281
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
282
+ <type>default</type>
283
+ <block>sales/order_item_renderer_default</block>
284
+ <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
285
+ </action>
286
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
287
+ <type>grouped</type>
288
+ <block>sales/order_item_renderer_grouped</block>
289
+ <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
290
+ </action>
291
 
292
+ </reference>
293
+ </sales_order_creditmemo>
294
 
295
+ <sales_order_printcreditmemo>
296
+ <reference name="sales.order.print.creditmemo">
297
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
298
+ <type>default</type>
299
+ <block>sales/order_item_renderer_default</block>
300
+ <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
301
+ </action>
302
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
303
+ <type>grouped</type>
304
+ <block>sales/order_item_renderer_grouped</block>
305
+ <template>carebyzinc/sales/order/creditmemo/items/renderer/default.phtml</template>
306
+ </action>
307
+ </reference>
308
+ </sales_order_printcreditmemo>
309
+
310
+ <sales_email_order_items>
311
+ <reference name="items">
312
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
313
+ <type>default</type>
314
+ <block>sales/order_email_items_order_default</block>
315
+ <template>carebyzinc/email/order/items/order/default.phtml</template>
316
+ </action>
317
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
318
+ <type>grouped</type>
319
+ <block>sales/order_email_items_order_grouped</block>
320
+ <template>carebyzinc/email/order/items/order/default.phtml</template>
321
+ </action>
322
+ </reference>
323
+ </sales_email_order_items>
324
 
325
+ <sales_email_order_invoice_items>
326
+ <reference name="items">
327
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
328
+ <type>default</type>
329
+ <block>sales/order_email_items_order_default</block>
330
+ <template>carebyzinc/email/order/items/invoice/default.phtml</template>
331
+ </action>
332
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
333
+ <type>grouped</type>
334
+ <block>sales/order_email_items_order_grouped</block>
335
+ <template>carebyzinc/email/order/items/invoice/default.phtml</template>
336
+ </action>
337
+ </reference>
338
+ </sales_email_order_invoice_items>
339
 
340
+ <sales_email_order_creditmemo_items>
341
+ <reference name="items">
342
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
343
+ <type>default</type>
344
+ <block>sales/order_email_items_order_default</block>
345
+ <template>carebyzinc/email/order/items/creditmemo/default.phtml</template>
346
+ </action>
347
+ <action method="addItemRender" ifconfig="carebyzinc/general/enabled">
348
+ <type>grouped</type>
349
+ <block>sales/order_email_items_order_grouped</block>
350
+ <template>carebyzinc/email/order/items/creditmemo/default.phtml</template>
351
+ </action>
352
 
353
+ </reference>
354
 
355
  </sales_email_order_creditmemo_items>
 
 
356
  </layout>
app/design/frontend/base/default/template/carebyzinc/carebyzinc.phtml CHANGED
@@ -1,98 +1,167 @@
1
  <?php
2
  /*
3
- * Care by Zinc in Product Page
4
- */
 
 
 
 
 
 
 
 
 
 
5
 
 
 
6
  ?>
7
- <?php $product_id = Mage::registry('current_product')->getId();
8
- $product = Mage::getModel('catalog/product')->load($product_id);
9
- $productType = $product->getTypeId();
10
- $price = $product->getFinalPrice();
11
- $helper = Mage::helper('carebyzinc');
12
- if(($productType == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE || $productType == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) && ($product->getCarebyzinc() == 1) && ($helper->checkQuoteVisibility())):
13
-
14
- $zip = $helper->getZipCode(); ?>
15
- <div class="product-box">
16
- <h1 class="product-title"><?php echo $helper->getTitle()?></h1>
17
- <input type="text" name="zipcode" id="zipcode" value="<?php echo $zip ;?>" placeholder="Enter Zip code here" style="width:21%"/>
18
- <button class="btn-zinc showCarebyzinc" onclick="showCarebyzinc(); return false;">Get Quote <span id="care-loader" class="care-loader"></span></button>
19
- <div id="carebyzincCnt"></div>
20
- </div>
21
- <script>
22
- //<![CDATA[
23
- function showCarebyzinc(){
24
- var val = document.getElementsByClassName("super-attribute-select");
25
- var customoption = document.getElementsByClassName("product-custom-option");
26
- var i;
27
- var configOptions = '';
28
- if(val.length)
29
- configOptions = '{';
30
- for (i = 0; i < val.length; i++) {
31
- var option = (val[i].name).match(/\d+/)[0];
32
- configOptions = configOptions+'"'+option+'":'+val[i].value;
33
- if(i != (val.length-1))
34
- configOptions = configOptions+',';
35
- }
36
- if(val.length)
37
- configOptions = configOptions+'}';
38
- var customoptionPrice = 0;
39
- for (i = 0; i < customoption.length; i++) {
40
- var option = customoption[i].value;
41
- var selectedIndex = customoption[i].selectedIndex;
42
- if(selectedIndex)
43
- customoptionPrice = customoptionPrice + customoption[i][selectedIndex].getAttribute('price');
44
- }
45
- var zip = document.getElementById('zipcode').value;
46
- if(zip){
47
-
48
- if(/(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(zip)){
49
- var url = '<?php echo $this->getUrl("carebyzinc/index/pricequote") ?>';
50
- jQuery( "button" ).addClass( "selected" );
51
- jQuery("#care-loader").addClass('show');
52
- new Ajax.Request(url, {
53
- method: 'post',
54
- parameters: {pid: <?php echo Mage::registry('current_product')->getId(); ?>,zip:zip,configOptions:configOptions,customoptionPrice:customoptionPrice},
55
- onComplete: function(transport) {
56
- var content = JSON.parse(transport.responseText);
57
- jQuery("#carebyzincCnt").show();
58
- $('carebyzincCnt').update(content);
59
- jQuery("#care-loader").removeClass('show');
60
- jQuery( "button" ).removeClass( "selected" );
61
-
62
- }
63
-
64
- });
65
- }
66
- else
67
- alert('Enter a valid zip code');
68
- }else
69
- alert('Enter a valid zipcode');
70
- }
71
- jQuery(".configurable-swatch-list li a").click(function(){
72
- jQuery("#carebyzincCnt").hide();
73
- $('carebyzincCnt').update('');
74
- });
75
- jQuery("select.super-attribute-select").change(function(){
76
- jQuery("#carebyzincCnt").hide();
77
- $('carebyzincCnt').update('');
78
- });
79
-
80
- function checkAction(item){
81
- var radioButtons = $("input[type='radio'][name='"+ item.name +"']");
82
- var radioStates = {};
83
- jQuery('input[name=' + item.name + ']').click(function() {
84
- var val = jQuery(this).val();
85
- jQuery(this).attr('checked', (radioStates[val] = !radioStates[val]));
86
-
87
- jQuery.each(radioButtons, function(index, rd) {
88
- if(rd.value !== val) {
89
- radioStates[rd.value] = false;
90
- }
91
- });
92
- });
 
 
 
93
 
94
- }
95
-
96
- //]]>
97
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  <?php endif; ?>
 
1
  <?php
2
  /*
3
+ * Care by Zinc in Product Page
4
+ */
5
+ ?>
6
+ <?php
7
+ $product_id = Mage::registry('current_product')->getId();
8
+ $product = Mage::getModel('catalog/product')->load($product_id);
9
+ $productType = $product->getTypeId();
10
+ $price = $product->getFinalPrice();
11
+ $helper = Mage::helper('carebyzinc');
12
+
13
+ $session = Mage::getSingleton("core/session", array("name"=>"frontend"));
14
+ $interstitials = $session->getData('interstitials');
15
 
16
+ if (($productType == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE || $productType == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) && ($product->getCarebyzinc() == 1) && ($helper->checkQuoteVisibility('product'))):
17
+ $zip = $helper->getZipCode();
18
  ?>
19
+ <div class="product-box">
20
+ <input type="text" name="zipcode" id="zipcode" value="<?php echo $zip; ?>" placeholder="Enter Zip code here" style="width:21%"/>
21
+ <button class="btn-zinc showCarebyzinc">Get Quote <span id="care-loader" class="care-loader"></span></button>
22
+ <div id="carebyzincCnt"></div>
23
+ <input type="hidden" name="isProduct" value="1" />
24
+ </div>
25
+ <?php if($interstitials && isset($interstitials['html'])) : ?>
26
+ <div id="interstitials" style="display: none;">
27
+ <link rel="stylesheet" type="text/css" href="<?php echo $interstitials['stylesheet']; ?>" />
28
+ <?php echo $interstitials['html']; ?>
29
+ </div>
30
+ <?php endif; ?>
31
+ <script>
32
+ //<![CDATA[
33
+ jQuery(document).ready(function () {
34
+ showCarebyzinc();
35
+ });
36
+
37
+ function showCarebyzinc() {
38
+ var val = document.getElementsByClassName("super-attribute-select");
39
+ var customoption = document.getElementsByClassName("product-custom-option");
40
+ var i;
41
+ var configOptions = '';
42
+ if (val.length)
43
+ configOptions = '{';
44
+ for (i = 0; i < val.length; i++) {
45
+ var option = (val[i].name).match(/\d+/)[0];
46
+ configOptions = configOptions + '"' + option + '":' + val[i].value;
47
+ if (i != (val.length - 1))
48
+ configOptions = configOptions + ',';
49
+ }
50
+ if (val.length)
51
+ configOptions = configOptions + '}';
52
+ var customoptionPrice = 0;
53
+ for (i = 0; i < customoption.length; i++) {
54
+ var option = customoption[i].value;
55
+ var selectedIndex = customoption[i].selectedIndex;
56
+ if (selectedIndex)
57
+ customoptionPrice = customoptionPrice + customoption[i][selectedIndex].getAttribute('price');
58
+ }
59
+ var zip = document.getElementById('zipcode').value;
60
+ if (zip) {
61
+
62
+ if (/(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(zip)) {
63
+ var url = '<?php echo $this->getUrl("carebyzinc/index/pricequote") ?>';
64
+ jQuery("button").addClass("selected");
65
+ jQuery("#care-loader").addClass('show');
66
+ new Ajax.Request(url, {
67
+ method: 'post',
68
+ parameters: {pid: <?php echo Mage::registry('current_product')->getId(); ?>, zip: zip, configOptions: configOptions, customoptionPrice: customoptionPrice},
69
+ onComplete: function (transport) {
70
+ var content = JSON.parse(transport.responseText);
71
+ jQuery("#carebyzincCnt").show();
72
+ $('carebyzincCnt').update(content);
73
+ jQuery("#care-loader").removeClass('show');
74
+ jQuery("button").removeClass("selected");
75
+
76
+ }
77
+
78
+ });
79
+ }
80
+ else
81
+ alert('Enter a valid zip code');
82
+ } else
83
+ alert('Enter a valid zipcode');
84
+ }
85
+ jQuery(".configurable-swatch-list li a").click(function () {
86
+ jQuery("#carebyzincCnt").hide();
87
+ $('carebyzincCnt').update('');
88
+ });
89
+ jQuery("select.super-attribute-select").change(function () {
90
+ jQuery("#carebyzincCnt").hide();
91
+ $('carebyzincCnt').update('');
92
+ });
93
+
94
+ function checkAction(item) {
95
+ var radioButtons = $("input[type='radio'][name='" + item.name + "']");
96
+ var radioStates = {};
97
+ jQuery('input[name=' + item.name + ']').click(function () {
98
+ var val = jQuery(this).val();
99
+ jQuery(this).attr('checked', (radioStates[val] = !radioStates[val]));
100
+
101
+ jQuery.each(radioButtons, function (index, rd) {
102
+ if (rd.value !== val) {
103
+ radioStates[rd.value] = false;
104
+ }
105
+ });
106
+ });
107
+ }
108
 
109
+ //]]>
110
+ </script>
111
+
112
+ <?php if($interstitials && isset($interstitials['html'])) : ?>
113
+ <script>
114
+ //<![CDATA[
115
+ jQuery(document).ready(function() {
116
+ jQuery.colorbox({
117
+ inline: true,
118
+ href: "#interstitials",
119
+ width: 722,
120
+ fastIframe: false,
121
+ innerHeight: 270,
122
+ open: true,
123
+ escKey: false,
124
+ overlayClose: false,
125
+ onLoad: function() {
126
+ jQuery('#cboxClose').remove();
127
+ },
128
+ onClosed: function() {
129
+ jQuery('#interstitials').hide();
130
+ },
131
+ onOpen: function() {
132
+ jQuery('#interstitials').show();
133
+ }
134
+ });
135
+ });
136
+
137
+ jQuery('#ZincInterstitial-cancel').click(function() {
138
+ jQuery.colorbox.close();
139
+ var url = '<?php echo $this->getUrl("checkout/cart/ajaxprocessitem") ?>';
140
+ new Ajax.Request(url, {
141
+ method: 'post',
142
+ parameters: {pId: <?php echo Mage::registry('current_product')->getId(); ?>, action: 'cancel'},
143
+ onComplete: function (transport) {
144
+ var content = JSON.parse(transport.responseText);
145
+ if(content != false) {
146
+ window.location.replace(content);
147
+ }
148
+ }
149
+ });
150
+ });
151
+
152
+ jQuery('#ZincInterstitial-add').click(function() {
153
+ jQuery.colorbox.close();
154
+ var url = '<?php echo $this->getUrl("checkout/cart/ajaxprocessitem") ?>';
155
+ jQuery('#carebyzincCnt input[name="carebyzinc_option"]').attr('checked', 'checked');
156
+ new Ajax.Request(url, {
157
+ method: 'post',
158
+ parameters: {pId: <?php echo Mage::registry('current_product')->getId(); ?>, action: 'add'},
159
+ onComplete: function () {
160
+ jQuery('.add-to-cart-buttons .btn-cart').trigger('click');
161
+ }
162
+ });
163
+ });
164
+ //]]>
165
+ </script>
166
  <?php endif; ?>
167
+ <?php endif; ?>
app/design/frontend/base/default/template/carebyzinc/checkout/cart.phtml CHANGED
@@ -35,14 +35,14 @@
35
  <div class="cart <?php echo $_priceDisplay; ?>">
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 top">
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()->toHtml() ?>
@@ -57,11 +57,11 @@
57
  <col width="1" />
58
  <col width="1" />
59
  <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
60
- <col width="1" />
61
- <col width="1" />
62
  <?php endif; ?>
63
 
64
- <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
65
  <thead>
66
  <tr>
67
  <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product') ?></span></th>
@@ -69,34 +69,34 @@
69
  <th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
70
 
71
  <th class="a-center cart-price-head" colspan="<?php echo $mergedCells; ?>">
72
- <!-- <div class="cart-price-placeholder">-->
73
- <span class="nobr"><?php echo $this->__('Price') ?></span>
74
- <!-- </div>-->
75
  </th>
76
 
77
  <th rowspan="<?php echo $mergedCells; ?>" class="a-center">
78
  <?php echo $this->__('Qty') ?>
79
 
80
- <?php /*if ($this->helper('wishlist')->isAllowInCart()) : ?>
81
- <span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span>
82
- <?php endif*/ ?>
83
 
84
  </th>
85
 
86
  <th class="a-center cart-total-head" colspan="<?php echo $mergedCells; ?>">
87
- <?php echo $this->__('Subtotal') ?>
88
  </th>
89
 
90
  <th class="a-center" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
91
 
92
  </tr>
93
  <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
94
- <tr>
95
- <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
96
- <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
97
- <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
98
- <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
99
- </tr>
100
  <?php endif; ?>
101
  </thead>
102
  <tfoot>
@@ -112,7 +112,7 @@
112
 
113
  <span class="or">-<?php echo $this->__('or'); ?>-</span>
114
 
115
- <?php if($this->getContinueShoppingUrl()): ?>
116
  <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue Shopping')) ?>" class="button2 btn-continue" onclick="setLocation('<?php echo Mage::helper('core')->quoteEscape($this->getContinueShoppingUrl()) ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
117
  <?php endif; ?>
118
  <!--[if lt IE 8]>
@@ -141,9 +141,9 @@
141
  </tr>
142
  </tfoot>
143
  <tbody>
144
- <?php foreach($this->getItems() as $_item): ?>
145
- <?php echo $this->getItemHtml($_item) ?>
146
- <?php endforeach ?>
147
  </tbody>
148
  </table>
149
  <script type="text/javascript">decorateTable('shopping-cart-table')</script>
@@ -155,108 +155,110 @@
155
  <?php echo $this->getChildHtml('checkout_cart_widget') ?>
156
  <?php echo $this->getChildHtml('coupon') ?>
157
  <?php echo $this->getChildHtml('checkout.cart.extra') ?>
158
- <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
 
 
159
  </div>
160
  <div class="cart-totals-wrapper">
161
  <div class="cart-totals">
162
  <?php echo $this->getChildHtml('totals'); ?>
163
- <?php if(!$this->hasError()): ?>
164
- <ul class="checkout-types bottom">
165
- <?php foreach ($this->getMethods('methods') as $method): ?>
166
- <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
167
- <li class="method-<?php echo preg_replace("/[^_a-zA-Z0-9-]/", '-', $method); ?>"><?php echo $methodHtml; ?></li>
168
- <?php endif; ?>
169
- <?php endforeach; ?>
170
- </ul>
171
- <?php endif; ?>
172
  </div>
173
  </div>
174
- <?php echo $this->getChildHtml('crosssell') ?>
175
  </div>
176
  <script>
177
  //<![CDATA[
178
- function showCarebyzinc(pid,itemId){
179
- var zip = document.getElementById('zipcode_'+itemId).value;
180
- if(zip){
181
- if(/(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(zip)){
182
- var url = '<?php echo $this->getUrl("carebyzinc/index/priceQuote") ?>';
183
- var cntid = "carebyzincCnt_"+itemId;
184
- var loader = "#care-loader_"+itemId;
185
- jQuery(loader).show();
186
- new Ajax.Request(url, {
187
- method: 'post',
188
- parameters: {pid: pid,itemId:itemId,zip:zip},
189
- onComplete: function(transport) {
190
- var content = JSON.parse(transport.responseText);
191
- $(cntid).update(content);
192
- jQuery(loader).hide();
193
-
194
- }
195
-
196
- });
197
- }
198
- else
199
- alert('Enter a valid zip code');
200
- }else
201
- alert('Enter a valid zip code');
202
- }
203
-
204
- function updateCareByZinc(itemId)
205
- {
206
-
207
- var url = '<?php echo $this->getUrl('carebyzinc/index/updatePriceQuoteinCart') ?>';
208
- var name = "carebyzinc_option_"+itemId;
209
- var radio = document.getElementsByName(name);
210
- var c = -1;
211
- for(var i=0; i < radio.length; i++){
212
- if(radio[i].checked) {
213
- c = i;
214
- }
215
- }
216
- if (c == -1){
217
- document.getElementById('advice-required-entry_'+itemId).style.display="block";
218
- }else{
219
- document.getElementById('advice-required-entry_'+itemId).style.display="none";
220
- var val = document.querySelector('input[name="'+name+'"]:checked').value;
221
- new Ajax.Request(url, {
222
- method: 'post',
223
- parameters: { carebyzinc: val,itemId:itemId },
224
- onComplete: function(transport) {
225
- var content = transport.responseText;
226
- window.location = '';
227
- }
228
-
229
- });
230
- }
231
- }
232
- jQuery.noConflict();
233
- jQuery(document).ready(function() {
234
- jQuery("a", ".quotelabel").click(
235
- function(event) {
236
- event.preventDefault();
237
- var elementURL = jQuery(this).attr("href");
238
- jQuery.colorbox({iframe: true, href: elementURL, innerWidth: 645,fastIframe: false, innerHeight: 509,width:"70%"});
239
- });
240
- });
241
-
242
- function checkAction(item){
243
- var radioButtons = $("input[type='radio'][name='"+ item.name +"']");
244
- var radioStates = {};
245
- jQuery('input[name=' + item.name + ']').click(function() {
246
- var val = jQuery(this).val();
247
- jQuery(this).attr('checked', (radioStates[val] = !radioStates[val]));
248
-
249
- jQuery.each(radioButtons, function(index, rd) {
250
- if(rd.value !== val) {
251
- radioStates[rd.value] = false;
252
- }
253
- });
254
  });
255
 
256
- }
257
- function openUpdatezip(itemId){
258
- document.getElementById('updatezipside_'+itemId).style.display="block";
259
- }
260
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  //]]>
262
  </script>
35
  <div class="cart <?php echo $_priceDisplay; ?>">
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 top">
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()->toHtml() ?>
57
  <col width="1" />
58
  <col width="1" />
59
  <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
60
+ <col width="1" />
61
+ <col width="1" />
62
  <?php endif; ?>
63
 
64
+ <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
65
  <thead>
66
  <tr>
67
  <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product') ?></span></th>
69
  <th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
70
 
71
  <th class="a-center cart-price-head" colspan="<?php echo $mergedCells; ?>">
72
+ <!-- <div class="cart-price-placeholder">-->
73
+ <span class="nobr"><?php echo $this->__('Price') ?></span>
74
+ <!-- </div>-->
75
  </th>
76
 
77
  <th rowspan="<?php echo $mergedCells; ?>" class="a-center">
78
  <?php echo $this->__('Qty') ?>
79
 
80
+ <?php /* if ($this->helper('wishlist')->isAllowInCart()) : ?>
81
+ <span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span>
82
+ <?php endif */ ?>
83
 
84
  </th>
85
 
86
  <th class="a-center cart-total-head" colspan="<?php echo $mergedCells; ?>">
87
+ <?php echo $this->__('Subtotal') ?>
88
  </th>
89
 
90
  <th class="a-center" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
91
 
92
  </tr>
93
  <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
94
+ <tr>
95
+ <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
96
+ <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
97
+ <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
98
+ <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
99
+ </tr>
100
  <?php endif; ?>
101
  </thead>
102
  <tfoot>
112
 
113
  <span class="or">-<?php echo $this->__('or'); ?>-</span>
114
 
115
+ <?php if ($this->getContinueShoppingUrl()): ?>
116
  <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue Shopping')) ?>" class="button2 btn-continue" onclick="setLocation('<?php echo Mage::helper('core')->quoteEscape($this->getContinueShoppingUrl()) ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
117
  <?php endif; ?>
118
  <!--[if lt IE 8]>
141
  </tr>
142
  </tfoot>
143
  <tbody>
144
+ <?php foreach ($this->getItems() as $_item): ?>
145
+ <?php echo $this->getItemHtml($_item) ?>
146
+ <?php endforeach ?>
147
  </tbody>
148
  </table>
149
  <script type="text/javascript">decorateTable('shopping-cart-table')</script>
155
  <?php echo $this->getChildHtml('checkout_cart_widget') ?>
156
  <?php echo $this->getChildHtml('coupon') ?>
157
  <?php echo $this->getChildHtml('checkout.cart.extra') ?>
158
+ <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping');
159
+ endif;
160
+ ?>
161
  </div>
162
  <div class="cart-totals-wrapper">
163
  <div class="cart-totals">
164
  <?php echo $this->getChildHtml('totals'); ?>
165
+ <?php if (!$this->hasError()): ?>
166
+ <ul class="checkout-types bottom">
167
+ <?php foreach ($this->getMethods('methods') as $method): ?>
168
+ <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
169
+ <li class="method-<?php echo preg_replace("/[^_a-zA-Z0-9-]/", '-', $method); ?>"><?php echo $methodHtml; ?></li>
170
+ <?php endif; ?>
171
+ <?php endforeach; ?>
172
+ </ul>
173
+ <?php endif; ?>
174
  </div>
175
  </div>
176
+ <?php echo $this->getChildHtml('crosssell') ?>
177
  </div>
178
  <script>
179
  //<![CDATA[
180
+ function showCarebyzinc(pid, itemId) {
181
+ var zip = document.getElementById('zipcode_' + itemId).value;
182
+ if (zip) {
183
+ if (/(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(zip)) {
184
+ var url = '<?php echo $this->getUrl("carebyzinc/index/priceQuote") ?>';
185
+ var cntid = "carebyzincCnt_" + itemId;
186
+ var loader = "#care-loader_" + itemId;
187
+ jQuery(loader).show();
188
+ new Ajax.Request(url, {
189
+ method: 'post',
190
+ parameters: {pid: pid, itemId: itemId, zip: zip},
191
+ onComplete: function (transport) {
192
+ var content = JSON.parse(transport.responseText);
193
+ $(cntid).update(content);
194
+ jQuery(loader).hide();
195
+
196
+ }
197
+
198
+ });
199
+ }
200
+ else
201
+ alert('Enter a valid zip code');
202
+ } else
203
+ alert('Enter a valid zip code');
204
+ }
205
+
206
+ function updateCareByZinc(itemId)
207
+ {
208
+
209
+ var url = '<?php echo $this->getUrl('carebyzinc/index/updatePriceQuoteinCart') ?>';
210
+ var name = "carebyzinc_option_" + itemId;
211
+ var radio = document.getElementsByName(name);
212
+ var c = -1;
213
+ for (var i = 0; i < radio.length; i++) {
214
+ if (radio[i].checked) {
215
+ c = i;
216
+ }
217
+ }
218
+ if (c == -1) {
219
+ document.getElementById('advice-required-entry_' + itemId).style.display = "block";
220
+ } else {
221
+ document.getElementById('advice-required-entry_' + itemId).style.display = "none";
222
+ var val = document.querySelector('input[name="' + name + '"]:checked').value;
223
+ new Ajax.Request(url, {
224
+ method: 'post',
225
+ parameters: {carebyzinc: val, itemId: itemId},
226
+ onComplete: function (transport) {
227
+ var content = transport.responseText;
228
+ window.location = '';
229
+ }
230
+
231
+ });
232
+ }
233
+ }
234
+ jQuery.noConflict();
235
+ jQuery(document).ready(function () {
236
+ jQuery("a", ".quotelabel").click(
237
+ function (event) {
238
+ event.preventDefault();
239
+ var elementURL = jQuery(this).attr("href");
240
+ jQuery.colorbox({iframe: true, href: elementURL, innerWidth: 645, fastIframe: false, innerHeight: 509, width: "70%"});
241
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  });
243
 
244
+ function checkAction(item) {
245
+ var radioButtons = $("input[type='radio'][name='" + item.name + "']");
246
+ var radioStates = {};
247
+ jQuery('input[name=' + item.name + ']').click(function () {
248
+ var val = jQuery(this).val();
249
+ jQuery(this).attr('checked', (radioStates[val] = !radioStates[val]));
250
+
251
+ jQuery.each(radioButtons, function (index, rd) {
252
+ if (rd.value !== val) {
253
+ radioStates[rd.value] = false;
254
+ }
255
+ });
256
+ });
257
+
258
+ }
259
+ function openUpdatezip(itemId) {
260
+ document.getElementById('updatezipside_' + itemId).style.display = "block";
261
+ }
262
+
263
  //]]>
264
  </script>
app/design/frontend/base/default/template/carebyzinc/checkout/cart/item/default.phtml CHANGED
@@ -1,51 +1,51 @@
1
  <?php
2
- /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
  ?>
9
  <?php
10
  $_item = $this->getItem();
11
  $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
12
  $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
13
- ?>
14
- <?php
15
- $product = Mage::getModel('catalog/product')->load($_item->getProductId());
16
- $flag = 0;$warrantyflag = 0;
17
  $model = Mage::getModel('carebyzinc/carebyzinc');
18
- $helper = Mage::helper('carebyzinc');
19
- if(($product->getCarebyzinc() == 1) && ($product->getCarebyzincCategory() != NULL)){
20
- $flag = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
- if($_item->getCarebyzincVariantid())
23
- $flag = 0;
24
- if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')){
25
- $carebyStatus = $model->getwarrantyStatus($_item->getCarebyzincParentid(),$_item->getId());
26
- $flag = 1;$warrantyflag = 1;
27
-
28
- }elseif (($product->getCarebyzinc() == 1) && (! $_item->getCarebyzincVariantid()) ){
29
- $zip = $helper->getZipCode();
30
- $product = Mage::getModel('catalog/product')->load($_item->getProductId());
31
- $itemId = $_item->getId();
32
- $quoteDataSession = $model->getPriceQuoteinCart($product, $itemId,$zip);
33
- if((empty($quoteDataSession)) || (! is_array($quoteDataSession))){
34
- $flag = 0;
35
- }
36
- }
37
-
38
  ?>
39
 
40
- <tr <?php if($flag) echo "style='border-bottom:0px'"; ?>>
41
- <td class="product-cart-image"<?php if($flag):?> rowspan="2" <?php endif;?>>
42
- <?php if ($this->hasProductUrl()):?>
43
  <a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image">
44
- <?php endif;?>
45
- <img src="<?php echo $this->getProductThumbnail()->resize(180); ?>" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" <?php if ($warrantyflag):?> style="max-width: 100%;" <?php endif;?>/>
46
- <?php if ($this->hasProductUrl()):?>
47
  </a>
48
- <?php endif;?>
49
 
50
  <ul class="cart-links">
51
  <?php if ($isVisibleProduct): ?>
@@ -67,56 +67,57 @@ if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_p
67
  <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove Item')) ?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove Item') ?></a>
68
 
69
  <h2 class="product-name">
70
- <?php if ($this->hasProductUrl()):?>
71
- <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
72
- <?php else: ?>
73
- <?php if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
74
- $name = $model->getWarrentyName($_item->getCarebyzincParentid());
75
- ?>
76
- <?php echo $this->escapeHtml($this->getProductName().$name) ?>
77
- <?php else:?>
78
- <?php echo $this->escapeHtml($this->getProductName()) ?>
79
- <?php endif; ?>
80
- <?php endif; ?>
 
81
  </h2>
82
 
83
  <div class="product-cart-sku">
84
  <span class="label"><?php echo $this->__('SKU'); ?>:</span> <?php echo $this->escapeHtml($_item->getSku()); ?>
85
  </div>
86
 
87
- <?php if ($_options = $this->getOptionList()):?>
88
- <dl class="item-options">
89
- <?php foreach ($_options as $_option) : ?>
90
- <?php if($_option['label'] != 'carebyzinc'):?>
91
- <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
92
- <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
93
- <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
94
- <?php if (isset($_formatedOptionValue['full_view'])): ?>
95
- <div class="truncated_full_value">
96
- <dl class="item-options">
97
- <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
98
- <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
99
- </dl>
100
- </div>
101
- <?php endif; ?>
102
- </dd>
103
- <?php endif;?>
 
 
 
 
 
 
 
 
 
104
  <?php endforeach; ?>
105
- </dl>
106
- <?php endif;?>
107
-
108
- <?php if ($messages = $this->getMessages()): ?>
109
- <?php foreach ($messages as $message): ?>
110
- <p class="item-msg <?php echo $message['type'] ?>">
111
- * <?php echo $this->escapeHtml($message['text']) ?>
112
- </p>
113
- <?php endforeach; ?>
114
- <?php endif; ?>
115
 
116
  <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
117
  <?php if ($addInfoBlock): ?>
118
  <?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
119
- <?php endif;?>
120
 
121
  </td>
122
 
@@ -136,88 +137,88 @@ if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_p
136
  <?php else: ?>
137
 
138
  <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
139
- <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Excl. Tax'); ?>">
140
-
141
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
142
- <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
143
- <?php else: ?>
144
- <span class="cart-price">
145
- <?php endif; ?>
146
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
147
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
148
- <?php else: ?>
149
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
150
- <?php endif; ?>
151
-
152
- </span>
153
-
154
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
155
-
156
- <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
157
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
158
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
159
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
160
- <?php endforeach; ?>
161
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
162
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
163
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
164
- <?php endforeach; ?>
165
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
166
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
167
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
168
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
169
  <?php endif; ?>
170
- </div>
171
-
172
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
173
- <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
174
- <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
175
- </div>
176
- <?php endif; ?>
177
- <?php endif; ?>
178
- </td>
179
  <?php endif; ?><!-- inclusive price starts here -->
180
  <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
181
- <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Incl. Tax'); ?>">
182
- <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
183
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
184
- <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
185
- <?php else: ?>
186
- <span class="cart-price">
187
- <?php endif; ?>
188
-
189
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
190
- <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
191
- <?php else: ?>
192
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
193
- <?php endif; ?>
194
-
195
- </span>
196
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
197
-
198
- <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
199
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
200
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
201
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
202
- <?php endforeach; ?>
203
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
204
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
205
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
206
- <?php endforeach; ?>
207
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
208
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
209
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
210
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
211
  <?php endif; ?>
212
- </div>
213
-
214
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
215
- <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
216
- <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
217
- </div>
218
- <?php endif; ?>
219
- <?php endif; ?>
220
- </td>
221
  <?php endif; ?>
222
  <?php endif; ?>
223
  <td class="product-cart-actions" data-rwd-label="<?php echo $this->__('Qty'); ?>">
@@ -236,11 +237,11 @@ if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_p
236
  <?php endif ?>
237
 
238
  <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
239
- <li>
240
- <?php if ($isVisibleProduct): ?>
241
- <a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move to wishlist'); ?></a>
242
- <?php endif ?>
243
- </li>
244
  <?php endif ?>
245
  </ul>
246
 
@@ -248,160 +249,171 @@ if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_p
248
 
249
  <!--Sub total starts here -->
250
  <?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
251
- <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>">
252
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
253
- <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
254
- <?php else: ?>
255
- <span class="cart-price">
256
- <?php endif; ?>
257
-
258
- <?php if ($canApplyMsrp): ?>
259
- <span class="cart-msrp-subtotal">--</span>
260
- <?php else: ?>
261
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
262
- <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
263
  <?php else: ?>
264
- <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
265
- <?php endif; ?>
266
- <?php endif; ?>
267
 
268
- </span>
269
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
 
 
 
 
 
 
 
270
 
271
- <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
272
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
273
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
274
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
275
- <?php endforeach; ?>
276
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
277
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
278
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
279
- <?php endforeach; ?>
280
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
281
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
282
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
283
- <?php endforeach; ?>
284
- <?php endif; ?>
285
- </div>
 
 
 
286
 
287
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
288
- <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
289
- <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
290
- </div>
291
- <?php endif; ?>
292
- <?php endif; ?>
293
- </td>
294
  <?php endif; ?>
295
  <?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
296
- <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>">
297
- <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
298
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
299
- <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
300
- <?php else: ?>
301
- <span class="cart-price">
302
- <?php endif; ?>
303
-
304
- <?php if ($canApplyMsrp): ?>
305
- <span class="cart-msrp-subtotal">--</span>
306
- <?php else: ?>
307
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
308
- <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
309
  <?php else: ?>
310
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
311
- <?php endif; ?>
312
- <?php endif; ?>
313
-
314
- </span>
315
 
 
 
 
 
 
 
 
 
 
316
 
317
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
- <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
320
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
321
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
322
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
323
- <?php endforeach; ?>
324
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
325
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
326
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
327
- <?php endforeach; ?>
328
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
329
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
330
- <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
331
- <?php endforeach; ?>
332
  <?php endif; ?>
333
- </div>
334
-
335
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
336
- <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
337
- <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
338
- </div>
339
- <?php endif; ?>
340
- <?php endif; ?>
341
- </td>
342
  <?php endif; ?>
343
  <td class="a-center product-cart-remove">
344
  <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove Item')) ?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove Item') ?></a>
345
  </td>
346
  </tr>
347
 
348
- <?php $careByZinc = $_item->getCarebyzincOption();?>
349
- <?php if($careByZinc): ?>
350
- <tr>
351
- <td colspan="5">
352
- <?php $carebyzincAry = (array) unserialize($careByZinc); ?>
353
- <div class="product-cart-careby">
354
- <p class="warranty_desc quotelabel"><?php echo $carebyzincAry['description'] ?></p>
355
- </div>
356
- </td>
357
- </tr>
358
-
359
- <?php else:?>
360
- <?php
361
- if (($product->getCarebyzinc() == 1) && (! $_item->getCarebyzincVariantid()) && ($_item->getProductId() != Mage::getStoreConfig('carebyzinc/general/warranty_product'))):
362
- $zip = $helper->getZipCode();
363
- $product = Mage::getModel('catalog/product')->load($_item->getProductId());
364
- $itemId = $_item->getId();
365
- $quoteDataSession = $model->getPriceQuoteinCart($product, $itemId,$zip);
366
- ?>
367
- <?php if(! empty($quoteDataSession)):?>
368
- <?php if( is_array($quoteDataSession)):
369
- $quoteData = $quoteDataSession[$itemId];?>
370
- <tr><td colspan="5">
371
-
372
- <div class="product-box">
373
- <div id="carebyzincCnt_<?php echo $_item->getId(); ?>" class="carebyzincCnt product-container" style="display:block;">
374
-
375
- <ul class="product-list">
376
- <?php foreach($quoteData as $qitem): ?>
377
- <li>
378
- <div class="bx-l">
379
- <div class="squared input">
380
- <input type="radio" value="<?php echo $qitem['id']; ?>" id="carebyzinc_<?php echo $itemId.'_'.$qitem['id']; ?>" name="carebyzinc_option_<?php echo $itemId?>" onclick="updateCareByZinc(<?php echo $itemId?>)"/>
381
- <label for="carebyzinc_<?php echo $itemId.'_'.$qitem['id']; ?>" ></label>
382
- </div>
383
- </div>
384
- <div class="bx-r">
385
- <h2 class="p-price"><?php echo Mage::helper('core')->currency($qitem['price_per_year']); ?></h2>
386
- <h3 class="p-name quotelabel"><?php echo $qitem['description']; ?></h3>
387
-
388
- </div>
389
- </li>
390
- <?php endforeach; ?>
391
- </ul>
392
- <div class="validation-advice carebyzinc_validation" id="advice-required-entry_<?php echo $_item->getId(); ?>" style="display:none;"><?php echo $this->__('This is a required field.');?></div>
393
- <span><?php echo $this->__('Based on zip:')?></span> <span class="updatezip" onclick="openUpdatezip(<?php echo $itemId; ?>)"><strong><u><?php echo $zip ;?></u></strong></span>
394
- <div id="updatezipside_<?php echo $_item->getId(); ?>" style="display:none;">
395
- <input type="text" name="zipcode_<?php echo $_item->getId(); ?>" id="zipcode_<?php echo $_item->getId(); ?>" value="<?php echo $zip ;?>" placeholder="Enter Zip code here" style="width:21%"/>
396
-
397
- <button class="btn-zinc showCarebyzinc" id="showCarebyzinc_<?php echo $_item->getId(); ?>" onclick="showCarebyzinc(<?php echo $_item->getProductId(); ?>,<?php echo $_item->getId(); ?>); return false;"><?php echo $this->__('Confirm')?><span id="care-loader_<?php echo $_item->getId(); ?>" class="care-loader"></span></button>
398
-
399
- </div>
400
- </div>
401
- </div>
402
- </td></tr>
403
-
404
- <?php endif; ?>
405
- <?php endif;?>
406
- <?php endif;?>
407
- <?php endif;?>
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ /**
3
  * ZincPlatform
4
  * @package Zinc_Carebyzinc
5
  * @copyright Copyright (c) 2016-2017 Zinplatform (http://www.zincplatform.com/)
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
  ?>
9
  <?php
10
  $_item = $this->getItem();
11
  $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
12
  $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
13
+ $product = Mage::getModel('catalog/product')->load($_item->getProductId());
14
+ $flag = 0;
15
+ $warrantyflag = 0;
 
16
  $model = Mage::getModel('carebyzinc/carebyzinc');
17
+ $helper = Mage::helper('carebyzinc');
18
+
19
+ if (($product->getCarebyzinc() == 1) && ($product->getCarebyzincCategory() != NULL)) {
20
+ $flag = 1;
21
+ }
22
+
23
+ if ($_item->getCarebyzincVariantid())
24
+ $flag = 0;
25
+ if ($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')) {
26
+ $carebyStatus = $model->getwarrantyStatus($_item->getCarebyzincParentid(), $_item->getId());
27
+ $flag = 1;
28
+ $warrantyflag = 1;
29
+ } elseif (($product->getCarebyzinc() == 1) && (!$_item->getCarebyzincVariantid())) {
30
+ $zip = $helper->getZipCode();
31
+ $product = Mage::getModel('catalog/product')->load($_item->getProductId());
32
+ $itemId = $_item->getId();
33
+ $quoteDataSession = $model->getPriceQuoteinCart($product, $itemId, $zip);
34
+ if ((empty($quoteDataSession)) || (!is_array($quoteDataSession))) {
35
+ $flag = 0;
36
+ }
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ?>
39
 
40
+ <tr <?php if ($flag) echo "style='border-bottom:0px'"; ?>>
41
+ <td class="product-cart-image"<?php if ($flag): ?> rowspan="2" <?php endif; ?>>
42
+ <?php if ($this->hasProductUrl()): ?>
43
  <a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image">
44
+ <?php endif; ?>
45
+ <img src="<?php echo $this->getProductThumbnail()->resize(180); ?>" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" <?php if ($warrantyflag): ?> style="max-width: 100%;" <?php endif; ?>/>
46
+ <?php if ($this->hasProductUrl()): ?>
47
  </a>
48
+ <?php endif; ?>
49
 
50
  <ul class="cart-links">
51
  <?php if ($isVisibleProduct): ?>
67
  <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove Item')) ?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove Item') ?></a>
68
 
69
  <h2 class="product-name">
70
+ <?php if ($this->hasProductUrl()): ?>
71
+ <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
72
+ <?php else: ?>
73
+ <?php
74
+ if ($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
75
+ $name = $model->getWarrantyName($_item->getCarebyzincParentid());
76
+ ?>
77
+ <?php echo $this->escapeHtml($this->__('Insurance ') . $name) ?>
78
+ <?php else: ?>
79
+ <?php echo $this->escapeHtml($this->getProductName()) ?>
80
+ <?php endif; ?>
81
+ <?php endif; ?>
82
  </h2>
83
 
84
  <div class="product-cart-sku">
85
  <span class="label"><?php echo $this->__('SKU'); ?>:</span> <?php echo $this->escapeHtml($_item->getSku()); ?>
86
  </div>
87
 
88
+ <?php if ($_options = $this->getOptionList()): ?>
89
+ <dl class="item-options">
90
+ <?php foreach ($_options as $_option) : ?>
91
+ <?php if ($_option['label'] != 'carebyzinc'): ?>
92
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
93
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
94
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
95
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
96
+ <div class="truncated_full_value">
97
+ <dl class="item-options">
98
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
99
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
100
+ </dl>
101
+ </div>
102
+ <?php endif; ?>
103
+ </dd>
104
+ <?php endif; ?>
105
+ <?php endforeach; ?>
106
+ </dl>
107
+ <?php endif; ?>
108
+
109
+ <?php if ($messages = $this->getMessages()): ?>
110
+ <?php foreach ($messages as $message): ?>
111
+ <p class="item-msg <?php echo $message['type'] ?>">
112
+ * <?php echo $this->escapeHtml($message['text']) ?>
113
+ </p>
114
  <?php endforeach; ?>
115
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
116
 
117
  <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
118
  <?php if ($addInfoBlock): ?>
119
  <?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
120
+ <?php endif; ?>
121
 
122
  </td>
123
 
137
  <?php else: ?>
138
 
139
  <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
140
+ <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Excl. Tax'); ?>">
141
+
142
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
143
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
144
+ <?php else: ?>
145
+ <span class="cart-price">
146
+ <?php endif; ?>
147
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
148
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?>
149
+ <?php else: ?>
150
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
151
+ <?php endif; ?>
152
+
153
+ </span>
154
+
155
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
156
+
157
+ <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
158
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
159
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
160
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'], true, true); ?></span>
161
+ <?php endforeach; ?>
162
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
163
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
164
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'], true, true); ?></span>
165
+ <?php endforeach; ?>
166
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
167
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
168
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'], true, true); ?></span>
169
+ <?php endforeach; ?>
170
+ <?php endif; ?>
171
+ </div>
172
+
173
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
174
+ <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
175
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?></span>
176
+ </div>
177
+ <?php endif; ?>
178
  <?php endif; ?>
179
+ </td>
 
 
 
 
 
 
 
 
180
  <?php endif; ?><!-- inclusive price starts here -->
181
  <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
182
+ <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Incl. Tax'); ?>">
183
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
184
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
185
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
186
+ <?php else: ?>
187
+ <span class="cart-price">
188
+ <?php endif; ?>
189
+
190
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
191
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
192
+ <?php else: ?>
193
+ <?php echo $this->helper('checkout')->formatPrice($_incl - $_item->getWeeeTaxDisposition()) ?>
194
+ <?php endif; ?>
195
+
196
+ </span>
197
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
198
+
199
+ <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
200
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
201
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
202
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></span>
203
+ <?php endforeach; ?>
204
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
205
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
206
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></span>
207
+ <?php endforeach; ?>
208
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
209
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
210
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></span>
211
+ <?php endforeach; ?>
212
+ <?php endif; ?>
213
+ </div>
214
+
215
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
216
+ <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
217
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
218
+ </div>
219
+ <?php endif; ?>
220
  <?php endif; ?>
221
+ </td>
 
 
 
 
 
 
 
 
222
  <?php endif; ?>
223
  <?php endif; ?>
224
  <td class="product-cart-actions" data-rwd-label="<?php echo $this->__('Qty'); ?>">
237
  <?php endif ?>
238
 
239
  <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
240
+ <li>
241
+ <?php if ($isVisibleProduct): ?>
242
+ <a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move to wishlist'); ?></a>
243
+ <?php endif ?>
244
+ </li>
245
  <?php endif ?>
246
  </ul>
247
 
249
 
250
  <!--Sub total starts here -->
251
  <?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
252
+ <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>">
253
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
254
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
 
 
 
 
 
 
 
 
 
255
  <?php else: ?>
256
+ <span class="cart-price">
257
+ <?php endif; ?>
 
258
 
259
+ <?php if ($canApplyMsrp): ?>
260
+ <span class="cart-msrp-subtotal">--</span>
261
+ <?php else: ?>
262
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
263
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?>
264
+ <?php else: ?>
265
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
266
+ <?php endif; ?>
267
+ <?php endif; ?>
268
 
269
+ </span>
270
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
271
+
272
+ <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
273
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
274
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
275
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'], true, true); ?></span>
276
+ <?php endforeach; ?>
277
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
278
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
279
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'], true, true); ?></span>
280
+ <?php endforeach; ?>
281
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
282
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
283
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'], true, true); ?></span>
284
+ <?php endforeach; ?>
285
+ <?php endif; ?>
286
+ </div>
287
 
288
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
289
+ <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
290
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?></span>
291
+ </div>
292
+ <?php endif; ?>
293
+ <?php endif; ?>
294
+ </td>
295
  <?php endif; ?>
296
  <?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
297
+ <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>">
298
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
299
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
300
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
 
 
 
 
 
 
 
 
 
301
  <?php else: ?>
302
+ <span class="cart-price">
303
+ <?php endif; ?>
 
 
 
304
 
305
+ <?php if ($canApplyMsrp): ?>
306
+ <span class="cart-msrp-subtotal">--</span>
307
+ <?php else: ?>
308
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
309
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
310
+ <?php else: ?>
311
+ <?php echo $this->helper('checkout')->formatPrice($_incl - $_item->getWeeeTaxRowDisposition()) ?>
312
+ <?php endif; ?>
313
+ <?php endif; ?>
314
 
315
+ </span>
316
+
317
+
318
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
319
+
320
+ <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
321
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
322
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
323
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
324
+ <?php endforeach; ?>
325
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
326
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
327
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
328
+ <?php endforeach; ?>
329
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
330
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
331
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span>
332
+ <?php endforeach; ?>
333
+ <?php endif; ?>
334
+ </div>
335
 
336
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
337
+ <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
338
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
339
+ </div>
340
+ <?php endif; ?>
 
 
 
 
 
 
 
 
341
  <?php endif; ?>
342
+ </td>
 
 
 
 
 
 
 
 
343
  <?php endif; ?>
344
  <td class="a-center product-cart-remove">
345
  <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove Item')) ?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove Item') ?></a>
346
  </td>
347
  </tr>
348
 
349
+ <?php $careByZinc = $_item->getCarebyzincOption(); ?>
350
+ <?php if ($careByZinc): ?>
351
+ <tr>
352
+ <td colspan="5">
353
+ <?php $carebyzincAry = (array) unserialize($careByZinc); ?>
354
+ <!-- <div class="product-cart-careby">
355
+ <p class="warranty_desc quotelabel"><?php echo $carebyzincAry['description'] ?></p>
356
+ </div>-->
357
+ </td>
358
+ </tr>
359
+
360
+ <?php else : ?>
361
+ <?php if ($helper->checkQuoteVisibility('cart')) : ?>
362
+ <?php
363
+ if (($product->getCarebyzinc() == 1) && (!$_item->getCarebyzincVariantid()) && ($_item->getProductId() != Mage::getStoreConfig('carebyzinc/general/warranty_product'))):
364
+ $zip = $helper->getZipCode();
365
+ $product = Mage::getModel('catalog/product')->load($_item->getProductId());
366
+ $itemId = $_item->getId();
367
+ $quoteDataSession = $model->getPriceQuoteinCart($product, $itemId, $zip);
368
+ ?>
369
+ <?php if (!empty($quoteDataSession)): ?>
370
+ <?php
371
+ if (is_array($quoteDataSession) && $quoteDataSession['code'] == '200') :
372
+ $quoteData = $quoteDataSession['price'][$itemId];
373
+ ?>
374
+ <tr>
375
+ <td class="product-cart-cbz" colspan="5">
376
+ <div class="product-box">
377
+ <div id="carebyzincCnt_<?php echo $_item->getId(); ?>" class="carebyzincCnt product-container" style="display:block;">
378
+ <ul class="product-list">
379
+ <?php foreach ($quoteData as $qitem): ?>
380
+ <li>
381
+ <div class="bx-l">
382
+ <div class="squared input">
383
+ <input type="radio" value="<?php echo $qitem['id']; ?>" id="carebyzinc_<?php echo $itemId . '_' . $qitem['id']; ?>" name="carebyzinc_option_<?php echo $itemId ?>" onclick="updateCareByZinc(<?php echo $itemId ?>)"/>
384
+ <label for="carebyzinc_<?php echo $itemId . '_' . $qitem['id']; ?>" ></label>
385
+ </div>
386
+ </div>
387
+ <div class="bx-r">
388
+ <h2 class="p-price"><?php echo Mage::helper('core')->currency($qitem['price_per_year']); ?></h2>
389
+ <h3 class="p-name quotelabel"><?php echo $qitem['description']; ?></h3>
390
+
391
+ </div>
392
+ </li>
393
+ <?php endforeach; ?>
394
+ </ul>
395
+ <div class="validation-advice carebyzinc_validation" id="advice-required-entry_<?php echo $_item->getId(); ?>"><?php echo $this->__('This is a required field.'); ?></div>
396
+ <span class="cart-selected-zipcode"><?php echo $this->__('Based on zip:') ?></span> <span class="updatezip" onclick="openUpdatezip(<?php echo $itemId; ?>)"><strong><u><?php echo $zip; ?></u></strong></span>
397
+ <div class="cart-update-zipcode" id="updatezipside_<?php echo $_item->getId(); ?>">
398
+ <input type="text" name="zipcode_<?php echo $_item->getId(); ?>" id="zipcode_<?php echo $_item->getId(); ?>" value="<?php echo $zip; ?>" placeholder="Enter Zip code here" style="width:21%"/>
399
+ <button class="btn-zinc showCarebyzinc" id="showCarebyzinc_<?php echo $_item->getId(); ?>" onclick="showCarebyzinc(<?php echo $_item->getProductId(); ?>,<?php echo $_item->getId(); ?>);
400
+ return false;"><?php echo $this->__('Confirm') ?><span id="care-loader_<?php echo $_item->getId(); ?>" class="care-loader"></span></button>
401
+ </div>
402
+ </div>
403
+ </div>
404
+ </td>
405
+ </tr>
406
+ <?php elseif ($quoteDataSession['code'] == '400') : ?>
407
+ <tr>
408
+ <td class="product-cart-cbz" colspan="5">
409
+ <div>
410
+ <p class="error-msg"><?php echo $quoteDataSession['title']; ?></p>
411
+ <p class="error-details"><?php echo $quoteDataSession['details']; ?></p>
412
+ </div>
413
+ </td>
414
+ </tr>
415
+ <?php endif; ?>
416
+ <?php endif; ?>
417
+ <?php endif; ?>
418
+ <?php endif; ?>
419
+ <?php endif; ?>
app/design/frontend/base/default/template/carebyzinc/checkout/cart/minicart/default.phtml CHANGED
@@ -25,35 +25,36 @@
25
  */
26
  ?>
27
  <?php
28
- $model = Mage::getModel('carebyzinc/carebyzinc');
29
- $_item = $this->getItem();
30
- $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
31
- $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
32
  ?>
33
  <li class="item" xmlns="http://www.w3.org/1999/html">
34
  <?php if ($this->hasProductUrl()): ?>
35
- <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
36
  <?php else: ?>
37
  <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
38
  <?php endif; ?>
39
  <div class="product-details">
40
  <p class="product-name">
41
- <?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?>
42
- <?php if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
43
- $name = $model->getWarrentyName($_item->getCarebyzincParentid());
44
- ?>
45
- <?php echo $this->escapeHtml($this->getProductName().$name) ?>
46
- <?php else:?>
47
- <?php echo $this->escapeHtml($this->getProductName()) ?>
48
- <?php endif; ?>
49
- <?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
 
50
 
51
  <table class="info-wrapper">
52
  <tbody>
53
  <tr>
54
  <th><?php echo $this->__('Price'); ?></th>
55
  <td>
56
- <?php if ($canApplyMsrp): ?>
57
 
58
  <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
59
 
@@ -64,34 +65,34 @@
64
  <?php echo $this->__('Excl. Tax'); ?>:
65
  <?php endif; ?>
66
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
67
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
68
  <?php else: ?>
69
  <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
70
  <?php endif; ?>
71
  <?php if (Mage::helper('weee')->getApplied($_item)): ?>
72
  <br />
73
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
74
  <small>
75
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
76
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
77
- <?php endforeach; ?>
78
  </small>
79
  <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
80
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
81
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
82
  <?php endforeach; ?>
83
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
84
  <small>
85
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
86
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
87
- <?php endforeach; ?>
88
  </small>
89
  <?php endif; ?>
90
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
91
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
92
  <?php endif; ?>
93
  <?php endif; ?>
94
- <?php endif; ?>
95
 
96
 
97
 
@@ -103,25 +104,25 @@
103
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
104
  <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
105
  <?php else: ?>
106
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
107
  <?php endif; ?>
108
  <?php if (Mage::helper('weee')->getApplied($_item)): ?>
109
  <br />
110
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
111
  <small>
112
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
114
- <?php endforeach; ?>
115
  </small>
116
  <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
117
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
118
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span>
119
  <?php endforeach; ?>
120
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
121
  <small>
122
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
123
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
124
- <?php endforeach; ?>
125
  </small>
126
  <?php endif; ?>
127
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
@@ -130,7 +131,7 @@
130
  <?php endif; ?>
131
  <?php endif; ?>
132
 
133
- <?php endif; //Can apply MSRP ?>
134
  </td>
135
  </tr>
136
  <tr class="qty-wrapper">
@@ -142,8 +143,8 @@
142
  data-item-id="<?php echo $_item->getId(); ?>"
143
  data-cart-item-id="<?php echo $_item->getSku(); ?>"
144
  class="qty cart-item-quantity input-text" name=""
145
- value="<?php echo $this->getQty()?>"
146
- <?php if ($this->isOnCheckoutPage()) echo 'disabled'; ?>
147
  />
148
 
149
  <button id="qbutton-<?php echo $_item->getId(); ?>"
@@ -152,76 +153,68 @@
152
  data-update
153
  data-cart-item-update
154
  class="button quantity-button">
155
- <?php echo $this->__('ok'); ?>
156
  </button>
157
  </td>
158
  </tr>
159
  </tbody>
160
  </table>
161
 
162
- <?php if ($isVisibleProduct): ?>
163
- <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit">
164
- <?php echo $this->__('Edit item')?>
165
- </a>
166
  |
167
- <?php if (!$this->isOnCheckoutPage()): ?>
168
  <a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>"
169
  data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
170
  class="remove">
171
- <?php echo $this->__('Remove Item') ?>
172
  </a>
173
  <?php else: ?>
174
  <span><?php echo $this->__('Remove Item') ?></span>
175
  <?php endif; ?>
176
  <?php endif ?>
177
- <?php
178
- $_options = $this->getOptionList();$i = 1;
179
- foreach ($_options as $_option) {
180
- if($_option['label'] != 'carebyzinc')
181
- $i++;
182
-
183
-
184
- }
185
-
186
-
187
- ?>
188
- <?php if($i):
189
-
190
- if ($_options = $this->getOptionList()):?>
191
- <div class="truncated">
192
- <div class="truncated_full_value">
193
- <dl class="item-options">
194
- <?php foreach ($_options as $_option) : ?>
195
- <?php if($_option['label'] != 'carebyzinc'): ?>
196
- <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
197
- <dd>
198
- <?php if (is_array($_option['value'])): ?>
199
- <?php echo nl2br(implode("\n", $_option['value'])) ?>
200
- <?php else: ?>
201
- <?php echo $_option['value'] ?>
202
- <?php endif; ?>
203
- </dd>
204
- <?php endif; ?>
205
- <?php endforeach; ?>
206
- <?php $careByZinc = $_item->getCarebyzincOption();?>
207
- <?php if($careByZinc): ?>
208
-
209
- <dt><?php echo Mage::helper('carebyzinc')->getTitle() ?></dt>
210
- <dd>
211
-
212
-
213
- <?php $carebyzincAry = (array) unserialize($careByZinc); ?>
214
- <div class="product-cart-careby">
215
- <p><?php echo $carebyzincAry['description'] ?></p>
216
-
217
- </div>
218
- </dd>
219
- <?php endif; ?>
220
 
221
- </dl>
222
- </div>
223
- <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
224
- </div>
225
- <?php endif; ?> <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  </div>
227
  </li>
25
  */
26
  ?>
27
  <?php
28
+ $model = Mage::getModel('carebyzinc/carebyzinc');
29
+ $_item = $this->getItem();
30
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
31
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
32
  ?>
33
  <li class="item" xmlns="http://www.w3.org/1999/html">
34
  <?php if ($this->hasProductUrl()): ?>
35
+ <a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
36
  <?php else: ?>
37
  <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
38
  <?php endif; ?>
39
  <div class="product-details">
40
  <p class="product-name">
41
+ <?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?>
42
+ <?php
43
+ if ($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
44
+ $name = $model->getWarrantyName($_item->getCarebyzincParentid());
45
+ ?>
46
+ <?php echo $this->escapeHtml($this->getProductName() . $name) ?>
47
+ <?php else: ?>
48
+ <?php echo $this->escapeHtml($this->getProductName()) ?>
49
+ <?php endif; ?>
50
+ <?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
51
 
52
  <table class="info-wrapper">
53
  <tbody>
54
  <tr>
55
  <th><?php echo $this->__('Price'); ?></th>
56
  <td>
57
+ <?php if ($canApplyMsrp): ?>
58
 
59
  <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
60
 
65
  <?php echo $this->__('Excl. Tax'); ?>:
66
  <?php endif; ?>
67
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
68
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?>
69
  <?php else: ?>
70
  <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
71
  <?php endif; ?>
72
  <?php if (Mage::helper('weee')->getApplied($_item)): ?>
73
  <br />
74
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
75
  <small>
76
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
77
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'], true, true); ?></span>
78
+ <?php endforeach; ?>
79
  </small>
80
  <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
81
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
82
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></small></span><br />
83
  <?php endforeach; ?>
84
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
85
  <small>
86
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
87
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></span><br />
88
+ <?php endforeach; ?>
89
  </small>
90
  <?php endif; ?>
91
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
92
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()); ?></span>
93
  <?php endif; ?>
94
  <?php endif; ?>
95
+ <?php endif; ?>
96
 
97
 
98
 
104
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
105
  <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
106
  <?php else: ?>
107
+ <?php echo $this->helper('checkout')->formatPrice($_incl - $_item->getWeeeTaxDisposition()) ?>
108
  <?php endif; ?>
109
  <?php if (Mage::helper('weee')->getApplied($_item)): ?>
110
  <br />
111
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
112
  <small>
113
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
114
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'], true, true); ?></span><br />
115
+ <?php endforeach; ?>
116
  </small>
117
  <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
118
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></small></span>
120
  <?php endforeach; ?>
121
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
122
  <small>
123
  <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
124
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'], true, true); ?></span><br />
125
+ <?php endforeach; ?>
126
  </small>
127
  <?php endif; ?>
128
  <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
131
  <?php endif; ?>
132
  <?php endif; ?>
133
 
134
+ <?php endif; //Can apply MSRP ?>
135
  </td>
136
  </tr>
137
  <tr class="qty-wrapper">
143
  data-item-id="<?php echo $_item->getId(); ?>"
144
  data-cart-item-id="<?php echo $_item->getSku(); ?>"
145
  class="qty cart-item-quantity input-text" name=""
146
+ value="<?php echo $this->getQty() ?>"
147
+ <?php if ($this->isOnCheckoutPage()) echo 'disabled'; ?>
148
  />
149
 
150
  <button id="qbutton-<?php echo $_item->getId(); ?>"
153
  data-update
154
  data-cart-item-update
155
  class="button quantity-button">
156
+ <?php echo $this->__('ok'); ?>
157
  </button>
158
  </td>
159
  </tr>
160
  </tbody>
161
  </table>
162
 
163
+ <?php if ($isVisibleProduct): ?>
164
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit">
165
+ <?php echo $this->__('Edit item') ?>
166
+ </a>
167
  |
168
+ <?php if (!$this->isOnCheckoutPage()): ?>
169
  <a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>"
170
  data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
171
  class="remove">
172
+ <?php echo $this->__('Remove Item') ?>
173
  </a>
174
  <?php else: ?>
175
  <span><?php echo $this->__('Remove Item') ?></span>
176
  <?php endif; ?>
177
  <?php endif ?>
178
+ <?php
179
+ $_options = $this->getOptionList();
180
+ $i = 1;
181
+ foreach ($_options as $_option) {
182
+ if ($_option['label'] != 'carebyzinc')
183
+ $i++;
184
+ }
185
+ ?>
186
+ <?php if ($i):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
+ if ($_options = $this->getOptionList()):
189
+ ?>
190
+ <div class="truncated">
191
+ <div class="truncated_full_value">
192
+ <dl class="item-options">
193
+ <?php foreach ($_options as $_option) : ?>
194
+ <?php if ($_option['label'] != 'carebyzinc'): ?>
195
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
196
+ <dd>
197
+ <?php if (is_array($_option['value'])): ?>
198
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
199
+ <?php else: ?>
200
+ <?php echo $_option['value'] ?>
201
+ <?php endif; ?>
202
+ </dd>
203
+ <?php endif; ?>
204
+ <?php endforeach; ?>
205
+ <?php $careByZinc = $_item->getCarebyzincOption(); ?>
206
+ <?php if ($careByZinc): ?>
207
+ <dd>
208
+ <?php $carebyzincAry = (array) unserialize($careByZinc); ?>
209
+ <div class="product-cart-careby">
210
+ <p><?php echo $carebyzincAry['description'] ?></p>
211
+ </div>
212
+ </dd>
213
+ <?php endif; ?>
214
+ </dl>
215
+ </div>
216
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
217
+ </div>
218
+ <?php endif; ?> <?php endif; ?>
219
  </div>
220
  </li>
app/design/frontend/base/default/template/carebyzinc/checkout/multishipping/item/default.phtml CHANGED
@@ -27,7 +27,7 @@
27
  <h3 class="product-name">
28
  <?php if($this->getItem()->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
29
  $model = Mage::getModel('carebyzinc/carebyzinc');
30
- $name = $model->getWarrentyName($this->getItem()->getCarebyzincParentid());
31
  ?>
32
  <?php echo $this->escapeHtml($this->getProductName().$name) ?>
33
  <?php else:?>
27
  <h3 class="product-name">
28
  <?php if($this->getItem()->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
29
  $model = Mage::getModel('carebyzinc/carebyzinc');
30
+ $name = $model->getWarrantyName($this->getItem()->getCarebyzincParentid());
31
  ?>
32
  <?php echo $this->escapeHtml($this->getProductName().$name) ?>
33
  <?php else:?>
app/design/frontend/base/default/template/carebyzinc/checkout/onepage/review/item.phtml CHANGED
@@ -30,7 +30,7 @@
30
  <h3 class="product-name">
31
  <?php if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
32
  $model = Mage::getModel('carebyzinc/carebyzinc');
33
- $name = $model->getWarrentyName($_item->getCarebyzincParentid());
34
  ?>
35
  <?php echo $this->escapeHtml($this->getProductName().$name) ?>
36
  <?php else:?>
30
  <h3 class="product-name">
31
  <?php if($_item->getProductId() == Mage::getStoreConfig('carebyzinc/general/warranty_product')):
32
  $model = Mage::getModel('carebyzinc/carebyzinc');
33
+ $name = $model->getWarrantyName($_item->getCarebyzincParentid());
34
  ?>
35
  <?php echo $this->escapeHtml($this->getProductName().$name) ?>
36
  <?php else:?>
app/design/frontend/base/default/template/carebyzinc/checkout/success.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ $zincSuccess = Mage::registry('zincSuccess');
28
+
29
+ ?>
30
+ <div class="page-title">
31
+ <h1><?php echo $this->__('Your order has been received.') ?></h1>
32
+ </div>
33
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
34
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
35
+
36
+ <?php if ($this->getOrderId()):?>
37
+ <?php if ($this->getCanViewOrder()) :?>
38
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
39
+ <?php else :?>
40
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
41
+ <?php endif;?>
42
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
43
+ <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
44
+ <p>
45
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
46
+ <?php echo $this->getChildHtml() ?>
47
+ </p>
48
+ <?php endif;?>
49
+ <?php endif;?>
50
+
51
+ <?php if ($this->getAgreementRefId()): ?>
52
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
53
+ <?php endif;?>
54
+
55
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
56
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
57
+ <ul class="disc">
58
+ <?php foreach($profiles as $profile):?>
59
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
60
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
61
+ <?php endforeach;?>
62
+ </ul>
63
+ <?php endif;?>
64
+
65
+ <div class="buttons-set">
66
+ <button type="button" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
67
+ </div>
68
+
69
+ <?php if($zincSuccess['code'] == '200' && isset($zincSuccess['url']) && $zincSuccess['url'] != '') : ?>
70
+ <script>
71
+ //<![CDATA[
72
+ jQuery(document).ready(function() {
73
+ jQuery.colorbox({
74
+ iframe: true,
75
+ href: '<?php echo $zincSuccess['url']; ?>',
76
+ innerWidth: 500,
77
+ fastIframe: false,
78
+ innerHeight: 720,
79
+ open: true
80
+ });
81
+ });
82
+ //]]>
83
+ </script>
84
+ <?php endif; ?>
85
+
app/design/frontend/base/default/template/carebyzinc/options/cart.phtml CHANGED
@@ -1,42 +1,37 @@
1
- <?php $quoteData = $this->getQuoteData();
2
- $itemId = $this->getItemId();
3
- $pId = $this->getPId();
 
4
  ?>
5
- <?php if(! empty($quoteData)): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- <?php if( is_array($quoteData)): ?>
8
- <ul class="product-list">
9
- <?php foreach($quoteData as $item): ?>
10
- <li>
11
- <div class="bx-l">
12
- <div class="squared input">
13
- <input type="radio" value="<?php echo $item['id']; ?>" id="carebyzinc_<?php echo $itemId.'_'.$item['id']; ?>" name="carebyzinc_option_<?php echo $itemId?>" onclick="updateCareByZinc(<?php echo $itemId?>)"/>
14
- <label for="carebyzinc_<?php echo $itemId.'_'.$item['id']; ?>"></label>
15
- </div>
16
- </div>
17
- <div class="bx-r">
18
- <h2 class="p-price"><?php echo Mage::helper('core')->currency($item['price_per_year']); ?></h2>
19
- <h3 class="p-name quotelabel"><?php echo $item['description']; ?></h3>
20
- </div>
21
- </li>
22
- <?php endforeach; ?>
23
- </ul>
24
- <?php $helper = Mage::helper('carebyzinc');
25
- $zip = $this->getZipData()? $this->getZipData():$helper->getZipCode();?>
26
-
27
- <div class="validation-advice carebyzinc_validation" id="advice-required-entry_<?php echo $itemId; ?>" style="display:none;"><?php echo $this->__('This is a required field.');?></div>
28
- <span><?php echo $this->__('Based on zip:')?></span> <span class="updatezip" onclick="openUpdatezip(<?php echo $itemId; ?>)"><strong><u><?php echo $zip ;?></u></strong></span>
29
- <div id="updatezipside_<?php echo $itemId; ?>" style="display:none;">
30
- <input type="text" name="zipcode_<?php echo $itemId; ?>" id="zipcode_<?php echo $itemId; ?>" value="<?php echo $zip ;?>" placeholder="Enter Zip code here" style="width:21%"/>
31
-
32
- <button class="btn-zinc showCarebyzinc" id="showCarebyzinc_<?php echo $itemId; ?>" onclick="showCarebyzinc(<?php echo $pId; ?>,<?php echo $itemId; ?>); return false;"><?php echo $this->__('Confirm')?><span id="care-loader_<?php echo $itemId; ?>" class="care-loader"></span></button>
33
-
34
- </div>
35
- <?php else:
36
- //echo $quoteData;
37
- ?>
38
- <?php endif; ?>
39
- <?php else:
40
- //echo 'No quotes available';
41
- ?>
42
  <?php endif; ?>
1
+ <?php
2
+ $quoteData = $this->getQuoteData();
3
+ $itemId = $this->getItemId();
4
+ $pId = $this->getPId();
5
  ?>
6
+ <?php if (!empty($quoteData)): ?>
7
+ <?php if (is_array($quoteData)): ?>
8
+ <ul class="product-list">
9
+ <?php foreach ($quoteData as $item): ?>
10
+ <li>
11
+ <div class="bx-l">
12
+ <div class="squared input">
13
+ <input type="radio" value="<?php echo $item['id']; ?>" id="carebyzinc_<?php echo $itemId . '_' . $item['id']; ?>" name="carebyzinc_option_<?php echo $itemId ?>" onclick="updateCareByZinc(<?php echo $itemId ?>)"/>
14
+ <label for="carebyzinc_<?php echo $itemId . '_' . $item['id']; ?>"></label>
15
+ </div>
16
+ </div>
17
+ <div class="bx-r">
18
+ <h2 class="p-price"><?php echo Mage::helper('core')->currency($item['price_per_year']); ?></h2>
19
+ <h3 class="p-name quotelabel"><?php echo $item['description']; ?></h3>
20
+ </div>
21
+ </li>
22
+ <?php endforeach; ?>
23
+ </ul>
24
+ <?php $helper = Mage::helper('carebyzinc');
25
+ $zip = $this->getZipData() ? $this->getZipData() : $helper->getZipCode();
26
+ ?>
27
 
28
+ <div class="validation-advice carebyzinc_validation" id="advice-required-entry_<?php echo $itemId; ?>"><?php echo $this->__('This is a required field.'); ?></div>
29
+ <span class="cart-selected-zipcode"><?php echo $this->__('Based on zip:') ?></span> <span class="updatezip" onclick="openUpdatezip(<?php echo $itemId; ?>)"><strong><u><?php echo $zip; ?></u></strong></span>
30
+ <div class="cart-update-zipcode" id="updatezipside_<?php echo $itemId; ?>">
31
+ <input type="text" name="zipcode_<?php echo $itemId; ?>" id="zipcode_<?php echo $itemId; ?>" value="<?php echo $zip; ?>" placeholder="Enter Zip code here" style="width:21%"/>
32
+ <button class="btn-zinc showCarebyzinc" id="showCarebyzinc_<?php echo $itemId; ?>" onclick="showCarebyzinc(<?php echo $pId; ?>,<?php echo $itemId; ?>); return false;"><?php echo $this->__('Confirm') ?><span id="care-loader_<?php echo $itemId; ?>" class="care-loader"></span></button>
33
+ </div>
34
+ <?php else: ?>
35
+ <?php endif; ?>
36
+ <?php else: ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  <?php endif; ?>
app/design/frontend/base/default/template/carebyzinc/options/default.phtml CHANGED
@@ -1,48 +1,40 @@
1
- <?php $quoteData = $this->getQuoteData();?>
2
- <?php if(! empty($quoteData)): ?>
3
- <?php if( is_array($quoteData)): ?>
4
- <div class="product-wrap">
5
 
6
- <ul class="product-list">
7
- <?php foreach($quoteData as $item): ?>
8
- <li>
9
- <div class="bx-l">
10
- <div class="squared input">
11
- <input type="radio" value="<?php echo $item['id']; ?>" id="carebyzinc_<?php echo $item['id']; ?>" name="carebyzinc_option" onclick="checkAction(this)"/>
12
- <label for="carebyzinc_<?php echo $item['id']; ?>"></label>
13
- </div>
14
- </div>
15
- <div class="bx-r">
16
- <h2 class="p-price"><?php echo Mage::helper('core')->currency($item['price_per_year']); ?></h2>
17
- <h3 class="p-name quotelabel"><?php echo $item['description']; ?></h3>
18
- </div>
19
- </li>
20
- <?php endforeach; ?>
21
- </ul>
22
- </div>
23
- <script>
24
- //<![CDATA[
25
- jQuery(".quotelabel").on("click","a", function(event){
26
- event.preventDefault();
27
- var elementURL = jQuery(this).attr("href");
28
- jQuery.colorbox({iframe: true, href: elementURL, innerWidth: 645,fastIframe: false, innerHeight: 509,width:"70%"});
29
- });
30
- //]]>
31
- </script>
32
- <?php else:?>
33
- <div id="warning_div"><?php echo $quoteData;?></div>
34
- <script>
35
- //<![CDATA[
36
- hideDivData();
37
- function hideDivData(){
38
- setTimeout(function() {
39
- jQuery('#warning_div').fadeOut('fast');
40
- }, 1000);
41
- }
42
- //]]>
43
- </script>
44
- <?php endif; ?>
45
- <?php else:?>
46
- <p style="color:red;"><?php echo $this->__( 'No quotes available');?>
47
- </p>
48
  <?php endif; ?>
1
+ <?php $quoteData = $this->getQuoteData(); ?>
2
+ <?php if(!empty($quoteData)): ?>
3
+ <?php if( is_array($quoteData) && $quoteData['code'] == '200') : ?>
4
+ <div class="product-wrap">
5
 
6
+ <ul class="product-list">
7
+ <?php foreach($quoteData['price'] as $item): ?>
8
+ <li>
9
+ <div class="bx-l">
10
+ <div class="squared input">
11
+ <input type="radio" value="<?php echo $item['id']; ?>" id="carebyzinc_<?php echo $item['id']; ?>" name="carebyzinc_option" onclick="checkAction(this)"/>
12
+ <label for="carebyzinc_<?php echo $item['id']; ?>"></label>
13
+ </div>
14
+ </div>
15
+ <div class="bx-r">
16
+ <h2 class="p-price"><?php echo Mage::helper('core')->currency($item['price_per_year']); ?></h2>
17
+ <h3 class="p-name quotelabel"><?php echo $item['description']; ?></h3>
18
+ </div>
19
+ </li>
20
+ <?php endforeach; ?>
21
+ </ul>
22
+ </div>
23
+ <script>
24
+ //<![CDATA[
25
+ jQuery(".quotelabel").on("click","a", function(event){
26
+ event.preventDefault();
27
+ var elementURL = jQuery(this).attr("href");
28
+ jQuery.colorbox({iframe: true, href: elementURL, innerWidth: 645,fastIframe: false, innerHeight: 509,width:"70%"});
29
+ });
30
+ //]]>
31
+ </script>
32
+ <?php elseif ($quoteData['code'] == '400') : ?>
33
+ <div id="warning_div">
34
+ <p class="error-msg"><?php echo $quoteData['title']; ?></p>
35
+ <p class="error-details"><?php echo $quoteData['details']; ?></p>
36
+ </div>
37
+ <?php endif; ?>
38
+ <?php else : ?>
39
+ <p class="error-msg"><?php echo $this->__( 'No quotes available');?></p>
 
 
 
 
 
 
 
 
40
  <?php endif; ?>
app/design/frontend/base/default/template/carebyzinc/sales/order/shipment/items/renderer/default.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?>
29
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
30
+ <td><h4 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h4>
31
+ <?php
32
+ $careByZinc = $this->getItem()->getOrderItem()->getCarebyzincOption();
33
+ ?>
34
+ <?php if($careByZinc): ?>
35
+ <?php $carebyzincAry = (array) unserialize($careByZinc); ?>
36
+ <div class="product-cart-careby">
37
+ <p><?php echo $carebyzincAry['description'] ?></p>
38
+ <p class="care-price"><?php echo $this->getOrder()->formatPrice($carebyzincAry['price_per_year']) ?></p>
39
+ <p class="care-prov"><span>Provider:</span> <?php echo $carebyzincAry['provider'] ?></p>
40
+ <?php $order = Mage::getModel('carebyzinc/order')->load($this->getItem()->getOrderItem()->getId(),'item_id');?>
41
+ <p><span>Policy Key:</span> <?php echo $order->getCarebyzincKey(); ?></p>
42
+ </div>
43
+
44
+ <?php endif; ?>
45
+ <?php if($_options = $this->getItemOptions()): ?>
46
+ <dl class="item-options">
47
+ <?php foreach ($_options as $_option) : ?>
48
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
49
+ <?php if (!$this->getPrintStatus()): ?>
50
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
51
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
52
+ <?php echo $_formatedOptionValue['value'] ?>
53
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
54
+ <div class="truncated_full_value">
55
+ <dl class="item-options">
56
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
57
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
58
+ </dl>
59
+ </div>
60
+ <?php endif; ?>
61
+ </dd>
62
+ <?php else: ?>
63
+ <dd><?php echo $this->escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?></dd>
64
+ <?php endif; ?>
65
+ <?php endforeach; ?>
66
+ </dl>
67
+ <?php endif; ?>
68
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
69
+ <?php if ($addInfoBlock) :?>
70
+ <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?>
71
+ <?php endif; ?>
72
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
73
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
74
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
75
+ <?php endif; ?>
76
+ </td>
77
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
78
+ <td class="a-center"><?php echo $_item->getQty()*1 ?></td>
79
+ </tr>
js/carebyzinc/functions.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ jQuery(document).ready(function () {
2
+ jQuery('body.adminhtml-catalog-product-edit a[title="Zinc Admin"]').hide();
3
+ });
media/catalog/product/zinc/warranty.png DELETED
Binary file
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>zinc</name>
4
- <version>1.0.7</version>
5
  <stability>stable</stability>
6
- <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Zinc is an application to allow merchants cross sell warranties and product protections online.</summary>
10
  <description>Zinc enables online merchants to seamlessly offer product protection insurance and warranty plans for their products. </description>
11
- <notes>Fix Configurable product issues and fixed minor bugs</notes>
12
- <authors><author><name>Sam Li</name><user>ZincPlatform</user><email>sam.li@zincplatform.com</email></author></authors>
13
- <date>2017-04-19</date>
14
- <time>04:21:06</time>
15
- <contents><target name="magelocal"><dir name="Zinc"><dir name="Carebyzinc"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="dc6cb39059a6be0f4388e6157156932d"/><dir name="Renderer"><file name="Category.php" hash="61226784107fb456d937264d785c33c8"/><file name="Manufacturer.php" hash="1161494098478dc016bce23869806c05"/><file name="Model.php" hash="8c59d310ea275521c30a41c0269683c2"/><file name="Subcategory.php" hash="5b72ca48d2f4a50646fe799448f6ccd0"/></dir></dir></dir><dir name="Order"><file name="Grid.php" hash="f3686d6d5eb5084fb6a6ff52d10e2700"/></dir><file name="Order.php" hash="8ad16b270a3d721125f598582d59065b"/><dir name="Product"><dir name="Edit"><file name="Form.php" hash="676122e90b68bfec48e7d8c32b330ea8"/><dir name="Tab"><file name="Form.php" hash="14aed4e9c8d3fc736c9358c010cadf1a"/></dir><file name="Tabs.php" hash="db637798104873a38241fe683f511e27"/></dir><file name="Edit.php" hash="504cc82857251201ff83bd10544d5927"/><file name="Grid.php" hash="c471ae0ff3aa9ac5a2b891c87df221fb"/></dir><file name="Product.php" hash="e603838ed67849456c5230395d081e1b"/><dir name="System"><dir name="Config"><file name="Tokenvalidate.php" hash="24e6f31db4da9d1bbb1b8380b42d1f05"/></dir></dir></dir><file name="Carebyzinc.php" hash="e7cab3fcb5c8792677a7db8d39603d6a"/></dir><dir name="Helper"><file name="Data.php" hash="91ced6d138a68348415e034a5035de63"/></dir><dir name="Model"><file name="Carebyzinc.php" hash="bf7341c7afc41330a8e56a88bfce28fb"/><dir name="Checkout"><file name="Cart.php" hash="be75cc17a7593589f50d2b3424c2ba2f"/><file name="Multishipping.php" hash="0dda682d23bf5b96c8d11c3da3d9bfa4"/></dir><dir name="Entity"><file name="Category.php" hash="cfca0b90e178b2f695236925d4318df1"/><file name="Subcategory.php" hash="41ba25ee7a4d07a95c27f30ac0bf69dc"/></dir><dir name="Mysql4"><dir name="Order"><file name="Collection.php" hash="73eb61cc74cfdd568f1644c664a25ed6"/></dir><file name="Order.php" hash="fdc62f0551b1714f7c0e7fec8e87495c"/></dir><file name="Observer.php" hash="94070127ee6b2e773f9351a6038ab44a"/><file name="Order.php" hash="6c4fbce789985b6fcb4b1a94749b74f2"/><dir name="Sales"><file name="Quote.php" hash="65cb7a95b7c01e1ee259e9ab38e73ece"/></dir><dir name="System"><dir name="Config"><file name="Protocol.php" hash="7fa3b71a3ff8d7c50a9c7fd0dd02062f"/><file name="Source.php" hash="2e29cb2b89d849ca20bcfde1648c6dd9"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CarebyzincController.php" hash="17c600837868272b8d052f2599e0e70f"/><file name="OrderController.php" hash="abb2466958fa6f7b9ed13b5675e06f5c"/><file name="ProductController.php" hash="bbb425fa6535637df84114baea24f085"/><dir name="Sales"><dir name="Order"><file name="CreditmemoController.php" hash="81f7bcad7606cb1a3fe808259cd47173"/></dir></dir></dir><file name="CartController.php" hash="b3f27702781c1e261c6730b2e5b90b00"/><file name="IndexController.php" hash="cdc4f06db9e95549a30f6475b7032aa9"/><dir name="Sales"><file name="OrderController.php" hash="0339596d5830e8c1de7f47b86331a47a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="06cfc2ccc3fe727bee732ff3dd6df96f"/><file name="config.xml" hash="39b9912c98e9e2b179973b8e8252cc79"/><file name="system.xml" hash="2cb40531a4b96af83ee4c75f3b9f62cb"/></dir><dir name="sql"><dir name="carebyzinc_setup"><file name="mysql4-install-0.1.0.php" hash="c342593327c1d0428217b315dcdced1c"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="108da13421767fab0083f7c4cc9b16e2"/><file name="mysql4-upgrade-0.2.0-1.0.0.php" hash="10ebb8695adeba50e281b39ad0cf20ed"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="761f18c5ecf1635e95c597e6ee137f45"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="fd29cdd9a47b882ecea7de944d8e4d38"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="ac78f6811e781b4a03233188918658d3"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="b661111a5ded4c7604932caa6467ecb7"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="0a5c1d77cfa3660f8976c4dec907e338"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="21528eaf2e8d493488fdfe1073292073"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="7a657189520bd0ca1f646245c7158d12"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zinc_Carebyzinc.xml" hash="4d2b3b715ff40beadbf897a373561e85"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="zinc_carebyzinc.xml" hash="17338a9719d71165dac38c10839d86ad"/></dir><dir name="template"><dir name="carebyzinc"><file name="carebyzinc_massaction.phtml" hash="5768f1b539cb3d60872e20ec40710266"/><dir name="order"><dir name="creditmemo"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="81b8edfa17f0baec00a2d1fb5f9afe03"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="be2417354e4035669c7722856ea7beea"/></dir></dir></dir></dir><dir name="invoice"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="ec89a299e6cf7068a24580c7cbaa1c64"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="068e7689e80cc4f3ddef5e34731f1407"/></dir></dir></dir></dir><dir name="shipment"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="1f6dc82e72dff2a2f89df63eb04adfb3"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="57d8d0365b5a8521094dd972f0afd91f"/></dir></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="2ee24c3069f693e28e6b82710b4d5f79"/></dir></dir></dir></dir><dir name="system"><file name="tokenvalidate.phtml" hash="c8f6847678e6327cc168d19bb1f889f9"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="zinc_carebyzinc.xml" hash="3cae8cea33d4a18466430e9aa3502f1f"/></dir><dir name="template"><dir name="carebyzinc"><file name="carebyzinc.phtml" hash="3f7d99825019f79775e197ecfad752c4"/><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="a96879c6260e377345577d04caf3de9a"/></dir><dir name="minicart"><file name="default.phtml" hash="02d2455538277a570a0e1066002bb6f9"/></dir></dir><file name="cart.phtml" hash="6f93a00d50bc31b81386229776bd148a"/><dir name="multishipping"><dir name="item"><file name="default.phtml" hash="60d4b1f26ff75401ce296ce2f8d6182f"/></dir></dir><dir name="onepage"><dir name="review"><file name="info.phtml" hash="af3945f40e8846ed50f7ea100cb5988d"/><file name="item.phtml" hash="3c8272ed8901359d1906850b3dbb03b6"/></dir></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="creditmemo"><file name="default.phtml" hash="8a2ac27dd9b6c8dc8b4bae6a7e5ddda8"/></dir><dir name="invoice"><file name="default.phtml" hash="e12be1097a1f18c0db7882c11f7a6641"/></dir><dir name="order"><file name="default.phtml" hash="793605d82ba878ccbdf42dd12f28c03d"/></dir><dir name="shipment"><file name="default.phtml" hash="f6402f09d846768acb7ce2deee933f2e"/></dir></dir></dir></dir><dir name="options"><file name="cart.phtml" hash="18e0240d1cf783bf2ef2aed6d185da27"/><file name="default.phtml" hash="11e1ef3b8149de578498321f22d94b4d"/></dir><dir name="sales"><dir name="order"><dir name="creditmemo"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="9453ba266319722eb98d8623e7d2b430"/></dir></dir></dir><dir name="invoice"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="bc9aa0720ab66aac609def09cb1a9b34"/></dir></dir></dir><dir name="items"><dir name="renderer"><file name="default.phtml" hash="40e189989f63b6bb40fdc284c75a66ee"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="carebyzinc"><file name="jquery.colorbox.js" hash="931988f42363a4824812885ffc27d99e"/><file name="jquery.min.js" hash="219073097031d9c1a95a1291d66f3a10"/><file name="noConflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="product.js" hash="007f9365ae78449497daa03e83169fd3"/></dir></dir></target><target name="magemedia"><dir name="catalog"><dir name="product"><dir name="zinc"><file name="warranty.png" hash="e7dc52b5e26fc42bb62e5ad21b3004ba"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="carebyzinc"><dir name="css"><file name="carebyzinc.css" hash="3d4ef0a233b948c06df939a5e6626346"/><file name="colorbox.css" hash="4b7379294ea68f88b0bba06cd803a646"/><dir name="images"><file name="border.png" hash="b593eef877678cd14706323d199e047d"/><file name="cancel.png" hash="7d54d20abee3ff4e694a98798f261d09"/><file name="care-preloader.gif" hash="eba7ca3ef216ece9ab9974f0cc524536"/><file name="controls.png" hash="05ad6ec2cbc17a7f3d1b1aac6dbe770d"/><file name="loading.gif" hash="f1d7268ba36b264f8b33b5b2bf0f108c"/><file name="loading_background.png" hash="7649e6a7c32b6d29ce63255a30b7405a"/><file name="overlay.png" hash="8918e1f6fbaae9e65880f3eff6fa3713"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="carebyzinc"><dir name="css"><file name="carebyzinc.css" hash="3d4ef0a233b948c06df939a5e6626346"/><file name="colorbox.css" hash="4b7379294ea68f88b0bba06cd803a646"/><dir name="images"><file name="border.png" hash="b593eef877678cd14706323d199e047d"/><file name="cancel.png" hash="7d54d20abee3ff4e694a98798f261d09"/><file name="care-preloader.gif" hash="eba7ca3ef216ece9ab9974f0cc524536"/><file name="controls.png" hash="05ad6ec2cbc17a7f3d1b1aac6dbe770d"/><file name="loading.gif" hash="f1d7268ba36b264f8b33b5b2bf0f108c"/><file name="loading_background.png" hash="7649e6a7c32b6d29ce63255a30b7405a"/><file name="overlay.png" hash="8918e1f6fbaae9e65880f3eff6fa3713"/></dir></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>zinc</name>
4
+ <version>1.0.8</version>
5
  <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Zinc is an application to allow merchants cross sell warranties and product protections online.</summary>
10
  <description>Zinc enables online merchants to seamlessly offer product protection insurance and warranty plans for their products. </description>
11
+ <notes>Code refactoring and bug fixing.</notes>
12
+ <authors><author><name>ZincPlatform</name><user>ZincPlatform</user><email>support@zincplatform.com</email></author></authors>
13
+ <date>2017-07-11</date>
14
+ <time>11:59:20</time>
15
+ <contents><target name="magelocal"><dir name="Zinc"><dir name="Carebyzinc"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="7f3434e6f26bc7f4a539bf9071a8359c"/><dir name="Renderer"><file name="Category.php" hash="61226784107fb456d937264d785c33c8"/><file name="List.php" hash="821b28248cb94a64b38189bbfe4fe42d"/><file name="Manufacturer.php" hash="1161494098478dc016bce23869806c05"/><file name="Model.php" hash="8c59d310ea275521c30a41c0269683c2"/><file name="Subcategory.php" hash="5b72ca48d2f4a50646fe799448f6ccd0"/></dir></dir></dir><dir name="Order"><file name="Grid.php" hash="f3686d6d5eb5084fb6a6ff52d10e2700"/></dir><file name="Order.php" hash="8ad16b270a3d721125f598582d59065b"/><dir name="Product"><dir name="Edit"><file name="Form.php" hash="63baec7aeefac643a7da6b48ab98d713"/><dir name="Tab"><file name="Form.php" hash="420703c8c9e7a157e651082f1b10596d"/></dir><file name="Tabs.php" hash="db637798104873a38241fe683f511e27"/></dir><file name="Edit.php" hash="504cc82857251201ff83bd10544d5927"/><file name="Grid.php" hash="2f0427086965a89dcbcef0469e0a4ffc"/></dir><file name="Product.php" hash="e603838ed67849456c5230395d081e1b"/><dir name="System"><dir name="Config"><file name="Importorders.php" hash="55dca9cb946d63358606f96857300803"/><file name="Tokenvalidate.php" hash="24e6f31db4da9d1bbb1b8380b42d1f05"/></dir></dir></dir><file name="Carebyzinc.php" hash="dddf72e64c21b3bc6fd02e5c0685a715"/></dir><dir name="Helper"><file name="Data.php" hash="62848eb499a0a070ff9171b447e95519"/></dir><dir name="Model"><file name="Carebyzinc.php" hash="ce423c42201c4d9822550ead47a56f35"/><dir name="Checkout"><file name="Cart.php" hash="0fb7f345a2669c078a94c02c6d905b1b"/><file name="Multishipping.php" hash="0dda682d23bf5b96c8d11c3da3d9bfa4"/></dir><dir name="Entity"><file name="Category.php" hash="cfca0b90e178b2f695236925d4318df1"/><file name="Subcategory.php" hash="41ba25ee7a4d07a95c27f30ac0bf69dc"/></dir><dir name="Mysql4"><dir name="Order"><file name="Collection.php" hash="73eb61cc74cfdd568f1644c664a25ed6"/></dir><file name="Order.php" hash="fdc62f0551b1714f7c0e7fec8e87495c"/></dir><file name="Observer.php" hash="7a771afa6d9a4f12fe196cea9ed76602"/><file name="Order.php" hash="6a45642f112578422c596463a39acc99"/><dir name="Sales"><file name="Quote.php" hash="65cb7a95b7c01e1ee259e9ab38e73ece"/></dir><dir name="System"><dir name="Config"><file name="Source.php" hash="2ebef08a6a336cb0fe45e18ddbb06d54"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CarebyzincController.php" hash="d49146b8c84e891d327800d1e61d0cb8"/><file name="OrderController.php" hash="abb2466958fa6f7b9ed13b5675e06f5c"/><file name="ProductController.php" hash="f98c11da8bc62983db16712408b4b162"/><dir name="Sales"><dir name="Order"><file name="CreditmemoController.php" hash="81f7bcad7606cb1a3fe808259cd47173"/></dir></dir></dir><file name="CartController.php" hash="d6f865c2e0223aaab1c84d5d79c3114c"/><dir name="Checkout"><file name="OnepageController.php" hash="4aebfc721c0593239e54987a6336fa14"/></dir><file name="IndexController.php" hash="b202ce337ce5d206f73b00c06ba3a510"/><dir name="Sales"><file name="OrderController.php" hash="0339596d5830e8c1de7f47b86331a47a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="dc2bd98908b138920fcd9d5a27280fd2"/><file name="config.xml" hash="7ae480c644b90b4a90aaeef090aa8e92"/><file name="system.xml" hash="cf02a01fde15b2920826c834610a0af0"/></dir><dir name="sql"><dir name="carebyzinc_setup"><file name="mysql4-install-0.1.0.php" hash="c342593327c1d0428217b315dcdced1c"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="108da13421767fab0083f7c4cc9b16e2"/><file name="mysql4-upgrade-0.2.0-1.0.0.php" hash="10ebb8695adeba50e281b39ad0cf20ed"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="46ca427c76ee07d4916df7990671beb8"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="fd29cdd9a47b882ecea7de944d8e4d38"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="ac78f6811e781b4a03233188918658d3"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="b661111a5ded4c7604932caa6467ecb7"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="0a5c1d77cfa3660f8976c4dec907e338"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="21528eaf2e8d493488fdfe1073292073"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="3fb3b72336a3642422d97df4123f12a2"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="199a4328202004a26e120672fa1b096f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="zinc_carebyzinc.xml" hash="857f96af2d497873f6749f53734cec92"/></dir><dir name="template"><dir name="carebyzinc"><file name="carebyzinc.phtml" hash="f6be62b5ebec72302b4d663e42612190"/><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="aac8aaa67b58880a246d4dc2e19e8e6f"/></dir><dir name="minicart"><file name="default.phtml" hash="5dc0a620ef214809901418354cb1a92d"/></dir></dir><file name="cart.phtml" hash="e724bf79c886b8696da549816a8020d2"/><dir name="multishipping"><dir name="item"><file name="default.phtml" hash="5584c3659e9351ce473ec3cacfe949d0"/></dir></dir><dir name="onepage"><dir name="review"><file name="info.phtml" hash="af3945f40e8846ed50f7ea100cb5988d"/><file name="item.phtml" hash="c25cf5accf1bd2f439485540ce64e39a"/></dir></dir><file name="success.phtml" hash="9a2427648f11548cd3889e466364e880"/></dir><dir name="email"><dir name="order"><dir name="items"><dir name="creditmemo"><file name="default.phtml" hash="8a2ac27dd9b6c8dc8b4bae6a7e5ddda8"/></dir><dir name="invoice"><file name="default.phtml" hash="e12be1097a1f18c0db7882c11f7a6641"/></dir><dir name="order"><file name="default.phtml" hash="793605d82ba878ccbdf42dd12f28c03d"/></dir><dir name="shipment"><file name="default.phtml" hash="f6402f09d846768acb7ce2deee933f2e"/></dir></dir></dir></dir><dir name="options"><file name="cart.phtml" hash="fdb73ae2f515fb1f897a850bcb20125f"/><file name="default.phtml" hash="c22ddd6b332c74d99cc24424e6e14115"/></dir><dir name="sales"><dir name="order"><dir name="creditmemo"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="9453ba266319722eb98d8623e7d2b430"/></dir></dir></dir><dir name="invoice"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="bc9aa0720ab66aac609def09cb1a9b34"/></dir></dir></dir><dir name="items"><dir name="renderer"><file name="default.phtml" hash="40e189989f63b6bb40fdc284c75a66ee"/></dir></dir><dir name="shipment"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="e8ac8a72cb4a4e9b5d5fc75b4d542225"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="zinc_carebyzinc.xml" hash="9e98d75239efecef07c87293d753307a"/></dir><dir name="template"><dir name="carebyzinc"><file name="carebyzinc_massaction.phtml" hash="15553da17d9dc7e3866765c34e9323f8"/><dir name="order"><dir name="creditmemo"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="81b8edfa17f0baec00a2d1fb5f9afe03"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="be2417354e4035669c7722856ea7beea"/></dir></dir></dir></dir><dir name="invoice"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="ec89a299e6cf7068a24580c7cbaa1c64"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="068e7689e80cc4f3ddef5e34731f1407"/></dir></dir></dir></dir><dir name="shipment"><dir name="create"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="1f6dc82e72dff2a2f89df63eb04adfb3"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="57d8d0365b5a8521094dd972f0afd91f"/></dir></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="default.phtml" hash="2ee24c3069f693e28e6b82710b4d5f79"/></dir></dir></dir></dir><dir name="system"><file name="importorders.phtml" hash="cc9053d6df5c152512998a088c698289"/><file name="tokenvalidate.phtml" hash="c8f6847678e6327cc168d19bb1f889f9"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zinc_Carebyzinc.xml" hash="4d2b3b715ff40beadbf897a373561e85"/></dir></target><target name="mage"><dir name="js"><dir name="carebyzinc"><file name="functions.js" hash="ec1d2b5ffe59046ecb3bda26a0b4d2ab"/><file name="jquery.colorbox.js" hash="931988f42363a4824812885ffc27d99e"/><file name="jquery.min.js" hash="219073097031d9c1a95a1291d66f3a10"/><file name="noConflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="product.js" hash="007f9365ae78449497daa03e83169fd3"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="carebyzinc"><file name="carebyzinc.css" hash="2de28b23400c973dbe9b7150283d01d6"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="carebyzinc"><dir name="css"><file name="carebyzinc.css" hash="1a15002fb7ff3d42fa67e9090c97627d"/><file name="colorbox.css" hash="4b7379294ea68f88b0bba06cd803a646"/><dir name="images"><file name="border.png" hash="b593eef877678cd14706323d199e047d"/><file name="cancel.png" hash="7d54d20abee3ff4e694a98798f261d09"/><file name="care-preloader.gif" hash="eba7ca3ef216ece9ab9974f0cc524536"/><file name="controls.png" hash="05ad6ec2cbc17a7f3d1b1aac6dbe770d"/><file name="loading.gif" hash="f1d7268ba36b264f8b33b5b2bf0f108c"/><file name="loading_background.png" hash="7649e6a7c32b6d29ce63255a30b7405a"/><file name="overlay.png" hash="8918e1f6fbaae9e65880f3eff6fa3713"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="carebyzinc"><dir name="css"><file name="carebyzinc.css" hash="1a15002fb7ff3d42fa67e9090c97627d"/><file name="colorbox.css" hash="1cac861e234b26a286df11e645891fa7"/><dir name="images"><file name="border.png" hash="b593eef877678cd14706323d199e047d"/><file name="cancel.png" hash="7d54d20abee3ff4e694a98798f261d09"/><file name="care-preloader.gif" hash="eba7ca3ef216ece9ab9974f0cc524536"/><file name="controls.png" hash="05ad6ec2cbc17a7f3d1b1aac6dbe770d"/><file name="loading.gif" hash="f1d7268ba36b264f8b33b5b2bf0f108c"/><file name="loading_background.png" hash="7649e6a7c32b6d29ce63255a30b7405a"/><file name="overlay.png" hash="8918e1f6fbaae9e65880f3eff6fa3713"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.6.0</min><max>7.0.0</max></php></required></dependencies>
18
  </package>
skin/adminhtml/default/default/carebyzinc/carebyzinc.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .guess-select {
2
+ padding: 6px 0 0 10px;
3
+ }
skin/frontend/base/default/carebyzinc/css/carebyzinc.css CHANGED
@@ -3,107 +3,373 @@
3
  * Copyright 2016-2017
4
  *
5
  */
6
- .product-box { margin-bottom: 20px; }
7
- .product-container { border: 1px solid #efefef; border-radius: 2px;display: none; }
8
- .checkout-cart-index .product-container { border-width: 0; }
9
- .checkout-cart-index .product-container .updatezip { cursor: pointer; }
10
- .checkout-cart-index .product-box { border: 1px solid #efefef; }
11
- .product-title { font-size: 16px;text-transform: capitalize; padding: 10px 5px 0 0; margin-bottom: 10px;display: inline-block;}
12
- .carebyzincCnt .product-title { font-size: 13px }
13
- .carebyzincCnt.product-container .product-title + input { font-size: 13px;height: 25px; }
14
- .product-wrap { border: 1px solid #ccc;padding: 10px;border-radius: 2px; }
15
- .carebyzincCnt{display: none;}
16
- .product-list { list-style-type: none;padding-left: 0; margin: 0;}
17
- .bx-l,.bx-r { float: left; position: relative; }
18
- .bx-l { width: 25px; }
19
- .bx-r { width: -webkit-calc(100% - 25px); width: -moz-calc(100% - 25px); width: calc(100% - 25px); }
20
- .product-list .input input[type=radio] ,.squared input[type=radio] { visibility: hidden; }
21
- .product-list li { color: #535353;border-bottom: 1px solid #f7f7f7;padding: 5px 5px;transition: all .2s; }
22
- .product-list li:last-child { border-bottom: 0; }
23
- .product-list li:hover{ background: #f7f7f7; }
24
- .product-list li:after { clear: both; content: '.'; display: block; visibility: hidden; height: 0; }
25
- .product-list li .p-name { font-size: 11px;text-transform: capitalize;margin: 0; display: inline-block;}
26
- .product-list li .p-price,.care-price { font-size: 15px;color: #007ead;font-weight: 600; display: inline-block;/* margin: 2px 0; margin-left: 15px;*/}
27
- .care-price { /*color: #636363;*/ color:#007ead; }
28
- .product-list li .p-provider,.care-prov { text-transform: lowercase; font-size: 11px;font-weight: normal; font-style: italic;}
29
- .product-list li .p-provider span ,.care-prov span { text-transform: uppercase;position: relative; font-weight: 600; }
30
- .product-list li .p-provider span:after { content: ":";position: relative; margin: 0 5px; font-weight: bold;}
31
- .squared { width: 20px; margin-right: 10px; position: relative; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  .squared label {
33
- cursor: pointer;
34
- position: absolute;
35
- width: 15px;
36
- height: 15px;
37
- top: 3px;
38
- left: 0;
39
- border-radius: 2px;
40
- border: 2px solid #0291c6;
41
- /*-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
42
- -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
43
- box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);*/
44
- /*background: -webkit-linear-gradient(top, #0291c6 0%, #006d95 100%);
45
- background: -moz-linear-gradient(top, #0291c6 0%, #006d95 100%);
46
- background: -o-linear-gradient(top, #0291c6 0%, #006d95 100%);
47
- background: -ms-linear-gradient(top, #0291c6 0%, #006d95 100%);
48
- background: linear-gradient(top, #0291c6 0%, #006d95 100%);*/
49
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
50
  }
 
51
  .squared label:after {
52
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
53
- filter: alpha(opacity=0);
54
- opacity: 0;
55
- content: '';
56
- position: absolute;
57
- width: 7px;
58
- height: 4px;
59
- background: transparent;
60
- top: 3px;
61
- left: 2.5px;
62
- border: 2px solid #006d95;
63
- border-top: none;
64
- border-right: none;
65
- -webkit-transform: rotate(-45deg);
66
- -moz-transform: rotate(-45deg);
67
- -o-transform: rotate(-45deg);
68
- -ms-transform: rotate(-45deg);
69
- transform: rotate(-45deg);
70
  }
 
71
  .squared label:hover::after {
72
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
73
- filter: alpha(opacity=30);
74
- opacity: 0.3;
75
  }
 
76
  .squared input[type=radio]:checked + label:after {
77
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
78
- filter: alpha(opacity=100);
79
- opacity: 1;
80
  }
81
- .btn-zinc { background:#037daa;border:none;outline:none;color:#fff;border-radius:2px;padding:2px 10px;font-size:13px;margin-top: 0px;cursor: pointer; position: relative;height: 30px;line-height: 18px;}
82
- .carebyzincCnt.product-container .btn-zinc { height: 25px; }
83
- .add-to-cart-wrapper .product-box #zipcode { margin-top: 5px; }
84
- .btn-zinc:hover,.btn-zinc:active { background: #017099; }
85
- .btn-zinc.selected { background: #868686; }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
- .product-container .button { margin: auto;color: #fff !important; margin-bottom: 5px;background: #3399cc !important; margin-top: 5px; border-radius: 2px; padding: 1px 5px !important; font-size: 12px;margin-left: 30px;line-height: 18px;}
89
- .product-container .button + span,.product-container .button + span.updatezip { font-size: 13px; }
90
- .remove_warranty { background: url(images/cancel.png) no-repeat; display: inline-block; width: 13px; height: 13px; background-size: 100%; }
91
- .product-cart-careby .warranty_desc { font-weight: bolder;display: inline-block; /*color: #3399cc;*/}
92
 
93
- .care-loader { background: rgba(255, 255, 255, 0.8) url(images/care-preloader.gif) no-repeat center center; height: 100%; width: 100%; display:none; background-size: 20px; position: absolute; top: 0; left: 0; }
94
- #care-loader.show { display: inline-block; }
95
- /*#care-loader.hide { display: inline-block; }*/
96
- /*.care-loader { display: none; }*/
97
- .product-cart-careby { padding-left: 15px; }
98
 
 
 
 
 
99
 
100
- @media only screen and (max-width: 599px) {
101
- .product-list li .p-price .price, .care-price .price { font-weight: 600 !important; }
102
- .product-list li .p-price, .care-price { display: block;margin-left: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
- .desc_popup{
105
- margin: 12px 10px;
106
- padding-top: 7px;
107
- display:none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
- .product-list li .p-price,.care-price { margin: 0 7px 0 2px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Copyright 2016-2017
4
  *
5
  */
6
+
7
+ .error-msg {
8
+ color: #f00;
9
+ }
10
+
11
+ .error-details {
12
+ font-size: 12px;
13
+ }
14
+
15
+ .product-box {
16
+ margin-bottom: 20px;
17
+ }
18
+
19
+ .product-container {
20
+ border: 1px solid #efefef;
21
+ border-radius: 2px;
22
+ display: none;
23
+ }
24
+
25
+ .product-title {
26
+ font-size: 16px;
27
+ text-transform: capitalize;
28
+ padding: 10px 5px 0 0;
29
+ margin-bottom: 10px;
30
+ display: inline-block;
31
+ }
32
+
33
+ .carebyzincCnt .product-title {
34
+ font-size: 13px
35
+ }
36
+
37
+ .carebyzincCnt.product-container .product-title + input {
38
+ font-size: 13px;
39
+ height: 25px;
40
+ }
41
+
42
+ .product-wrap {
43
+ border: 1px solid #ccc;
44
+ padding: 10px;
45
+ border-radius: 2px;
46
+ }
47
+
48
+ .carebyzincCnt{
49
+ display: none;
50
+ }
51
+
52
+ .product-list {
53
+ list-style-type: none;
54
+ padding-left: 0;
55
+ margin: 0;
56
+ }
57
+
58
+ .bx-l,
59
+ .bx-r {
60
+ float: left;
61
+ position: relative;
62
+ }
63
+
64
+ .bx-l {
65
+ width: 25px;
66
+ }
67
+
68
+ .bx-r {
69
+ width: -webkit-calc(100% - 25px);
70
+ width: -moz-calc(100% - 25px);
71
+ width: calc(100% - 25px);
72
+ }
73
+
74
+ .product-list .input input[type=radio] ,
75
+ .squared input[type=radio] {
76
+ visibility: hidden;
77
+ }
78
+
79
+ .product-list li {
80
+ color: #535353;
81
+ border-bottom: 1px solid #f7f7f7;
82
+ padding: 5px 5px;
83
+ transition: all .2s;
84
+ }
85
+
86
+ .product-list li:last-child {
87
+ border-bottom: 0;
88
+ }
89
+
90
+ .product-list li:hover{
91
+ background: #f7f7f7;
92
+ }
93
+
94
+ .product-list li:after {
95
+ clear: both;
96
+ content: '.';
97
+ display: block;
98
+ visibility: hidden;
99
+ height: 0;
100
+ }
101
+
102
+ .product-list li .p-name {
103
+ display: inline-block;
104
+ font-size: 11px;
105
+ text-transform: capitalize;
106
+ margin: 0;
107
+ }
108
+
109
+ .product-list li .p-price,
110
+ .care-price {
111
+ font-size: 15px;
112
+ color: #007ead;
113
+ font-weight: 600;
114
+ display: inline-block;
115
+ }
116
+
117
+ .care-price {
118
+ color: #007ead;
119
+ }
120
+
121
+ .product-list li .p-provider,
122
+ .care-prov {
123
+ text-transform: lowercase;
124
+ font-size: 11px;
125
+ font-weight: normal;
126
+ font-style: italic;
127
+ }
128
+
129
+ .product-list li .p-provider span,
130
+ .care-prov span {
131
+ text-transform: uppercase;
132
+ position: relative;
133
+ font-weight: 600;
134
+ }
135
+
136
+ .product-list li .p-provider span:after {
137
+ content: ":";
138
+ position: relative;
139
+ margin: 0 5px;
140
+ font-weight: bold;}
141
+
142
+ .squared {
143
+ width: 20px;
144
+ margin-right: 10px;
145
+ position: relative;
146
+ }
147
+
148
  .squared label {
149
+ cursor: pointer;
150
+ position: absolute;
151
+ width: 15px;
152
+ height: 15px;
153
+ top: 3px;
154
+ left: 0;
155
+ border-radius: 2px;
156
+ border: 2px solid #0291c6;
157
+ /*-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
158
+ -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
159
+ box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);*/
160
+ /*background: -webkit-linear-gradient(top, #0291c6 0%, #006d95 100%);
161
+ background: -moz-linear-gradient(top, #0291c6 0%, #006d95 100%);
162
+ background: -o-linear-gradient(top, #0291c6 0%, #006d95 100%);
163
+ background: -ms-linear-gradient(top, #0291c6 0%, #006d95 100%);
164
+ background: linear-gradient(top, #0291c6 0%, #006d95 100%);*/
165
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
166
  }
167
+
168
  .squared label:after {
169
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
170
+ filter: alpha(opacity=0);
171
+ opacity: 0;
172
+ content: '';
173
+ position: absolute;
174
+ width: 7px;
175
+ height: 4px;
176
+ background: transparent;
177
+ top: 3px;
178
+ left: 2.5px;
179
+ border: 2px solid #006d95;
180
+ border-top: none;
181
+ border-right: none;
182
+ -webkit-transform: rotate(-45deg);
183
+ -moz-transform: rotate(-45deg);
184
+ -o-transform: rotate(-45deg);
185
+ -ms-transform: rotate(-45deg);
186
+ transform: rotate(-45deg);
187
  }
188
+
189
  .squared label:hover::after {
190
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
191
+ filter: alpha(opacity=30);
192
+ opacity: 0.3;
193
  }
194
+
195
  .squared input[type=radio]:checked + label:after {
196
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
197
+ filter: alpha(opacity=100);
198
+ opacity: 1;
199
  }
 
 
 
 
 
200
 
201
+ .btn-zinc {
202
+ background: #037daa;
203
+ border: none;
204
+ outline: none;
205
+ color: #fff;
206
+ border-radius: 2px;
207
+ padding: 2px 10px;
208
+ font-size: 13px;
209
+ margin-top: 0px;
210
+ cursor: pointer;
211
+ position: relative;
212
+ height: 30px;
213
+ line-height: 18px;
214
+ }
215
 
216
+ .carebyzincCnt.product-container .btn-zinc {
217
+ height: 25px;
218
+ }
 
219
 
220
+ .add-to-cart-wrapper .product-box #zipcode {
221
+ margin-top: 5px;
222
+ }
 
 
223
 
224
+ .btn-zinc:hover,
225
+ .btn-zinc:active {
226
+ background: #017099;
227
+ }
228
 
229
+ .btn-zinc.selected {
230
+ background: #868686;
231
+ }
232
+
233
+ .product-container .button {
234
+ margin: auto;
235
+ color: #fff !important;
236
+ margin-bottom: 5px;
237
+ background: #3399cc !important;
238
+ margin-top: 5px;
239
+ border-radius: 2px;
240
+ padding: 1px 5px !important;
241
+ font-size: 12px;
242
+ margin-left: 30px;
243
+ line-height: 18px;
244
+ }
245
+
246
+ .product-container .button + span,
247
+ .product-container .button + span.updatezip {
248
+ font-size: 13px;
249
+ }
250
+
251
+ .remove_warranty {
252
+ background: url(images/cancel.png) no-repeat;
253
+ display: inline-block;
254
+ width: 13px;
255
+ height: 13px;
256
+ background-size: 100%;
257
+ }
258
+
259
+ .product-cart-careby .warranty_desc {
260
+ font-weight: bolder;
261
+ display: inline-block;
262
+ }
263
+
264
+ .care-loader {
265
+ background: rgba(255, 255, 255, 0.8) url(images/care-preloader.gif) no-repeat center center;
266
+ height: 100%;
267
+ width: 100%;
268
+ display:none;
269
+ background-size: 20px;
270
+ position: absolute;
271
+ top: 0;
272
+ left: 0;
273
+ }
274
+
275
+ #care-loader.show {
276
+ display: inline-block;
277
+ }
278
+
279
+ .product-cart-careby {
280
+ padding-left: 15px;
281
+ }
282
+
283
+ body.catalog-product-view #zipcode,
284
+ body.catalog-product-view .showCarebyzinc {
285
+ visibility: hidden;
286
+ position: absolute;
287
+ bottom: 0;
288
+ right: 0;
289
+ z-index: 0;
290
+ }
291
+
292
+ .desc_popup {
293
+ margin: 12px 10px;
294
+ padding-top: 7px;
295
+ display: none;
296
  }
297
+
298
+ .product-list li
299
+ .p-price,
300
+ .care-price {
301
+ margin: 0 7px 0 2px;
302
+ }
303
+
304
+ /* checkout */
305
+ .checkout-cart-index .product-container {
306
+ border-width: 0;
307
+ }
308
+
309
+ .checkout-cart-index .product-container .updatezip {
310
+ cursor: pointer;
311
+ }
312
+
313
+ .checkout-cart-index .product-box {
314
+ border: 1px solid #efefef;
315
+ }
316
+
317
+ .checkout-cart-index .cart-selected-zipcode,
318
+ .checkout-cart-index .cart-update-zipcode,
319
+ .checkout-cart-index .validation-advice,
320
+ .checkout-cart-index .updatezip {
321
+ display: none;
322
+ }
323
+
324
+ .checkout-cart-index .product-cart-cbz {
325
+ padding-left: 10px;
326
+ padding-top: 0;
327
+ }
328
+
329
+ .checkout-cart-index .product-cart-cbz p {
330
+ padding-left: 5px;
331
  }
332
+
333
+ .checkout-cart-index .cart-cbz-title {
334
+ color: #3399cc;
335
+ font-weight: 400;
336
+ font-size: 16px;
337
+ padding-bottom: 3px;
338
+ text-transform: capitalize;
339
+ padding-left: 5px;
340
+ }
341
+
342
+ body.checkout-onepage-index .product-cart-careby {
343
+ display: none;
344
+ }
345
+
346
+ .ZincInterstitial-featureList li > span {
347
+ position: static !important;
348
+ display: block;
349
+ clear: both;
350
+ }
351
+
352
+ .ZincInterstitial-mainAction {
353
+ background-image: none !important;
354
+ background-color: #3399cc !important;
355
+ border-radius: 0 !important;
356
+ }
357
+
358
+ .ZincInterstitial-secondaryAction {
359
+ border-color: 1px solid #3399cc !important;
360
+ color: #3399cc !important;
361
+ border-radius: 0 !important;
362
+ }
363
+
364
+ /* other resolution */
365
+ @media only screen and (max-width: 599px) {
366
+ .product-list li .p-price .price,
367
+ .care-price .price {
368
+ font-weight: 600 !important;
369
+ }
370
+ .product-list li .p-price,
371
+ .care-price {
372
+ display: block;
373
+ margin-left: 0;
374
+ }
375
+ }
skin/frontend/rwd/default/carebyzinc/css/carebyzinc.css CHANGED
@@ -3,107 +3,373 @@
3
  * Copyright 2016-2017
4
  *
5
  */
6
- .product-box { margin-bottom: 20px; }
7
- .product-container { border: 1px solid #efefef; border-radius: 2px;display: none; }
8
- .checkout-cart-index .product-container { border-width: 0; }
9
- .checkout-cart-index .product-container .updatezip { cursor: pointer; }
10
- .checkout-cart-index .product-box { border: 1px solid #efefef; }
11
- .product-title { font-size: 16px;text-transform: capitalize; padding: 10px 5px 0 0; margin-bottom: 10px;display: inline-block;}
12
- .carebyzincCnt .product-title { font-size: 13px }
13
- .carebyzincCnt.product-container .product-title + input { font-size: 13px;height: 25px; }
14
- .product-wrap { border: 1px solid #ccc;padding: 10px;border-radius: 2px; }
15
- .carebyzincCnt{display: none;}
16
- .product-list { list-style-type: none;padding-left: 0; margin: 0;}
17
- .bx-l,.bx-r { float: left; position: relative; }
18
- .bx-l { width: 25px; }
19
- .bx-r { width: -webkit-calc(100% - 25px); width: -moz-calc(100% - 25px); width: calc(100% - 25px); }
20
- .product-list .input input[type=radio] ,.squared input[type=radio] { visibility: hidden; }
21
- .product-list li { color: #535353;border-bottom: 1px solid #f7f7f7;padding: 5px 5px;transition: all .2s; }
22
- .product-list li:last-child { border-bottom: 0; }
23
- .product-list li:hover{ background: #f7f7f7; }
24
- .product-list li:after { clear: both; content: '.'; display: block; visibility: hidden; height: 0; }
25
- .product-list li .p-name { font-size: 11px;text-transform: capitalize;margin: 0; display: inline-block;}
26
- .product-list li .p-price,.care-price { font-size: 15px;color: #007ead;font-weight: 600; display: inline-block;/* margin: 2px 0; margin-left: 15px;*/}
27
- .care-price { /*color: #636363;*/ color:#007ead; }
28
- .product-list li .p-provider,.care-prov { text-transform: lowercase; font-size: 11px;font-weight: normal; font-style: italic;}
29
- .product-list li .p-provider span ,.care-prov span { text-transform: uppercase;position: relative; font-weight: 600; }
30
- .product-list li .p-provider span:after { content: ":";position: relative; margin: 0 5px; font-weight: bold;}
31
- .squared { width: 20px; margin-right: 10px; position: relative; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  .squared label {
33
- cursor: pointer;
34
- position: absolute;
35
- width: 15px;
36
- height: 15px;
37
- top: 3px;
38
- left: 0;
39
- border-radius: 2px;
40
- border: 2px solid #0291c6;
41
- /*-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
42
- -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
43
- box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);*/
44
- /*background: -webkit-linear-gradient(top, #0291c6 0%, #006d95 100%);
45
- background: -moz-linear-gradient(top, #0291c6 0%, #006d95 100%);
46
- background: -o-linear-gradient(top, #0291c6 0%, #006d95 100%);
47
- background: -ms-linear-gradient(top, #0291c6 0%, #006d95 100%);
48
- background: linear-gradient(top, #0291c6 0%, #006d95 100%);*/
49
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
50
  }
 
51
  .squared label:after {
52
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
53
- filter: alpha(opacity=0);
54
- opacity: 0;
55
- content: '';
56
- position: absolute;
57
- width: 7px;
58
- height: 4px;
59
- background: transparent;
60
- top: 3px;
61
- left: 2.5px;
62
- border: 2px solid #006d95;
63
- border-top: none;
64
- border-right: none;
65
- -webkit-transform: rotate(-45deg);
66
- -moz-transform: rotate(-45deg);
67
- -o-transform: rotate(-45deg);
68
- -ms-transform: rotate(-45deg);
69
- transform: rotate(-45deg);
70
  }
 
71
  .squared label:hover::after {
72
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
73
- filter: alpha(opacity=30);
74
- opacity: 0.3;
75
  }
 
76
  .squared input[type=radio]:checked + label:after {
77
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
78
- filter: alpha(opacity=100);
79
- opacity: 1;
80
  }
81
- .btn-zinc { background:#037daa;border:none;outline:none;color:#fff;border-radius:2px;padding:2px 10px;font-size:13px;margin-top: 0px;cursor: pointer; position: relative;height: 30px;line-height: 18px;}
82
- .carebyzincCnt.product-container .btn-zinc { height: 25px; }
83
- .add-to-cart-wrapper .product-box #zipcode { margin-top: 5px; }
84
- .btn-zinc:hover,.btn-zinc:active { background: #017099; }
85
- .btn-zinc.selected { background: #868686; }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
- .product-container .button { margin: auto;color: #fff !important; margin-bottom: 5px;background: #3399cc !important; margin-top: 5px; border-radius: 2px; padding: 1px 5px !important; font-size: 12px;margin-left: 30px;line-height: 18px;}
89
- .product-container .button + span,.product-container .button + span.updatezip { font-size: 13px; }
90
- .remove_warranty { background: url(images/cancel.png) no-repeat; display: inline-block; width: 13px; height: 13px; background-size: 100%; }
91
- .product-cart-careby .warranty_desc { font-weight: bolder;display: inline-block; /*color: #3399cc;*/}
92
 
93
- .care-loader { background: rgba(255, 255, 255, 0.8) url(images/care-preloader.gif) no-repeat center center; height: 100%; width: 100%; display:none; background-size: 20px; position: absolute; top: 0; left: 0; }
94
- #care-loader.show { display: inline-block; }
95
- /*#care-loader.hide { display: inline-block; }*/
96
- /*.care-loader { display: none; }*/
97
- .product-cart-careby { padding-left: 15px; }
98
 
 
 
 
 
99
 
100
- @media only screen and (max-width: 599px) {
101
- .product-list li .p-price .price, .care-price .price { font-weight: 600 !important; }
102
- .product-list li .p-price, .care-price { display: block;margin-left: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
- .desc_popup{
105
- margin: 12px 10px;
106
- padding-top: 7px;
107
- display:none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
- .product-list li .p-price,.care-price { margin: 0 7px 0 2px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Copyright 2016-2017
4
  *
5
  */
6
+
7
+ .error-msg {
8
+ color: #f00;
9
+ }
10
+
11
+ .error-details {
12
+ font-size: 12px;
13
+ }
14
+
15
+ .product-box {
16
+ margin-bottom: 20px;
17
+ }
18
+
19
+ .product-container {
20
+ border: 1px solid #efefef;
21
+ border-radius: 2px;
22
+ display: none;
23
+ }
24
+
25
+ .product-title {
26
+ font-size: 16px;
27
+ text-transform: capitalize;
28
+ padding: 10px 5px 0 0;
29
+ margin-bottom: 10px;
30
+ display: inline-block;
31
+ }
32
+
33
+ .carebyzincCnt .product-title {
34
+ font-size: 13px
35
+ }
36
+
37
+ .carebyzincCnt.product-container .product-title + input {
38
+ font-size: 13px;
39
+ height: 25px;
40
+ }
41
+
42
+ .product-wrap {
43
+ border: 1px solid #ccc;
44
+ padding: 10px;
45
+ border-radius: 2px;
46
+ }
47
+
48
+ .carebyzincCnt{
49
+ display: none;
50
+ }
51
+
52
+ .product-list {
53
+ list-style-type: none;
54
+ padding-left: 0;
55
+ margin: 0;
56
+ }
57
+
58
+ .bx-l,
59
+ .bx-r {
60
+ float: left;
61
+ position: relative;
62
+ }
63
+
64
+ .bx-l {
65
+ width: 25px;
66
+ }
67
+
68
+ .bx-r {
69
+ width: -webkit-calc(100% - 25px);
70
+ width: -moz-calc(100% - 25px);
71
+ width: calc(100% - 25px);
72
+ }
73
+
74
+ .product-list .input input[type=radio] ,
75
+ .squared input[type=radio] {
76
+ visibility: hidden;
77
+ }
78
+
79
+ .product-list li {
80
+ color: #535353;
81
+ border-bottom: 1px solid #f7f7f7;
82
+ padding: 5px 5px;
83
+ transition: all .2s;
84
+ }
85
+
86
+ .product-list li:last-child {
87
+ border-bottom: 0;
88
+ }
89
+
90
+ .product-list li:hover{
91
+ background: #f7f7f7;
92
+ }
93
+
94
+ .product-list li:after {
95
+ clear: both;
96
+ content: '.';
97
+ display: block;
98
+ visibility: hidden;
99
+ height: 0;
100
+ }
101
+
102
+ .product-list li .p-name {
103
+ display: inline-block;
104
+ font-size: 11px;
105
+ text-transform: capitalize;
106
+ margin: 0;
107
+ }
108
+
109
+ .product-list li .p-price,
110
+ .care-price {
111
+ font-size: 15px;
112
+ color: #007ead;
113
+ font-weight: 600;
114
+ display: inline-block;
115
+ }
116
+
117
+ .care-price {
118
+ color: #007ead;
119
+ }
120
+
121
+ .product-list li .p-provider,
122
+ .care-prov {
123
+ text-transform: lowercase;
124
+ font-size: 11px;
125
+ font-weight: normal;
126
+ font-style: italic;
127
+ }
128
+
129
+ .product-list li .p-provider span,
130
+ .care-prov span {
131
+ text-transform: uppercase;
132
+ position: relative;
133
+ font-weight: 600;
134
+ }
135
+
136
+ .product-list li .p-provider span:after {
137
+ content: ":";
138
+ position: relative;
139
+ margin: 0 5px;
140
+ font-weight: bold;}
141
+
142
+ .squared {
143
+ width: 20px;
144
+ margin-right: 10px;
145
+ position: relative;
146
+ }
147
+
148
  .squared label {
149
+ cursor: pointer;
150
+ position: absolute;
151
+ width: 15px;
152
+ height: 15px;
153
+ top: 3px;
154
+ left: 0;
155
+ border-radius: 2px;
156
+ border: 2px solid #0291c6;
157
+ /*-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
158
+ -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);
159
+ box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);*/
160
+ /*background: -webkit-linear-gradient(top, #0291c6 0%, #006d95 100%);
161
+ background: -moz-linear-gradient(top, #0291c6 0%, #006d95 100%);
162
+ background: -o-linear-gradient(top, #0291c6 0%, #006d95 100%);
163
+ background: -ms-linear-gradient(top, #0291c6 0%, #006d95 100%);
164
+ background: linear-gradient(top, #0291c6 0%, #006d95 100%);*/
165
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
166
  }
167
+
168
  .squared label:after {
169
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
170
+ filter: alpha(opacity=0);
171
+ opacity: 0;
172
+ content: '';
173
+ position: absolute;
174
+ width: 7px;
175
+ height: 4px;
176
+ background: transparent;
177
+ top: 3px;
178
+ left: 2.5px;
179
+ border: 2px solid #006d95;
180
+ border-top: none;
181
+ border-right: none;
182
+ -webkit-transform: rotate(-45deg);
183
+ -moz-transform: rotate(-45deg);
184
+ -o-transform: rotate(-45deg);
185
+ -ms-transform: rotate(-45deg);
186
+ transform: rotate(-45deg);
187
  }
188
+
189
  .squared label:hover::after {
190
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
191
+ filter: alpha(opacity=30);
192
+ opacity: 0.3;
193
  }
194
+
195
  .squared input[type=radio]:checked + label:after {
196
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
197
+ filter: alpha(opacity=100);
198
+ opacity: 1;
199
  }
 
 
 
 
 
200
 
201
+ .btn-zinc {
202
+ background: #037daa;
203
+ border: none;
204
+ outline: none;
205
+ color: #fff;
206
+ border-radius: 2px;
207
+ padding: 2px 10px;
208
+ font-size: 13px;
209
+ margin-top: 0px;
210
+ cursor: pointer;
211
+ position: relative;
212
+ height: 30px;
213
+ line-height: 18px;
214
+ }
215
 
216
+ .carebyzincCnt.product-container .btn-zinc {
217
+ height: 25px;
218
+ }
 
219
 
220
+ .add-to-cart-wrapper .product-box #zipcode {
221
+ margin-top: 5px;
222
+ }
 
 
223
 
224
+ .btn-zinc:hover,
225
+ .btn-zinc:active {
226
+ background: #017099;
227
+ }
228
 
229
+ .btn-zinc.selected {
230
+ background: #868686;
231
+ }
232
+
233
+ .product-container .button {
234
+ margin: auto;
235
+ color: #fff !important;
236
+ margin-bottom: 5px;
237
+ background: #3399cc !important;
238
+ margin-top: 5px;
239
+ border-radius: 2px;
240
+ padding: 1px 5px !important;
241
+ font-size: 12px;
242
+ margin-left: 30px;
243
+ line-height: 18px;
244
+ }
245
+
246
+ .product-container .button + span,
247
+ .product-container .button + span.updatezip {
248
+ font-size: 13px;
249
+ }
250
+
251
+ .remove_warranty {
252
+ background: url(images/cancel.png) no-repeat;
253
+ display: inline-block;
254
+ width: 13px;
255
+ height: 13px;
256
+ background-size: 100%;
257
+ }
258
+
259
+ .product-cart-careby .warranty_desc {
260
+ font-weight: bolder;
261
+ display: inline-block;
262
+ }
263
+
264
+ .care-loader {
265
+ background: rgba(255, 255, 255, 0.8) url(images/care-preloader.gif) no-repeat center center;
266
+ height: 100%;
267
+ width: 100%;
268
+ display:none;
269
+ background-size: 20px;
270
+ position: absolute;
271
+ top: 0;
272
+ left: 0;
273
+ }
274
+
275
+ #care-loader.show {
276
+ display: inline-block;
277
+ }
278
+
279
+ .product-cart-careby {
280
+ padding-left: 15px;
281
+ }
282
+
283
+ body.catalog-product-view #zipcode,
284
+ body.catalog-product-view .showCarebyzinc {
285
+ visibility: hidden;
286
+ position: absolute;
287
+ bottom: 0;
288
+ right: 0;
289
+ z-index: 0;
290
+ }
291
+
292
+ .desc_popup {
293
+ margin: 12px 10px;
294
+ padding-top: 7px;
295
+ display: none;
296
  }
297
+
298
+ .product-list li
299
+ .p-price,
300
+ .care-price {
301
+ margin: 0 7px 0 2px;
302
+ }
303
+
304
+ /* checkout */
305
+ .checkout-cart-index .product-container {
306
+ border-width: 0;
307
+ }
308
+
309
+ .checkout-cart-index .product-container .updatezip {
310
+ cursor: pointer;
311
+ }
312
+
313
+ .checkout-cart-index .product-box {
314
+ border: 1px solid #efefef;
315
+ }
316
+
317
+ .checkout-cart-index .cart-selected-zipcode,
318
+ .checkout-cart-index .cart-update-zipcode,
319
+ .checkout-cart-index .validation-advice,
320
+ .checkout-cart-index .updatezip {
321
+ display: none;
322
+ }
323
+
324
+ .checkout-cart-index .product-cart-cbz {
325
+ padding-left: 10px;
326
+ padding-top: 0;
327
+ }
328
+
329
+ .checkout-cart-index .product-cart-cbz p {
330
+ padding-left: 5px;
331
  }
332
+
333
+ .checkout-cart-index .cart-cbz-title {
334
+ color: #3399cc;
335
+ font-weight: 400;
336
+ font-size: 16px;
337
+ padding-bottom: 3px;
338
+ text-transform: capitalize;
339
+ padding-left: 5px;
340
+ }
341
+
342
+ body.checkout-onepage-index .product-cart-careby {
343
+ display: none;
344
+ }
345
+
346
+ .ZincInterstitial-featureList li > span {
347
+ position: static !important;
348
+ display: block;
349
+ clear: both;
350
+ }
351
+
352
+ .ZincInterstitial-mainAction {
353
+ background-image: none !important;
354
+ background-color: #3399cc !important;
355
+ border-radius: 0 !important;
356
+ }
357
+
358
+ .ZincInterstitial-secondaryAction {
359
+ border-color: 1px solid #3399cc !important;
360
+ color: #3399cc !important;
361
+ border-radius: 0 !important;
362
+ }
363
+
364
+ /* other resolution */
365
+ @media only screen and (max-width: 599px) {
366
+ .product-list li .p-price .price,
367
+ .care-price .price {
368
+ font-weight: 600 !important;
369
+ }
370
+ .product-list li .p-price,
371
+ .care-price {
372
+ display: block;
373
+ margin-left: 0;
374
+ }
375
+ }
skin/frontend/rwd/default/carebyzinc/css/colorbox.css CHANGED
@@ -22,36 +22,36 @@
22
  */
23
  #cboxOverlay{background:url(images/overlay.png) repeat 0 0; opacity: 0.9; filter: alpha(opacity = 90);}
24
  #colorbox{outline:0;}
25
- #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;}
26
- #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;}
27
- #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;}
28
- #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;}
29
- #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;}
30
- #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;}
31
- #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;}
32
- #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;}
33
- #cboxContent{background:#fff; overflow:hidden;}
34
- .cboxIframe{background:#fff;}
35
- #cboxError{padding:50px; border:1px solid #ccc;}
36
- #cboxLoadedContent{margin-bottom:28px;}
37
- #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
38
- #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
39
- #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
40
- #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
41
 
42
- /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
43
- #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
44
-
45
- /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
46
- #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
47
 
48
- #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
49
- #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
50
- #cboxPrevious:hover{background-position:-75px -25px;}
51
- #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
52
- #cboxNext:hover{background-position:-50px -25px;}
53
- #cboxClose{position:absolute; top:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
54
- #cboxClose:hover{background-position:-25px -25px;}
 
 
 
55
 
56
  /*
57
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
@@ -67,5 +67,4 @@
67
  .cboxIE #cboxMiddleLeft,
68
  .cboxIE #cboxMiddleRight {
69
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
70
- }
71
-
22
  */
23
  #cboxOverlay{background:url(images/overlay.png) repeat 0 0; opacity: 0.9; filter: alpha(opacity = 90);}
24
  #colorbox{outline:0;}
25
+ #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;}
26
+ #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;}
27
+ #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;}
28
+ #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;}
29
+ #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;}
30
+ #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;}
31
+ #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;}
32
+ #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;}
33
+ #cboxContent{background:#fff; overflow:hidden;}
34
+ .cboxIframe{background:#fff;}
35
+ #cboxError{padding:50px; border:1px solid #ccc;}
36
+ #cboxLoadedContent{margin-bottom:0;}
37
+ #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
38
+ #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
39
+ #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
40
+ #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
41
 
42
+ /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
43
+ #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
 
 
 
44
 
45
+ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
46
+ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
47
+
48
+ #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
49
+ #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
50
+ #cboxPrevious:hover{background-position:-75px -25px;}
51
+ #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
52
+ #cboxNext:hover{background-position:-50px -25px;}
53
+ #cboxClose{position:absolute; top:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
54
+ #cboxClose:hover{background-position:-25px -25px;}
55
 
56
  /*
57
  The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
67
  .cboxIE #cboxMiddleLeft,
68
  .cboxIE #cboxMiddleRight {
69
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
70
+ }