Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

  • Index
  •  » ClickCartPro 6
  •  » ADMIN SIDE - Email administrator when inventory level reaches Zero

#51 09-19-2008 21:50:26

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

I got rid of the extra addresses, and ran it again - set a product to 11, added it to the cart, ordered it, did  the update so it would be 'pending shipment' and then post order update for inventory then confirmed inventory dropped to 10, but still no email. Any clues?

Code:

if ($inv <= 10) {
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT AT 10 OR LESS --- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}

               if ($inv <= 0) {$inv = '0';
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT OUT OF STOCK--- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}

I then bought 10 items so it would drop to zero, followed same steps above, confirmed inventory was 0, but no emails.

Last edited by wyattea (09-19-2008 21:57:28)

Offline

 

#52 09-22-2008 13:19:02

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Is there any possible way to 'test' this problem? Kind of like printing a variable to a screen...maybe dump a variable to a text file to see if the variables actually contain something? My previous problem was  semi colons instead of commas but that apparently wasn't the problem since I just used one address and still get no emails.

James...

Offline

 

#53 09-22-2008 13:22:13

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Well the only variable being used is $inv so you could add a print 'Inventory level is ' . $inv; in there to see what it is.

Offline

 

#54 09-22-2008 13:27:24

antsevo
Member
From: Surrey, UK
Registered: 02-08-2005
Posts: 592
Website

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Dave wrote:

The format of your to variable is incorrect in the modification you made.  If you have a list of addresses they must be in the form:

user@example.com, anotheruser@example.com

It looks like you may be using a ; instead of a ,

Are you sure about that dave, we are using an apache server and postfix version 2.3.3, we are using a semi-colon and all emails are being sent correctly


Anthony - Personalised and Celebrity Face Masks
Anthony - Adult Toys

Offline

 

#55 09-22-2008 13:31:31

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Yes.  From the PHP manual:

to

    Receiver, or receivers of the mail.

    The formatting of this string must comply with RFC 2822. Some examples are:

    user@example.com
    user@example.com, anotheruser@example.com
    User <user@example.com>
    User <user@example.com>, Another User <anotheruser@example.com>

PHP itself may be configured to use something other than it's built in method for sending mail which may be why it is working for you.  Using a comma will work in any situation.

Offline

 

#56 09-22-2008 13:56:03

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

I know the $inv variable is available...but where exactly would that $inv variable print TO? The only way to test is to drop product inventory myself and then place an order, but I have to manually do the post-order update to update inventory.

Offline

 

#57 09-22-2008 14:18:17

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

I use the pay by check gateway with it's post order update set to true which will complete an order as being complete and do the updates. Even though it is seen by all customers I have only had one person in 3 years even use it and you could always set it to pending payment if they did.

John

Offline

 

#58 09-22-2008 14:21:44

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

wyattea wrote:

I know the $inv variable is available...but where exactly would that $inv variable print TO?

It will print in the web page James.  To make it stand out add a <p> before and after it.

Code:

print '<p/>Inventory level is ' . $inv . '<p/>';

Offline

 

#59 09-22-2008 14:40:29

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

what web page? I'd be in admin when I submit the post order update...?

Offline

 

#60 09-22-2008 15:00:26

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

On that page James ... when you click on submit it should show up there.  It'll be somewhere on the page.

Last edited by Dave (09-22-2008 15:06:53)

Offline

 

#61 09-22-2008 15:04:28

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

"CCP - every day, you learn something new!"

that's the new Kryptronic tagline...

smile

Offline

 

#62 09-22-2008 15:07:25

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

wyattea wrote:

"CCP - every day, you learn something new!"

That's been my mantra for almost 2 years now smile

Offline

 

#63 09-22-2008 21:24:18

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Ok, added a couple of print statements, did my thing, and nothing was displayed on the admin screen when I clicked on submit after checking the box for update product inventory. I confirmed that the inventory amount was reduced for that particular product. Damn this is getting annoying...

Code:

