Saturday 13 February 2016

Get customer addresses with admin formated

 $order = $this->getOrder();
 $address = $order->getShippingAddress()->getFormated(true);
 echo $address;

Thursday 11 February 2016

How to display product option/variant in category page in woocommerce wordpress

<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_rating - 5
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
</a>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
with this:
<?php
/**
* ADD PRODUCT VARIABLE WITH ADD TO CART ON CATALOG PAGE
ADDED BY GW
**/
?>
<div class="catbox">
<?php
//ADD SHORT DESCRIPTION TO PRODUCT
add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5); ?>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_rating - 5
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
<?php
//ADD VARIATIONS BEFORE ADD TO CART
if($product->product_type == "variable"){
woocommerce_variable_add_to_cart();
} else {
woocommerce_template_loop_add_to_cart();
}
?>
</div>

Tuesday 26 January 2016

Get Shopping cart rule coupon code SKU Magento

<?php
    $couponCode = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
    //echo '<pre>'; print_r($productModel); echo '</pre>';
    $couponarray = array();
    if($couponCode){
        $couponarray = explode(',', $couponCode);
    }
    $rules = Mage::getResourceModel('salesrule/rule_collection')->load();
    $havecoupon = 0;
    foreach ($rules as $rule) {
        if ($rule->getIsActive()) {
            $rule = Mage::getModel('salesrule/rule')->load($rule->getId());
            $conditions = $rule->getActions()->asArray();
            foreach($conditions['conditions'] as $_conditions ):
                if($_conditions['attribute'] == 'sku' && $_item->getSku() == $_conditions['value']){
                    if(in_array($rule->getCouponCode(), $couponarray)){
                        $havecoupon = 1;
                        echo 'Yes i have '.$rule->getCouponCode();
                        ?>
                            <a href="#" onclick="javascript: $('amcoupon_code_cancel_cus').value = '<?php echo $rule->getCouponCode() ?>'; $('canceldiscount').submit(); return false;">
                                <?php echo $this->__('Cancel'); ?>
                            </a>
                        <?php
                    }
                }
            endforeach;
        }
    }
    if($havecoupon == 0){
        ?>
        <input value="" name="coupon_code" id="coupon_code_<?php echo $_item->getId() ?>" class="input-text">
        <a href="#" class="button" onclick="javascript: $('amcoupon_code_cancel_cus').value = ''; $('canceldiscount').submit(); return false;">
            <?php echo $this->__('Submit'); ?>
        </a>
        <?php
    }
    ?>

Tuesday 29 December 2015

Add Field in Account Information in magento admin panel direct database

Add field in          ---------> eav_attribute table
Add field in          ---------> customer_eav_attribute table
Add field in          ---------> customer_form_attribute table

Friday 20 November 2015

Upgrade Mysql version 5.6.0 or later ubuntu upgrade

For 14.04 users:

Ubuntu 14.04 defaults to MySQL 5.5, but also has MySQL 5.6 available for installation from the universe archive. Installing 5.6 is as easy as specifying the version:
myuser@mypc:~$ sudo apt-get purge mysql-server-5.5 mysql-client-5.5
myuser@mypc:~$ sudo apt-get autoremove
myuser@mypc:~$ sudo apt-get install mysql-server-5.6 mysql-client-5.6
If you have existing data in a MySql 5.5 database, it should be migrated automatically. Though it is always a good idea to make a backup before doing a major upgrade.

First make a backup of the data in your existing database:

mysqldump --lock-all-tables -u root -p --all-databases > dump.sql
Then after installing the newer version, you can restore if needed by running:

mysql -u root -p < dump.sql 

Tuesday 17 November 2015

How to upload a project to Github





  1. cd var/www/html/github/my-first-pro/
  2. git add .
  3. git commit -m "adding files". -m
  4. git commit -m "adding files". -a
  5. git remote add origin https://github.com/Kanasagra-Jaydip/my-first-pro.git
  6. git push -u origin master

Here is how you would do it in Windows:
  1. If you don't have git installed, see this article on how to set it up.
  2. Open up a Windows command prompt.
  3. Change into the directory where your source code is located in the command prompt.
  4. First, create a new repository in this directory git init. This will say "Initialized empty git repository in ....git" (... is the path).
  5. Now you need to tell git about your files by adding them to your repository. Do this with git add filename. If you want to add all your files, you can do git add .
  6. Now that you have added your files and made your changes, you need to commit your changes so git can track them. Type git commit -m "adding files". -m lets you add the commit message in line.
So far, the above steps is what you would do even if you were not using github. They are the normal steps to start a git repository. Remember that git is distributed (decentralized), means you don't need to have a "central server" (or even a network connection), to use git.
Now you want to push the changes to your git repository hosted with github. To you this by telling git to add a remote location, and you do that with this command:
git remote add origin https://github.com/yourusername/your-repo-name.git
Once you have done that, git now knows about your remote repository. You can then tell it to push (which is "upload") your commited files:
git push -u origin master

How to add grouped products in Magento



In Magento, you can easily create a grouped product. Customers can choose this grouped product to buy all products in group or only buy some of the associated products.

Step 1: Login to your Magento Admin Panel, go to Catalog -> Manage Products




Step 2: On Manage Products page, choose Add Product



Step 3: In Product Type drop-down menu, choose Grouped Product option and then click Continue



Step 4: You should fill all necessary information and settings for this grouped product. Most of settings and information are configured in the same way as they are configured when add a simple product. There only have some differences in weight and price because they are managed by the products that are added into group. Besides, you should mark the checkbox of products you want to add to the grouped product in Associated Products



Finally, you should click Save button