Magento Forum - UK Magento Forum (Unofficial)

An unofficial but dedicated Magento Forum for Magento Users, Designers and Developers

I am trying to override model in Magento 2

A forum for Magento users to discuss tips, issues etc with regards to actually using the Magento front and back end systems.

I am trying to override model in Magento 2

Postby suthanalley » Fri Dec 22, 2017 5:09 am

I have first created a custom module as editing the core files might be a big problem for me later as i am following all the steps mentioned in the tutorial http://magenticians.com/override-model-magento-2/ but still having some issues in the code. I don't know whether i am making mistakes. This is the code

Code: Select all
<?php
 
namespace Magenticians\Moduleproduct\Model\Catalog;
 
class Product extends \Magento\Catalog\Model\Product
 
{
   public function getName()
   {
       return $this->_getData(self::NAME) . ' + Demo Text';
   }
 
public function getSku()
   {
       return "123-Demo";
   }
}
suthanalley
 
Posts: 5
Joined: Mon Sep 18, 2017 8:20 am

Return to Magento Users

cron