OpenCart_Library_Global_Methods

OpenCart Library Global Methods

  • Code only what you need, if you missed these global methods then you may repeat codes
  • You can find global methods at system/library
  • Opencart has many predefined methods that can be called in Controller and Model

Namespace in OpenCart

  • A namespace is like a directory and by adding ‘namespace’, Affiliate is now under ‘Cart’.
  • To use ‘Affiliate’, we call or instantiate as new Cart\Affiliate()
  • Adding a ‘namespace’ to a class is like organizing files from one directory into a bunch of sub-directories.
  • The use statement lets us call class by a nickname.

Affiliate

  • $this->affiliate->login($email, $password);
    You can find code used at catalog/controller/affiliate/login.php validate() method.
    Affiliate login script at system/library/cart/affiliate.php is used to provide the authentication for Affiliate section of OpenCart. Affiliate session is activated for affiliate_id, firstname, lastname, email, telephone, fax and code.
  • $this->affiliate->logout()
    You can find code used at catalog/controller/affiliate/logout.php index() method.
    Affiliate logout script at system/library/cart/affiliate.php  is used to unset the affiliate session and assign empty value to affiliate_id, firstname, lastname, email, telephone and fax of Affiliate. By this Affiliate is logged out.
  • $this->affiliate->isLogged()
    You can find code used at catalog/controller/affiliate/account.php index() method.
    Affiliate isLogged script at system/library/cart/affiliate.php is used to check whether affiliate_id is active or not.
  • $this->affiliate->getId()
    You can find code used at catalog/model/affiliate/affiliate.php editAffiliate($data) method.
    Affiliate getId script at system/library/cart/affiliate.php  is used to return active affiliate_id.
  • $this->affiliate->getFirstName()
    You can find code used at catalog/controller/affiliate/login.php index() method.
    Affiliate getFirstName script at system/library/cart/affiliate.php is used to return active affiliate first name.
  • $this->affiliate->getLastName()
    You can find code used at catalog/controller/affiliate/login.php index() method.
    Affiliate getLastName script at system/library/cart/affiliate.php  is used to return active affiliate last name.
  • $this->affiliate->getEmail()
    You can find code used at catalog/controller/affiliate/edit.php validate() method.
    Affiliate getEmail script at system/library/cart/affiliate.php is used to return active affiliate email.
  • $this->affiliate->getTelephone()
    Not used in OpenCart but you can use it J.
    Affiliate getTelephone script at system/library/cart/affiliate.php  is used to return active affiliate Telephone number.
  • $this->affiliate->getCode()
    You can find code used at catalog/controller/affiliate/tracking.php index() method.
    Affiliate getCode script at system/library/cart/affiliate.php is used to return active affiliate tracking code which is used to track referrals.
  • $this->affiliate->getFax()
    Not used in OpenCart but you can use it J.
    Affiliate getFax script at system/library/cart/affiliate.php  is used to return active affiliate Fax number.

Other Global Methods

  • Cart
  • Currency
  • Customer
  • Length
  • Tax
  • User
  • Weight
  • Config
  • DB
  • Document
  • Encryption
  • Image
  • Language
  • Log
  • Mail
  • Openbay
  • Pagination
  • Request
  • Response
  • Session
  • Template
  • URL

For Detail description read “OpenCart Theme and Module Development” book

OpenCart theme and module development

https://www.packtpub.com/web-development/opencart-theming

LEAVE A REPLY

Please enter your comment!
Please enter your name here