• Welcome to KonaKart Community Forum. Please login or sign up.
 

Deal of the Day

Started by Dishant, September 06, 2012, 12:40:34 pm

Previous topic - Next topic

Dishant

Hi Guys,
I have implemented a promotion called Deal of the day.
I want to know how can i get whether the promotion is applied to a product or a category.
If it is applied to a product , i want the name of that product and if its a category i want the name of the category.Can anyone help me to know the api's using which i can solve the above queries.I want the Deal of the Day promotion to be visible in all the pages having the product name or category name .



ryan

The Enterprise version of KonaKart has an API call that receives an array of products which it populates with promotion results when all the promotion rules are satisfied.

In the community version you need to create an order and look at the order totals to see whether any promotions apply.

Dishant

Dear Ryan,

Thank you for your reply.

But if i have multiple promotions, then will there be any method / workaround to uniquely identify a particular promotion. ?

ryan

Yes, you get a result for each promotion.

    /**
     * This method is used to calculate a discount on individual products so that the discount can
     * be displayed without having to add the product to the cart.<br>
     * The method receives an array of products and returns an array of products with attached
     * PromotionResult objects that contain the results of one or more of the promotions passed in
     * as a parameter. The PromotionResult contains the value of the discount, whether it is an
     * amount or a percentage discount and also information regarding the promotion it applies to.
     * If a product has an array of ProductQuantity objects (one for each SKU) each one of these may
     * have an array of PromotionResult objects since a promotion may only apply to one product
     * configuration and not to another (i.e. blue shirt and not red shirt).<br>
     * The PromotionOptions object can be configured so that the values of the promotions for a
     * product are subtracted from the product price. The options allow you to set rules that
     * determine whether in this case the promotions need to be cumulative or whether the largest or
     * smallest should be chosen. The calculation is only made for products with a single array of
     * PromotionResult objects. It is not calculated for products that have an array of
     * PromotionResult objects for each ProductQuantity.
     *
     * @param sessionId
     *            Only used if the customer is logged in. Otherwise set to null.
     * @param customerId
     *            If the sessionId is set to null then the customerId should contain the id of the
     *            temporary user which is a negative number. The temporary user id can be used for
     *            evaluating expression rules.
     * @param products
     *            An array of products to be processed
     * @param promotions
     *            The promotions which will be applied to the products if all rules are matched.
     * @param couponCodes
     *            Coupon codes to use. If none of the promotions require coupons, it should be set
     *            to null
     * @param options
     *            An object containing information to configure the calculation for applying one or
     *            more promotion results to the product price.
     * @return Returns the same array of products passed in as a parameter with attached
     *         PromotionResult objects if applicable
     * @throws KKException
     */
    public ProductIf[] getPromotionsPerProducts(String sessionId, int customerId,
            ProductIf[] products, PromotionIf[] promotions, String[] couponCodes,
            PromotionOptionsIf options) throws KKException;