Re: Move SKU on product page
Hi,
In X-Cart 5 a "widget" is a combination of a template file and a PHP class that provides methods to that template file.
It's the PHP class that provides methods like getSKU() to template files.
Even when you don't specify a PHP class for a template (for example, when you add a template into a list with the @ListChild tag), there is a PHP class inherited from the parent template file. In case of @ListChild the parent template is the template where the list is displayed.
When you move a template from one list to another, it changes the parent template. In your case the new parent template has a different PHP class associated with it, and, in that PHP class, there is no getSKU() method.
What you can do:
1. In your custom module create a new View class and declare getSKU() method there. Add the @ListChild tag to that class (instead of adding it to the template) and point getDefaultTemplate() to the template file that you need.
2. Find another list that has getSKU() method available and add your template there.
3. Find what PHP class is used when you call getSKU() method in the new list, decorate that class in your module and add getSKU() method there. In your case the class is /XLite/View/Content (see the error message). It is one of the top View classes, so I would prefer the first method (creating a new View class) instead of decorating this one.
|