You Just Write Below Code for you Category Title purpose.
<?php
$cat_id = ’11’;
echo get_cat_name( $cat_id );
?>
this is showing the category title in your particular post category title.
You Just Write Below Code for you Category Title purpose.
<?php
$cat_id = ’11’;
echo get_cat_name( $cat_id );
?>
this is showing the category title in your particular post category title.
Hi below code for single product url. When you pass the query string in your url. You can use below code for single product url. Or you can put product id also here working fine.
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper(‘catalog/output’);
//Jai Write Below Code for Product id via getting Product URL Start
//redirect to old Product
if(isset($_GET[‘product_id’])){
$product_id = $_GET[‘product_id’];
$cProduct = Mage::getModel(“catalog/product”);
$cProduct->load($product_id);
//echo $cProduct->getImageUrl().”<br />”;
$currentProductURL = $cProduct->getProductUrl();
//echo $currentProductURL.”<br />”;
echo “<script type=’text/javascript’ language=’javascript’>window. location='”.$currentProductURL.”‘;</script>”;
}
//Jai Write Below Code for Product id via getting Product URL Start
?>
I have small knowledge in magento. So, I more then 3 hours spent for this code getting. If anyone find this post. This is useful for you.
thanks.
1. You Want cart page to view the SKU number :
You can use below code in your : app/design/frontend/youtheme/yourtheme/template/checkout/cart.phtml
<?php echo $this->__(‘SKU Number’) ?>
And add item section this : app/design/frontend/youtheme/yourtheme/template/checkout/cart/item/default.phtml
<?php echo $_item->getSku() ?>
2. You want to view the Page View :
app/design/frontend/youtheme/yourtheme/template/catalog/product/view.phtml
<!– Write SKU –>
<?php echo $this->__(‘SKU Number :’); ?> <?php
$sku = Mage::getModel(‘catalog/product’)->load($_product->getId())->getSku();
echo $sku; ?>
<!– Sku End –>
its is working for my side.
Just put this code where you want:
$this->getSkinUrl(“images/sample.jpg”)
– This skin url code: $this->getSkinUrl
Example:
echo ‘.main { background:url(‘.$this->getSkinUrl(“images/sample.jpg”).’) 0 0 repeat-y !important}’;
<img src=”$this->getSkinUrl(“images/sample.jpg”)”>
Hi,
Below code useful for all this is very nice one in WordPress.
<div>
<h2>Latest News</h2>
<?php
//$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘category’ => 6, ‘order’=> ‘DESC’); //This Categories wise latest post display
$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘order’=> ‘DESC’); // This all post display
$postslist = get_posts( $args );
$i; //This is counting the iteam purpose using
foreach ($postslist as $post) : setup_postdata($post);
$i++; // This is increasing howmany foreach going that is purpose using.
?>
<div>
<h2><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h2>
<?php //the_date(); ?>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);?>
<?php echo get_the_post_thumbnail($page->ID, ‘full’); ?>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
</div><!– Latest News Container End –>
Below Example is substr :
$check_allowed = substr($total,35);
Below Example is finding only in numberic value:
echo ereg_replace(“/[^0-9.]/”, “”, $total);
Below Example is convert float :
$check_allowed =(float)$total;
Below Example is finding dollar sign :
$price= $total;
list($symbol, $price) = sscanf($price,’%[^0-9]%s’);
echo var_dump($symbol).'<br />’;
echo var_dump($price);
Below Example is SPlit :
$check_allowed = split(‘;’,$total);
echo $check_allowed[1];
checking if condition :
if($check_allowed[1] >= “10.00”){
?>
<a target=”_parent” href=”<?php echo get_option(‘shopping_cart_url’); ?>” title=”<?php _e(‘Checkout’, ‘wpsc’); ?>”><?php _e(‘Checkout’, ‘wpsc’); ?></a>
<?php
}
else{
?>
<a target=”_parent” href=”javascript:alert(‘Sorry, your order does not meet the minimum order value of €10’);” title=”<?php _e(‘Checkout’, ‘wpsc’); ?>”><?php _e(‘Checkout’, ‘wpsc’); ?></a>
<?php
}
?>
<?php
// All Categorie Lagest Post Code
$the_query = new WP_Query( ‘page_id=14’ );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h2><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
<?php
endwhile;
// Reset Post Data
wp_reset_postdata();
?>
<div>LATEST ARTICLES</div>
<?php
$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘category’ => 6, ‘order’=> ‘DESC’);
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
<div></div>
<?php
// All Categorie Lagest Post Code
$the_query = new WP_Query( ‘cat=6&posts_per_page=10&offset=3’ );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
<?php
endwhile;
// Reset Post Data
wp_reset_postdata();
?>
<div></div>
<?php
// Get Categorie Slug Name
function get_cat_slug($cat_id) {
$cat_id = (int) $cat_id;
$category = &get_category($cat_id);
return $category->slug;
}
?>
<?php
// Get the categories
$category = get_the_category();
// Get the 3 Latest Article
$string = get_category_link( $category[0]->cat_ID );
// echo $string;
?>
<div><a href=”http://www.anotherway.org/category/<?php echo get_cat_slug(6); ?>”>View All Save Your Health</a></div>
<?php
// Get Categorie Slug Name
function get_cat_slug($cat_id) {
$cat_id = (int) $cat_id;
$category = &get_category($cat_id);
return $category->slug;
}
?>
<div><a href=”http://www.yourdomain.com/category/<?php echo get_cat_slug(8); ?>”>View All</a></div>
that’s all. 🙂