Techinflo_ProductDeliveryAvailability - Version 1.0.1

Version Notes

This extension allows Customer to check product availability in its location by entering zip code of the location. If product is not available then extension gives appropriate message and does not allow customer to checkout.

Download this release

Release Info

Developer Techinflo
Extension Techinflo_ProductDeliveryAvailability
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Techinflo/Checkavailability/Model/Availability.php CHANGED
@@ -24,39 +24,36 @@ class Techinflo_Checkavailability_Model_Availability extends Mage_Core_Model_Abs
24
  $this->_init('checkavailability/availability');
25
  }
26
 
27
- public function detailpage($pid, $pincode) {
28
 
29
  $product_id = $pid;
30
  $product = Mage::getModel('catalog/product')->load($product_id);
31
  $pin_code = $pincode;
32
 
33
- $avilble_vendors = explode("||", $product->getVendorAvailability());
34
- //print_r($avilble_vendors);
35
  foreach ($avilble_vendors as $vendarr) {
36
  $vand_ar1 = explode(":", $vendarr);
37
- $zips = explode(",", $vand_ar1[1]);
38
  foreach ($zips as $ziprange) {
39
-
40
- if (strpos($ziprange, "-")) {
41
- //echo "true".$zip;
42
  $rang = explode("-", $ziprange);
43
  $r1 = trim($rang[0]);
44
  $r2 = trim($rang[1]);
45
  for ($i = $r1; $i <= $r2; $i++) {
46
- $vendors[$vand_ar1[0]][] = $i;
47
  }
48
  } else {
49
- $vendors[$vand_ar1[0]][] = trim($ziprange);
50
  }
51
  }
52
  }
53
  $reponse = "";
54
- foreach ($vendors as $key => $vend) {
55
- if (in_array($pin_code, $vend) || in_array('ALL', $vend)) {
56
  $reponse = $pin_code . ",";
57
  } else {
58
  $reponse = "1," . $pin_code;
59
- }
60
  }
61
  echo " " . rtrim($reponse, ",");
62
  }
@@ -69,8 +66,8 @@ class Techinflo_Checkavailability_Model_Availability extends Mage_Core_Model_Abs
69
  $pin_code = $pincode;
70
  $avilble_vendors = explode("||", $product->getVendorAvailability());
71
  foreach ($avilble_vendors as $vendarr) {
72
- $vand_ar1 = explode(":", $vendarr);
73
- $zips = explode(",", $vand_ar1[1]);
74
  foreach ($zips as $ziprange) {
75
  if (strpos($ziprange, "-")) {
76
  //echo "true".$zip;
@@ -78,22 +75,22 @@ class Techinflo_Checkavailability_Model_Availability extends Mage_Core_Model_Abs
78
  $r1 = trim($rang[0]);
79
  $r2 = trim($rang[1]);
80
  for ($i = $r1; $i <= $r2; $i++) {
81
- $vendors[$vand_ar1[0]][] = $i;
82
  }
83
  } else {
84
- $vendors[$vand_ar1[0]][] = trim($ziprange);
85
  }
86
  }
87
  }
88
 
89
  //$reponse="";
90
- foreach ($vendors as $key => $vend) {
91
- if (in_array($pin_code, $vend) || in_array('ALL', $vend)) {
92
  $reponse_yes = $pin_code . ",";
93
  } else {
94
  $reponse_no = $pin_code;
95
  }
96
- }
97
  }
98
  if (isset($reponse_no) || !empty($reponse_no)) {
99
  echo '1,' . $pin_code;
@@ -115,8 +112,8 @@ class Techinflo_Checkavailability_Model_Availability extends Mage_Core_Model_Abs
115
  }
116
  $avilble_vendors = explode("||", $product->getVendorAvailability());
117
  foreach ($avilble_vendors as $vendarr) {
118
- $vand_ar1 = explode(":", $vendarr);
119
- $zips = explode(",", $vand_ar1[1]);
120
  foreach ($zips as $ziprange) {
121
  if (strpos($ziprange, "-")) {
122
  //echo "true".$zip;
@@ -124,21 +121,21 @@ class Techinflo_Checkavailability_Model_Availability extends Mage_Core_Model_Abs
124
  $r1 = trim($rang[0]);
125
  $r2 = trim($rang[1]);
126
  for ($i = $r1; $i <= $r2; $i++) {
127
- $vendors[$vand_ar1[0]][] = $i;
128
  }
129
  } else {
130
- $vendors[$vand_ar1[0]][] = trim($ziprange);
131
  }
132
  }
133
  }
134
 
135
  //$reponse="";
