Showing posts with label Magento Development Services. Show all posts
Showing posts with label Magento Development Services. Show all posts

Tuesday, 26 May 2015

Magento Features that Remain Unknown



Magento is a highly inspiring platform solution to build e-commerce solutions thus giving your business a boost. You will see that almost all the features available with Magento enrich your store, and help flourish your business. While most of the Magento features are live and accessible, you will see that many features are still unknown. These features will help take care of some of the trivial issues that bother you while working on this platform. Here are some of the lesser known yet very powerful features of Magento

 
Set the Admin Session

Many times while working with the admin panel, you will see that you have been timed out. You were trying to change the product description, but for some reason when you began saving it, you realized you were timed out. You have an option of setting the admin session lifetime to work uninterrupted.

Go to System>Config>Admin>    Security>Session Lifetime (seconds)

You will need to set the value to over 3600 seconds. This is so that your admin session does not get logged out every 60 minutes

Nest Static Blocks
Do you feel the need to make the content more manageable? With the static blocks, you will be able to divide the different content blocks thus simplifying the content. You can reduce the amount of content in the static blocks nest the different static blocks to be called on a single category or product page.

Allow Customer Ratings

Do you want your customers to rate your products on various parameters? You can now add the different parameters.

All you need to do is go to catalog>reviews and ratings>manage rating

You can add the star rating criteria here. All rating parameters are manageable at the store view level

Create Admin Action Log
With this logging functionality, you can log the actions that you want to record. With such a log you can easily diagnose the issues that you encounter. How will you log the admin actions?

Go to System>    Admin Actions Log and check the boxes next the actions you want logged.

Pricing the Items

In case, you want to display a different pricing for multiple quantities of a particular product, you can easily do so using tier pricing. How will you set tier pricing?

Go to Magento Admin>Catalog>Managed Products

Now click on the item that you want to add tier pricing to

Click on pricer>Add Tier

Now, you should enter the quantity for the tier pricing; also add the price per item and then press save. You will see the tier pricing on your e-store

Conclusion


There are many such things which you tend to ignore. But, these things not just grab your customer’s attention, but also helps reach out to more people. In fact, the store’s popularity and performance improves thus increasing footfalls.


Author Bio:

Deepa is a passionate blogger associated with Silver Touch Technologies., a leading Magento Development Company UK. She recommends checking out Magento Development Services at https://www.silvertouchtech.co.uk If you are looking to hire Magento Developer UK then just get in touch with her.

Friday, 1 May 2015

Disable Shipping Method on the Frontend with a Few Tweaks

Magento, in its default state, does not support the functionality wherein you can disable shipping method from the frontend, but leave it enabled in the admin area of your Magento website. Well, while it is not functionally supported by Magento, you can always add some tweaks to make it possible. Configurations for the different functionalities are available at global, website and store levels for Magento, but at a global/website level, you can either enable/disable the shipping methods. At the store level, you can only edit the title of your store. You will not be able to enable or disable shipping at store level.



Let’s take a simple case to understand the tweak better.

Scenario 1: you have a single website within your Magento system. Go to sales>order>generate new order.

You will see the “please select a customer grid” option blinking on your screen from where you will need to choose the customer for whom you want to create the order.

Scenario 2: You have two websites defined in your Magento system

Go to sales>order>generate new order.

Now, you will see “please select a website”. Once you have selected the website, the following line will appear “please select a customer”.

Now, that you have seen two different scenarios, let’s try to understand what’s really happening.

Either you use the default website (as you did when working with single website), or choose the website you want to create the customer for. In both scenarios, after reading the website configuration, the shipping data is retrieved from the website. This simply means that you cannot configure the store to show the shipping method at the admin side only.

How can we overcome this issue, and configure the shipping method to be shown only in the admin area? Simple! You will need to rewrite Mage_Shipping_Model_Config and Mage_Sales_Model_Quote_Address

Go to app/code/local/Mycompany/Myextension/etc/config.xml

<models>
    <shipping>
        <rewrite>
            <config>Mycompany_Myextension_Model_Shipping_Config</config>
        </rewrite>              
    </shipping>
    <sales>
        <rewrite>
            <quote_address>Mycompany_Myextension_Model_Sales_Quote_Address</quote_address>
        </rewrite>
    </sales>
</models>

Configuring the shipping methods

Go to

app/code/local/Mycompany/Myextension/Model/Adminhtml/System/Config/Source/Shipping/M
ethods

<?php

