Magento get product by attribute

For example here we will product by it name   $collectionss = Mage::getModel(‘catalog/product’)->getCollection()->addAttributeToSelect(‘*’)->addUrlRewrite(); $collectionss->addFieldToFilter(array( array(‘attribute’=>’name’,’eq’=>’test’), )) Get Product By Id $_newProduct = Mage::getModel(‘catalog/product’)->load($id);

Read more

magento add product to cart

require_once ‘app/Mage.php’; Mage::app(“default”); Mage::getSingleton(“core/session”, array(“name” => “frontend”)); $session = Mage::getSingleton(“customer/session”); $userData=Mage::helper(‘customer’)->getCustomer()->getData(); $cart = Mage::getSingleton(‘checkout/cart’); $yourProId=7; $qty=2; $params = array( ‘product’ => $yourProId, ‘related_product’ => null, ‘qty’ => $qty ); $product = new Mage_Catalog_Model_Product(); $product->load($yourProId); $cart-> addProduct($product, $params); $cart->save(); Mage::getSingleton(‘checkout/session’)->setCartWasUpdated(true); $message = (‘Your cart has been updated successfully.’); Mage::getSingleton(‘checkout/session’)->addSuccess($message);

Read more

jquery date picker

Bydefault Jquery date picker come with Jquery UI and Jquery UI has lots of css and js file so it is not as easy to use jquery date picker.So here you will find full Jquery date picker only code with downloads.This date picker is extracted from Jquery UI so you can use seprate jquery date picker without using lots of

Read more

PHP Download File Forcefully

In php there are some situation where you want to download file Forcefully.For that you have to use php header function. In header function you have to use Content-Type as application/octet-stream and Content-Disposition. ob_clean(); ob_start(); $filename=’private_movie.zip’; $absoluteFilePath=’/public_html/downloads/private_movie.zip’ header(“Pragma: public”); header (“Cache-Control: must-revalidate, post-check=0, pre-check=0”); header(“Cache-Control: maxage=1”); header (“Content-Type: application/octet-stream”); header (“Content-Length: ” . filesize($absoluteFilePath)); header (“Content-Disposition: attachment; filename=$filename”); readfile($absoluteFilePath);

Read more

jquery radio button checked value

There are losts of way to get checked radio value.The easiest way is to use “:checked” selector.The checked selector is used to get checked radio.After getting it you can use is is(“:checked”) to check wather it is checked or not.For getting value you can use .val() function. var $n = jQuery.noConflict(); //Jquery no conflict $n(“#btnsubmit”).click(function() { var allRadio=$n(‘input[name=rdoarr[]]’); jQuery.each(allRadio, function(i,

Read more

Jquery get all checkboxes

You can get all elements by name var $n = jQuery.noConflict(); //Jquery no conflict $n(“#btnsubmit”).click(function() { var allChkbox=$n(‘input[name=chkarr[]]’); jQuery.each(allChkbox, function(i, singlecheckbox) { alert(singlecheckbox.value+” is “+ singlecheckbox.checked); }); });

Read more

wordpress custom page

custom page is wordpress standalone page which is not use as wordpress page or page.there is some situation where you need custom page which will define owns html and js and othere elements using wordpress header and footer.This is very easy in wordpress to create cusom page.This wordpress custom page will depends on theme you are using.So some of customization

Read more

wordpress logout user

example <div ><a href=”<?php echo wp_logout_url( ); ?>” title=”Logout”>Logout</a></div> How to logout user using another way ? If you want to logout user own way then you can do using following code <?php require_once(‘wp-blog-header.php’);  // this is root file so adjust your pah accordingly   wp_clear_auth_cookie();  //this will logout user ?>  

Read more

wordpress physical installation path

Simply you can get wordpress physical installation path using ABSPATH Constant. require_once(‘wp-config.php’); echo ABSPATH;

Read more

wordpress how to check is post or page

How to check if the current request is for the post  ?   You can check if the current request is for for post using wordpress function is_singel(). Example is_single( ’17’ ) When Post 17 is being displayed as a single Post. is_single( ‘Irish Stew’ ) When the Post with Title “Irish Stew” is being displayed as a single Post.

Read more
1 3 4 5 6 7