Add to cart

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Mon Nov 12, 2012 7:00 pm
Reply with quote
Report this post
How do i hide the add to cart button when pricing is not being shown (e.g. to guest users until registered/logged in)

e.g. http://evidentdental.co.uk/index.php/k2 ... -72-detail

price is hidden but you can still add to cart !
User avatar
Fresh Boarder

Konrad M
Tue Nov 13, 2012 2:03 pm
Reply with quote
Report this post
Hi,
you can try using java script. Please go to js/gk.scripts.js and find:
Code: Select all
new SmoothScroll();

after this paste:
Code: Select all
if(document.getElements('.PricesalesPrice')) {
 
var el = document('.addtocart-area');
for (vari =0;i < el.length;i++) {
  el[i].addClass('nodisplay');
}

}

then please try add to override.css
Code: Select all
.nodisplay {
display:none !important;
}

Remember to enable override.css option in template settings.
User avatar

GK User
Tue Nov 13, 2012 6:09 pm
Reply with quote
Report this post
I have done that but it doesn't work and now you don't get the dot when you hover over the image either!

see attached for screenshot of code
addtocartcode.png
User avatar
Fresh Boarder

Konrad M
Tue Nov 13, 2012 6:12 pm
Reply with quote
Report this post
Sorry I forgot space change it to:
Code: Select all
if(document.getElements('.PricesalesPrice')) {
 
var el = document('.addtocart-area');
for (var i =0;i < el.length;i++) {
  el[i].addClass('nodisplay');
}

}
User avatar

GK User
Thu Nov 15, 2012 12:33 pm
Reply with quote
Report this post
Changed the code but no difference

Hover over the zoom still not working (since the code added) and the add to cart still showing
User avatar
Fresh Boarder

Konrad M
Thu Nov 15, 2012 2:35 pm
Reply with quote
Report this post
Ok please remove code I gave you. Then find in this file (line 203):
Code: Select all
});
// function to set cookie
function setCookie(c_name, value, expire) {
   var exdate=new Date();
   exdate.setDate(exdate.getDate()+expire);
   document.cookie=c_name+ "=" +escape(value) + ((expire==null) ? "" : ";expires=" + exdate.toUTCString());
}

and change to:
Code: Select all
   var elm = document.getElements('.PricesalesPrice');
   if(elm == null) {
 
      var el = document.getElements('.addtocart-area');
      for (var i =0;i < el.length;i++) {
           el[i].addClass('nodisplay');
      }

    }
});
// function to set cookie
function setCookie(c_name, value, expire) {
   var exdate=new Date();
   exdate.setDate(exdate.getDate()+expire);
   document.cookie=c_name+ "=" +escape(value) + ((expire==null) ? "" : ";expires=" + exdate.toUTCString());
}
User avatar

GK User
Tue Dec 04, 2012 5:32 pm
Reply with quote
Report this post
I'm afraid that didn't work either - You still see the add to cart when you are not logged in even though you can't see the price
http://evidentdental.co.uk/index.php?op ... Itemid=631
User avatar
Fresh Boarder

GK User
Tue Dec 04, 2012 6:24 pm
Reply with quote
Report this post
Managed to find a fix myself by editing -/templates/gk_bikestore/html/com_virtuemart/productdetails/default.php

replace: <div class="addtocart-area"> (about line 194)

with:
<?php if ( ! $user->get('guest')) { ?>
<div class="addtocart-area">
<?php } else { ?>
<div class="addtocart-area-hide">
<?php } ?>
User avatar
Fresh Boarder


cron