Click here to Skip to main content
16,006,475 members
Home / Discussions / Web Development
   

Web Development

 
QuestionDisplay Derived Objects In Swagger Example Values Pin
Liagapi15-Dec-17 19:21
Liagapi15-Dec-17 19:21 
SuggestionRe: Display Derived Objects In Swagger Example Values Pin
Richard MacCutchan15-Dec-17 22:43
mveRichard MacCutchan15-Dec-17 22:43 
AnswerRe: Display Derived Objects In Swagger Example Values Pin
VenkatReddy.RC3-Jan-18 23:01
professionalVenkatReddy.RC3-Jan-18 23:01 
Questionan unusual problem of building multiple sites towards a longer term goal Pin
symfonycoda12-Dec-17 8:48
symfonycoda12-Dec-17 8:48 
AnswerRe: an unusual problem of building multiple sites towards a longer term goal Pin
W Balboos, GHB29-Dec-17 6:02
W Balboos, GHB29-Dec-17 6:02 
QuestionHow can i disable add to cart button in Magneto 2? Pin
suthan alley10-Dec-17 19:41
suthan alley10-Dec-17 19:41 
AnswerRe: How can i disable add to cart button in Magneto 2? Pin
Afzaal Ahmad Zeeshan14-Dec-17 4:07
professionalAfzaal Ahmad Zeeshan14-Dec-17 4:07 
AnswerRe: How can i disable add to cart button in Magneto 2? Pin
Member 1358395818-Dec-17 20:43
Member 1358395818-Dec-17 20:43 
You need to create a custom module to implement it.

After the creation of module, create the InstallData.php file in app/code/Magenticians/Mymodule/Setup and add the following code in it:

eavSetupFactory = $eavSetupFactory;
$this->attributeSetFactory = $attributeSetFactory;
$this->categorySetupFactory = $categorySetupFactory;
}



public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();

// CREATE ATTRIBUTE SET

$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$attributeSet = $this->attributeSetFactory->create();
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
$data = [
'attribute_set_name' => 'DisableAddToCart',
'entity_type_id' => $entityTypeId,
'sort_order' => 200,
];
$attributeSet->setData($data);
$attributeSet->validate();
$attributeSet->save();
$attributeSet->initFromSkeleton($attributeSetId);
$attributeSet->save();



// CREATE PRODUCT ATTRIBUTE

$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'text_add_to_cart',
[
'type' => 'varchar',
'label' => 'Add to Cart Text',
'backend' => '',
'input' => 'text',
'wysiwyg_enabled' => false,
'source' => '',
'required' => false,
'sort_order' => 5,
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
'used_in_product_listing' => true,
'visible_on_front' => fasle,
'attribute_set' => 'DisableAddToCart',
]
);
$setup->endSetup();
}

} ?>



Now based on the above attribute you can disable your overridden add to cart file.

Complete Guide: Magento 2 Disable Add to Cart Button for Certain Products
QuestionBootstrap Carousel not carouselling Pin
#realJSOP10-Dec-17 3:56
professional#realJSOP10-Dec-17 3:56 
AnswerRe: Bootstrap Carousel not carouselling Pin
#realJSOP10-Dec-17 5:38
professional#realJSOP10-Dec-17 5:38 
SuggestionRe: Bootstrap Carousel not carouselling Pin
Richard Deeming11-Dec-17 2:12
mveRichard Deeming11-Dec-17 2:12 
GeneralRe: Bootstrap Carousel not carouselling Pin
#realJSOP11-Dec-17 3:21
professional#realJSOP11-Dec-17 3:21 
QuestionHow to override block in Magento 2 ? Pin
suthan alley7-Dec-17 22:44
suthan alley7-Dec-17 22:44 
Questiongoogle map API biostall library issue on my project in codeigniter Pin
Member 135521401-Dec-17 5:13
Member 135521401-Dec-17 5:13 
QuestionMVCCodeRouting Pin
#realJSOP30-Nov-17 6:39
professional#realJSOP30-Nov-17 6:39 
AnswerRe: MVCCodeRouting Pin
Nathan Minier1-Dec-17 1:43
professionalNathan Minier1-Dec-17 1:43 
GeneralRe: MVCCodeRouting Pin
#realJSOP1-Dec-17 8:13
professional#realJSOP1-Dec-17 8:13 
GeneralRe: MVCCodeRouting Pin
Nathan Minier4-Dec-17 1:15
professionalNathan Minier4-Dec-17 1:15 
QuestionMVC and Custom Routes Pin
#realJSOP30-Nov-17 5:08
professional#realJSOP30-Nov-17 5:08 
AnswerRe: MVC and Custom Routes Pin
Richard Deeming30-Nov-17 8:24
mveRichard Deeming30-Nov-17 8:24 
GeneralRe: MVC and Custom Routes Pin
#realJSOP1-Dec-17 1:04
professional#realJSOP1-Dec-17 1:04 
QuestionHow do I insert dropdown Text, not the value, into the database? Pin
samflex17-Nov-17 9:58
samflex17-Nov-17 9:58 
AnswerRe: How do I insert dropdown Text, not the value, into the database? Pin
W Balboos, GHB6-Dec-17 7:27
W Balboos, GHB6-Dec-17 7:27 
GeneralMessage Closed Pin
24-Jan-19 11:19
Sarah George24-Jan-19 11:19 
GeneralRe: How do I insert dropdown Text, not the value, into the database? Pin
W Balboos, GHB25-Jan-19 1:14
W Balboos, GHB25-Jan-19 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.