136
- foreach ($vendors as $key => $vend) {
137
- if (in_array($pin_code, $vend) || in_array('ALL', $vend)) {
138
  return $reponse_yes = "Yes";
139
  } else {
140
  return $reponse_no = "No";
141
- }
142
  }
143
  }
144
 
24
  $this->_init('checkavailability/availability');
25
  }
26
 
27
+ public function detailpage($pid, $pincode) {
28
 
29
  $product_id = $pid;
30
  $product = Mage::getModel('catalog/product')->load($product_id);
31
  $pin_code = $pincode;
32
 
33
+ $avilble_vendors = explode("||", $product->getVendorAvailability());
 
34
  foreach ($avilble_vendors as $vendarr) {
35
  $vand_ar1 = explode(":", $vendarr);
36
+ $zips = explode(",", $vendarr);
37
  foreach ($zips as $ziprange) {
38
+ if (strpos($ziprange, "-")) {
 
 
39
  $rang = explode("-", $ziprange);
40
  $r1 = trim($rang[0]);
41
  $r2 = trim($rang[1]);
42
  for ($i = $r1; $i <= $r2; $i++) {
43
+ $vendors[] = $i;
44
  }
45
  } else {
46
+ $vendors[] = trim($ziprange);
47
  }
48
  }
49
  }
50
  $reponse = "";
51
+ // foreach ($vendors as $key => $vend) {
52
+ if (in_array($pin_code, $vendors) || in_array('ALL', $vendors)) {
53
  $reponse = $pin_code . ",";
54
  } else {
55
  $reponse = "1," . $pin_code;
56
+ // }
57
  }
58
  echo " " . rtrim($reponse, ",");
59
  }
66
  $pin_code = $pincode;
67
  $avilble_vendors = explode("||", $product->getVendorAvailability());
68
  foreach ($avilble_vendors as $vendarr) {
69
+ // $vand_ar1 = explode(":", $vendarr);
70
+ $zips = explode(",", $vendarr);
71
  foreach ($zips as $ziprange) {
72
  if (strpos($ziprange, "-")) {
73
  //echo "true".$zip;
75
  $r1 = trim($rang[0]);
76
  $r2 = trim($rang[1]);
77
  for ($i = $r1; $i <= $r2; $i++) {
78
+ $vendors[] = $i;
79
  }
80
  } else {
81
+ $vendors[] = trim($ziprange);
82
  }
83
  }
84
  }
85
 
86
  //$reponse="";
87
+ //foreach ($vendors as $key => $vend) {
88
+ if (in_array($pin_code, $vendors) || in_array('ALL', $vendors)) {
89
  $reponse_yes = $pin_code . ",";
90
  } else {
91
  $reponse_no = $pin_code;
92
  }
93
+ //}
94
  }
95
  if (isset($reponse_no) || !empty($reponse_no)) {
96
  echo '1,' . $pin_code;
112
  }
113
  $avilble_vendors = explode("||", $product->getVendorAvailability());
114
  foreach ($avilble_vendors as $vendarr) {
115
+ // $vand_ar1 = explode(":", $vendarr);
116
+ $zips = explode(",", $vendarr);
117
  foreach ($zips as $ziprange) {
118
  if (strpos($ziprange, "-")) {
119
  //echo "true".$zip;
121
  $r1 = trim($rang[0]);
122
  $r2 = trim($rang[1]);
123
  for ($i = $r1; $i <= $r2; $i++) {
124
+ $vendors[] = $i;
125
  }
126
  } else {
127
+ $vendors[] = trim($ziprange);
128
  }
129
  }
130
  }
131
 
132
  //$reponse="";
133
+ //foreach ($vendors as $key => $vend) {
134
+ if (in_array($pin_code, $vendors) || in_array('ALL', $vendors)) {
135
  return $reponse_yes = "Yes";
136
  } else {
137
  return $reponse_no = "No";
138
+ //}
139
  }
140
  }
141
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Techinflo_ProductDeliveryAvailability</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>This extension allows Customer to check product availability in its location by entering zip code of the location. If product is not available then extension gives appropriate message and does not allow customer to checkout.</description>
11
  <notes>This extension allows Customer to check product availability in its location by entering zip code of the location. If product is not available then extension gives appropriate message and does not allow customer to checkout.</notes>
12
  <authors><author><name>Techinflo</name><user>techinflo</user><email>anil.gupta@techinflo.com</email></author></authors>
