Change Copyright Year At Footer Of magento

9. Januar 2015 at 10:21

Was asked once by client how to make the copyright year at the footer of Magento site so that it changes automatically every year without doing it manually every year.

Solution one about Template Change and PHP

Copy the file app/design/frontend/default/default/template/page/html/footer.phtml
to your them-folder e.g. app/design/frontend/default/fly2marsmedia/template/page/html/footer.phtml
and open this file in your editor.

Change the

<address><?php echo $this->getCopyright() ?></address>

to

<address>&copy; <?php echo Mage::getModel('core/date')->date('Y') . ' ' . $this->getCopyright() ?></address>

Then
1) Log in to your Magento admin panel

2) Navigate to system > configuration > General > Design.

3) Click to expand the Footer section

4) Inside the Copyright text field remove the „&copy 2014“ part, this first part is changed automatically!

Solution Two about Magento-Admin-Panel configuration and javascript

1) Log in to your Magento admin panel

2) Navigate to system > configuration > General > Design.

3) Click to expand the Footer section

4) Inside the Copyright text field replace the @copy; YYYY with

&copy; <script type="text/javascript">
var d = new Date();
document.write(d.getFullYear())
</script>

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento: Datum und Zeit / Date and Time

27. Mai 2014 at 14:48

Bei Operationen mit Datum und Zeit sollten die Klassen Mage_Core_Model_Date oder
Mage_Core_Model_Locale verwendet werden, um Zeitverschiebungen zu berücksichtigen.

Verwendung von now() und date() dafür nicht geeignet.

Beispiele zur Verwendung der Date Funktion in Magento

// get timestamp on server based time
$now = Mage::getModel('core/date')->timestamp(time());
// get server date and time
$now = Mage::getModel('core/date')->date('Y-m-d h:i:s');
// get UTC date and time
$now = Zend_Date::now();
$anyDate = '2011-12-11';
$currentDate = Mage::getModel('core/date')->date('d.m.Y', strtotime($anyDate));
// a more complete example with the im admin panel configured timezone
$datetime = Zend_Date::now();
// admin controls this output through configuration
$datetime->setLocale(Mage::getStoreConfig(
Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE))
->setTimezone(Mage::getStoreConfig(
Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
echo $datetime->get(Zend_Date::DATETIME_SHORT);
// formated
$date = $datetime->toString("Y-MM-d_H:m:s");
GD Star Rating
loading...
GD Star Rating
loading...