Showing posts with label Issue solve. Show all posts
Showing posts with label Issue solve. Show all posts

Thursday, 21 May 2015

Magento Add Breadcrumbs For CMS Page

Hello

I am issue in magento breadcrumbs.

issue is that i am create shop page in magento cms page. i am added all product in default category.
it's working fine. but it can not show Breadcrumbs in this page. i am searching on internet
i am checking in admin panel
admin -> system ->config-> web -> default pages -> Show Breadcrumbs for CMS Pages ->yes
but only shop page cms page not display breadcrumbs. other cms page display breadcrumbs.

that i am search for how to add breadcrumbs using xml in cms page i am found that we can
added breadcrumbs manully i am added this code it's working properlly

I am added this code in you cms page. edit your cmspage ->design->Layout Update XML->

I am adding this code



 breadcrumbs  
   
       <reference name="root">
<action method="setTemplate"><template>page/category.phtml</template></action>
 <action method="unsetChild"><alias>breadcrumbs</alias></action>    
    <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>About us</crumbName>
            <crumbInfo><label>SHOP</label><title>SHOP</title></crumbInfo>
        </action>      
    </block>
</reference>
SHOP
       
         


this code for breadcrumbs my page name is shop add title shop and also change label shop

breadcrumbs  
    <action method="unsetChild"><alias>breadcrumbs</alias></action>    
    <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>About us</crumbName>
            <crumbInfo><label>SHOP</label><title>SHOP</title></crumbInfo>
        </action>      
    </block>
         

I think you can help this code.







Wednesday, 20 May 2015

how can add span in breadcrumbs in magneto?

Hello

I have Issue in My magento. i have add span beetween description.

Here Only I want to change in magento result page (search page).

THis In My Question


Here My breadcrumbs html

  • Home

i want span at 


between search and ring 

i like this 


result.php my breadcrumbs code 

$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
        if ($breadcrumbs) {
            $title = $this->__("Search > %s",$this->helper('catalogsearch')->getQueryText());

            $breadcrumbs->addCrumb('home', array(
                'label' => $this->__('Home'),
                'title' => $this->__('Go to Home Page'),
                'link'  => Mage::getBaseUrl()
            ))->addCrumb('search', array(
                'label' => $title,
                'title' => $title

            ));
        }

I Found Solution From magento.stackexchange site.


The text you put in the breadcrumbs is escaped before printing so you won't be a victim of XSS. So any tag you put in the breadcrumbs label will be shown as a tag in the frontend and won't be interpreted.
But you can achieve what you need like this
You need to add after this line:

$title = $this->__("Search > %s",$this->helper('catalogsearch')->getQueryText());

this
$label = $this->__('Search <span></span>');//span add here
$label .= Mage::helper('core')->escapeHtml($this->helper('catalogsearch')->getQueryText());

This will make your query string escaped before sending it to the breadcrumbs template.

You will also have 2 variables instead of one. $title will still have the original text so you can use it as title for the span element (this will be escaped) and $label that you can use as the span innerHTML.
Now you need to tell the template not to escape the $label again.

So replace this

 ->addCrumb('search', array(
     'label' => $title,
     'title' => $title
 ))

with 

->addCrumb('search', array(
     'label' => $label,
     'title' => $title,
     'no_escape' => true
 ))

Now you need to edit the breadcrumbs template an remove the htmlEscape when the no_escape element is true.



Replace this section

if($_crumbInfo['link']): 
    echo $this->htmlEscape($_crumbInfo['label']) 
elseif($_crumbInfo['last']): 
    echo $this->htmlEscape($_crumbInfo['label']) 
else: 
    echo $this->htmlEscape($_crumbInfo['label']) 
endif; 
with this


if (isset($_crumbInfo['no_escape']) && $_crumbInfo['no_escape']) : 
    $label = $_crumbInfo['label'];
else : 
    $label = $this->htmlEscape($_crumbInfo['label']) ;
endif;
if($_crumbInfo['link']): 
    echo $label 
elseif($_crumbInfo['last']): 
    echo $label 
else: 
    echo $label 
endif;