Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit 012bc8d

Browse files
author
Edwin Jacobs
committed
Trimmed leading and trailing slashes
1 parent 72c87da commit 012bc8d

File tree

1 file changed

+18
-0
lines changed
  • app/code/local/Emico/AttributeLanding/Model/Resource

1 file changed

+18
-0
lines changed

app/code/local/Emico/AttributeLanding/Model/Resource/Page.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,24 @@ protected function _afterLoad(Mage_Core_Model_Abstract $object)
6565
return parent::_afterLoad($object);
6666
}
6767

68+
/**
69+
* Perform actions before object save
70+
*
71+
* @param Varien_Object $object
72+
* @return Mage_Core_Model_Resource_Db_Abstract
73+
*/
74+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
75+
{
76+
parent::_beforeSave($object);
77+
// Trim leading and trailing slashes
78+
$urlPath = $object->getData('url_path');
79+
$urlPath = trim($urlPath, '/');
80+
81+
$object->setData('url_path', $urlPath);
82+
83+
return $this;
84+
}
85+
6886
/**
6987
* Assign page to store views
7088
*

0 commit comments

Comments
 (0)