A way around page refreshes/back button problems with a simple concept
The problem: You have a form in which the user fills out and clicks a “submit” button that validates their input, does some processing and output’s some results. The problem being the application needs to cater for page refreshes, back buttons and the case of the page being submitted more than once (latency/slow internet connection). [...]
Removing Test orders from Magento
If you want to do this manually and not pay (via a extension) then use the following script on your database. Please make sure you back up your database first, I take no responsibility for the overall result, this script worked for me on version 1.4.0.1: SET FOREIGN_KEY_CHECKS=0; TRUNCATE `sales_order`; TRUNCATE `sales_order_tax`; TRUNCATE `sales_order_datetime`; TRUNCATE [...]
var _gaq undefined – Magento
I came across this javascript error when updating a instance of Magento to version 1.4 and Google Analytics “var _gaq is undefined” In the ga.php file located under /app/code/core/Mage/GoogleAnalytics/Block add the following line of code before _gaq.push javascript “var _gaq = _gaq || [];” – about line 179 This will remove the error. I still [...]
toolbar.phtml -> Magento 1.4 error
Came across this error in toolbar.phtml for Magento 1.4: Warning: Invalid argument suppplied for foreach() line 51. Fix is available from here (this is only a fix, it doesn’t solve the problem – The paging is removed). References: http://www.sonassi.com/knowledge-base/magento-1-4-install-errors/
Enabling Sales Order Notification in Magento
Very helpful post there that enables sales order notifications to the shop admin email address. Dont’s use the Bcc option System Configuration -> Sales menu, you have to send a copy of the email to another email address. References: http://nik.chankov.net/2009/10/28/adding-notification-when-new-order-arrives-magento/
Bluehost wont allow gmail SMTP connections
According to bluehost, you cannot send emails through SMTP connections from web applications hosted on bluehost. They only allow sending through their own SMTP servers. The problem I had was trying to send emails in Magento using GMAIL (Google Apps) using the code from this forum: http://www.magentocommerce.com/boards/viewthread/1073/ The work around is that I setup a [...]
JFactory::getDate() doesn’t automatically add offset
By default, calling JFactory::getDate() doesn’t automatically apply the timezone offset. The default date/time is GMT. By using the following code, you can set the offset from the global joomla configuration file <?php $thisJApp = &JFactory::getApplication(); $thisJDate = JFactory::getDate(); $thisJDate ->setOffset($thisJApp ->getCfg(‘offset’)); echo $thisJDate->toFormat(“%A %d %b %Y”); ?> If you want to set the date from [...]
Blocking IP Addresses on Linux Server
Had some suspect IP addresses trying to attempt to login via the admin user in Moodle. Best thing to do is block the IP address to the server or even better the IP range (after doing a IP lookup to see where the IP address came from). References: http://www.cyberciti.biz/faq/how-do-i-block-an-ip-on-my-linux-server/
SimplePie Joomla Proxy Issue
The issue I had with a particular joomla site is that I could not load external RSS feeds. The error was “Could not connect to {server}”. RSS Feed load failed. This was caused in the SimplePie.php class around line 6601. Steps to resolve: I enabled the cUrl extension in php.ini (running on a IIS platform) [...]
Limiting the number of text in textarea using JQuery
example: <textarea id=”id” maxlength=”255″></textarea> jQuery(‘textarea[maxlength]‘).keyup(function() { var max = parseInt(jQuery(this).attr(‘maxlength’)); if (jQuery(this).val().length > max) { jQuery(this).val(jQuery(this).val().substr(0, jQuery(this).attr(‘maxlength’))); } if (jQuery(this).parent().find(‘.charsRemaining’).length > 0) jQuery(this).parent().find(‘.charsRemaining’).html(‘You have ‘ + (max – jQuery(this).val().length) + ‘ characters remaining’); else jQuery(this).parent().append(‘<div class=”charsRemaining”>You have ‘ + (max – jQuery(this).val().length) + ‘ characters remaining</div>’); });


