DUNTUK

A web and systems development journal (from a–too busy–web developer who does a lot of various IT work.)

Add "You Save" amount and percentage to Special Price in Magento

Last updated: Thu, 04/25/2013 - 1:57am

In order to display a "You Save" for "Special Price" products in magento--to make it look similar to amazon's price display--you can do the following:

Copy app/design/frontend/base/default/template/catalog/product/price.phtml
to
app/design/frontend/default/YOURTEMPLATE/template/catalog/product/price.phtml

Then in price.phtml that you just copied, right above:

How to set date and time automatically in CentOS

Last updated: Thu, 04/18/2013 - 12:36pm

tzselect

Answer the 3 locations questions. Then create a symlink to your local time.

rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

The symlink will be according to your time zone--above is just an example.

Now, we check the date and time

date

Time and date should now be properly set.

Categories: 

Disable IE "compatibility mode" through .htaccess

Last updated: Sun, 04/14/2013 - 12:32am

Internet Explorer "compatibility mode" is that dreadful page icon, inconveniently placed right next to the refresh button/icon.

What it does is turn IE 8 or higher into an outdated browser, so it can properly display really old school websites that were, likely, built using invalid and/or outdated HTML code. It's a horrible feature, that I see no practical use for whatsoever. Plus it's easy to accidentally click it, because it's located a few pixels away from the refresh button--talk about non-intuitive...

Anyhow...

How to install XCache 3.0 from source

Last updated: Mon, 02/11/2013 - 3:34am

Alright... So APC has been pretty unstable for me on 2 separate servers running PHP 5.3.x and PHP 5.4.x. So I figured I'd give XCache a try after reading about similar problems with APC.

Anyhow...

Here's how to install XCache 3.X from source on CentOS

Get the latest version of XCache from here: http://xcache.lighttpd.net/#Downloads

Latest version at the time of this writing is XCache 3.0.1

Drupal .htaccess rewrite with 'www' but not for sub-domains

Last updated: Wed, 01/23/2013 - 12:57am

Say you have your Drupal's .htaccess set "To redirect all users to access the site WITH the 'www.' prefix", and you added a sub-domain, and it came out looking something like http://www.sub.domain.com. So, most people will NOT want the "www" added to the url in this case. So what do you do? Easy.

Use this instead:

Categories: 

How to install GEOS on CentOS and directadmin

Last updated: Sun, 04/28/2013 - 8:22pm

cd /usr/local/src
wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2  # go here to find the latest version: http://download.osgeo.org/geos/
tar -xvjf geos-3.3.8.tar.bz2
cd geos-3.3.8
./configure --enable-php && make clean && make
make install
ldconfig
vi /etc/ld.so.conf

Add the following line if it doesn't already exist

Upgrade Drupal 6 to Drupal 7 using Drush site-upgrade

Last updated: Tue, 12/04/2012 - 10:26pm

Ok... So you decided that it's time to upgrade from Drupal 6 to Drupal 7. It's not going to be easy, but using Drush will make life a little easier.

What this will do is save you the time of manually upgrading Drupal 6 core and drupal 6 modules to Drupal 7 core and drupal 7 modules. Of course likely your site will be broken after the drush site-upgrade, but at least you have the manual job of searching for upgraded modules taken care of.

So, let's begin...

Categories: 

Add memcached Support to Magento

Last updated: Tue, 09/18/2012 - 5:20pm

After you successfully install memcached and pecl/memcached (memcached PHP support), you will next want take full advantage of it by enabling native support for memcached in magento.

NOTE: you must have memcached and pecl/memcached already installed. Otherwise your Magento installation will break if you try following this guide.

Ok... now that the warning is out the way. Here's how we do it...

Edit your local.xml

vi ./app/etc/local.xml

Add the following between

Magento Google Shopping Setup aka Google Base aka Google Content aka Google Merchant

Last updated: Fri, 07/06/2012 - 6:09am

Here's a quick (and hopefully easy) tutorial on how to properly setup Magento with Google Base aka "Google Shopping" or "Google Content" .

I know there is very limited help for Google Base/Shopping for Magento Community Edition 1.6 and 1.7 (and nothing official exists on any lower versions)...

