December 14, 2018

cm-mini

Thinking Magento

FREE MagentoGo Migration to CE

Time is running out for store owners who are still on MagentoGO. If you need someone to handle your migration, head on over to Nimbus Hosting and start the migration before the new year. February 2015 is closer than you think.

The migration process should be fairly quick and they'll be able to move your categories, customers, orders, products and attributes and attribute sets.

For more information, checkout their website

Tell them you came from Creative Media!

 

 

Magento - Unable to communicate with the PayPal gateway

Your customer is trying to checkout with Paypal and the error they received is Unable to communicate with the PayPal gateway.

One of two things may have happened.

- Your webhosting company has applied a patch for the ShellShock Bug and forgotten to restart Apache / NginX
- Your certificate is no longer signed by one of the trusted root certificate authorities

To fix the root certificate problem you will need to have ROOT access to your server to execute the following

First, backup the old bundle:

cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak
Then download the new bundle:

wget -O /etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem

Restart Apache / NginX / PHP

If this saved you hours of work or saved you from a headache, feel free to buy us a beer.

Fatal error: Allowed memory size of XXXX bytes exhausted - Sales_Order_Collection Grid

Are you suddenly receiving the error Fatal error: Allowed memory size of XXXX bytes exhausted when viewing a grid in the magento admin, which uses sales order collection data?

Symptons: The admin grid loads correctly, however the footer does not appear to load. Right click on the page and go to view source, scroll down to the base of the source code page where the code ends you should see the Fatal Error:

The problem could be much easier than you could ever hope and caused by Mass Action and the Select All option.

When select all is enabled on an admin grid, it appears top left of the grid, next to select visible and it pre populates the javascript mass action with ALL of the row ID's and can be quite a memory strain on your server.

Find the grid.php file that is causing you problems (It may not be called grid.php if it is in a custom module) and locate the _prepareMassaction() function

In _prepareMassaction() you will need to add the following code to disable the select all button and save on server resources.

$this->getMassactionBlock()->setUseSelectAll(false);

So your code could look something like this

$this->setMassactionIdField('entity_id');
$this->getMassactionBlock()->setFormFieldName('form-name');
$this->getMassactionBlock()->setUseSelectAll(false);

If this saved you hours of work or saved you from a headache, feel free to buy us a beer.

Cannot send headers; headers already sent

Have you started up your magento development site or live site to discover Cannot send headers; headers already sent. 

More often than not, this error is caused by the local.xml file not validating correctly after being edited for a server transfer.

Look at the following carefully, I've highlighted in bold where the mistake is normally made in the closing tags.

<username><![CDATA[]]></username>
<password><![CDATA[]]></password>
<dbname><![CDATA[]]></dbname>

If you use web development software, you can paste it in to an xml file and validate it or download the file and validate it.

Not the error you were looking for?

Next thing to look at is if your index.php file has been edit. If any additional code has been added before <?php in the index.php file, it will start to throw up this error.

It will not show in your logs that the error is coming from the index.php file, so I've suggested looking at this file before enabling debugging logs.

Last but not least you can enable logging to find the file that is causing the error.

Open app/code/local/Mage/Core/Controller/Response/Http.php

FIND

Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));

WITH

Mage::Log(print_r(get_included_files(),true));

This will start saving to /var/log/system.log, look for the last entry and the error will be in that file.

Found the error and fixed it? Undo the changes you made to Http.php, otherwise that log will grow very quickly and bring your website to a standstill before long.

Exclude Tier Prices From Catalog Price Rules

It maybe necessary for you to exclude products that already have tier prices from catalog price rule promotions. An example would be that you want to have a global sales rule for all products, but on some items you have to purchase a certain quantity in order to qualify for the discount. This work around has been applied to a multi-store magento website.

The following adjustments to Mage_CatalogRule_Model_Resource_Rule will be beneficial for you. 

Copy Mage_CatalogRule_Model_Resource_Rule to local directory structure

Find function _getRuleProductsStmt

FIND THE FOLLOWING

$select->joinInner(
array('product_website' => $this->getTable('catalog/product_website')),
'product_website.product_id=rp.product_id ' .
'AND rp.website_id=product_website.website_id ' .
'AND product_website.website_id='.$websiteId,
array()
);

ADD THE FOLLOWING BELOW IT

$select->joinInner(
array('pt' => 'catalog_product_index_price'),
'pt.entity_id=rp.product_id AND pt.customer_group_id IN(rp.customer_group_id) AND pt.tier_price IS NULL AND pt.website_id='.$websiteId,
array()
);

It's not the cleanest way of doing it and requires that you have Flat Catalog Products enabled in your System > Configuration. It will however get you to where you want to be and you can process your Catalog Price Rules without worrying about removing tier price discounts.

If this saved you hours of work or saved you from a headache, feel free to buy us a beer.