if (!(empty($result))) {

          foreach ($result as $num => $row) {

               $inv = $row['inventory'] - $cartinv_opt[$row['id']];


print '<p>Inventory level is ' . $inv . '</p>';

              if ($inv <= '10') {
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT AT 10 OR LESS --- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}


print '<p>Inventory level is ' . $inv . '</p>';

               if ($inv <= '0') {$inv = '0';
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT OUT OF STOCK--- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}

Last edited by wyattea (09-23-2008 07:59:54)

Offline

 

#64 09-23-2008 11:51:55

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Besides getting this problem solved, I'd like to display inventory levels for products right below the price on the product detail display when it reaches 10 or less. I tried this:

Code:

<?php print '<p>Order soon, only ' . $inv . ' left!</p>'; ?>

(I didn't bother to use the if statement to test for quantity <= yet but I will). The $inv variable had nothing in it - only thing printed was "Order soon, only left!".  Is there something I need to reference at the top of the include to be able to have a value in the $inv variable? $inv is a 'man-made' variable from 0300_inventory.php, is there another variable to reference?

James...

Last edited by wyattea (09-23-2008 11:53:30)

Offline

 

#65 09-23-2008 12:14:42

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

In the product array the invlevel key (column) contains the inventory level of the product.  $inv is specific to the 0300_inventory.php code.

Offline

 

#66 09-23-2008 16:03:50

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

bingo, in the 'create product name and description' section, I added: $inv = $proddisp['invlevel']; and then called it with:

Code:

if ($inv < 10) {
print '<br/><p><strong>Limited Supply - Only ' . $inv . ' Left!</strong></p>';
}
?>

So, back to the email issue - I added the print statement outside of the if statement and it still doesn't print on the page displayed after the submitting the post order update for inventory. Here's my code:

Code:

print '<p>Inventory level is ' . $inv . '</p>';

     if (!(empty($result))) {

          foreach ($result as $num => $row) {

               $inv = $row['inventory'] - $cartinv_opt[$row['id']];


print '<p>Inventory level is ' . $inv . '</p>';

              if ($inv <= '10') {
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT AT 10 OR LESS --- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}


print '<p>Inventory level is ' . $inv . '</p>';

               if ($inv <= '0') {$inv = '0';
                   $to = "james@mysite.com";
                   $subject = 'PRODUCT OUT OF STOCK--- ' . $row['id'];
              $body = 'https://www.mysite.com/admin.php?app=ccp0&ns=manageprod&func=dbupdate&funcid=' . $row['id'];
                   mail($to, $subject, $body);
}

               $data = array('inventory' => $inv);

               $update_clause = $this->KHXC_DB->clause_update(array('table'      => $table,
                                                                    'data'       => $data));

               if (!($this->IsError($update_clause))) {

                    $sql = $update_clause . ' WHERE id=' . $this->KHXC_DB->quote($row['id']);

                    $this->KHXC_DB->sql_do(array('sql'   => $sql,
                                                 'table' => $table));

               } // End of if statement.

          } // End of foreach statement.

     } // End of if statement.

So, the 'send mail' if statements aren't being 'fired off' since the print statements aren't even happening either. Where do we go from here?

Last edited by wyattea (09-23-2008 18:31:06)

Offline

 

#67 09-23-2008 18:29:57

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

a customer got this error message:

Code:

Fatal error: Class 'CCP_Order_inventory-LATEST-TEMP' not found in /home/wyattea/mysite.com/khxc-private/core/KHXC/KHXC.php on line 1753

It might have been when I was uploading the 0300_inventory.php file so she couldn't access it. I never renamed a class with that name, but I've renamed filenames with -LATEST-TEMP.php at the end as a backup. What could this be?

UPDATED: don't have a backup file in the ext dir - it was a 0300_inventory.php file I had renamed as a backup called 0300_inventory-LATEST-TEMP.php that was the offending file.

Last edited by wyattea (09-23-2008 21:42:40)

Offline

 

#68 09-24-2008 04:32:17

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

You've run into this one before if I recall correctly.  Anything in the /ext directory with an extension of PHP will be executed so you can't simply change the file name when you're modifying one of the files.  You have to remove it or change the extension to something other than php.

Offline

 

#69 09-24-2008 06:36:36

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

yes, i remember it happening before but I didn't remember which dir couldn't have backup files. I've had that file there since last week so every customer was getting that error...finally someone told me about the error otherwise i never would have known.

Offline

 

#70 09-24-2008 06:39:46

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

Load gun, aim, shoot foot smile

Offline

 

#71 09-24-2008 06:45:00

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

uhm, don't forget my "don't get the emails" issue smile

Offline

 

#72 09-24-2008 07:37:38

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

It's not forgotten but I'm not pursuing it either James.  The inventory extension will only be run once so if the order you are testing with has the postordinv column already set to one it won't be run again.  It also won't be run if the order status is P or X.

Offline

 

#73 09-24-2008 08:07:01

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

I don't understand what you mean? When you mention order status, it made me remember that I did a mod from John that made the order status automatically 'Pending Shipment' when they returned to the site from the payment gateway.

Then again, I don't remember exactly what I did but when I read the thread, it made sense and I implemented. It had something to do with adding a 'NC' status code for some reason. I'm not sure if it's a completely new code or just added to a specific point in the order process. I know I'm being vague, maybe you have a clue what I'm talking about? I just found the thread:

https://forum.kryptronic.com/viewtopic.php?id=17782 - post #25 says what I did (add a ccp0.orderstatus.NC option referred to as Not Completed)

Offline

 

#74 09-24-2008 08:17:37

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

wyattea wrote:

I don't understand what you mean?

Look at the logic in the code.  If the post order inventory process has been run once it won't run again.  If the order status is P or X it won't do anything.  I was merely suggesting that you see if the column for post order inventory had already been set to 1 for the order you're testing with.

Offline

 

#75 09-24-2008 08:19:43

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: ADMIN SIDE - Email administrator when inventory level reaches Zero

where would I look at the column for post order inventory?

Offline

 
  • Index
  •  » ClickCartPro 6
  •  » ADMIN SIDE - Email administrator when inventory level reaches Zero

Board footer