The interested fact is, Magento is knowingly supplying a broken extension with 1.6 and 1.7--i.e. there is no way it will work unless you hack the core code; as we will below.

Hopefully, the community edition will get a working extension soon, just like the Magento Go version.

Anyhow... on to self help!

Categories: 

"Customers who bought this product also purchased" extension, magento 1.6+ compatibility fix

Last updated: Sat, 08/18/2012 - 8:05pm

To install Customers who bought this product also purchased extension for magento 1.6+, we need to apple a few fixes.

1st Fix. This will make this extension 1.5+ compatible.

app/code/local/Jain/Bought/etc/config.xml
Categories: 

How to install APC on CentOS and DirectAdmin

Last updated: Tue, 01/29/2013 - 12:51am

cd /usr/local/src
mount -o remount,exec,suid /tmp
yum install autoconf 
yum install php-pear 
yum install php-devel 
yum install httpd-devel 
yum install pcre-devel 
wget http://pecl.php.net/get/APC
tar xvfz APC-VERSION.tgz
cd APC-VERSION
phpize
whereis php-config 

This will give you the location of php-config, which you will put after --with-php-config=

Categories: 

Flush or Clear out Exim mail queue

Last updated: Tue, 05/01/2012 - 3:37pm

Exim mail queue can get out of control. If your var is on a separate smaller sized partition it can quickly run out of space.

We can see what's using up all that space via:

cd /var
du -sh * | sort -n

and as with Exim, our culprit location should be:

/var/spool/exim/input

So to quickly clear out the exim mail queue we do the following:

Flush MySQL log-bin data and disable binary log files

Last updated: Mon, 10/22/2012 - 3:30pm

If your disk is starting to run out of space due to an excess of mysql-bin.XXXXXXXX files here's what to do to fix that.

vi /etc/my.cnf

under 'log-bin=mysql-bin' (the destination could be different in your my.cnf) put:

expire_logs_days = 10

Change 10 to whatever you're comfortable with.

or you can simply disable the binary log files by uncommenting the line:

Categories: 

How to install Apache Solr 3.x for Drupal 7 or Drupal 6

Last updated: Tue, 09/18/2012 - 7:28pm

First we'll need to install Java 1.6 JDK, and be on PHP 5.2 or higher (You can check my PHP installation tutorial here. Also I'm on CentOS.

Install Java 1.6 JDK

yum install java-1.6*

Install Apache Solr

We're going to install Apache Solr into /usr/local/share; however you can install it somewhere else if you'd like (e.g. install it in the root dir / )

Update CentOS / DirectAdmin Server with custombuild 2.0

Last updated: Tue, 05/01/2012 - 7:05pm

Here is how to use latest version of custombuild 2.0 . The commands for custombuild 2.0 are basically identical to custombuild 1.1 and 1.2, so all this stuff should look familiar.

Notice: At the time of this writing (2012-03-14) custombuild 2.0 doesn't support upgrading from php 5.2 to 5.4. If you're upgrading from php 5.2 to 5.4 please use custombuild 1.2.

cd /usr/local/directadmin
wget http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
./build

edit options.conf file, selecting whatever you want to upgrade and what version numbers... then run:

./build update_data

How to place drupal blocks anywhere in content.

Last updated: Fri, 10/21/2011 - 9:44pm

If you're looking to place a block anywhere inside your content, simply do the following:

go to /admin/build/block

select the block you want to insert into your content to get the proper block references...

e.g. I created a custom views block called "latest_news" which, if you click it's url looks like:
/admin/build/block/configure/views/latest_news-block

so basically, you'll use "views" at the beginning of the function reference and "latest_news-block" at the end:

Categories: 

How to install safe-rm.

Last updated: Thu, 10/20/2011 - 4:25pm

So, you're worried about accidentally wiping out your entire system or important directory by doing something like  rm -rf / or  rm -rf *

with safe-rm , it won't allow you to do that, you'll get something like:

$ rm -rf /
Skipping /

Here's how to install:

