Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

top.Links problem anyone? 
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I am getthing this very weird result from topLinks. It shows ‘10 Array’, ‘50 Array’ and so on before the ‘My cart’ and ‘Checkout’/

my template file: 
<ul id="right_nav"> <?php echo $this->getChildHtml('topLinks') ?> </ul>

page.xml:
<block type="page/html_toplinks" name="top.links" as="topLinks"/>

top.links.phtml:
<?php if($toplinks && is_array($toplinks)): ?>

<?php echo $this->getChildHtml() ?>
<?php foreach($toplinks as $_toplink): ?>
<li<?php if($_toplink['first']||$_toplink['last']): ?> class="<?php if($_toplink['first']): ?>first <?php endif; ?><?php if($_toplink['last']): ?>last <?php endif; ?>"<?php endif; ?> <?php echo $_toplink['liParams'] ?>> <?php echo $_toplink['beforeText'] ?><a <?php echo $_toplink['aParams'] ?>><?php echo $_toplink['innerText'] ?></a><?php echo $_toplink['afterText'] ?></li>
<?php endforeach; ?>
<?endif;?>

Don’t know where else I should check to find the cause. I haven’t replaced any other files yet so think it’s unlikely my modified files from v0.9x are causing it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

Same here.

If you look closely you have in
app/code/core/Mage/Page/Block/Template/Links.php

public function addLink($label$url=''$title=''$prepare=false$urlParams=array(), $position=null$liParams=null$aParams=null$beforeText=''$afterText='')

in
app/code/core/Mage/Page/Block/Html/Toplinks.php :

public function addLink($liParams$aParams$innerText$position=''$beforeText=''$afterText='')
So, as you can see, we have not the same parameters between this two functions.

But when the function is called for example in app/code/core/Mage/Checkout/Block/Links.php, you have :

$this->getParentBlock()->addLink($text'checkout/cart'$texttrue, array(), 50null'class="top-link-cart"');
while the function addLink() is called in app/code/core/Mage/Page/Block/Html/Toplinks.php…

For the moment, I write in that way (example for app/code/core/Mage/Checkout/Block/Links.php) :

$this->getParentBlock()->addLink(null'class="top-link-cart" href="'.Mage::getUrl('checkout/cart').'"'$text);

Hard-coded, but it display correctly…
We are looking for a fix ...

Sorry for my bad english, man.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

This could happen if you are using layouts from previous version or did not clean layout cache.

Does it work with standard layout files from 1.0?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 
Moshe - 31 March 2008 05:48 PM

This could happen if you are using layouts from previous version or did not clean layout cache.

Does it work with standard layout files from 1.0?

Hi Moshe, I have not changed anything in the Mage files but the ‘header’ (where top.links located), ‘page.xml’ and ‘top.links.phtml’

Already clean the layout cache many times, still seeing the same thing.  I am going to look into Mage files where ryu007 pointed out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 
chinesedream - 31 March 2008 06:38 PM

Moshe - 31 March 2008 05:48 PM
This could happen if you are using layouts from previous version or did not clean layout cache.

Does it work with standard layout files from 1.0?

Hi Moshe, yes, the standard layout shows no problem.

I have not changed anything in the Mage files but the ‘header’ (where top.links located), ‘page.xml’ and ‘top.links.phtml’, I compared every line of code I have changed, but can’t find anything wrong. Will double check again!

Already clean the layout cache many times, still seeing the same thing.  I am going to look into Mage files where ryu007 pointed out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

Found it, the culprit is:

v0.97x:
<block type="page/html_toplinks” name="top.links" as="topLinks"/>

v1.0:  <block type="page/template_links” name="top.links" as="topLinks"/>

Lesson learned. Must always pay extreme close attention working with Magento red face

Want to train your kid for his impatience and carelessness? Ask him to work on Magento.  smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

Ah yes, it’s working now.
Thank you, chinesedream.

I forgot to ask you something.
Since update from magento 1.0, my checkout (onepage) don’t work and redirect me to the index.
Same for you ?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top