Category Archives: PHP

Everything PHP

Removing All from Show All Per Page on Magento’s front end

.

Searching low and high, trying every search string i can think of in google. I’ve found nothing. Posting on Magento Commerce’s website i got a response with the answer. Here is the answer:

The file you are looking for is: Mage/Catalog/Block/Product/List/Toolbar.php

In this file at line 530 function getAvailableLimit()

public function getAvailableLimit()
{
if ($this->getCurrentMode() == 'list') {
if (isset($this->_availableLimit['list'])) {
return $this->_availableLimit['list'];
}
$perPageValues = (string)Mage::getStoreConfig('catalog/frontend/list_per_page_values');
$perPageValues = explode(',', $perPageValues);
$perPageValues = array_combine($perPageValues, $perPageValues);
return ($perPageValues /*+ array('all'=>$this->__('All'))*/);
}
elseif ($this->getCurrentMode() == 'grid') {
if (isset($this->_availableLimit['grid'])) {
return $this->_availableLimit['grid'];
}
$perPageValues = (string)Mage::getStoreConfig('catalog/frontend/grid_per_page_values');
$perPageValues = explode(',', $perPageValues);
$perPageValues = array_combine($perPageValues, $perPageValues);
return ($perPageValues /*+ array('all'=>$this->__('All'))*/);
}
return parent::getAvailableLimit();
}

as you can see the

return ($perPageValues /*+ array('all'=>$this->__('All'))*/);

I comment /*+ array(’all’=>$this->__(’All’))*/
now the “All” show anymore ….

Or course you should not change the core but sometime it’s easier then build an override
for it.

You should test it on a development store before !!!!
USE AT YOUR OWN RISK !!!!

Let me know if you have any problem

Installing MCrypt in php

1 way I’ve found of installing mcrypt, to tell you the truth I have no idea how it works, but it worked for me. Please comment and let me know how it works for you.

From root SSH (putty)

run commands as follows:

yum install mcrypt*

yum install php-mcrypt*

Your Magento folder does not have sufficient write permissions

.

Error: Please check for sufficient write file permissions

Your Magento folder does not have sufficient write permissions, which this web based downloader requires.

If you wish to proceed downloading Magento packages online, please set all Magento folders to have writable permission for the web server user (example: apache) and press the “Refresh” button to try again.
Refresh

To learn more about setting write permissions, please visit the Magento community site for further details.


Ever seen the above error message?  I have.  Solution’s I’ve found for this are as follows:

I installed magento through SSH as root.  Now the problem with this is all the folders magento creates is now owned by root, so apache or magento cannot change them.  Simple fix.  From what I read off of MagnetoCommerce.com is somebody changed the owner of the downloader folder.   I tried this, it didn’t fix my problem.  Feel free to try this way though.
chown apache downloader/ -hR

I took this a step further since I was still having the same problem.  I did this to the entire website directory

chown apache www/ -hR

Let me know if this works for you.

Moving OS Commerce from php4 to php5

I’m not sure if this fix is due to os commerce mods or just cause it’s needed when migrating a site from php 4 to php 5. After I switched the os commerce site to a new host i had many problems. A few hours and all can be fixed. This is just one of my problems. After moving the site the article link was bring up an error message:

Unknown column ‘a.authors_id’ in ‘on clause’

After google searching I found this fix which seems to work.

If anyone else finds this useful please post here and let me know.

Find the following variable in articles.php and change the query inside from:

$articles_all_query_raw = “select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from ” . TABLE_ARTICLES . ” a, ” . TABLE_ARTICLES_TO_TOPICS . ” a2t left join ” . TABLE_TOPICS_DESCRIPTION . ” td on a2t.topics_id = td.topics_id left join ” . TABLE_AUTHORS . ” au on a.authors_id = au.authors_id, ” . TABLE_ARTICLES_DESCRIPTION . ” ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = ‘1’ and a.articles_id = ad.articles_id and ad.language_id = ‘” . (int)$languages_id . “‘ and td.language_id = ‘” . (int)$languages_id . “‘ order by a.articles_date_added desc, ad.articles_name”;

TO:

$articles_all_query_raw = “select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from ((” . TABLE_ARTICLES . ” a), ” . TABLE_ARTICLES_TO_TOPICS . ” a2t) left join ” . TABLE_TOPICS_DESCRIPTION . ” td on a2t.topics_id = td.topics_id left join ” . TABLE_AUTHORS . ” au on a.authors_id = au.authors_id, ” . TABLE_ARTICLES_DESCRIPTION . ” ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = ‘1’ and a.articles_id = ad.articles_id and ad.language_id = ‘” . (int)$languages_id . “‘ and td.language_id = ‘” . (int)$languages_id . “‘ order by a.articles_date_added desc, ad.articles_name”;