Engine23

Development

Zend Framework - javascript and css being included multiple times in head

If you are looking at the view source of your zend framework page, and you notice that your external javascript files and your external css files are being included many times, its because you have echo in front of each line:

<?php  echo $this->headLink()->prependStylesheet($this->serverUrl().'/css/style.css'); ?>
<?php echo $this->headLink()->prependStylesheet($this->serverUrl().'/css/colorbox.css'); ?>
<?php echo $this->headScript()->appendFile($this->serverUrl().'/js/jquery.1.7.2.js') ?>
<?php echo $this->headScript()->appendFile($this->serverUrl().'/js/oe.js') ?>
<?php echo $this->headScript()->appendFile($this->serverUrl().'/js/colorbox/jquery.colorbox-min.js') ?>
<?php echo $this->headLink()?>
<?php echo $this->headScript()?>
The way to remove the css and  javascript files from being included many times is to do the echo on the headLink() and headScript() after you have set the files and just echo one line:

Read more

Magento Admin logout settings for version 1.7.0.2

If you have Magneto 1.0.7.2 and your tired of being logged out of the admin area every few minutes, to adjust that setting: System->Configuration->Admin In the security section, change that to 86400 if you want it to be 1 day, or any value over 60. This will extend your admin time before your logged out! Life is good again!

Magento File path and file paths

Base Directory: Mage::getBaseDir() Mage::getBaseDir(‘base’) /var/www/magento/ App: Mage::getBaseDir(‘app’) /var/www/magento/app/ Code: code Mage::getBaseDir(‘code’) /var/www/magento/app/code Design: design Mage::getBaseDir(‘design’) /var/www/magento/app/design/ Etc: etc Mage::getBaseDir(‘etc’) /var/www/magento/app/etc Lib: lib Mage::getBaseDir(‘lib’) /var/www/magento/lib Locale: locale Mage::getBaseDir(‘locale’) /var/www/magento/app/locale Media: media Mage::getBaseDir(‘media’) /var/www/magento/media/ Skin: skin Mage::getBaseDir(‘skin’) /var/www/magento/skin/ Var: var Mage::getBaseDir(‘var’) /var/www/magento/var/ Tmp: tmp Mage::getBaseDir(‘tmp’) /var/www/magento/var/tmp Cache: cache Mage::getBaseDir(‘cache’) /var/www/magento/var/cache Log: log Mage::getBaseDir(‘log’) /var/www/magento/var/log Session: session Mage::getBaseDir(‘session’) /var/www/magento/var/session Upload: upload Mage::getBaseDir(‘upload’) /var/www/magento/media/upload Export: export Mage::getBaseDir(‘export’) /var/www/magento/var/export

Magento Cron configuration

Magento Settings: System >> Configuration >> System > ‘Cron (Scheduled Tasks)’ tab.

  • Generate schedules every: 60
  • Schedule ahead for: 1
  • Missed if not run within: 60
  • History cleanup every: 120
  • Success history lifetime: 120
  • Failure history lifetime: 120
$ crontab -e 
# Execute the Magneto cron every 15 minutes
*/15 * * * * /bin/sh /path/to/magento/cron.sh 
These settings allow Magento to generate and clean schedules within a 2-hour time frame.

Get a Magento table name or custom table name

So you want to get the table name that is declared in the xml and you are not in an upgrade/install script.

If you were in an upgrade/install script you could just use: 

$tbl = $this->getTable('catalog/product');

In any other page you can use:

$tbl = Mage::getSingleton('core/resource')->getTableName('catalog/product');

If this will return: catalog_product_entity

This works with any declaration that is set in the xml!

Setting up Amazon EC2 Ubuntu 12.10 server for Magneto using NFS

This is all the steps and details i used to create an instance of a web server to be used for a Magento Website.

1 - Start a m3.xlarge instance

2 - Make sure its part of a security group that has Ports 80, 443 open to all 0.0.0.0/0

3 - Add a SSH port execption for your IP

4 - Assign an Elastic IP to each new instance

5 - Get the ssh details from Connect Instance in the Amazon control panel and ssh into the device(s)

6- Change the date/time of the server

Read more