13
- <date>2014-04-15</date>
14
- <time>07:00:45</time>
15
- <contents><target name="magecommunity"><dir name="Techinflo"><dir name="Checkavailability"><dir name="Block"><file name="Availability.php" hash="6b6b3cab42f2add619c18f03513f8e38"/></dir><dir name="Model"><file name="Availability.php" hash="ceb445218885df846c5cb0582b0baa8d"/><dir name="Resource"><file name="Setup.php" hash="f7fd405e6c33652ff0c261e84630a377"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="4ed191036782420bad4280738bd1494a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5c14daf0b4392c26ff65793ff4573ebb"/><file name="config.xml" hash="ba188fa08fc8a689ea2a60a8b6e5afa6"/><file name="system.xml" hash="19d6149c586bb33305c45d787eb7be65"/></dir><dir name="sql"><dir name="techinflo_checkavailability_setup"><file name="mysql4-install-1.2.3.php" hash="dc08e3f2b3ead005c00a3d6b83310c8e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="techinflo_checkavl.xml" hash="df13a24e42e6bc5b008b23cdea8b2d9e"/></dir><dir name="template"><dir name="techinflo"><dir name="checkavailability"><dir name="checkout"><file name="availability_cart.phtml" hash="19a8bbc44d26b5e7a9ace3b21340cbbb"/><file name="availability_checkout_js.phtml" hash="a7f0d611e005e990266c87d021bfa077"/></dir><file name="availability.phtml" hash="99062a90ee96345dd6e6d8683d5fe8e6"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Techinflo_Checkavailability.xml" hash="7da21c4c4d0b6143e4f0c7a9c7f0d86f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="techinflo"><dir name="checkavailability"><file name="Thumbs.db" hash="1c890b323f44146c732232ab3217de23"/><file name="ajax-loader.gif" hash="7b9776076d5fceef4993b55c9383dedd"/><file name="techinflo_avl.css" hash="c5a842dfc659aac65d6562a3f4daecfd"/></dir></dir></dir><dir name="js"><dir name="techinflo"><dir name="checkavailability"><file name="common.js" hash="1452f79eb6a0dcd0e688ce19eea7ad3e"/><file name="jquery.min.js" hash="e0c79cc6e409291cc68c5de36bf09c1a"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.1.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Techinflo_ProductDeliveryAvailability</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
10
  <description>This extension allows Customer to check product availability in its location by entering zip code of the location. If product is not available then extension gives appropriate message and does not allow customer to checkout.</description>
11
  <notes>This extension allows Customer to check product availability in its location by entering zip code of the location. If product is not available then extension gives appropriate message and does not allow customer to checkout.</notes>
12
  <authors><author><name>Techinflo</name><user>techinflo</user><email>anil.gupta@techinflo.com</email></author></authors>
13
+ <date>2014-05-01</date>
14
+ <time>09:43:45</time>
15
+ <contents><target name="magecommunity"><dir name="Techinflo"><dir name="Checkavailability"><dir name="Block"><file name="Availability.php" hash="6b6b3cab42f2add619c18f03513f8e38"/></dir><dir name="Model"><file name="Availability.php" hash="c6957ce81fc34ff3753a93c0daa45b3d"/><dir name="Resource"><file name="Setup.php" hash="f7fd405e6c33652ff0c261e84630a377"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="4ed191036782420bad4280738bd1494a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5c14daf0b4392c26ff65793ff4573ebb"/><file name="config.xml" hash="ba188fa08fc8a689ea2a60a8b6e5afa6"/><file name="system.xml" hash="19d6149c586bb33305c45d787eb7be65"/></dir><dir name="sql"><dir name="techinflo_checkavailability_setup"><file name="mysql4-install-1.2.3.php" hash="dc08e3f2b3ead005c00a3d6b83310c8e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="techinflo_checkavl.xml" hash="df13a24e42e6bc5b008b23cdea8b2d9e"/></dir><dir name="template"><dir name="techinflo"><dir name="checkavailability"><dir name="checkout"><file name="availability_cart.phtml" hash="19a8bbc44d26b5e7a9ace3b21340cbbb"/><file name="availability_checkout_js.phtml" hash="a7f0d611e005e990266c87d021bfa077"/></dir><file name="availability.phtml" hash="99062a90ee96345dd6e6d8683d5fe8e6"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Techinflo_Checkavailability.xml" hash="7da21c4c4d0b6143e4f0c7a9c7f0d86f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="techinflo"><dir name="checkavailability"><file name="Thumbs.db" hash="1c890b323f44146c732232ab3217de23"/><file name="ajax-loader.gif" hash="7b9776076d5fceef4993b55c9383dedd"/><file name="techinflo_avl.css" hash="c5a842dfc659aac65d6562a3f4daecfd"/></dir></dir></dir><dir name="js"><dir name="techinflo"><dir name="checkavailability"><file name="common.js" hash="1452f79eb6a0dcd0e688ce19eea7ad3e"/><file name="jquery.min.js" hash="e0c79cc6e409291cc68c5de36bf09c1a"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.1.0</max></php></required></dependencies>
18
  </package>