How to Show Magento Particular Categorie Image in Magento?

<?php
$cat_id = 8; // set desired category id
$category = Mage::getModel('catalog/category')->load($cat_id);
$products = $category->getProductCollection()->
addCategoryFilter($category)->addAttributeToSelect('*');
?>
<?php foreach ( $products as $_product ): ?>
<a href="<?php echo $_product->getProductUrl() ?>">
<img src="<?php echo $this->helper('catalog/image')->
init($_product, 'small_image')->resize(135, 135); ?>"
width="135" height="135" title="<?php echo $_product->getName() ?>"
alt="<?php echo $_product->getName() ?>" /></a>
<?php endforeach; ?>

How to Reduce Magento Resize Product Image Size?

<?php
$_helper = $this->helper('catalog/output');
$productId = $this->getProduct_id();
$_product = Mage::getModel('catalog/product')->load($productId);  //load the product
$_img = '<a id="a_image" href="'.$_product->getProductUrl().'" title="">
<img id="image".src="'.$this->helper('catalog/image')->
init($_product, 'image')->constrainOnly(TRUE)->
keepAspectRatio(TRUE)->resize(176,251).'" alt="'.$this->
htmlEscape($this->getImageLabel()).'" title="'.
$this->htmlEscape($this->getImageLabel()).'"/></a>';
echo $_helper->productAttribute($_product, $_img, 'image');
?>

How to view Particular Category List in Home Page from Magento?

Go to Magento Cms Page Inside, Put Blow Code then view in your page :
{{block type=”catalog/product_list” category_id=”98″ template=”catalog/product/list.phtml”}}

(OR)

Open in your Magento theme page layout, There you can past below code

<?php     echo $this->getLayout()->createBlock(‘catalog/product_list’)->setCategoryId(98)->setTemplate(‘catalog/product/list.phtml’)->toHtml()     ?>

(OR)

Open Magento Static Block, Create Magento New Static Block, Then Past Below Code :

{{block type=”catalog/product_list” category_id=”98″ template=”catalog/product/list.phtml”}}

Once you placed above code in Magento Staic block inside, You can write below code in your Magento .phtml file inside,

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId(IDENTIFIER)->toHtml() ?>

Here you change "IDENTIFIER" in your Magento Static Block identified number.
Now you refresh your site will show your custom Magento Style Theme.

Thanks,
J.
echo $this->getLayout()->createBlock('catalog/product_list')->setCategoryId(10)->setTemplate('catalog/product/list.phtml')->toHtml()

How to add Magento CMS static blocks inside CMS Page?

1. You simply add below code in your cms template :

{{block type="cms/block" block_id="IDENTIFIER"}}

2. You want add static Block in xml file inside :
  <block type="cms/block" name="BLOCK_NAME" after="cart_sidebar">
    <action method="setBlockId"><block_id>IDENTIFIER</block_id></action>
  </block>

3. You want add static Block in page inside :

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId(IDENTIFIER)->toHtml() ?>

its is the method of static block in your cms page...

How to view in weight back value in kg?

Hi you go to app folder.
1. Then go to design–> frontend –> yourtheme –> yourtheme –> template –> catalog –>product –>view –> attributes.phtml

there you can find this code : <?php echo $_helper->productAttribute($_product, $_data[‘value’], $_data[‘code’]) ?>

to change

Then add below code :

<?php
$_weightValue = $_data[‘value’];
if($_data[‘code’]==’weight’){ //this attribute code checkup condition
if (is_numeric($_weightValue)) //this attribute value numberic or not checkup condition
{
$_weightValue = round($_weightValue, 2).’ kg’;  //round to 0.00
}
}
?>
<?php echo $_helper->productAttribute($_product, strip_tags($_weightValue), $_data[‘code’]) ?>

That’s all.

How to Solve WP Nav Menu Dissapears in Category Pages?

I found this is mostly plugins problem.

My site hidding the “external video” plugin. So, your side also check this happen some plugin.

Otherwise go to This url : http://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1?replies=15

And Search This Keyword to Google you will find good solution : “wp nav menu disappear in wordpress”

How to view in Catgory Name wise Recent Post view in WP?

You can add below code where you want in your php file inside :
<?php query_posts(‘category_name=pre-work-out&showposts=10’); ?>
<?php while (have_posts()) : the_post(); ?>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<?php endwhile;?>

This is show what you like in your recent post from your specific category wise. What you like change you “query_post” inside.

How to view in expert field box in WP-admin side?

Just below one line code is working very perfectly.

add_post_type_support(‘page’, ‘excerpt’);

this is very fun. But this working.

How to change expert more link label in WP?

// This link in excerpts more
function new_excerpt_more($more) {
global $post;
return ‘<a href=”‘. get_permalink($post->ID) . ‘”>Read More</a>’;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);

Add above code in your functions.php.(This is file contain in your theme inside.)

What label you need, change the return href inside.

How to Change the Expert Length in WP?

Just add below code in functions.php inside,

add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
return 25;
}

And change the return value “25” to “Your Value”.

© 2020 Spirituality