Mage_Econda - Version 1.0.1

Version Notes

Release for econda Web Controlling functions.

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Econda
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/local/Mage/Econda/Block/Econda.php CHANGED
@@ -94,6 +94,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
94
  * emos addContent
95
  */
96
  $storeId = Mage::app()->getStore()->getStoreId();
 
97
  $storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
98
  $storeName = $storeNameLoad->getName();
99
  $tablePrefix = Mage::getConfig()->getTablePrefix();
@@ -198,12 +199,51 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
198
  }
199
  }
200
 
201
- //not specified sites
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  if(trim($contentPath == '')){
203
  $urlExt = $_SERVER['PHP_SELF'];
204
- $urlExt = str_replace('index.php','',$urlExt);
205
- $urlExt = str_replace('.html','',$urlExt);
206
- $urlExt = str_replace('//','/',$urlExt);
 
 
 
 
 
207
 
208
  if(substr($urlExt,0,1) == '/') {
209
  $urlExt = substr($urlExt,1);
@@ -211,7 +251,7 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
211
 
212
  if(substr($urlExt,-1) == '/') {
213
  $urlExt = substr($urlExt,0,-1);
214
- }
215
  $urlExtExp = explode("/",$urlExt);
216
  $urlExtO = '';
217
  for ($i = 0; $i < sizeof($urlExtExp); $i++) {
@@ -219,14 +259,11 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
219
  }
220
  $urlExtO = substr($urlExtO,0,-1);
221
  $contentPath = 'Start/'.$eLang[38].'/'.$urlExtO;
222
- if(trim($contentPath == '' || $contentPath == 'Start/'.$eLang[38].'/')){
223
- $urlExt1 = $_SERVER['REQUEST_URI'];
224
- $contentPath = 'Start/'.$eLang[38].$urlExt1;
225
- if($contentPath == 'Start/' || $contentPath == 'Start/'.$eLang[38].'/' || $contentPath == 'Start/'.$eLang[38].'/index.php/') {
226
- $contentPath = 'Start';
227
- }
228
  }
229
  }
 
230
 
231
  // if not onePage checkout steps
232
  if(stristr($realUrl,'checkout/onepage/') == false) {
@@ -237,21 +274,12 @@ class Mage_Econda_Block_Econda extends Mage_Core_Block_Template
237
  if(stristr($realUrl,'checkout/onepage/success') != false) {
238
  $emos->addContent($contentPath);
239
  }
240
-
241
  /*
242
  * emos addPageID
243
  */
244
  $emos->addPageID(md5($contentPath)); //same as $contentPath
245
-
246
- /*
247
- * emos addSiteID
248
- */
249
- /* will not work on multilanguage shops
250
- $getStoreID = Mage::app()->getStore()->getStoreId();
251
- $selectStoreDB = Mage::getModel('core/store_group')->load($getStoreID);
252
- $siteName = $selectStoreDB->getId ();
253
- */
254
-
255
  $siteName = $_SERVER['SERVER_NAME'];
256
  $emos->addSiteID($siteName);
257
 
94
  * emos addContent
95
  */
96
  $storeId = Mage::app()->getStore()->getStoreId();
97
+ $storeCode = Mage::app()->getStore()->getCode();
98
  $storeNameLoad = Mage::getModel('core/store_group')->load($storeId);
99
  $storeName = $storeNameLoad->getName();
100
  $tablePrefix = Mage::getConfig()->getTablePrefix();
199
  }
200
  }
201
 
202
+ /* not specified sites
203
+ * check if get current url match
204
+ */
205
+ if(trim($contentPath) == '') {
206
+ $checkPath = str_replace($_SERVER['SERVER_NAME'],"",$realUrl);
207
+ $checkPath = str_replace("https://","",$checkPath);
208
+ $checkPath = str_replace("http://","",$checkPath);
209
+ if(strpos($checkPath,"?") != false) {
210
+ $reqPos = strPos($checkPath,"?");
211
+ $checkPath = substr($checkPath,0,$reqPos);
212
+ }
213
+ if(substr($checkPath,-1) == "/") {
214
+ $checkPath = substr($checkPath,0,-1);
215
+ }
216
+ $checkPath = str_replace("/index.php/".$storeCode,"",$checkPath);
217
+ $checkPath = str_replace("/index.php","",$checkPath);
218
+ $codeLen = strlen($storeCode);
219
+ if(substr($checkPath,0,$codeLen+1) == '/'.$storeCode) {
220
+ $checkPath = substr($checkPath,$codeLen+1);
221
+ }
222
+
223
+ if(trim($checkPath) != '') {
224
+ $urlExtExp = explode("/",$checkPath);
225
+ $urlExtO = '';
226
+ for ($i = 0; $i < sizeof($urlExtExp); $i++) {
227
+ if(trim($urlExtExp[$i]) != ''){
228
+ $urlExtO .= ucfirst($urlExtExp[$i]).'/';
229
+ }
230
+ }
231
+ $contentPath = 'Start/'.$eLang[38].'/'.substr($urlExtO,0,-1);
232
+ $contentPath = str_replace("//","/",$contentPath);
233
+ }
234
+ }
235
+
236
+ //then if php self match
237
  if(trim($contentPath == '')){
238
  $urlExt = $_SERVER['PHP_SELF'];
239
+ $urlExt = str_replace("/index.php/".$storeCode."/","",$urlExt);
240
+ $urlExt = str_replace("index.php","",$urlExt);
241
+ $codeLen = strlen($storeCode);
242
+ if(substr($urlExt,0,$codeLen+1) == '/'.$storeCode) {
243
+ $urlExt = substr($urlExt,$codeLen+1);
244
+ }
245
+ $urlExt = str_replace(".html","",$urlExt);
246
+ $urlExt = str_replace("//","/",$urlExt);
247
 
248
  if(substr($urlExt,0,1) == '/') {
249
  $urlExt = substr($urlExt,1);
251
 
252
  if(substr($urlExt,-1) == '/') {
253
  $urlExt = substr($urlExt,0,-1);
254
+ }
255
  $urlExtExp = explode("/",$urlExt);
256
  $urlExtO = '';
257
  for ($i = 0; $i < sizeof($urlExtExp); $i++) {
259
  }
260
  $urlExtO = substr($urlExtO,0,-1);
261
  $contentPath = 'Start/'.$eLang[38].'/'.$urlExtO;
262
+ if(trim($contentPath == '' || $contentPath == 'Start/'.$eLang[38].'/' || $contentPath == 'Start/'.$eLang[38].'/index.php/')){
263
+ $contentPath = 'Start';
 
 
 
 
264
  }
265
  }
266
+
267
 
268
  // if not onePage checkout steps
269
  if(stristr($realUrl,'checkout/onepage/') == false) {
274
  if(stristr($realUrl,'checkout/onepage/success') != false) {
275
  $emos->addContent($contentPath);
276
  }
277
+
278
  /*
279
  * emos addPageID
280
  */
281
  $emos->addPageID(md5($contentPath)); //same as $contentPath
282
+
 
 
 
 
 
 
 
 
 
283
  $siteName = $_SERVER['SERVER_NAME'];
284
  $emos->addSiteID($siteName);
285