Banner 7 Magento - Link problem

Asked

Viewed 61 times

0

I am facing a small problem with the rotatory banner of the following site: http://todabeauty.com.br.

As you can see, the second slide has a clickable link in the image with the text: "Learn more". But I’m trying to get the entire slide image linked. In order to only click on the image to go to the link page in question. But without success.

Below the code of Banner 7:

<?php 
/******************************************************
 * Website: http://www.plazathemes.com
*******************************************************/
?> 
<?php if($this->getConfig('enabled')){ ?>     <!-- start enable -->
    <?php $cur_store = Mage::app()->getStore()->getId() ?>
    <div class="ma-banner7-container">
        <!--<div class="container">-->
            <div class="flexslider ma-nivoslider">
        <div class="ma-loading"></div>
        <div id="ma-inivoslider" class="slides">

                <?php
                    // Get data banner
                    $slide = $this->getDataBanner7();
                    $path = Mage::getBaseUrl('media');                  
                    $qty_Item = $this->getConfig('qty_item');
                    if ($this->getConfig('auto')) { $auto = 'true'; } else { $auto = 'false'; }
                    /* Get max item & qty item */
                    if ($qty_Item > count($slide)) {
                        $qty_Item = count($slide);
                    }
                ?>
                <?php
                    $i = 1;
                    foreach($slide as $s) {
                        if($i <= $qty_Item) {
                            //Get images slide show
                            $st1 = $s['image'];
                            $p1 = strpos($st1,'banner7');
                            $st2 = substr($st1,$p1+7);
                            $p2 = strpos($st2,'"');
                            $imag = substr($st2,0,$p2);
                    ?>
                    <img style="display: none;" src="<?php echo $path.'magentothem/banner7'.$imag;?>" alt="" title="#banner7-caption<?php echo $i; ?>"  />
                    <?php $i++; ?>
                <?php
                        }//end if
                    } // end foreach
                ?>
        </div>
                <?php
                    $i = 1;
                    foreach($slide as $s) { ?>

                            <div id="banner7-caption<?php echo $i; ?>" class="banner7-caption nivo-html-caption nivo-caption">
                                <div class="banner7-title">
                                    <h3><?php echo $this->__($s['title']) ?></h3>
                                </div>
                                <div class="banner7-des">
                                    <?php echo $this->__($s['description']) ?>
                                </div>
                                <?php if( $s['link'] ) { ?>
                                    <div class="banner7-readmore">
                                        <a href="<?php echo $s['link']?>" title="<?php echo $this->__('Saiba mais') ?>"><?php echo $this->__('Saiba mais') ?></a>   
                                    </div>
                                <?php } ?>
                            </div>                      
                <?php
                    $i++;
                    }
                ?>
        <script type="text/javascript">
            $jq(window).load(function() {
                $jq('#ma-inivoslider').nivoSlider({
                    effect: '<?php echo $this->getConfig('animation') ?>',
                    slices: 15,
                    boxCols: 8,
                    boxRows: 4,
                    animSpeed: <?php echo $this->getConfig('interval') ?>,
                    pauseTime: <?php echo $this->getConfig('speed') ?>,
                    startSlide: 0,
                    <?php if (!$this->getConfig('nav_ctrl')) { ?>
                    controlNav: false,
                    <?php } ?>
                    <?php if (!$this->getConfig('next_back')) { ?>
                    directionNav: false,
                    <?php } ?>
                    controlNavThumbs: false,
                    pauseOnHover: true,
                    manualAdvance: false,
                    prevText: 'Prev',
                    nextText: 'Next',
                    afterLoad: function(){
                        $jq('.ma-loading').css("display","none");
                        //$jq('.banner7-title, .banner7-des, .banner7-readmore').css("left","100px") ;
                        },     
                    beforeChange: function(){ 
                        $jq('.banner7-title, .banner7-des').css("left","-2000px" );
                        $jq('.banner7-readmore').css("left","-2000px"); 
                    }, 
                    afterChange: function(){ 
                        $jq('.banner7-title, .banner7-des, .banner7-readmore').css("left","40px") 
                    }
                });
            });
        </script>
    </div>
        <!--</div>-->
    </div>
<?php } ?> <!-- end enable -->

1 answer

0

great Felipe,

we can observe two blocks of code that start with foreach

the first serves to load the images, using the code:

<img style="display: none;" src="<?php echo $path.'magentothem/banner7'.$imag;?>" alt="" title="#banner7-caption<?php echo $i; ?>"  />

the second serves to display the "know more" button. then in this first foreach, you will change the line above by:

<?php if( $s['link'] ) { ?>
    <a href="<?php echo $s['link']?>">
        <img style="display: none;" src="<?php echo $path.'magentothem/banner7'.$imag;?>" alt="" title="#banner7-caption<?php echo $i; ?>"  />
    </a>
<?php } else { ?>
    <img style="display: none;" src="<?php echo $path.'magentothem/banner7'.$imag;?>" alt="" title="#banner7-caption<?php echo $i; ?>"  />
<?php } ?>

I haven’t tested it, but I imagine it should work.. If it doesn’t, it’ll be by some small detail to be reviewed.. But the code is practically this one there. :)

success there.

  • It worked! Confusing me a lot with PHP. Thanks a lot, thanks a lot!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.