class Mycompany_Myextension_Model_Adminhtml_System_Config_Source_Shipping_Methods
{
    protected $_options;

    public function toOptionArray()
    {
        $carriers = Mage::getSingleton('shipping/config')->getAllCarriers();

        $carriersActive = Mage::getSingleton('shipping/config')->getActiveCarriers();
        $carriersActive = array_keys($carriersActive);

        if (!$this->_options) {
            foreach ($carriers as $carrier) {
                $carrierCode = $carrier->getId();
                $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', Mage::app()->getStore()->getId());
                $carrierTitle = trim($carrierTitle);

                if (empty($carrierTitle)) {
                    continue;
                }

                if (in_array($carrierCode, $carriersActive)) {
                    $carrierTitle = sprintf('%s (currently active)', $carrierTitle);
                } else {
                    $carrierTitle = sprintf('%s (currently inactive)', $carrierTitle);
                }

                $this->_options[] = array('value'=>$carrierCode, 'label'=>$carrierTitle);
            }
        }

        $options = $this->_options;

        array_unshift($options, array('value'=>'', 'label'=> ''));

        return $options;
    }
}

The system.xml defines the file “source_model”

Go to app/code/local/Mycompany/Myextension/etc/system.xml

<fields>
    <frontend_hidden_methods>
        <label>Hide Shipping Methods on Frontend</label>
        <comment><![CDATA[If a shipping method has been enabled under its settings, you can choose to hide it on the frontend by selecting it here from the list. This way, the shipping method would be available from the admin area but not from the frontend.]]></comment>
        <frontend_type>multiselect</frontend_type>
        <source_model>mycompany_myextension/adminhtml_system_config_source_shipping_methods</source_model>
        <sort_order>2</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
    </frontend_hidden_methods>
</fields>

The actual config definition has been shown partially as part of the above code

Defining the helper data

Go to app/code/local/Mycompany/Myextension/Helper/Data.php. Paste the following code here

<?php
 class Mycompany_Myextension_Helper_Data extends Mage_Core_Helper_Abstract
{
    const CONFIG_PATH_HIDE_FRONTEND_SHIPPING_METHODS = 'some-path-to-system-xml-field';

    public function getHiddenFrontendShippingMethods()
    {
        $methods = Mage::getStoreConfig(self::CONFIG_PATH_HIDE_FRONTEND_SHIPPING_METHODS);
        $methods = explode(',', $methods);
         return $methods;
    }
}

Rewrite Shipping Config

Go to app/code/local/Mycompany/Myextension/Model/Shipping/Config.php
<?php
 class Mycompany_Myextension_Model_Shipping_Config extends Mage_Shipping_Model_Config
{
    public function getActiveCarriers($store = null)
    {
        $carriers = parent::getActiveCarriers($store);
         if (Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND) {
             $carriersCodes = array_keys($carriers);
            $hiddenShippingMethods = Mage::helper('mycompany_myextension')->getHiddenFrontendShippingMethods();

            foreach ($carriersCodes as $carriersCode) {
                if (in_array($carriersCode, $hiddenShippingMethods)) {
                    unset($carriers[$carriersCode]);
                }
            }          
        }
         return $carriers;
    }
}

Rewrite quote address. Go to

app/code/local/Mycompany/Myextension/Model/Sales/Quote/Address.php
<?php
 class Mycompany_Myextension_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
{
    public function getShippingRatesCollection()
    {
        parent::getShippingRatesCollection();
         $hiddenFrontendShippingMethods = Mage::helper('mycompany_myextension')->getHiddenFrontendShippingMethods();
         $removeRates = array();
         foreach ($this->_rates as $key => $rate) {
            if (in_array($rate->getCarrier(), $hiddenFrontendShippingMethods)) {
                $removeRates[] = $key;
            } 
        }
         foreach ($removeRates as $key) {
            $this->_rates->removeItemByKey($key);
        }
         return $this->_rates;
    }
}

With these rewrites, you have created a select option using which you can click on methods that you want to display at the front end, and the ones that you want to enable at the admin area. Do not confuse this hide from frontend method with enable/disable for shipping methods.

Conclusion

With this method, you can hide certain shipping methods from the front end. With this method in use, you can customize shipping methods such that you can display certain methods on the frontend, while enable certain others only in the backend.

Author Bio:

Deepa is writer who loves writing blog on Magento Topic. In case if you are looking for Magento Development Services and Magento Development in UK you may check for getting the same at https://www.silvertouchtech.co.uk