Skip to content

Instantly share code, notes, and snippets.

@MrJoshFisher
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrJoshFisher/2329a931eee3e1acfb29 to your computer and use it in GitHub Desktop.
Save MrJoshFisher/2329a931eee3e1acfb29 to your computer and use it in GitHub Desktop.
Magneto Disable Shopping Cart With Attribute
<?php
//Checks if the "Disable Add to Cart" variable is set to 'Yes':
if(($_product->getAttributeText('no_sample_button')) == "Yes"){
//If set to Yes, tell PHP what to output:
} else {
?>
//If set as No, then show the 'add to cart box' as usual.
<?php
}
?>
1. You must create an attribute with a global scope and have the yes/no selection, name the attribute the same as whats in the:
if(($_product->getAttributeText('no_sample_button')) == "Yes"){ "no_sample_button"
is what you have to change to wahtever your calling your attribute.
2. Adjust the If statment to what you want in this case it curently says when the no_sample_button attribute says yes do nothing else also do nothing.
any issues let me know.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment