Magento Catalog Price Rules bugs

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>

Tags: magento

Disable scroll wheel zoom in Firefox

This is probably an annoyance for all those that use keyboard CTRL commands (like, CTRL-C and CTRL-V) and accidentally keep hitting CTRL + mouse scroll wheel, which zooms in and out, or enlarges and decreases text size in your browser...

Here's how to disable that in firefox...

Firefox:

In your address bar, type in

about:config

search for

mousewheel.withcontrolkey.action

Change the value to "0"

Restart your browser, and you're all set.

Google Chrome

Nothing available at the time of this writing...

Tags: firefox annoyances browser

Magento default sort order

In order to specify the default sort order of the product listing open up your 'catalog.xml' (this is tested in magento 1.4): desc To order products by a specific order, e.g. to order products by the order specified under category listing: set in your admin: yoursite.com/admin/system_config/edit/section/catalog/
Product listing sort by: Best Value
And for those wondering where 'category products' is... it's located here: /admin/admin/catalog_category/ (under "Category Products" tab, when you click on any category)
Tags: magento

How to add free shipping notice on product listing and product view in Magento

NOTE: This tutorial assumes you're using an extension that uses the "special_shipping_group" attribute... But you can also use this tutorial to output any attribute you'd like into the product view and product listing.

Ok... Say you're using the "special_shipping_group" attribute, to specify which products should receive free shipping.

You would, for example, add an attribute called: FREE SHIPPING

Make sure you also set this visible under product listing, and product view, or else it won't display.

Following, you will assign this attribute to all the products that are to use this "FREE SHIPPING" attribute.

Now...

Tags: Design magento attributes shipping free shipping display

Magento Featured Products Listing on Home Page

There are a few articles and extensions I've come across showing how to add "Featured Products" on the home page of Magento. The problem is that none that I have read, seem to fully tackle the issue of being compatible with Magento 1.4.x (Magento 1.4.0.1 at the time of this writing) AND fully using Magento's features while being fairly easy to implement (i.e. without adding complicated, unnecessary,redundant or outdated code)

Tags: magento featured products

Magento 1.4 toolbar error (How to properly upgrade to Magento 1.4)

In case you upgraded to magento 1.4, and noticed that your category listings that require pagination (page 1, 2, 3) no longer show, here's the fix...

1. copy the new 1.4 toolbar.phtml from

app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml

and paste it into your custom theme

app/design/frontend/*/YOURTHEME/template/catalog/product/list/toolbar.phtml

(note: make sure you put this into your currently used theme directory. If you installed a theme via Admin-->System-->Design then get the name of the theme from there)

2. edit your app/design/frontend/*/YOURTHEME/layout/catalog.xml

Find:

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">

Tags: magento

How to remove Yoast MetaRobots from Magento

In case you want to upgrade to magento 1.4, and have Yoast MetaRobots installed, you'll have to uninstall it first, since it's not compatible with 1.4.

Here's how:

1. uninstall it from magento connect
2. Remove the config xml file from /app/etc/modules/Yoast_Metarobots.xml
3. Remove the module files and directories from /app/code/community/yoast/Metarobots/
4.Clear your cache
SSH into your root magento directory and:

