Results 1 to 10 of 10
  1. #1
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    Default Notifying Manufacturers

    Hi all,
    I have a downloadable game site ( http://games.savagesoftware.com.au ) and as such have contracts with developers aka manufacturers. Some of these developers would like to be notified each time a game is sold while others want a monthly email to be sent to them of how many units of their game have been sold.

    How have others achieved this sort of functionality?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Notifying Manufacturers

    You could build in an automatic email into the orders class to send to the manufactuer of each product an email when their product(s) sell ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    customer issue Re: Notifying Manufacturers

    Quote Originally Posted by Ajeh View Post
    You could build in an automatic email into the orders class to send to the manufactuer of each product an email when their product(s) sell ...
    Yes that is essentially what I'm trying to achieve.

    I have added a contact_email field to the zen_manufacturers_info table and believe I can get a list of email addresses that need to be notified by running the following query....

    Code:
    select zm.manufacturers_name, zmi.contact_email, zpd.products_name from 
    zen_orders_products zop 
    inner join zen_products zp on ( zop.products_id = zp.products_id )
    inner join zen_products_description zpd on ( zp.products_id = zpd.products_id )
    inner join zen_manufacturers zm on ( zp.manufacturers_id = zm.manufacturers_id )
    inner join zen_manufacturers_info zmi on ( zm.manufacturers_id = zmi.manufacturers_id ) 
    where zop.orders_id = $zf_insert_id;
    Would something like the following be ok...

    Code:
    $developers_query = "zm.manufacturers_name , zmi.contact_email, zpd.products_name from " . 
    TABLE_ORDERS_PRODUCTS . " zop inner join " .
    TABLE_PRODUCTS . " zp on ( zop.products_id = zp.products_id ) inner join " .
    TABLE_PRODUCTS_DESCRIPTION . " zpd on ( zpd.products_id = zp.products_id ) inner join " .
    TABLE_MANUFACTURERS . " zm on  ( zp.manufacturers_id = zm.manufacturers_id ) inner join " .
    TABLE_MANUFACTURERS_INFO . " zmi on 
                             where zop.orders_id = '" . (int)$zf_insert_id . "';
    
        $developers_emails = $db->Execute($developers_query);
    
        while (!$developers_emails->EOF) 
        {
          zen_mail( $developers_emails->fields['manufacturers_name'], $developers_emails->fields['contact_email'],EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $developers_emails->fields['products_name'], 'checkout');
          $developers_emails->MoveNext();
        }
    Is there a more efficient way to do this and is the best place at the bottom of the send_order_email() function?

    Thanks.
    Last edited by savage; 6 Nov 2007 at 07:25 PM.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Notifying Manufacturers

    You would need to test this on Orders with multiple products from multiple manufacturers and multiple products from the same manufacturer all in the same Order to ensure that the right product(s) is sent to the right manufacturer(s) ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Nov 2006
    Location
    Papworth, Cambridgeshire, UK
    Posts
    731
    Plugin Contributions
    3

  6. #6
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    bug Re: Notifying Manufacturers

    My final code looks like this...

    Code:
    // Send email to developers
        $developers_query = "select zm.manufacturers_name , zmi.contact_email, zpd.products_name
          from " . TABLE_ORDERS_PRODUCTS . " zop 
          inner join " . TABLE_PRODUCTS . " zp on ( zop.products_id = zp.products_id ) 
          inner join " . TABLE_PRODUCTS_DESCRIPTION . " zpd on ( zpd.products_id = zp.products_id ) 
          inner join " . TABLE_MANUFACTURERS . " zm on  ( zp.manufacturers_id = zm.manufacturers_id ) 
          inner join " . TABLE_MANUFACTURERS_INFO . " zmi on ( zm.manufacturers_id = zmi.manufacturers_id )
          where zop.orders_id = '" . (int)$zf_insert_id . "'
          and zmi.notification_of_sale = 1";
    
        $developers_emails = $db->Execute($developers_query);
        
        while (!$developers_emails->EOF) 
        {
          zen_mail( $developers_emails->fields['manufacturers_name'], $developers_emails->fields['contact_email'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $developers_emails->fields['products_name'], STORE_NAME, EMAIL_FROM, '<b>Just Sold!</b>', 'checkout');
          $developers_emails->MoveNext();
        }
    But the emails are not being sent out even though it is the last thing to be executed in send_order_email().

    Any ideas? I tried debugging it by adding a print_r( $developers_emails ); followed by die(); but that did not display anything. How do others debug this type of thing?
    Last edited by savage; 7 Nov 2007 at 11:39 AM. Reason: slight typo

  7. #7
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    red flag Re: Notifying Manufacturers

    Any suggestions because I can't seem to get this small piece of code to work.

    What is the best way to debug that function?

  8. #8
    Join Date
    Nov 2006
    Location
    Papworth, Cambridgeshire, UK
    Posts
    731
    Plugin Contributions
    3

    Default Re: Notifying Manufacturers

    I might be wildly wrong, but shouldn't that be

    $developers_query = "select zm.manufacturers_name as manufacturers_name , zmi.contact_email as contact_email, zpd.products_name as product_name
    from " . TABLE_ORDERS_PRODUCTS . " zop etc

  9. #9
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    Default Re: Notifying Manufacturers

    Hi Chuckl, thanks for your reply.
    In phpMyAdmin, it does not require field name aliasing to work. I was always under the impression that if the column names were unique you did not need to alias them, but I might be wrong. Can anyone else confirm?

  10. #10
    Join Date
    Jan 2004
    Posts
    66,451
    Plugin Contributions
    81

    Default Re: Notifying Manufacturers

    If it's not sending anything but not giving any errors, then you're likely not getting the right results back from the query.

    What happens if you run the query directly in phpMyAdmin? How many records does it bring back? If it's not getting any records, then your code is running exactly as you told it ... do nothing if nothing is found.

    What happens if you remove the "and" clause?
    .
    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. This is weird! Customers placing orders but orders not showing up or notifying me?
    By mooncavecrystals in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 28 Jun 2011, 05:38 PM
  2. manufacturers side box is not showing the manufacturers list inside it
    By shresthashree in forum Basic Configuration
    Replies: 2
    Last Post: 31 Oct 2010, 02:49 PM
  3. Confused about notifying customer when download is ready
    By tracib in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 7 Mar 2008, 03:37 AM
  4. Merging Guest/User Carts: Notifying Customer of Old Items
    By dmfelder in forum General Questions
    Replies: 0
    Last Post: 10 Feb 2007, 09:02 PM

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