Tuesday, 30 July 2013

magento multi vendor extension free

Give your vendors the freedom to manage their own products, and notify them automatically of their new orders.

Site link ishttp://www.magentocommerce.com/magento-connect/super-simple-multi-vendor-marketplace-free-2295.html

Magento Connecthttp://connect20.magentocommerce.com/community/Junaidbhura_Jbmarketplace

Please copy the above magento connect and install in into your store.


















Magento File System

The File System Magento extension is an indispensable tool for every website administrator. With File System, you can manage your Magento files exactly from the administration panel. Now you don't have to open your FTP client every time you need to make some slight changes in your files.

Forget about these FTP or SSH connections which are too expensive and difficult to use. With the File System Magento extension, you can easily do all the necessary operations. Just install this MagPlesure module and enjoy the simplicity of use!

This a free magento extension.
Link : http://www.magentocommerce.com/magento-connect/file-system.html















Wednesday, 24 July 2013

php difference between echo and print

Echo can accept multiple expressions while print cannot. For performance echo is faster than print since it does not return a value.
Print always returns 1 (integer).
Echo does not return any value.












php difference between session and cookie

The main difference between cookies and sessions is that cookies are stored in the user's browser, and sessions are not.

Cookies will only expire on expiry time or if you explicitly clean cookie / cache of your browser. Cookies will retain into the system even after you open your browser next day. Cookies are stored on client's system so they are less secure.

Session will expire on its expiry time or if the browser has been closed. As session is stored on server so it is more secure.

So for a log-in module, a combination of session and cookie should be used.










php difference between include and require

require will throw a PHP Fatal Error if the file cannot be loaded. (Execution stops)

include produces a Warning if the file cannot be loaded. (Execution continues)
















Thursday, 11 July 2013

Magento Shorten the URL of a Module / Rewrite

Write this below code under the <global> in config.xml(app\etc) file.


       <rewrite>
<fancy_url>
<from><![CDATA[/path_name(.*)/]]></from>
<to><![CDATA[modulename/controllername/function_name/]]></to>
<complete>1</complete>
</fancy_url>

                <!--   This code for passing parameters  -->
<fancy_url>
<from><![CDATA[/path_name\/(.*)/]]></from>
<to><![CDATA[modulename/controllername/function_name/parameters/$1/]]></to>
                 <!--Current url = www.storename.com/deb/index/view/username/demo -->
<complete>1</complete>
</fancy_url>
</rewrite>

Magento Custom Shipping Module

In this blog i have describe how to create custom shipping module in magento.

I have used one method for this module named "My_Ship".

There are 3 primary things required for create this module.
1) system.xml
2) config.xml
3) Shipping Module

Step 1


Create system.xml file in app\code\local\Deb\Ship\etc folder, then use the below code in this file.


<?xml version="1.0"?>
<config>
   <sections>
    <carriers>
        <groups>
           <express translate="label">
    <label>Deb Express Shipping Method</label>
    <frontend_type>text</frontend_type>
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <fields>
        <active translate="label">
            <label>Enabled</label>
            <frontend_type>select</frontend_type>
            <source_model>adminhtml/system_config_source_yesno</source_model>
            <sort_order>1</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </active>
        <name translate="label">
            <label>Method name</label>
            <frontend_type>text</frontend_type>
            <sort_order>3</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
        </name>
        <price translate="label">
            <label>Price</label>
            <frontend_type>text</frontend_type>
            <sort_order>5</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </price>
        <handling_type translate="label">
            <label>Calculate Handling Fee</label>
            <frontend_type>select</frontend_type>
            <source_model>shipping/source_handlingType</source_model>
            <sort_order>7</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </handling_type>
        <handling_fee translate="label">
            <label>Handling Fee</label>
            <frontend_type>text</frontend_type>
            <sort_order>8</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </handling_fee>
        <sort_order translate="label">
            <label>Sort order</label>
            <frontend_type>text</frontend_type>
            </sort_order><sort_order>100</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        <title translate="label">
            <label>Title</label>
            <frontend_type>text</frontend_type>
            <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>
        </title>
        <type translate="label">
            <label>Type</label>
            <frontend_type>select</frontend_type>
            <source_model>adminhtml/system_config_source_shipping_flatrate</source_model>
            <sort_order>4</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </type>
        <sallowspecific translate="label">
            <label>Ship to applicable countries</label>
            <frontend_type>select</frontend_type>
            <sort_order>90</sort_order>
            <frontend_class>shipping-applicable-country</frontend_class>
            <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </sallowspecific>
        <specificcountry translate="label">
            <label>Ship to Specific countries</label>
            <frontend_type>multiselect</frontend_type>
            <sort_order>91</sort_order>
            <source_model>adminhtml/system_config_source_country</source_model>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </specificcountry>
        <showmethod translate="label">
            <label>Show method if not applicable</label>
            <frontend_type>select</frontend_type>
            <sort_order>92</sort_order>
            <source_model>adminhtml/system_config_source_yesno</source_model>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>0</show_in_store>
        </showmethod>
        <specificerrmsg translate="label">
            <label>Displayed Error Message</label>
            <frontend_type>textarea</frontend_type>
            <sort_order>80</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
        </specificerrmsg>
    </fields>
</express>

</groups>
        </carriers>
    </sections>
</config>

Step 2


Create one config.xml file in app\code\local\Deb\Ship\etc folder and used the below code.



<?xml version="1.0"?>
<config>
  <modules>
    <Deb_Ship>
      <version>0.1.0</version>
    </Deb_Ship>
  </modules>
  <global>
    <models>
      <ship>
        <class>Deb_Ship_Model</class>
      </ship>
    </models>  
  </global>
  <default>
<carriers>
<express>
            <active>0</active>
            <sallowspecific>0</sallowspecific>
            <model>shipping/carrier_express</model>
            <name>Express</name>
            <price>5.00</price>
            <title>Express</title>
            <type>I</type>
            <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
            <handling_type>F</handling_type>
    </express>

</carriers>
  </default>
</config>

Step 3


Create one Express.php file in app\code\local\Deb\Ship\Model\Carrier  folder and used the below code.




<?php
class Deb_Ship_Model_Carrier_Express
    extends Mage_Shipping_Model_Carrier_Abstract
    implements Mage_Shipping_Model_Carrier_Interface
{
    protected $_code = 'express';
    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }
        $freeBoxes = 0;
        if ($request->getAllItems()) {
            foreach ($request->getAllItems() as $item) {
                if ($item->getFreeShipping() && !$item->getProduct()->isVirtual()) {
                    $freeBoxes+=$item->getQty();
                }
            }
        }
        $this->setFreeBoxes($freeBoxes);
        $result = Mage::getModel('shipping/rate_result');
        if ($this->getConfigData('type') == 'O') { // per order
            $shippingPrice = $this->getConfigData('price');
        } elseif ($this->getConfigData('type') == 'I') { // per item
            $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
        } else {
            $shippingPrice = false;
        }
        $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
        if ($shippingPrice !== false) {
            $method = Mage::getModel('shipping/rate_result_method');
            $method->setCarrier('express');
            $method->setCarrierTitle($this->getConfigData('title'));
            $method->setMethod('express');
            $method->setMethodTitle($this->getConfigData('name'));
            if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                $shippingPrice = $this->getConfigData('price');
            }
            $method->setPrice($shippingPrice);
            $method->setCost($shippingPrice);
            $result->append($method);
        }
        return $result;
    }
    public function getAllowedMethods()
    {
        return array('express'=>$this->getConfigData('name'));
    }
}

?>




Then create xml file for active this module in magento store.

Create Deb_Ship.xml in app\etc\modules and used the below code.


<?xml version="1.0"?>
<config>
    <modules>
        <Deb_Ship>
            <active>true</active>
            <codePool>local</codePool>
        </Deb_Ship>
    </modules>
</config>

enjoy................






Thursday, 4 July 2013

Magento remove .html from category or product URL




  1. Go to System -> Config -> Catalog -> Search Engine Optimizations tab
  2. Delete “.html” from Category URL Suffix.
  3. Delete “.html” from Product URL Suffix.
  4. Go to System->Index Management
  5. Reindex “Catalog URL Rewrites”
  6. Refresh cache



Magento: How to remove index.php from URLs


