//header('Content-type: image/png');
$strInputFile = '20160312105210_girls.jpg';
$target = 'car_transparent.png';
$im = new Imagick($strInputFile);
//$im->paintTransparentImage($im->getImageBackgroundColor(), 0, 10000);
$im->paintTransparentImage('#000', 0, 10000); //Which color you need to remove #000
$im->setImageFormat('png');
//$im->writeImage($target);
$im->destroy();
//echo $im;
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
Saturday, 26 March 2016
Remove specific color/white/Black from any type of image
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: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.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
First make a backup of the data in your existing database:
mysqldump --lock-all-tables -u root -p --all-databases > dump.sqlThen 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
- cd var/www/html/github/my-first-pro/
- git add .
- git commit -m "adding files". -m
- git commit -m "adding files". -a
- git remote add origin https://github.com/Kanasagra-Jaydip/my-first-pro.git
- git push -u origin master
Here is how you would do it in Windows:
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.
- If you don't have git installed, see this article on how to set it up.
- Open up a Windows command prompt.
- Change into the directory where your source code is located in the command prompt.
- First, create a new repository in this directory
git init
. This will say "Initialized empty git repository in ....git" (...
is the path).- 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 dogit add .
- 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.
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
Subscribe to:
Posts (Atom)