rm -rf var/cache/*

5. run this SQL query (easily done in phpMyAdmin)

DELETE FROM `eav_attribute` WHERE `eav_attribute`.`attribute_code` = 'meta_robots';
DELETE FROM `core_resource` WHERE CODE = 'metarobots_setup';

You should be good to go after this...

Tags: magento extensions

Magento 1.4 product-name quotes are converted to html and then escaped

After upgrading from magento 1.3 to 1.4, if your product headings used quotes " " or ampersands & , then magento may convert these into HTML and then escape that HTML counterparts hence showing e.g.:

"Thermo Balance" Tub & Shower Valve Rough In Valve

like:

&quot;Thermo Balance&quot; Tub &amp; Shower Valve Rough In Valve

The fix is to go into "view.phtml" and change:

            <h1 class="product-name">
                <?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getName()), 'name') ?>
            </h1>

to

            <h1 class="product-name">
                <?php echo $this->htmlEscape($_product->getName())?>
            </h1>

Tags: howto magento

How to remove <br /> added by magento.

In case you're wondering why your product description is all spaced out, then that's because magento is adding automatic line breaks into the content description area...

To get rid of it... look for

nl2br

specifically in description.phtml you'll see

<div class="std">
    <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), 'description') ?>
</div>

it should look like this after you take the nl2br out:

<div class="std">
    <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), ($this->getProduct()->getDescription()), 'description') ?>
</div>

Tags: magento code

Drupal: How to create a View that shows results only from the current node

Let's say you want to create a Views block that shows on a bunch of different pages/nodes that have multiple (imagefield) images per page, and you want the block to dynamically display ONLY the images from the particular node you're on--and not display images from other nodes.

This is how you would do it:

1. Create your view as you normally would.
2. Add "Node: Nid" under "Arguments".
3. Select "Provide Default Argument" under "Action to take if argument is not present:"
4. Select "Node ID from URL" under "Default argument type:"
5. Leave everything else as is...
6. Hit "Update" and then "Save"... and you're done.

Tags: Drupal

How to disable PHP 5.3 Deprecated errors

If you installed PHP 5.3, then you may have noticed many deprecated errors from older web apps and even current ones--like some drupal modules.

NOTICE: this is not a true fix, you could be ignoring critical errors by doing the following... but most likely you should be fine... though make sure you do not log errors, or your log files will quickly grow to an unmanageable size.

anyhow...

via php.ini :

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
; change this to Off if you still get errors.
display_errors = On
log_errors = Off

after your done... as always, restart apache...

service httpd restart

also, some sites may be using their own .htaccess or error_reporting... therefore you may need to go to affected ones and modify the .htaccess file and insert the following to disable PHP 5.3 ... I had to do this for really old web apps.

php_flag display_errors off
php_flag log_errors off

Tags: php drupal

How to search and replace text in multiple files in linux

Here's how to replace a string of text in multiple files under a specific directory and all it's sub directories.

cd /to/directory/containing/files
find . -name '*.php' | xargs perl -pi -e "s/OLDSTRING/'NEWSTRING'/g;"

Real world example:

Let's say we want to replace the following in every .php file:

'profile', 'load_profile'

with new string

'profile_load_profile'

Hence, we do the following...

cd /home
find ./ -name '*.php' | xargs perl -pi -e "s/'profile', 'load_profile'/'profile_load_profile'/g;"

Tags: linux admin php

How to install mod_expires using custombuild

cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp configure/ap2/configure.apache custom/ap2/configure.apache
vi custom/ap2/configure.apache

add: --enable-expires

so it looks like this:

#!/bin/sh
"./configure" \
        "--prefix=/etc/httpd" \
        "--exec-prefix=/etc/httpd" \
        "--bindir=/usr/bin" \
        "--sbindir=/usr/sbin" \
        "--sysconfdir=/etc/httpd/conf" \
        "--enable-so" \
        "--enable-dav" \
        "--enable-dav-fs" \
        "--enable-dav-lock" \
        "--enable-suexec" \
        "--enable-deflate" \
        "--enable-unique-id" \
        "--with-suexec-caller=apache" \
        "--with-suexec-docroot=/" \
        "--with-suexec-gidmin=100" \
        "--with-suexec-logfile=/var/log/httpd/suexec_log" \
        "--with-suexec-uidmin=100" \
        "--with-suexec-userdir=public_html" \
        "--with-suexec-bin=/usr/sbin/suexec" \
        "--with-included-apr" \
        "--with-pcre=/usr/local" \
        "--includedir=/usr/include/apache" \
        "--libexecdir=/usr/lib/apache" \
        "--datadir=/var/www" \
        "--localstatedir=/var" \
        "--enable-logio" \
        "--enable-ssl" \
        "--enable-rewrite" \
        "--enable-proxy" \
        "--with-ssl=/usr" \
        "--enable-headers" \
        "--enable-expires"

./build clean
./build apache
service httpd restart

you may need to recompile php after this

./build php

Tags: linux apache

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable.

if you try running the following:

phpize

and get this error

$PHP_PREFIX/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

Then it's because you don't have autoconf installed.

To fix this error, do the following:

yum install autoconf

or you can install from source (if you want to use the latest version)


cd /usr/local/src/

/* find latest version of m4 here: http://ftp.gnu.org/gnu/m4/ */

Tags: Server Linux

How to remove Paypal Quick Checkout button from Magento when using Paypal.

If you disable "guest checkout" in magento -- and are using PayPal -- guest check is still possible via Paypal button--it will show below the "Proceed to Checkout" button.

In order to completely remove the possibility of Guest checkout, you'll need to alter the following:

app/design/frondend/default/YOURTEMPLATE/template/paypal/link.phtml

  • copy link.phtml to link-01.phtml or whatever
  • open/edit link.phtml and delete (or comment out) everything.
Tags: paypal magento

How to add custom javascript into the drupal webform module <form> <submit>

Recently, one of our clients asked to have custom tracking code implemented into their form submissions.

Since the client's site is built on Drupal, all forms are dynamically generated using the Webform module.

Their marketing company instructed us to add an 'onclick' code to :

<input type="submit" class="form-submit" value="Receive Coupons" id="edit-submit" name="op" onclick=tracking("track_submit_quote") />

However, since the Webform module creates all forms dynamically, there was no convenient way of hard coding the code into the form... i.e. there was no way for this to be done via webform admin.

Tags: Drupal module

phpMyAdmin database export "Save as file" template

Whenever you do a database backup using phpMyAdmin, you are presented with a default file name structure for saves, usually like so:

__DB__

which basically gives you the name of the database you just backed up. Which is ok, however, most people would also like the date and time stamp included as well...

So...

This is how it's done... replace the above with :

__DB__-%F-%T

or for newer version of phpMyAdmin

@DATABASE@-%F-%T

__DB__ = name of database Example: my_database
%F = Same as "%Y-%m-%d" (year-month-day) Example: 2009-11-25
%T = time stamp . (24 hour format, hour_minute_second) Example: 11_07_31

which will save a file with the naming structure similar to:

my_database-2009-11-25-11_07_31.sql

You can easily use other date/time structure, to suit your personal preference.

Tags: Linux admin mysql

How to install Windows 7 RC using a thumb drive

It's no secret, Windows 7 is the best windows ever--it doesn't matter that the RC build 7100 not the final version, it's still a LOT better and faster than the latest and most optimized Windows Vista.

OK... anyhow... some people don't have CD/DVD drives in their PCs, so using a thumb drive is usually the best way to go.

In Windows Vista

Tags: windows

How to install PECL uploadprogress w/ PHP 7 support

Original uploadprogress doesn't seem to be developed any longer, and hence doesn't support PHP 7. However, there's a PHP 7 compatible version we can use:

cd /usr/local/src/
git clone https://github.com/Jan-E/uploadprogress.git
cd uploadprogress
phpize
./configure
make
make install

Now add the extension to your php.ini

vi /usr/local/lib/php.ini

Add the following to your extensions section:

extension=uploadprogress.so

Restart apache

service httpd restart

Here are additional steps you may need to take: https://www.drupal.org/node/2718253#comment-11159883

Or if you are using PHP 5.X:

Tags: Drupal linux server media