I will extend View.php in htdocs\vendor\magento\module-catalog\Block\Product
My Solution was to make a new Folder Structure in the Folder app, like: htdocs\app\code\Webkul\Hello
1. Step was to make a Folder etc with the di.xml File.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Block\Product\View" type="Webkul\Hello\Block\Rewrite\Product\View" />
</config>
2. Step was the Folder htdocs\app\code\Webkul\Hello\Block\Rewrite\Product there i put the new View.php File.
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Webkul\Hello\Block\Rewrite\Product;
class View extends \Magento\Catalog\Block\Product\View
{
public function _getQuantityValidators2()
{
$validators = [];
$validators['required-number'] = true;
$validators['validate-pack'] = true;
return $validators;
}
}
This solution doesn't work and I don't know why. If someone has a idea, pleas let me know.