1

I have a static block that loads an image with a link on the main page. However what I need is if the user is logged in and is a wholesaler to have the image have a different url. So I am using jquery which I have loaded in our Magento CE website. My issue is it does not seem to be changing the url. However when I look at the code inspector in Chrome I do not see any errors? What happens is even when I am logged in my div with id demo does not have the wholesale content in it.

Here is my code (which I have in the header.phtml file)

       <?php
            //switch url for brestcancer awareness month 
            //slider that links to a product
         if(Mage::getSingleton('customer/session')->isLoggedIn())
            {
                // Get group Id
                $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
                //Get customer Group name
                $group = Mage::getModel('customer/group')->load($groupId);
                $agroupcodename = $group->getCode();

                 if($agroupcodename =='US-Wholesale')
                    {
       ?>

                        <script>
                             jQuery('#demo').html('<p><a href="https://www.*********.com/hair/hair-color/hair-color-wholesale#92=27" title="Breast Cancer Awareness Month"><img src="{{media url="wysiwyg/main_page_images/sliders/Pink_BCRF_homepage.jpg"}}" alt="Breast Cancer Awareness Month" /></a></p>');
                        </script>
       <?php
                    }
           }
        ?>

I then have a static we will call slider1

      <div id="demo">
           <p>
               <a href="https://www.*******.com/hair-color#92=27" title="Breast Cancer Awareness Month"><img src="{{media url="wysiwyg/main_page_images/sliders/Pink_BCRF_homepage.jpg"}}" alt="Breast Cancer Awareness Month" /></a>
           </p>
      </div>
1
 <script>
jQuery.noConflict();
jQuery(document).ready(function() {
  jQuery('#demo').html('<p><a href="https://www.*********.com/hair/hair-color/hair-color-wholesale#92=27" title="Breast Cancer Awareness Month"><img src="{{media url="wysiwyg/main_page_images/sliders/Pink_BCRF_homepage.jpg"}}" alt="Breast Cancer Awareness Month" /></a></p>');
});
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.