How to Add Products in Magento

1. Go to Magento admin dashboard select “Catalog“->”Manage Products“.

2. Click on “Add Product” button to add new product.

3. Check “Create Product Settings” and select “Attribute Set” and “Product Type“.

4. After fill product information like Name, Description, SKU etc..

Issue with admin login in Magento

GO to File at this location :- app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

And commenting out the following :

// session cookie params
$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath()//,
    //'domain'   => $cookie->getConfigDomain(),
    //'secure'   => $cookie->isSecure(),
    //'httponly' => $cookie->getHttponly()
);

//if (!$cookieParams['httponly']) {
//    unset($cookieParams['httponly']);
//    if (!$cookieParams['secure']) {
//        unset($cookieParams['secure']);
//        if (!$cookieParams['domain']) {
//            unset($cookieParams['domain']);
//        }
//    }
//}

Box gradient using CSS

.menu{

/* Safari 4-5, Chrome 1-9
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#43aedb));*/

/* Safari 5.1, Chrome 10+
background: -webkit-linear-gradient(top, #43aedb, #1a82f7);*/

/* Firefox 3.6+
background: -moz-linear-gradient(top, #43aedb, #1a82f7);*/

/* IE 10
background: -ms-linear-gradient(top, #43aedb, #1a82f7);*/

/* Opera 11.10+
background: -webkit-linear-gradient(top, #E0E9ED, #43aedb); */

}

gredient

CSS for box shadow

.tx
{
position: relative;
}
.tx:before, .tx:after
{
z-index: -1;
position: absolute;
content: “”;
bottom: 25px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: #777;
-webkit-box-shadow: 0 35px 20px #777;
-moz-box-shadow: 0 35px 20px #777;
box-shadow: 0 35px 20px #777;
-webkit-transform: rotate(-8deg);
-moz-transform: rotate(-8deg);
-o-transform: rotate(-8deg);
-ms-transform: rotate(-8deg);
transform: rotate(-8deg);
}
.tx:after,
{
-webkit-transform: rotate(8deg);
-moz-transform: rotate(8deg);
-o-transform: rotate(8deg);
-ms-transform: rotate(8deg);
transform: rotate(8deg);
right: 10px;
left: auto;
}

shadow

Get values in loop from $_POST

foreach($_POST as $key=>$value)
{
if(!in_array($key, $skip_list)) {
$message = $message . $key .”: ” . $value . “\n”;
}
}

$email = “email id”;

$from_address = “From id”;

$subject = “Email Subject”;

mail($email, $subject, $message,”FROM: “.$from_address);

Remove HTML tags and white space from content

Using strip_tags() function we can remove HTML tags from content.

$content = “<p><strong>testing data</strong></p>”;

echo strip_tags($content);  //  testing data

Using trim() remove white space from the beginning and end of a string.

$content = ”               testing data          “;

echo trim($content);  //  testing data

 

Category in archive page

<?php 
$obj = get_queried_object();

echo '<pre>';
print_r( $obj );
echo '</pre>';

stdClass Object
(
    [term_id] => 56
    [name] => Web Development
    [slug] => web-development
    [term_group] => 0
    [term_taxonomy_id] => 56
    [taxonomy] => project_type
    [description] => Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    [parent] => 0
    [count] => 0
)

echo $cat_id = $obj->term_id;
?>

Add WordPress Breadcrumbs

<?php $post_id = get_the_ID(); ?>
<?php if(!is_front_page() && !is_archive()){ ?>
<div class=”bread_cr”>
<span>
<a style=”color: #A8CE3F;” href=”<?php bloginfo(‘url’); ?>”>Home</a> » <?php echo get_the_title( $post_id ); ?>
</span>
</div>
<?php } else if(is_archive()) {
$obj = get_queried_object();
$parent = $obj->parent;
if($parent != 0){
global $wpdb;
$cat_name = $wpdb->get_var(“SELECT name FROM wp_terms WHERE term_id=’$parent'”);
$cat_slug = $wpdb->get_var(“SELECT slug FROM wp_terms WHERE term_id=’$parent'”);
}
?>
<div class=”bread_cr” style=”margin-bottom: 12px;”>
<span>
<a style=”color: #A8CE3F;” href=”<?php bloginfo(‘url’); ?>”>Home</a> »
<?php if($parent != 0){ ?>
<a href=”<?php bloginfo(‘url’); ?>/category/<?php echo $cat_slug; ?>”><?php echo $cat_name; ?></a> »
<?php } ?>
<?php echo $obj->name; ?> <br>
</span>
</div>
<?php } ?>