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.
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?
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
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
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
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
Offline
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
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
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
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.
print '<p/>Inventory level is ' . $inv . '<p/>';
Offline
what web page? I'd be in admin when I submit the post order update...?
Offline
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
"CCP - every day, you learn something new!"
that's the new Kryptronic tagline...
Offline
wyattea wrote:
"CCP - every day, you learn something new!"
That's been my mantra for almost 2 years now
Offline
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...
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
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:
<?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
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
bingo, in the 'create product name and description' section, I added: $inv = $proddisp['invlevel']; and then called it with:
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:
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
a customer got this error message:
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
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
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
Load gun, aim, shoot foot
Offline
uhm, don't forget my "don't get the emails" issue
Offline
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
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
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
where would I look at the column for post order inventory?
Offline