Call function after add to cart

Discussion in 'Opencart Support' started by harlandraka, Feb 22, 2017.

  1. harlandraka

    harlandraka UKBF Newcomer Free Member

    1 0
    Hi all,

    It's my very first attempt at creating plugins for OpenCart 2.3.2.

    I want a function I wrote to be called whenever a user adds a product to his cart.

    I've read about the event system, it seems to be what I'm looking for, but I cannot seem to find an official source which lists all available events. I only found a blog post dated 2014, which is a bit old (and anyway doesn't list cart events).

    Can anyone help me?

    Thank you
     
    Posted: Feb 22, 2017 By: harlandraka Member since: Feb 22, 2017
    #1
  2. WebDesires

    WebDesires UKBF Regular Free Member

    201 25
    As far as I know there isnt any events for it, you will need to use a VQ or OC mod to add your call to this file:

    Code:
    \system\library\cart.php
    Find the section:

    PHP:
    public function add($product_id$qty 1$option = array(), $recurring_id 0) {
     
    Posted: Mar 1, 2017 By: WebDesires Member since: Feb 23, 2016
    #2
  3. antropy

    antropy OpenCart Experts Full Member - Verified Business

    3,102 526
    Perhaps the OP means the JavaScript add() function?
     
    Posted: Mar 28, 2017 By: antropy Member since: Aug 2, 2010
    #3
  4. webmto

    webmto UKBF Contributor Free Member

    90 2
    You want something to happen after visitors add products in your cart?
     
    Posted: Sep 6, 2017 By: webmto Member since: Aug 28, 2017
    #4