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
Note: This plugin only supports the Magento version 1.9.
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
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