Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Move SKU on product page

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-12-2015, 05:44 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Move SKU on product page

I want to move the product sku out of the description tab and up to the main part of the product page under the price. I found the common.product-attributes,sku.tpl file is what displays this in the description. Everytime I try moving this into another list or moving the {getsku()} line into another tpl. It breaks the page layout. Does anyone know how to do accomplish this with out getting an error and breaking the layout? Does anyone know what would cause the error?
__________________
Ver 5.2.6
Reply With Quote
  #2  
Old 05-12-2015, 05:47 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Move SKU on product page

Here is what is in the xlite.log


May 12 10:37:13 XLite [error] Trying to call undefined class method; class - "XLite\Controller\Customer\Product", function - "getSKU"
Server API: cgi-fcgi;
Request method: GET;
URI: /liberty-ascent-ii-upflush-toilet-package/;
Backtrace:
file <compiled classes repository>/classes/XLite/Base.php : 83
method XLite\Base::__call('getSKU', array(0))
method XLite\Controller\Customer\Product::getSKU()
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 168
file <compiled classes repository>/skins/PmallTheme/default/en/product/details/common_attributes/common.product-attributes.sku.tpl.php : 1
file <compiled classes repository>/skins/PmallTheme/default/en/product/details/common_attributes/common.product-attributes.sku.tpl.php : 1
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 963
file <compiled classes repository>/skins/default/en/product/details/parts/page.info.tpl.php : 2
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 963
file <compiled classes repository>/skins/default/en/product/details/page/body.tpl.php : 3
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 963
file <compiled classes repository>/skins/default/en/center_top.tpl.php : 1
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/Content.php : 73
file <compiled classes repository>/skins/default/en/center.tpl.php : 5
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/Content.php : 73
file <compiled classes repository>/skins/default/en/layout/main.center.center.tpl.php : 7
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/Content.php : 73
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 963
file <compiled classes repository>/skins/default/en/layout/main.center.tpl.php : 8
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/Content.php : 73
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 963
file <compiled classes repository>/skins/default/en/main.tpl.php : 5
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 297
file <compiled classes repository>/classes/XLite/View/Content.php : 73
file <compiled classes repository>/classes/XLite/View/AViewAbstract.php : 319
file <compiled classes repository>/classes/XLite/View/ControllerAbstract.php : 291
file <compiled classes repository>/classes/XLite/View/ControllerAbstract.php : 320
file <compiled classes repository>/classes/XLite/View/ControllerAbstract.php : 136
file <compiled classes repository>/classes/XLite/Controller/AControllerAbstract.php : 558
file <compiled classes repository>/classes/XLite.php : 503
file <X-Cart root>/cart.php : 36
__________________
Ver 5.2.6
Reply With Quote
  #3  
Old 05-13-2015, 08:43 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Move SKU on product page

Phil,

I don't the energy to research this or explain properly. But here is the bottom line:

This call to getSku() references a method that is available in the class that draws/renders this other template. In the template that you have placed this call, the PHP file that defines the class, does not have this method implemented.

You need to look into the class that renders the template that you are working in, decorate it, and include this method getSku(). Perhaps in the template you are in, you simply need to use something like {$product->getSku()} - just an example.

You just need to gain an understanding of what is assigned, and what variables and methods you have available to you, and realize that this is determined by what class (php file) this template is rendered by, and what that class may possibly extend.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #4  
Old 05-19-2015, 09:31 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
Dawn Howard (02-21-2021)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:55 PM.

   

 
X-Cart forums © 2001-2020