we are using below code in product listing page, once customer click on icon present on listing page [list.phtml] , than it saving that product in database & displaying under My Product likes. but same code is not working in product view page [view.phtml]

enter image description here

In view page icon is not clickabe as here


enter image description here

code : list.phtml / view.phtml

<?php if($customerId){?>
   <?php if($customerlikeProduct=="No"){?>
         <img id="img-<?php echo $_product->getEntityId()?>" 
         onclick="saveproductLike('<?php echo $_product->getEntityId()?>','<?php echo $customerId?>','<?php echo count($likeProduct)?>');" 
         src="<?php echo $this->getSkinUrl($customerlikeProductimage) ?>"/>    
         <?php }else{?>
              <img src="<?php echo $this->getSkinUrl($customerlikeProductimage) ?>"/>
   <?php } ?>
<?php } else{?>

<!-- Code for Guest -->

list.phtml : http://pastebin.com/8dEUaXuP

View.phtml : http://pastebin.com/9RrCe3D2


Please check your product view page and product list page for the div which you are using are actually present or not.

For example: I have found that, you are using java script function:

setproductlogin(pid) and this function triggers click event on div with id('productlistlogin'). But this div is not present on your product view page.

  • we have this script function setrequestlogin() { //jQuery("#productlistlogin").trigger("click"); } in list.phtml, i updated same in product.phtml , still icon is not cickable in product view page..... Mar 9 '17 at 5:11
  • also i updated question with complete code of list.phtml & view.phtml , please check once..... Mar 9 '17 at 5:20
  • thanks a lot , welcome to community, we need developers like you.... Mar 9 '17 at 7:30
  • Thank you. for appreciation. Now your product view page has started showing login popup. Just some design issue is left.
    – Gulshan
    Mar 10 '17 at 1:07
  • ya, thats right, i will work on design after i complete this one Mar 10 '17 at 5:06

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.