Last active
August 29, 2015 14:12
-
-
Save MrJoshFisher/2329a931eee3e1acfb29 to your computer and use it in GitHub Desktop.
Magneto Disable Shopping Cart With Attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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