PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, May 10, 2022

[FIXED] How can i Override file engine/Shopware/Core/sArticles.php in Shopware?

 May 10, 2022     product, shopware     No comments   

Issue

I want to override sSaveComment function in Shopware engine/Shopware/Core/sArticles.php

since i want to replace at the place of (1 to 10 ) to (1 star , 2stars ,3stars) etc .

enter image description here


Solution

Changing the logic of functions is only possible with a custom plugin. Since this function has no events, it is only possible to change this function with a hook. There are three possible ways:

  • BeforeHook: Changing the data that is passed to the function
  • ReplaceHook: Replace the entire function with your custom logic
  • AfterHook: Changing the return values of that function

You can also use the hooks to make some custom things when the function is called (before/after).

But I guess it would be better (because of compatibility reasons) to change the appearance in the frontend. Changing the whole logic might cause incompatibilities with other extensions. Change the dropdown in frontend/detail/comment/form.tpl and use only values like 2,4,6,8,10...



Answered By - mnaczenski
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing