Friday, 22 November 2013
Tuesday, 12 November 2013
How to create Layered Navigation for custom product collection?
http://stackoverflow.com/questions/17924813/how-to-create-layered-navigation-for-custom-product-collection
http://stackoverflow.com/questions/5726891/magento-layered-navigation-on-custom-product-collection
http://www.webdesign-gm.co.uk/news/web-design/magento-web-design/layered-navigation-on-home-page-or-any-cms-page-magento.php
https://www.sonassi.com/knowledge-base/magento-kb/yoast-landing-pages-module-with-layered-navigation/
http://stackoverflow.com/questions/5726891/magento-layered-navigation-on-custom-product-collection
http://www.webdesign-gm.co.uk/news/web-design/magento-web-design/layered-navigation-on-home-page-or-any-cms-page-magento.php
https://www.sonassi.com/knowledge-base/magento-kb/yoast-landing-pages-module-with-layered-navigation/
Product image zoom free extensions
http://www.magentocommerce.com/magento-connect/simple-zoom-slider-3972.html
http://www.magentocommerce.com/magento-connect/customproduct-1021.html
http://www.magentocommerce.com/magento-connect/colors-by-adverti-se-1816.html
http://www.magentocommerce.com/magento-connect/productview.html
http://www.magentocommerce.com/magento-connect/product-zoom-2310.html
http://www.magentocommerce.com/magento-connect/color-swicher-module-9707.html
http://www.magentocommerce.com/magento-connect/qaz-q-zoom-image-1316.html
http://www.magentocommerce.com/magento-connect/cueblocks-zoom.html
http://www.magentocommerce.com/magento-connect/vs-product-image-zoom-featurezoom.html
http://www.magentocommerce.com/magento-connect/customproduct-1021.html
http://www.magentocommerce.com/magento-connect/colors-by-adverti-se-1816.html
http://www.magentocommerce.com/magento-connect/productview.html
http://www.magentocommerce.com/magento-connect/product-zoom-2310.html
http://www.magentocommerce.com/magento-connect/color-swicher-module-9707.html
http://www.magentocommerce.com/magento-connect/qaz-q-zoom-image-1316.html
http://www.magentocommerce.com/magento-connect/cueblocks-zoom.html
http://www.magentocommerce.com/magento-connect/vs-product-image-zoom-featurezoom.html
One Step checkout free extensions
One Step checkout free extensions:
http://www.magentocommerce.com/magento-connect/onecheckout-checkout-in-one-step-on-one-page-2559.html
http://www.magentocommerce.com/magento-connect/express-checkout-one-step-checkout-free-8118.html
http://www.magentocommerce.com/magento-connect/iwd-free-one-page-one-step-checkout.html
http://www.magentocommerce.com/magento-connect/0-step-checkout-9378.html
http://www.magentocommerce.com/magento-connect/swiftcheckout-free-single-page-checkout.html
http://www.magentocommerce.com/magento-connect/skip-checkout-step-1.html
Add discount coupon code in checkout review step:
http://www.magentocommerce.com/magento-connect/add-discount-coupon-with-checkout-process.html
Quick contact form extension:
http://www.magentocommerce.com/magento-connect/freequickcontact-mageworld.html
http://www.magentocommerce.com/magento-connect/onecheckout-checkout-in-one-step-on-one-page-2559.html
http://www.magentocommerce.com/magento-connect/express-checkout-one-step-checkout-free-8118.html
http://www.magentocommerce.com/magento-connect/iwd-free-one-page-one-step-checkout.html
http://www.magentocommerce.com/magento-connect/0-step-checkout-9378.html
http://www.magentocommerce.com/magento-connect/swiftcheckout-free-single-page-checkout.html
http://www.magentocommerce.com/magento-connect/skip-checkout-step-1.html
Add discount coupon code in checkout review step:
http://www.magentocommerce.com/magento-connect/add-discount-coupon-with-checkout-process.html
Quick contact form extension:
http://www.magentocommerce.com/magento-connect/freequickcontact-mageworld.html
Monday, 11 November 2013
USPS shipping method not working in Magento | Important Patch for USPS API
Patch: Magento Community Edition Alert: Important Patch for USPS API
Installation Instructions: http://www.magentocommerce.com/boards/viewthread/484325/
Alternatively you can simply install the below extension:
http://www.goivvy.com/blog/magento-usps-july-2013-patch
Installation Instructions: http://www.magentocommerce.com/boards/viewthread/484325/
Alternatively you can simply install the below extension:
http://www.goivvy.com/blog/magento-usps-july-2013-patch
Sunday, 10 November 2013
Tuesday, 5 November 2013
CSR Generation : Apple Mac OS X Server
http://support.apple.com/kb/HT3976
http://support.godaddy.com/help/article/5269/generating-a-certificate-signing-request-csr-apache-2x
http://support.godaddy.com/help/article/6227/generating-a-certificate-signing-request-csr-mdash-mac-os-x-server-106
http://support.godaddy.com/help/article/5280/generating-a-certificate-signing-request-csr-mac-os-x-server-105
https://www.sslgenie.com/csr/csr-Apple-Mac-OS-X-Server.html
http://support.godaddy.com/help/article/5269/generating-a-certificate-signing-request-csr-apache-2x
http://support.godaddy.com/help/article/6227/generating-a-certificate-signing-request-csr-mdash-mac-os-x-server-106
http://support.godaddy.com/help/article/5280/generating-a-certificate-signing-request-csr-mac-os-x-server-105
https://www.sslgenie.com/csr/csr-Apple-Mac-OS-X-Server.html
Thursday, 31 October 2013
Monday, 14 October 2013
Perl script for documents backup
#!/usr/bin/perl
# Configuration params
$backup_dir = '/home/username/public_html';
$file_prefix = 'doc_backup_';
# Get the timestamp for today
$date = `date "+%Y%m%d"`;
chomp($date);
chdir('/home/username/backup/doc_backup') ;
`tar -cv -f $file_prefix$date.tar $backup_dir`;
`bzip2 $file_prefix$date.tar`;
# Below line is used to remove the backups older than 5 days to free up the server space
system("find . -mtime +5 -type f -name 'doc_backup_*' -exec rm {} \\;");
# Configuration params
$backup_dir = '/home/username/public_html';
$file_prefix = 'doc_backup_';
# Get the timestamp for today
$date = `date "+%Y%m%d"`;
chomp($date);
chdir('/home/username/backup/doc_backup') ;
`tar -cv -f $file_prefix$date.tar $backup_dir`;
`bzip2 $file_prefix$date.tar`;
# Below line is used to remove the backups older than 5 days to free up the server space
system("find . -mtime +5 -type f -name 'doc_backup_*' -exec rm {} \\;");
Perl script for Database backup
#Configuration params
$host = 'localhost';
$user = 'username';
$pass = 'password';
$database = 'dbname';
$backup_dir = '/home/username/backup/db_backup';
$file_prefix = 'database_backup_';
# Get the timestamp for today
$date = `date "+%Y%m%d"`;
chomp($date);
`mysqldump --host=$host --user=$user --pass=$pass $database | bzip2 -c > $backup_dir/$file_prefix$database$date.sql.bz2`;
Friday, 4 October 2013
Wednesday, 25 September 2013
Increase number of emails to be sent via Nesletter
To increase the number emails to be sent for every 5 min:
In app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
Change the
$countOfSubscritions = 20;
To
$countOfSubscritions = 100; // whatever number you want
Also in app/code/core/Mage/Newsletter/Model/Oberver.php
Change the
$countOfSubscritions = 20;
To
$countOfSubscritions = 100; // whatever number you want
In app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
Change the
$countOfSubscritions = 20;
To
$countOfSubscritions = 100; // whatever number you want
Also in app/code/core/Mage/Newsletter/Model/Oberver.php
Change the
$countOfSubscritions = 20;
To
$countOfSubscritions = 100; // whatever number you want
Extend the core admin controller
Working example can be found at :
http://www.magentocommerce.com/boards/viewthread/25942/P15/#t348401
http://www.magentocommerce.com/boards/viewthread/25942/P15/#t348401
Tuesday, 24 September 2013
Creating Virtual Host on Mac
Restart Apache on Mac:
http://www.cyberciti.biz/faq/restart-apache2-mac-osx/
http://www.cyberciti.biz/faq/restarting-apache-under-oxs-commandline/
Creating a Virtual Host on Mac:
http://foundationphp.com/tutorials/vhosts_leopard.php
Subdomain Setup on Mac:
http://content.websitegear.com/article/subdomain_setup.htm
http://www.cyberciti.biz/faq/restart-apache2-mac-osx/
http://www.cyberciti.biz/faq/restarting-apache-under-oxs-commandline/
Creating a Virtual Host on Mac:
http://foundationphp.com/tutorials/vhosts_leopard.php
Subdomain Setup on Mac:
http://content.websitegear.com/article/subdomain_setup.htm
Sunday, 22 September 2013
Get Default Magento store ID
$defaultStoreId = Mage::app()
->getWebsite(true)
->getDefaultGroup()
->getDefaultStoreId();
Thursday, 19 September 2013
Improve Magento native search
Follow the tips at http://markustenghamn.com/improve-search-function-magento
Install the following free extension:
http://www.magentocommerce.com/magento-connect/enhanced-default-search-9697.html
Install the following free extension:
http://www.magentocommerce.com/magento-connect/enhanced-default-search-9697.html
Tuesday, 17 September 2013
Magento Newsletter UnSubscribe Link
Script to get Unsubscribe link:
Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getUnsubscriptionLink();
Code snippet to be used in email templates:
<a href="{{var subscriber.getUnsubscriptionLink()}}">{{var subscriber.getUnsubscriptionLink()}}</a>
Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getUnsubscriptionLink();
Code snippet to be used in email templates:
<a href="{{var subscriber.getUnsubscriptionLink()}}">{{var subscriber.getUnsubscriptionLink()}}</a>
Friday, 13 September 2013
Tuesday, 10 September 2013
Tuesday, 3 September 2013
Magento Newsletter Integration
MailChimp:
http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html
Constant Contact:
http://www.magentocommerce.com/magento-connect/constant-contact.html
http://www.freelunchlabs.com/store/constant-contact-and-magento-sync.html
IContact:
http://www.magecoders.com/index.php/magento-extensions/icontact-sync.html
http://www.magentocommerce.com/magento-connect/icontact-sync-9752.html
http://www.magentocommerce.com/magento-connect/mage-monkey-mailchimp-integration-4865.html
Constant Contact:
http://www.magentocommerce.com/magento-connect/constant-contact.html
http://www.freelunchlabs.com/store/constant-contact-and-magento-sync.html
IContact:
http://www.magecoders.com/index.php/magento-extensions/icontact-sync.html
http://www.magentocommerce.com/magento-connect/icontact-sync-9752.html
Monday, 2 September 2013
Get product URL without categpry and product ID
$product = Mage::getModel('catalog/product')->load($productId);
$url = Mage::getUrl($product->getUrlPath());
$url = Mage::getUrl($product->getUrlPath());
Integrating Onstagram with Magento
Instagram API:
http://instagram.com/developer/authentication/#
Free Extension:
http://magento.ikantam.com/store/free-instagram-magento-extension.html
Installation Guide:
http://magento.ikantam.com/store/media/catalog/product/pdf/Instagram_Extension.pdf
Extension on Magento Connect:
http://www.magentocommerce.com/magento-connect/instagram-extension-2508.html
Paid Extension:
http://www.magazento.com/english/magento-ext/magazento-extensions/instastream-instagram-integration
http://instagram.com/developer/authentication/#
Free Extension:
http://magento.ikantam.com/store/free-instagram-magento-extension.html
Installation Guide:
http://magento.ikantam.com/store/media/catalog/product/pdf/Instagram_Extension.pdf
Extension on Magento Connect:
http://www.magentocommerce.com/magento-connect/instagram-extension-2508.html
Paid Extension:
http://www.magazento.com/english/magento-ext/magazento-extensions/instastream-instagram-integration
Friday, 30 August 2013
Tuesday, 27 August 2013
CyberSource Payment Gateway Field validations and Guides
Field Validation
Notification
As part of its commitment to
maintain industry-leading security and data integrity, CyberSource will be
implementing additional front-end validation of transaction data entering it's
Systems, starting on January 22nd, 2013.
As part of this effort,
CyberSource will start performing additional validation on certain API field
values coming into the Production environment across all connection methods,
including several fields in the following groups:
Customer Information and Address Fields
Order Tracking Fields
After extensive testing versus
past production transaction data, we are confident that these changes will be
transparent to the vast majority of our customer base. However, if you do
see any perceived changes in data validation-related declines, please feel free
to contact CyberSource Customer Support for further assistance in
troubleshooting said transactions.
Cyber Source Simple Order SDK Tool Kit:
http://www.cybersource.com/developers/develop/integration_methods/simple_order_and_soap_toolkit_api/
Documentation on fields:
Development Guides:
Monday, 26 August 2013
WorldPay payment gateway test account
It has no test account however you can use the LIVE in test mode for testing
http://www.ukbusinessforums.co.uk/forums/showthread.php?t=211474
Magento Extension:
http://www.magentocommerce.com/magento-connect/worldpay-extension.html
Support - Forum:
http://www.magentocommerce.com/boards/viewthread/10803/P150/
Guides:
http://www.worldpay.com/support/kb/bg/pdf/tgl.pdf
http://www.worldpay.com/support/kb/bg/testandgolive/tgl.html
http://www.ukbusinessforums.co.uk/forums/showthread.php?t=211474
Magento Extension:
http://www.magentocommerce.com/magento-connect/worldpay-extension.html
Support - Forum:
http://www.magentocommerce.com/boards/viewthread/10803/P150/
Guides:
http://www.worldpay.com/support/kb/bg/pdf/tgl.pdf
http://www.worldpay.com/support/kb/bg/testandgolive/tgl.html
Tuesday, 20 August 2013
Search the date range between two dates SQL
CREATE TABLE `product_sales` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`From_date` date NOT NULL,
`To_date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `Product_sales`
--
INSERT INTO `Product_sales` (`id`, `name`, `From_date`, `To_date`) VALUES
(1, 'Product 1', '2013-08-20', '2013-08-30'),
(2, 'Product 2', '2013-08-14', '2013-08-27'),
(3, 'Product 3', '2013-08-25', '2013-08-31'),
(4, 'Product 4', '2013-08-10', '2013-08-22'),
(5, 'Product 4', '2013-08-24', '2013-08-28'),
(6, 'Product 4', '2013-08-23', '2013-08-30');
QUERY:
SELECT * FROM Product_sales WHERE ( From_date >= '2013-08-19' AND To_date <= '2013-08-23' ) OR ( To_date >= '2013-08-19' AND From_date <= '2013-08-23' )
Tuesday, 13 August 2013
Magento Extensions for Grid manager or extending
https://github.com/magento-hackathon
Adding order attribute to the orders grid in Magento 1.4.1
http://www.ecomdev.org/2010/07/27/adding-order-attribute-to-orders-grid-in-magento-1-4-1.html
How to extend Magento Order Grid?
http://inchoo.net/ecommerce/magento/how-to-extend-magento-order-grid/
The proper way to add columns to Sales Order Grid in Magento 1.7
http://stackoverflow.com/questions/15172137/the-proper-way-to-add-columns-to-sales-order-grid-in-magento-1-7
Grid Manager
http://ecommerce.aheadworks.com/magento-extensions/grid-manager.html
http://www.magentocommerce.com/magento-connect/grid-manager.html
Adding order attribute to the orders grid in Magento 1.4.1
http://www.ecomdev.org/2010/07/27/adding-order-attribute-to-orders-grid-in-magento-1-4-1.html
How to extend Magento Order Grid?
http://inchoo.net/ecommerce/magento/how-to-extend-magento-order-grid/
The proper way to add columns to Sales Order Grid in Magento 1.7
http://stackoverflow.com/questions/15172137/the-proper-way-to-add-columns-to-sales-order-grid-in-magento-1-7
Grid Manager
http://ecommerce.aheadworks.com/magento-extensions/grid-manager.html
http://www.magentocommerce.com/magento-connect/grid-manager.html
Wednesday, 7 August 2013
Tuesday, 30 July 2013
Remove index.php from Magento admin URL
http://www.bestdesigns.co.in/blog/remove-index-php-url-magento
http://www.magentocommerce.com/magento-connect/clockworkgeek/extension/3692/clockworkgeek_adminrewrites
Change admin URL and Path:
https://www.properhost.com/members/knowledgebase.php?action=displayarticle&id=15
Custom Router in Magento:
http://inchoo.net/ecommerce/magento/custom-router-in-magento/
Get Magento admin custom URL:
http://blog.chapagain.com.np/magento-how-to-get-controller-action-and-module-name-in-template-file/
http://www.magentocommerce.com/magento-connect/clockworkgeek/extension/3692/clockworkgeek_adminrewrites
Change admin URL and Path:
https://www.properhost.com/members/knowledgebase.php?action=displayarticle&id=15
Custom Router in Magento:
http://inchoo.net/ecommerce/magento/custom-router-in-magento/
Get Magento admin custom URL:
Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
Get Router, Module, Controller and Action names:http://blog.chapagain.com.np/magento-how-to-get-controller-action-and-module-name-in-template-file/
Thursday, 25 July 2013
Thursday, 18 July 2013
Add custom field / attribute to Google Calendar Event using API
An extended property is an arbitrary name/value pair that can be added to an event and retrieved via the API. It is not accessible from the
calendar web interface.
https://developers.google.com/gdata/docs/2.0/elements?hl=fr#gdExtendedProperty
Friday, 12 July 2013
Tuesday, 9 July 2013
Monday, 8 July 2013
Friday, 5 July 2013
Adding new / update / delete category attribute in Magento
<?php
/** @var $this Mage_Eav_Model_Entity_Setup */
$this->startSetup();
/** Remove existing atribute */
$this->removeAttribute('catalog_category', 'size_chart');
/** Add new atribute */
$this->addAttribute('catalog_category', 'short_description', array(
'group' => 'General Information',
'input' => 'textarea',
'type' => 'text',
'label' => 'Short Description',
//'source' => 'categoryattributes/source_sizechart',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'note' => 'Category Short Description will be shown in bottom 3 boxes of other category pages',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
/** Update existing atribute */
$categoryEntityTypeId = $this->getEntityTypeId('catalog_category');
$this->updateAttribute($categoryEntityTypeId, 'short_description', 'is_wysiwyg_enabled', 0);
$this->updateAttribute($categoryEntityTypeId, 'short_description', 'is_html_allowed_on_front', 0);
$this->endSetup();
?>
http://www.atwix.com/magento/add-category-attribute/
Thursday, 4 July 2013
Check Module existance in Magento
Following snippet can determine wether the module installed and it is active:
$modules = (array)Mage::getConfig()->getNode('modules')->children();
if (isset($modules['Company_Module']) && $modules['Company_Module']->is('active')) {
// Do something
}
$modules = (array)Mage::getConfig()->getNode('modules')->children();
if (isset($modules['Company_Module']) && $modules['Company_Module']->is('active')) {
// Do something
}
Installing APC Cache and setting up in Magento
http://www.euperia.com/website-performance-2/how-to-add-apc-cache-to-magento/799
http://magento2x.com/apc-configuration-for-magento/
http://www.aitoc.com/en/blog/apc_speeds_up_Magento.html
http://www.magentocommerce.com/boards/viewthread/8937/P45/
http://www.designguru.org/blog/120810/how-install-apc-media-temples-gridserver-accounts
http://magento2x.com/apc-configuration-for-magento/
http://www.aitoc.com/en/blog/apc_speeds_up_Magento.html
http://www.magentocommerce.com/boards/viewthread/8937/P45/
http://www.designguru.org/blog/120810/how-install-apc-media-temples-gridserver-accounts
Wednesday, 3 July 2013
Saturday, 29 June 2013
Installing phpMyAdmin on RedHat Linux
Installing phpMyAdmin on RedHat Linux
http://www.bharath.co.uk/articles/2011/07/installing-phpmyadmin-redhat-linux
Install PHP Mcrypt extension on RHEL 6
http://injustfiveminutes.wordpress.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
What is yum and how do I use it?
https://access.redhat.com/site/solutions/9934
Install Enginx:
http://wiki.nginx.org/Install
RPM Downloads:
http://dl.fedoraproject.org/pub/epel/6/x86_64/
http://www.bharath.co.uk/articles/2011/07/installing-phpmyadmin-redhat-linux
Install PHP Mcrypt extension on RHEL 6
http://injustfiveminutes.wordpress.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
What is yum and how do I use it?
https://access.redhat.com/site/solutions/9934
Install Enginx:
http://wiki.nginx.org/Install
RPM Downloads:
http://dl.fedoraproject.org/pub/epel/6/x86_64/
Wednesday, 26 June 2013
Fast Asynchronous Re-indexing and Caching
Fast Asynchronous Re-indexing
http://mirasvit.com/magento-extensions/magento-asynchronous-reindex.htmlAsynchronous Cache
http://mirasvit.com/magento-extensions/magento-asynchronous-cache.html
Tuesday, 25 June 2013
Pointers to get started with Magento
Below are the pointers to get started with Magento
- System Requirements
- http://www.magentocommerce.com/system-requirements
- Folder Structure
- http://www.magentocommerce.com/wiki/2_-_magento_concepts_and_architecture/magento-folder-structure
- Technical Documentation
- http://docs.magentocommerce.com/
- Knowledge Base
- http://www.magentocommerce.com/knowledge-base
- This will have following:
- Knowledge Base Home
- Installation & Configuration
- Build Your Store Manage Your Store
- Expand Your Store
- Themes and Design Development
- Magento Connect
- User Guides
- http://www.magentocommerce.com/resources/magento-user-guide
- Magento API
- http://www.magentocommerce.com/api/soap/introduction.html
Monday, 24 June 2013
Saturday, 22 June 2013
Wednesday, 19 June 2013
Generate BarCodes with PHP, ZEND and Magento
Zend Framework:
http://framework.zend.com/manual/1.12/en/zend.barcode.creation.html
It seems very easy to generate bar codes using Zend framework
PHP:
http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/
http://www.barcodephp.com/en/download
How UPC Bar Codes Work:
http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/upc.htm
http://framework.zend.com/manual/1.12/en/zend.barcode.creation.html
It seems very easy to generate bar codes using Zend framework
PHP:
http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/
http://www.barcodephp.com/en/download
How UPC Bar Codes Work:
http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/upc.htm
Tuesday, 18 June 2013
Friday, 3 May 2013
Download files from server using command line and PSCP in Windows
1) Download pscp.exe
2) Run >> CMD >> cd program files[location of pscp.exe]
3) pscp -r username@HOSTIPADDRESS:/var/www/vhosts/abc.com/httpdocs/ C:\backupfiles\httpdocs\
4) http://www.linuxquestions.org/questions/linux-newbie-8/scp-copy-file-from-remote-linux-server-onto-a-windows-machine-316263/
2) Run >> CMD >> cd program files[location of pscp.exe]
3) pscp -r username@HOSTIPADDRESS:/var/www/vhosts/abc.com/httpdocs/ C:\backupfiles\httpdocs\
4) http://www.linuxquestions.org/questions/linux-newbie-8/scp-copy-file-from-remote-linux-server-onto-a-windows-machine-316263/
Wednesday, 17 April 2013
Log Clearing Script Magento
<?php
$xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;
$db['pass'] = $xml->global->resources->default_setup->connection->password;
$db['pref'] = $xml->global->resources->db->table_prefix;
if($_GET['clean'] == 'log') clean_log_tables();
if($_GET['clean'] == 'var') clean_var_directory();
function clean_log_tables() {
global $db;
$tables = array(
'dataflow_batch_export',
'dataflow_batch_import',
'log_customer',
'log_quote',
'log_summary',
'log_summary_type',
'log_url',
'log_url_info',
'log_visitor',
'log_visitor_info',
'log_visitor_online',
'index_event',
'report_event',
'report_compared_product_index',
'report_viewed_product_index',
'catalog_compare_item',
'catalogindex_aggregation',
'catalogindex_aggregation_tag',
'catalogindex_aggregation_to_tag'
);
mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
mysql_select_db($db['name']) or die(mysql_error());
foreach($tables as $v => $k) {
@mysql_query('TRUNCATE `'.$db['pref'].$k.'`');
}
}
function clean_var_directory() {
$dirs = array(
'downloader/.cache/*',
'downloader/pearlib/cache/*',
'downloader/pearlib/download/*',
'var/cache/',
'var/locks/',
'var/log/',
'var/report/',
'var/session/',
'var/tmp/'
);
foreach($dirs as $v => $k) {
exec('rm -rf '.$k);
}
}
Sunday, 14 April 2013
Magento send emails using SMTP
In order to allow magento to use SMTP instead of the usual mail function, you need to take the below steps.
- Login to magento admin and go to. System->Configuration->Advanced->System->Mail Sending Settings
- Now here set the host value to your smtp host name like
mail.domain.com
- And then the default port is 25.
- Now you need to change magento file. Do not edit the core file as you will loose your change in an upgrade.
- So copy this file app/code/core/Mage/core/Model/Email/Template.php in to your local, by creating the same folder structure.
- Enable that module.
- Then in Template.php you will have to change the getMail() function as below.
public function getMail()
{
if (is_null($this->_mail)) {
/* changes begin */
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
$config = array(
'port' => $my_smtp_port,
'auth' => 'login',
'username' => 'email@domain.com',
'password' => 'yourpassword'
);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail('utf-8');
}
return $this->_mail;
}
- After this clear your cache.
- Now magento will be able to send emails for you.
- Login to magento admin and go to. System->Configuration->Advanced->System->Mail Sending Settings
- Now here set the host value to your smtp host name like
mail.domain.com
- And then the default port is 25.
- Now you need to change magento file. Do not edit the core file as you will loose your change in an upgrade.
- So copy this file app/code/core/Mage/core/Model/Email/Template.php in to your local, by creating the same folder structure.
- Enable that module.
- Then in Template.php you will have to change the getMail() function as below.
public function getMail()
{
if (is_null($this->_mail)) {
/* changes begin */
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
$config = array(
'port' => $my_smtp_port,
'auth' => 'login',
'username' => 'email@domain.com',
'password' => 'yourpassword'
);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail('utf-8');
}
return $this->_mail;
}
- After this clear your cache.
- Now magento will be able to send emails for you.
Friday, 12 April 2013
Thursday, 11 April 2013
Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13 Released
Highlights
- Major overhaul of tax calculation formulas, correction of rounding errors, and additional assistance with configuration
- Most indexing processes now run only to update products, categories, URL redirects, and so on that have changed—eliminating the need for manual full reindexing
- Additional option of using Redis NoSQL for cache and session storage in multi-host deployments (recommended for new deployments)
- Full page caching now invalidates only pages that are affected by product or category changes
- Optimized cache adapters for single-server systems
- Elimination of many types of database deadlocks
http://www.magentocommerce.com/knowledge-base/entry/ce-18-and-ee-113-documentation-home
Tuesday, 9 April 2013
Friday, 5 April 2013
Disable Author pages in Wordpress
Open your theme’s functions.php and put this in:
/* Kill attachment, search, author, daily archive pages */ add_action('template_redirect', 'bwp_template_redirect'); function bwp_template_redirect() { global $wp_query, $post; if (is_author() || is_attachment() || is_day() || is_search()) { $wp_query->set_404(); } if (is_feed()) { $author = get_query_var('author_name'); $attachment = get_query_var('attachment'); $attachment = (empty($attachment)) ? get_query_var('attachment_id') : $attachment; $day = get_query_var('day'); $search = get_query_var('s'); if (!empty($author) || !empty($attachment) || !empty($day) || !empty($search)) { $wp_query->set_404(); $wp_query->is_feed = false; } } }
The snippet above will effectively disable attachment pages, search page, author pages and daily archive pages. Automatically generated feeds for those pages will also be disabled.
You can find more conditional tags at: http://codex.wordpress.org/Conditional_Tags
Source: http://betterwp.net/wordpress-tips/disable-some-wordpress-pages/
Wednesday, 3 April 2013
Tuesday, 19 March 2013
Database table fields type using PHP
Script to list all the field data types in specified database and create a CSV file then download the CSV file.
<?php
set_time_limit(0);
getUniqueFieldTypes('HOSTNAME','DATABASE USERNAME','PASSWORD','DATABASENAME');
function getUniqueFieldTypes($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass) or die('Could not connect');
mysql_select_db($name,$link);
//Get all of the tables
if($tables == '*')
{
$tables = array();
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
$dataTypes = array();
//Cycle through
foreach($tables as $table)
{
$result = mysql_query('SHOW FIELDS FROM '.$table);
$num_fields = mysql_num_fields($result);
while($row = mysql_fetch_row($result))
{
$dataTypes[$row[1]] = $row[1];
}
//sleep(1);
}
asort($dataTypes);
$fp = fopen('fields.csv', 'w+');
foreach($dataTypes as $dataType) {
$values = array($dataType);
fputcsv($fp, $values);
}
fclose($fp);
$file = 'fields.csv';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
}
?>
<html>
<head>
<title>Create CSV with list of field data types</title>
</head>
</html>
Below are the list data types supported by MYSQL:
VARCHAR
TINYINT
TEXT
DATE
SMALLINT
MEDIUMINT
INT
BIGINT
FLOAT
DOUBLE
DECIMAL
DATETIME
TIMESTAMP
TIME
YEAR
CHAR
TINYBLOB
TINYTEXT
BLOB
MEDIUMBLOB
MEDIUMTEXT
LONGBLOB
LONGTEXT
ENUM
SET
BOOL
BINARY
VARBINARY
<?php
set_time_limit(0);
getUniqueFieldTypes('HOSTNAME','DATABASE USERNAME','PASSWORD','DATABASENAME');
function getUniqueFieldTypes($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass) or die('Could not connect');
mysql_select_db($name,$link);
//Get all of the tables
if($tables == '*')
{
$tables = array();
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
$dataTypes = array();
//Cycle through
foreach($tables as $table)
{
$result = mysql_query('SHOW FIELDS FROM '.$table);
$num_fields = mysql_num_fields($result);
while($row = mysql_fetch_row($result))
{
$dataTypes[$row[1]] = $row[1];
}
//sleep(1);
}
asort($dataTypes);
$fp = fopen('fields.csv', 'w+');
foreach($dataTypes as $dataType) {
$values = array($dataType);
fputcsv($fp, $values);
}
fclose($fp);
$file = 'fields.csv';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
}
?>
<html>
<head>
<title>Create CSV with list of field data types</title>
</head>
</html>
Below are the list data types supported by MYSQL:
VARCHAR
TINYINT
TEXT
DATE
SMALLINT
MEDIUMINT
INT
BIGINT
FLOAT
DOUBLE
DECIMAL
DATETIME
TIMESTAMP
TIME
YEAR
CHAR
TINYBLOB
TINYTEXT
BLOB
MEDIUMBLOB
MEDIUMTEXT
LONGBLOB
LONGTEXT
ENUM
SET
BOOL
BINARY
VARBINARY
Subscribe to:
Posts (Atom)