Blog: Extra-ordinary

How to Sort product list by custom attribute in Magento?

Please open \app\design\frontend\default\<your theme name>\template\catalog\product\ toolbar.phtml Line number may be 63. just replace with below code : <fieldset> <?php //$this->_availableOrder = array(‘name’=>__(‘Alphabetical’), ‘price’=>__(‘Price’)); ?> <label><?php echo $this->__(‘Sort by’) ?></label> <select onchange=”setLocation(this.value)”> <option value=”<?php echo $this->getOrderUrl(‘featured’, ‘asc’) ?>”<?php if($this->isOrderCurrent(‘featured’) && $this->getCurrentDirection() == ‘asc’): ?> selected=”selected”<?php endif; ?>>Featured </option> <option value=”<?php echo $this->getOrderUrl(‘sku’, ‘asc’) ?>”<?php if($this->isOrderCurrent(‘sku’) && $this->getCurrentDirection() == ‘asc’): ?> selected=”selected”<?php …

Continue Reading

How to get url in Magento?

 Get Base Url : Mage::getBaseUrl();  Get Skin Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); (i) Unsecure Skin Url : $this->getSkinUrl(‘images/imagename.jpg’); (ii) Secure Skin Url : $this->getSkinUrl(‘images/imagename.gif’, array(‘_secure’=>true));  Get Media Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);  Get Js Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);  Get Store Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); Get Current Url Mage::helper(‘core/url’)->getCurrentUrl(); Get Url in cms pages or static blocks  Get Base Url : {{store url=””}} Get Skin Url : …

Continue Reading

What is OOP( object-oriented programming)?

OOP is a programming paradigm that uses abstraction to create models based on the real world. It provides for better modeling of the real world by providing a much needed improvement in domain analysis and then integration with system design. The power of object-oriented systems lies in their promise of code reuse which will increase productivity, reduce costs and improve …

Continue Reading

How to copy a file from one directory to another using PHP?

This should be pretty easy. You want to copy & rename images that already exist on the server while still retaining the original image. Here’s the original image location: images/ folder/ your_image_name.jpg This is what I want: images/ folder/ your_image_name.jpg your_image_new_name.jpg <?php $file = ‘images/folder/your_image_name.jpg’; $newfile = ‘Images/folder/your_image_new_name.jpg’; if (!copy($file, $newfile)) { echo “failed to copy”; } Hope it will …

Continue Reading

How to decrease database size in Magento?

To decrease database size you take below action. It will not effect your database. You can say this is unwanted data. TRUNCATE dataflow_batch_export; TRUNCATE dataflow_batch_import; TRUNCATE log_customer; TRUNCATE log_quote; TRUNCATE log_summary; TRUNCATE log_summary_type; TRUNCATE log_url; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE log_visitor_info; TRUNCATE log_visitor_online; TRUNCATE report_viewed_product_index; TRUNCATE report_compared_product_index; TRUNCATE report_event; TRUNCATE index_event; TRUNCATE catalog_compare_item; TRUNCATE catalogindex_aggregation; TRUNCATE catalogindex_aggregation_tag; TRUNCATE catalogindex_aggregation_to_tag; Hope …

Continue Reading

How to Speed up Magento?

Please check below info to Speed up Magento: Speed up Magento with these simple admin settings. When you’re ready to go live with your Magento store, remember to setup your admin for maximum performance! These are the settings that will significantly speed up your Magento installation: 1. Most users are well aware of this one. Just navigate to System > …

Continue Reading