12th Jun 2019

Magento Plugin

The Magento Plugin is the layer between your system and the Talon.One API. Magento allows your system to send information to the Talon.One API to react to or store, and the Talon.One API to sent actions to your system. This allows the two to work seamlessly together. For example, your system can send the Talon.One API a user-inputted coupon code and Talon.One can tell your system it was valid and apply the discount on the customers page. The plugin functionalities include:

  • apply discount value in order/session shopping cart
  • add product to cart
  • remove product from cart
  • change shipping cost (if not possible, via discount)
  • cancel order/update order state
  • insert coupon form/input field/javascript in shop template

Note: This plugin only supports the Magento version 1.9.


The functionalities described here are located in a private repository. However, access can be given upon request by sending an email to support@talon.one. We will get back to you as soon as possible.


These functions get a list of free products from the Talon.One API, check if this free product is already in the cart, add the free product if applicable, and save the updated cart.

  • addFreeItemsToCart($quote) - check for free products from effects, add free products not yet in the cart (determined with addFreeProduct) into the cart and add product information in $quote; after free products have been added, save the cart and signal cart has been updated
  • getFreeItemFromCartBySku($quote,$sku) - search for a cart item with an SKU value the same as $sku, returns this item otherwise returns null
  • addFreeProduct($quote, $sku) - if a free product is not in the cart yet (checked by getFreeItemFromCartBySku), then return this product otherwise return null

Customer Profile

  • createOrUpdateCustomerProfile() - if a customer session has a customer profile and is logged in, then update customer profile

Customer Event

  • update($talonOneCustomerEvent) - posts a customer's events and checks the Talon.One API response to those events

Customer Session

  • update($customerSessionId, $talonOneCustomerSession) - if the last customer session hash does not equal the current customer session hash, update the customer session information and check the Talon.One API response
  • updateCustomerSession($state = 'open‘) - set customer session to $state and update
  • getCustomerId() - if customer session is logged in, return customer ID otherwise return empty string
  • getCustomerSessionId() - if a customer is logged in retrieve the session ID from the session, otherwise return session ID from core/session
  • closeCustomerSession() - changes the customer session to 'closed' and remove any effects in cart


  • isValidCouponCode - if getCouponCode is True and there are effects, returns True otherwise False
  • get/setCouponCode - get coupon code from Talon.One API, but if there isn't one remove any effects from the cart and set coupon code from Talon.One
  • get/setLastError - update last error in Talon.One API to the most recent error ($error), return last error in Talon.One API
  • getEffectCollection - if there are effects applied to the session, return those effects otherwise return effects from Talon.One effect collection
  • setEffectCollection - set the effects of the session to the Talon.One effect collection
Still need help? Get in touch!
Last updated on 12th Jun 2019

Was this article helpful?

Thank you! You have already voted

If you’d like a member of our support team to respond to you, please send a note to support@talon.one