step 1: Go to admin panel and enable the Rewrites(set yes for Use Web Server Rewrites). You can find it at System->Configuration->Web->Search Engine Optimization.
step 2: Then go to Cache management page (system cache management ) and refresh your cache and refresh to check the site.

How to remove all catalog products in Magento


SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `catalog_product_entity_text`;
TRUNCATE TABLE `catalog_product_entity_tier_price`;
TRUNCATE TABLE `catalog_product_entity_varchar`;
TRUNCATE TABLE `catalog_product_link`;
TRUNCATE TABLE `catalog_product_link_attribute`;
TRUNCATE TABLE `catalog_product_link_attribute_decimal`;
TRUNCATE TABLE `catalog_product_link_attribute_int`;
TRUNCATE TABLE `catalog_product_link_attribute_varchar`;
TRUNCATE TABLE `catalog_product_link_type`;
TRUNCATE TABLE `catalog_product_option`;
TRUNCATE TABLE `catalog_product_option_price`;
TRUNCATE TABLE `catalog_product_option_title`;
TRUNCATE TABLE `catalog_product_option_type_price`;
TRUNCATE TABLE `catalog_product_option_type_title`;
TRUNCATE TABLE `catalog_product_option_type_value`;
TRUNCATE TABLE `catalog_product_super_attribute`;
TRUNCATE TABLE `catalog_product_super_attribute_label`;
TRUNCATE TABLE `catalog_product_super_attribute_pricing`;
TRUNCATE TABLE `catalog_product_super_link`;
TRUNCATE TABLE `catalog_product_enabled_index`;
TRUNCATE TABLE `catalog_product_website`;
TRUNCATE TABLE `catalog_product_entity`;
TRUNCATE TABLE `cataloginventory_stock`;
TRUNCATE TABLE `cataloginventory_stock_item`;
TRUNCATE TABLE `cataloginventory_stock_status`;
TRUNCATE TABLE `catalog_product_link`;
TRUNCATE TABLE `catalog_product_link_type`;
TRUNCATE TABLE `catalog_product_option`;
TRUNCATE TABLE `catalog_product_option_type_value`;
TRUNCATE TABLE `catalog_product_super_attribute`;
TRUNCATE TABLE `catalog_product_entity`;
TRUNCATE TABLE `cataloginventory_stock`;
TRUNCATE TABLE `catalog_category_product`;
DELETE FROM catalog_product_flat_1;
DELETE FROM catalog_product_flat_10;
DELETE FROM catalog_product_flat_11;
DELETE FROM catalog_product_flat_12;
DELETE FROM catalog_product_flat_13;
DELETE FROM catalog_product_flat_14;
DELETE FROM catalog_product_flat_15;
DELETE FROM catalog_product_flat_16;
DELETE FROM catalog_product_flat_17;
DELETE FROM catalog_product_flat_18;
DELETE FROM catalog_product_flat_19;
DELETE FROM catalog_product_flat_2;
DELETE FROM catalog_product_flat_20;
DELETE FROM catalog_product_flat_21;
DELETE FROM catalog_product_flat_22;
DELETE FROM catalog_product_flat_23;
DELETE FROM catalog_product_flat_24;
DELETE FROM catalog_product_flat_25;
DELETE FROM catalog_product_flat_26;
DELETE FROM catalog_product_flat_27;
DELETE FROM catalog_product_flat_28;
DELETE FROM catalog_product_flat_29;
DELETE FROM catalog_product_flat_3;
DELETE FROM catalog_product_flat_30;
DELETE FROM catalog_product_flat_31;
DELETE FROM catalog_product_flat_32;
DELETE FROM catalog_product_flat_33;
DELETE FROM catalog_product_flat_34;
DELETE FROM catalog_product_flat_35;
DELETE FROM catalog_product_flat_36;
DELETE FROM catalog_product_flat_37;
DELETE FROM catalog_product_flat_4;
DELETE FROM catalog_product_flat_5;
DELETE FROM catalog_product_flat_6;
DELETE FROM catalog_product_flat_7;
DELETE FROM catalog_product_flat_8;
DELETE FROM catalog_product_flat_9;
SET FOREIGN_KEY_CHECKS = 1;

insert  into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell');
insert  into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal');
insert  into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');

After run the above query, you may require re-index all your indexes.
System > Index Management > Reindex all