Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Idev Affiliates code for per-product commissions

    I'm trying to intergrate our Idev Affiliate software with our Zen Cart. I have it integrated and it works fine for a single preset commission even with multiple tiers.. What we need to do is get the custom coding for "per-product commissions". According to Idev tech support(HA!) it will work but requires some custom coding which Idev states many times now that they don't do! According to the tutorial(HA!) you have to query the data base to send the products purchased along with the sale amount to the Idev tracking pixel in order for it to work. I have very limited experience in database and mysql and have tried every combination I could think of to make it work. Apparently I don't know what I'm doing because it still doesn't work. I had some questions such as what type "identifier" Idev software needs but all tech support(HA!) can tell me is they don't do custom coding and it will work with some custom coding. Seems to me it wouldn't be that hard to put the code in place to make it work from the beginning since it is supposed to be" a snap to integrate with the most popular carts in the world"(HA!). It integrated easily but not all of it!.

    Here is a link to their "tutorial"(HA!) http://www.idevlibrary.com/docs/Per_...ommissions.pdf

    Does anyone use this that could share the code or write the code real quick for me or let me pay you to do it if it works. I really need to get this and I'm about coded out on ideas. We can post and share any ideas because I know I'm not the only one that has this issue!

    I attached the file they said to edit.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Re: Idev Affiliates code for per-product commissions

    Guess I'm the only fool in the bunch. Maybe I can hire someone to do the custom coding I need. Coders take a look and PM me a quote please.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Idev Affiliates code for per-product commissions

    I just updated this FAQ article with code that should work with v1.5.3:
    http://www.zen-cart.com/content.php?...filiates-Tools
    This will send the list of products to iDev. It does NOT send individual commission override amounts ... you'll need to configure those per-product in your iDev settings.

    To use it, delete the tpl_footer.php file they gave you (it's not compatible with modern PHP versions anyway) and create the file mentioned in the article using the code posted there. (insert your correct iDev URL and profile ID number)

    Once you get it working, feel free to donate at: www.zen-cart.com/donate
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Re: Idev Affiliates code for per-product commissions

    DrByte, Thanks! Through a little manipulation I'm almost getting the code to work. It seemed to take a combination of new and old code to get it to do so.
    Scenario of how it's working now:
    Product A pays flat rate of $XXX.XX commission set up on per product commission
    Product B and all other products pay Standard commissions with 2 tiers as set up in IDEV (1)=10% - (2)=4% - (3)=1%

    If someone buys Prod A it pays flat rate per product commission as set up and tiers pay accordingly also

    Now, if someone buys product A and adds product b to the order, the 1st tier only gets the per product flat rate commission from the product A and the two tiers get the regular sales commissions as set up on both products. The first tier doesn't get the commission of product b included.

    If 2 different products with a per product commission are in the order then everything works as planned as long as they don't add any products that don't have a per product commission set in IDEV. 1st tier gets both per product commissions and 2nd and 3rd tier gets commission they are supposed too.

    If someone buys product b type only, all tiers get the regular set commissions as set up in IDEV.

    I wonder why the 1st tier only gets the single commission from product a and doesn't include product b type commission?

    I'm including the code page attached to this post. I had to combine both codes. Theirs and yours. Some of it might be over kill but I'm not a coder by any means and don't claim to be. All I know is it almost works like this. I put the code you so kindly pointed me too in with their code the best I knew how. Maybe it needs to have code to tell it if per product commissions are in there then make sure to check for regular products that don't have per product commission and include them also? Just stabbing at ideas!

    Did I see somewhere, or better yet is there a plugin that would make it where if someone bought Product A from Product A category then Zencart wouldn't allow any other items to be included in the order with it? I know shipping has one because of Hazmat orders and such. I remember seeing that. That might be what I'm thinking of.

    Also as I stated before I can hire a coder, I think, if I need too and can afford it. The site owner has agreed to make a donation when we are finished but I have no idea what would be fare because I'm not familiar with hiring coders or what might be a fair donation for Zencart. I don't want to make a donation and have someone say"that cheap %&*#$#% only donated $$$. LOL

  5. #5
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Re: Idev Affiliates code for per-product commissions

    Forgot to do something. Here's the file that sends Idev the data from Zencart.
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Re: Idev Affiliates code for per-product commissions

    Anybody have any thoughts on this?

  7. #7
    Join Date
    Jan 2012
    Posts
    24
    Plugin Contributions
    0

    Default Re: Idev Affiliates code for per-product commissions

    Here's the code that I ended up using. Maybe no one wants to open the file. This is the tail end that does the query and send the call to our idev. This works but you can see up above it's still not quite right. Any input on the matter would be greatly appreciated.

    PHP Code:
    <?PHP }
    if ((int)
    $orders_id 0) {
      
    $IDEV $db->Execute("select class, value from " TABLE_ORDERS_TOTAL " where orders_id = '".(int)$orders_id."' AND class in ('ot_coupon', 'ot_subtotal', 'ot_group_pricing')");
      while (!
    $IDEV->EOF) {
        switch (
    $IDEV->fields['class']) {
          case 
    'ot_subtotal':
           
    $order_subtotal $IDEV->fields['value'];
            break;
          case 
    'ot_coupon':
           
    $coupon_amount $IDEV->fields['value'];
            break;
          case 
    'ot_group_pricing':
           
    $group_pricing_amount $IDEV->fields['value'];
            break;
        }
        
    $IDEV->MoveNext();
      }    
      if (!isset(
    $order_summary['products_ordered_models'])) {
      
    $products_array = array();
      
    $products_query "SELECT products_id, products_model
                         FROM " 
    TABLE_ORDERS_PRODUCTS "
                         WHERE orders_id = :ordersID
                         ORDER BY products_id"
    ;
      
    $products_query $db->bindVars($products_query':ordersID'$orders_id'integer');
      
    $products $db->Execute($products_query);
      while (!
    $products->EOF) {
        
    $products_array[urlencode($products->fields['products_id'])] = urlencode($products->fields['products_model']);
        
    $products->MoveNext();
      }
      
    $idev_sale_amount = ($order_subtotal $coupon_amount $group_pricing_amount);
      
    $idev_sale_amount number_format($idev_sale_amount,2,'.','');
      
      
    $idev_coupon_code mysql_query("select coupon_code from " TABLE_ORDERS " where orders_id = '" . (int)$orders_id "'");
      
    $idev_coupon_code mysql_fetch_array($idev_coupon_code);
      
    $idev_coupon_code $idev_coupon_code['coupon_code'];
      
      
    $order_summary['products_ordered_ids'] = implode('|'array_keys($products_array));
      
    $order_summary['products_ordered_models'] = implode('|'array_values($products_array));



     echo 
    '<script type="text/javascript" src="https://www.mysite.com/idevaffiliate/sale.php?profile=1&idev_saleamt=' $order_summary['commissionable_order_formatted'] . 
           
    '&idev_ordernum=' $order_summary['order_number'] . '&products_purchased=' $order_summary['products_ordered_models'] . '&coupon_code=' urlencode($order_summary['coupon_code']) .
           
    '"></script>';


    echo 
    "</td></tr></table>";
    }

    ?>

  8. #8
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Idev Affiliates code for per-product commissions

    Quote Originally Posted by Barf View Post
    Now, if someone buys product A and adds product b to the order, the 1st tier only gets the per product flat rate commission from the product A and the two tiers get the regular sales commissions as set up on both products. The first tier doesn't get the commission of product b included.

    If 2 different products with a per product commission are in the order then everything works as planned as long as they don't add any products that don't have a per product commission set in IDEV. 1st tier gets both per product commissions and 2nd and 3rd tier gets commission they are supposed too.

    If someone buys product b type only, all tiers get the regular set commissions as set up in IDEV.

    I wonder why the 1st tier only gets the single commission from product a and doesn't include product b type commission?
    You might first check with iDev to see whether what you're asking is possible.
    The code I supplied is passing the product details. What iDev does with that is something you might need to take up with them.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Buttons and affiliates code for external sales pages
    By mariamar in forum General Questions
    Replies: 3
    Last Post: 11 Oct 2011, 08:02 PM
  2. Adding a Cookie to Category and Product Pages for affiliates
    By Andy_GS in forum General Questions
    Replies: 4
    Last Post: 20 Apr 2010, 03:47 PM
  3. Express button code vs affiliates
    By permissiontopost? in forum PayPal Express Checkout support
    Replies: 0
    Last Post: 17 Sep 2007, 04:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg