As the numbers of online customers are increasing so the numbers of shopping sites are also increasing with the time. When there are a lot of options available for a customer to purchase then why would he purchase from your store. Ease of shopping feature can attract customer to your store. Here ease of shopping refers to multiple factors like variety in product size, color, variant, easy checkout process and many more. Like traditional way of shopping customers buy items and often discriminate based on its color or other attributes, same is observed with online shopping. Magneto provides the functionality to facilitate such shopping environment; this makes Magento the most popular ecommerce platform. Configurable Product is one of the ways Magento offers to cater these requirements. Due to this customer can select their desired variant of the product without having to browse numbers of product pages. SKU (stock keeping unit) is an identification, usually alphanumeric which is assigned to each product that allows it to be tracked for inventory purposes. While saving a configurable product with big length SKU a fatal error is observed
Notice: Undefined variable: product in /MASKED_DIR/2018-08-06_12-56-07/htdocs/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php on line 156
Recently our Magento experts have found a solution to eliminate this error. If you are facing such errors then kindly follow the steps given below.
Step -1 Initially, set “const SKU_MAX_LENGTH = 255;” in the file module-
Step -2 You need to change the into database as well. Go to table
search for SKU at column attribute code then edit the resulted row.
Update the field frontend_class to null or validate-length maximum-length-255 according to your requirement.
Step -3 You have to change field size at the database table.
ALTER TABLE catalog_product_entity CHANGE sku sku VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SKU';
By implementing the above steps you can easily add the configurable product having big length SKU. Hope this solution works for you. If you have any better ideas please leave a comment below. Still facing a problem with this then drop us a message. Our Magento experts have ample experience in providing out of the box Magento solutions. Planning to hire Magento developer then contact us.