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

Where is the function getTotal() declared?

 
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 07-08-2016, 08:02 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Where is the function getTotal() declared?

This question is related to another question of mine.
I see that the function getTotal() is used in many places including
classes/XLite/View/Minicart.php, but the only place where I found it
declared so far is classes/XLite/Module/CDev/XPaymentsConnector/Model/Order.php.

I suppose I am missing something, but where?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #2  
Old 07-08-2016, 09:41 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Where is the function getTotal() declared?

When re-deploying, X-Cart 5.2.x auto-generates get* and set* methods for model properties. getTotal() translates to $this->total. You won't find these methods in the classes/ directory, but you will find them in the var/run/classes directory.

However, the upcoming X-Cart 5.3 won't autogenerate these methods anymore, so module authors will have to declare them manually.
__________________
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
  #3  
Old 07-10-2016, 05:38 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Where is the function getTotal() declared?

Thank you very much, I went through /var/run/classes, but I couldn't find where total() was declared. It would be nice if there were a documentation in KB that deals with this kind of thing. Anyway, would anyone know where I can find the function total() is declared?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #4  
Old 07-10-2016, 06:22 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Where is the function getTotal() declared?

There is no function "total". "Total" is a field in table. When the object is built XC automatically creates getTotal and setTotal functions to read/write in this field.

So if you have TableA and field in it called "total"

$TableA->total;
$TableA->getTotal();
$tableA->setTotal();

all work with the field "total" from table "TableA"
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
Ed B. (07-11-2016), qualiteam (07-11-2016)
  #5  
Old 07-11-2016, 08:28 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Where is the function getTotal() declared?

Thank you very much, this is now clear.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:22 AM.

   

 
X-Cart forums © 2001-2020