cd /usr/local/src
# get latest version here: http://www.safe-rm.org.nz/
wget http://launchpad.net/safe-rm/trunk/0.8/+download/safe-rm-0.8.tar.gz
tar xvfz safe-rm-0.8.tar.gz
cd safe-rm-0.8
# find out your $PATH; 
echo $PATH # most systems should include /usr/local/bin, if not then select any other listed
cp /bin/rm /usr/local/bin/rm
mv /bin/rm /bin/rm-01
cp safe-rm /bin/rm
vi /etc/safe-rm.conf
Categories: 

httpd causing high CPU load in CentOS / DirectAdmin

Last updated: Thu, 10/06/2011 - 4:53am

If you did TOP in ssh, and noticed httpd process has a high cpu load, and has been running for a long time (e.g. over 5 minutes) then you might try lowering your MaxRequestsPerChild.

vi /etc/httpd/conf/extra/httpd-mpm.conf

Now change your MaxRequestsPerChild from 1000 to 20...

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers      10
    MaxSpareServers      20
    ServerLimit         812
    MaxClients          812
    MaxRequestsPerChild   20
</IfModule>
service httpd restart

Magento upgrade to 1.5 or 1.6 or 1.7

Last updated: Sun, 04/28/2013 - 5:39pm

UPDATED: 2012-08-31

NOTE: this upgrade process works the same way for Magento version 1.5, 1.6, and 1.7

As many magento users will know, Magento is no fun to work with-- mainly due to poor community support (the developers help paying customers; i.e. Magento Enterprise ... Only payed support there... Great for business but bad for the average or beginning user...)

Anyhow...

So here's how we do it.

How to get 3TB HDD to work with NVIDIA motherboards

Last updated: Sat, 05/14/2011 - 5:40pm

If you recently tried installing a 3TB Hard Drive you'll notice that only about 1/3 of the drive is recognized by Windows. The fix is quite simple:

1. Download NVIDIA nForce Drivers 15.58 or later
2. Install the NVIDIA NFORCE 15.58 drivers and reboot your system after the install is done.
3. You're done. Your PC should be able to see the entire 3TB drive (it should be around 2.72TB)

Categories: 

How to fix Traktor not keeping play count or mp3 comment changes

Last updated: Thu, 03/24/2011 - 5:06pm

So... Here I was playing sets on my new Traktor S4 on my 2010 iMac, and noticed that Traktor was acting weird--comments were getting erased, ratings were disappearing, play counts weren't being kept. In other words,Traktor's explorer worked on some files and not others.

I tried changing file permissions, reinstalling Traktor, etc... nothing solved the problem... Doing research didn't show me any concrete solutions (e.g. change the play count settings; this didn't work).

Then it occurred to me, I haven't defragmented my Windows PC in over 2 months. And a few weeks before, I had my windows PC sync all my mp3 files to my iMac.

So long story short, the mp3 files were messed up ("garbage at the end of file")...

The solution

How to uninstall multipletablerates from magento

Last updated: Sun, 12/19/2010 - 10:12pm

Multiple Table Rates (aka multipletablerates) was a very popular extension in the magento 1.3 and earlier days... However, after several magento versions this extension basically became completely unstable/buggy (this is normal as it only lists magento 1.1 compatability)... Even so, it still worked on magento 1.3 with a few minor bugs... Then later down the road other extensions came up (mostly paid) that provided similar functionality, plus some, and minus the bugs...

Categories: 

Magento Catalog Price Rules bugs

Last updated: Mon, 11/15/2010 - 11:37am

Magento's "Catalog Price Rules" was always a buggy experience, ever since magento 1.3... I don't know what's going with the development, but it's still buggy up to 1.4.1 ...

So here are a couple of fixes I found.

Magento 1.4.0.1:

source: http://www.magentocommerce.com/boards/viewthread/194930/#t245120

1. Open up Observer.php in /app/code/core/Mage/CatalogRule/Model/
2. Find the dailyCatalogUpdate() method
3. At the end of the method, before “return $this;”, add:
$this->applyAllRules( $this );
4. (Not sure if this step is necessary) Open up /app/code/core/Mage/CatalogRule/etc/config.xml
5. Find the crontab > jobs > catalogrule_apply_all area
6. Change
<cron_expr>0 1 * * *</cron_expr>

Categories: 

Pages

Subscribe to DUNTUK RSS