Jump to content

motorcity

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by motorcity

  1. Finally figured this out by comparing the 5.2.9 php.ini to the current php 5.3.29 php.ini The default max_input_vars = 1000 was the culprit. Thanks for all the help, I really do appreciate it. ~Motorcity Not sure how to mark this solved, but it is.
  2. Really appreciate you taking a look here. I thought that last part about tep_db_ or mysql_ query was worth a quick going over and found that using $query = tep_db_query() in the place of mysql_query didn't bother any functioning files, and it didn't change anything that doesn't work. There has to be some sort of corruption in the data that just blows my mind because it spans multiple product groups and never reared its head until this switch in php & mysql.
  3. Thanks. To be more precise on form submission $_POST['reset'] or $_POST['save'] if the script is working you get a page refresh and a new total reflecting any changes, and a revised sort order. If not working, it still refreshes the page but it changes nothing. There are a number of php notices for undefined variables and indexes, but those were there before php5.3 and are common between those versions that work and those that don't. That the posted code is exactly the same with the hard coded vendors2_id being the only difference is really the point. And it sounds like your judgement is the problem isn't in the code. With a possible check of the php configuration probably due.
  4. I should probably explain works or doesn't work. Either way the file displays a sortable list by column headings with suggested products to order based on quantity in stock. The user can override the "approved" by clicking the checkbox off. What doesn't work is RESET or SAVE the order. Thanks for looking and any suggestions you may have.
  5. I've been up down and around in circles with this script. I know it's poor coding, but it has served its purpose. Incredibly it has worked for years and what I'm sharing here is the same code used for multiple vendors and manufacturers. The part that completely throws me is that it still works after the change from PHP 5.2.9 to PHP 5.3 for half of the vendors and doesn't work on the other half. I keep going back to the database (also updated from mysql 5.0.96 to mysql 5.5.42) a single column "vendors2_id" in the products table makes the difference of whether this code works or fails for the most part, and I've been all through the database convinced that somehow there is some sort of corruption in a table or a single product, but I believe that just isn't the case. Now I'm asking two things; Is php5.3 that much more exacting than 5.2 that something here works but only half of the time? (The ONLY difference is the number used I.E. vendors2_id = 16 works, vendors2_id = 4 does not work.) Or is it absolutely a problem in my database? <?php require('includes/application_top.php'); define('MAX_RESULTS', '1000'); //set_time_limit(300); function get_products_reorder_to($products_quantity, $reorder_quantity, $shelf_pack,$products_reorder_to){ $new_reorder_to = 0; if($products_quantity < $reorder_quantity && $shelf_pack > 0){ for($new_reorder_to = $shelf_pack;($new_reorder_to + $products_quantity) < $reorder_quantity;){ $new_reorder_to += $shelf_pack; } } if($products_reorder_to > 0) $new_reorder_to = $products_reorder_to; return $new_reorder_to; } //end function if($_POST['reset']){ $reset_query = tep_db_query("select products_id, products_quantity, shelf_pack, reorder_quantity from " . TABLE_PRODUCTS . " where vendors2_id = 16 and products_quantity < reorder_quantity"); while ($reset_select = tep_db_fetch_array($reset_query)) { $jd = get_products_reorder_to($reset_select['products_quantity'], $reset_select['reorder_quantity'], $reset_select['shelf_pack'], 0); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_reorder_to = '" . $jd . "' WHERE vendors2_id = 16 and products_id = '" . $reset_select['products_id'] . "'"); } mysql_query("UPDATE " . TABLE_PRODUCTS . " SET approved = '1' WHERE vendors2_id = 16 and products_quantity < reorder_quantity "); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET approved = '0', products_reorder_to = '0' WHERE vendors2_id = 16 and products_quantity >= reorder_quantity "); }//post reset if($_POST['save'] || $_POST['autosave'] == '1'){ if($_POST['add2order'] != '') $idchecked = join(",", $_POST['add2order']); if($_POST['add2orderlist'] != '') $idlist = join(",", $_POST['add2orderlist']); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET approved = 1 WHERE vendors2_id = 16 and products_id in (" . $idchecked . ")"); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET approved = 0 WHERE vendors2_id = 16 and products_id in (" . $idlist . ") and products_id NOT in (" . $idchecked . ")"); }//post save ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <form name="order_quantity" method="post"> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); $sorted = $HTTP_GET_VARS['sorted']; $orderby = $HTTP_GET_VARS['orderby']; if ($sorted !== "ASC" and $sorted !== "DESC") $sorted = "ASC"; ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <?php $products_query_raw = "select p.products_id, p.products_model, p.products_quantity, pd.products_name, p.products_sku, p.reorder_quantity, p.products_reorder_to, p.shelf_pack, p.vendors_product_price, pr.manufacturers_name, p2c.categories_id from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id inner join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left outer join " . TABLE_MANUFACTURERS . " pr on p.manufacturers_id = pr.manufacturers_id where p.vendors2_id = 16 and pd.language_id = '" . $languages_id. "' and p.approved=1 group by pd.products_id "; $products_query = tep_db_query($products_query_raw); while ($products = tep_db_fetch_array($products_query)) { $new_reorder_to = get_products_reorder_to($products['products_quantity'], $products['reorder_quantity'], $products['shelf_pack'], $products['products_reorder_to']); $subtotal = $new_reorder_to * $products['vendors_product_price']; $total += $subtotal; } ?> <td class="pageHeading" align="left">ABC Company</td> <td class="main" align="left">Grand Total = $<?php echo $total;?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td> <td class="dataTableHeadingContent"><?php if (!isset($orderby) or ($orderby == "sku" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=sku&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_PROD_ID . '</a>'; ?> </td> <td class="dataTableHeadingContent"><?php if (!isset($orderby) or ($orderby == "model" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=model&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' . TABLE_HEADING_MODEL . '</a>'; ?></td> <td class="dataTableHeadingContent"><?php if (!isset($orderby) or ($orderby == "name" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=name&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' . TABLE_HEADING_PRODUCTS . '</a>'; ?></td> <td class="dataTableHeadingContent" align="right"><?php if (!isset($orderby) or ($orderby == "cost" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=cost&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_PRICE_LEFT . '</a>'; ?> </td> <td class="dataTableHeadingContent" align="right"><?php if (!isset($orderby) or ($orderby == "shelf" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=shelf&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_SHELF . '</a>'; ?> </td> <td class="dataTableHeadingContent" align="right" bgcolor="FFCCCC"><?php if (!isset($orderby) or ($orderby == "stock" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=stock&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_QTY_LEFT . '</a>'; ?> </td> <td class="dataTableHeadingContent" align="right" bgcolor="CCFF99"><?php if (!isset($orderby) or ($orderby == "reorder" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=reorder&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_REORDER . '</a>'; ?> </td> <td class="dataTableHeadingContent" align="right"><?php if (!isset($orderby) or ($orderby == "reorder2" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=reorder2&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">' .TABLE_HEADING_REORDER2 . '</a>'; ?> </td> <td class="dataTableHeadingContent" align="right"><?php if (!isset($orderby) or ($orderby == "total" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=total&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">'. TABLE_HEADING_LINE_T. '</a>'; ?></td> <td class="dataTableHeadingContent" align="right"><?php if (!isset($orderby) or ($orderby == "approved" and $sorted == "ASC")) $to_sort = "DESC"; else $to_sort = "ASC"; echo '<a href="' . tep_href_link(FILENAME_STATS_INVENTORY16, 'orderby=approved&sorted='. $to_sort.($_GET['page']>0?'&page='.$_GET['page']:'')) . '" class="headerLink">'.TABLE_HEADING_CHECK_T. '</a>'; ?></td> </tr> <?php if ($HTTP_GET_VARS['page'] > 1) $rows = $HTTP_GET_VARS['page'] * 20 - 20; if ($orderby == "name") {$db_orderby = "pd.products_name";} elseif ($orderby == "stock") {$db_orderby = "p.products_quantity";} elseif ($orderby == "reorder") {$db_orderby = "p.reorder_quantity";} elseif ($orderby == "reorder2") {$db_orderby = "p.products_reorder_to";} elseif ($orderby == "shelf") {$db_orderby = "p.shelf_pack";} elseif ($orderby == "cost") {$db_orderby = "p.vendors_product_price";} elseif ($orderby == "sku") {$db_orderby = "p.products_sku";} elseif ($orderby == "model") {$db_orderby = "p.products_model";} elseif ($orderby == "total") {$db_orderby = "total";} elseif ($orderby == "approved") {$db_orderby = "p.approved";$secsort=",total desc";} else {$db_orderby = "p.approved";$secsort=",total desc"; $sorted='DESC';} $products_query_raw = "select p.products_id, p.products_model, p.products_quantity, pd.products_name, p.products_sku, p.reorder_quantity, p.products_reorder_to, p.shelf_pack, p.vendors_product_price, pr.manufacturers_name,(p.vendors_product_price * p.products_reorder_to) as total, p.approved, p2c.categories_id from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id inner join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left outer join " . TABLE_MANUFACTURERS . " pr on p.manufacturers_id = pr.manufacturers_id where p.vendors2_id = 16 and pd.language_id = '" . $languages_id. "' group by pd.products_id order by $db_orderby $sorted $secsort"; $products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_RESULTS, $products_query_raw, $products_query_numrows); $products_query = tep_db_query($products_query_raw); while ($products = tep_db_fetch_array($products_query)) { $rows++; if (strlen($rows) < 2) { $rows = '0' . $rows; } $products_id = $products['products_id']; $new_reorder_to = get_products_reorder_to($products['products_quantity'], $products['reorder_quantity'], $products['shelf_pack'], $products['products_reorder_to']); $subtotal = $new_reorder_to * $products['vendors_product_price']; $products_approved = tep_db_query("select approved from " . TABLE_PRODUCTS . " where products_id = $products_id"); $product_approved = tep_db_fetch_array($products_approved); $p_approved = $product_approved["approved"]; if($p_approved==1) $pagetotal += $subtotal; $approvedbutton = tep_draw_checkbox_field('add2order[]',$products_id,(($p_approved==1)? 'true':'')) . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . 'Approved'. '</span>': ''); echo '<input type="hidden" name="add2orderlist[]" value="'.$products_id.'">'; ?> <tr class="dataTableRow"onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"> <td align="left" class="dataTableContent"><?php echo $rows; ?>.</td> <td align="right" class="dataTableContent"><?php echo $products['products_sku']; ?></td> <td align="left" class="dataTableContent"><?php echo $products['products_model']; ?></td> <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $products['categories_id'] . '&pID='.$products['products_id'].'&action=new_product') . '" TARGET="_blank"><b>' . $products['products_name'] . '</a></b>'; ?></td> <td align="right" class="dataTableContent"><?php echo $products['vendors_product_price']; ?></td> <td align="right" class="dataTableContent"><?php echo $products['shelf_pack']; ?></td> <td align="right" bgcolor="FFCCCC" class="dataTableContent"><?php echo $products['products_quantity']; ?></td> <td align="right" bgcolor="CCFF99" class="dataTableContent"><?php echo $products['reorder_quantity']; ?></td> <td align="right" width="50" class="dataTableContent"><?php echo tep_draw_input_field('reorder2['.$products_id.']', $new_reorder_to, 'style="width: 100%"'); ?></td> <td align="right" class="dataTableContent"><?php echo sprintf("%01.2f",$subtotal); ?></td> <td align="right" class="dataTableContent"><?php echo $approvedbutton; ?></td> </tr> <?php //} unset($cPath_array); unset($p_category_array); } ?> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" colspan="4" align="center"><input type="submit" name="reset" value="Send/Reset Order" onClick="return confirm('Send/Reset all orders?');"></td> <td class="dataTableHeadingContent" colspan="5" align="center"><input type="submit" name="save" value="Save Order" onClick="return confirm('Save orders?');"></td> <td class="dataTableHeadingContent" colspan="2"><?php echo 'Sub Total : $'.$pagetotal; ?></td> </tr> </table></td> </tr> </form> <tr> <td colspan="3"><table border="0" width="90%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], "orderby=" . $orderby . "&sorted=" . $sorted); ?> </td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> </body> </html>
  6. Thanks for the reply & the code. It is the only query that uses this particular text file and this db table. And the only one producing errors in the data. The csv_reader is shared by a number of scripts, some of those were the ones getting goofed up because of un-escaped double quotes in the text. I can't figure out how or exactly where fgets fails where fgetcsv had no problem, but as a workaround I'm going to return to fgetcsv for this script only and try that.
  7. I made a couple of changes to a script that reads new data from a text file and updates mysql based on a field matching the text file. That field is $data_row[0] in the text file and products_sku in the following code. while (($data_row = $reader->getNextLine()) != NULL) { $products_sku = tep_db_prepare_input($data_row[0]); $products_model = $data_row[1]; //original $products_name = ucwords(strtolower($data_row[2])); $products_name = rtrim(ucwords(strtolower($data_row[8]))) . ' ' . rtrim(ucwords(strtolower($data_row[2]))) . ' ' . $data_row[1]; $products_width = $data_row[3]; //note there's a bunch more fields and the rest of the query // but this is the important part from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_sku = '" . $products_sku . "' and p.products_id = pd.products_id and pd.language_id = '1'"); What's happening is products that don't have a matching products_sku are being written over with all zeros in certain fields. The other part that I changed just before this problem appeared is this; class csv_reader { var $fp; function csv_reader($filename = '') { $this->fp = -1; if ($filename != '') { if (file_exists($filename)) { $this->fp = fopen($filename, "r"); } } } function getNextLine() { if ($this->fp == -1) return NULL; if (!feof($this->fp)) { $line = fgets($this->fp); return explode("~", $line); //original $arr = fgetcsv($this->fp, 0, "~"); //original return $arr; } else { fclose($this->fp); return NULL; } } } I changed from fgetcsv after reading http://php.net/manual/en/function.fgetcsv.php - post by jaimthorn at yahoo dot com I was having the same problem he described. Any thoughts on whether my code changes might be causing some fields to be written in all zeros where the products_sku is blank (not NULL, just blank).
  8. Thanks. I'm not sure how I got those odd quotes. I copied this from my personal notes blog (wordpress) Something else to look into.Thanks again!
  9. Sorry folks. It's been a long day, and none of it had to do with php. I have this code; $products_description = tep_db_prepare_input($data_row[1] . $data_row[2] . $data_row[3]); It "concats" I believe is the correct term, simply joins the data without adding spaces or anything else. I'm trying to duplicate that to a degree except I want to add html <br> between two datarows; $sql_data_array[‘products_description5′] = tep_db_prepare_input($data_row[4] ‘<br>’ $data_row[5]); or is it more like... $sql_data_array[‘products_description5′] = tep_db_prepare_input($data_row[4] . ‘<br>’ . $data_row[5]); Kinda running on empty here. I'm perfectly willing to find it myself. But what the heck would I search for?
  10. I'm still plugin away at this, still getting this error; Warning: ftp_fget() [function.ftp-fget]: Can't open data connection The script actually runs about 75 seconds just about every time. I tested manually and this file takes 4 seconds to download. I've tried ftp_get same result, ftp_nlist and ftp_rawlist and it still takes the same amount of time... Something isn't right. <?php ini_set('display_errors',1); error_reporting(E_ALL); // define some variables $folder_path = "/home/name/public_html/test/"; $local_file = "file.txt"; // $server_file = "file.txt"; //-- Connection Settings $ftp_server = "msserver"; // Address of FTP server. $ftp_user_name = "u"; // Username $ftp_user_pass = "p"; // Password // set up basic connection $conn_id = ftp_connect($ftp_server); // I checked, port is 21 // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); ftp_pasv($conn_id, true); if(ftp_chdir($conn_id, "folder/webfiles/")) { echo "Current directory is now: " . ftp_pwd($conn_id) . "\n"; } // ftp_pasv($conn_id, true); $lf = fopen($local_file, 'w'); if (!$lf){ die('Failed to create local file.'); } if (!ftp_fget($conn_id, $lf, $server_file, FTP_ASCII)) { die('Failed to download file from FTP server.'); } // ftp_get($conn_id, $local_file, $server_file, FTP_ASCII); // close the connection ftp_close($conn_id); fclose($lf); ?>
  11. Thanks again! But I'm still stuck though; Warning: ftp_fget() [function.ftp-fget]: Can't open data connection. Most of what I'm finding on this is the ftp_pasv that you suggested and I'm already using. It's not a time out issue even though this script runs for about 2-3 minutes, this is the smallest file of the group of 9 text files I need to deal with. Same results whether I use the ftp.name or ip Same also whether its ascii or binary.
  12. Makes perfect sense, only my method doesn't seem to work. Pretty much anywhere I've tried it. <?php ini_set('display_errors',1); error_reporting(E_ALL); // define some variables $folder_path = "/home/name/public_html/test/"; $local_file = "file.txt"; $server_file = "file.txt"; //-- Connection Settings $ftp_server = "ftp.msserver.com"; // Address of FTP server. $ftp_user_name = "u"; // Username $ftp_user_pass = "p"; // Password #$destination_file = "FILEPATH"; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if(ftp_chdir($conn_id, "/folder/webfiles/")) { echo "Current directory is now: " . ftp_pwd($conn_id) . "\n"; }else{ echo "Couldn't change directory\n"; } $lf = fopen($local_file, 'w'); if (!$lf){ die('Failed to create local file.'); } if (!ftp_fget($conn_id, $lf, $server_file, FTP_ASCII)) { die('Failed to download file from FTP server.'); } fclose($lf); // close the connection ftp_close($conn_id); ?> Here's what I'm getting; Current directory is now: /folder/webfiles Warning: ftp_fget() [function.ftp-fget]: Opening ASCII mode data connection for skudescadd.txt(216014 bytes). in /home/name/public_html/test/cron_transfer_texts.php on line 26 Failed to download file from FTP server.
  13. Thanks, that's moving closer. Now I know it's about changing directories on the remote server.
  14. I guess I need some help here. This is going to be cron job once I get it going. The source server is Microsoft-IIS/7.5 (we're getting pretty large text files that are in a directory. I.E. in manual ftp you need to cd /folder/webfiles/) The destination server is Apache/2.2.17 (Unix) PHP/5.2.9 File & folder permissions set to 777 So this is what I've been getting; Warning: ftp_get(file.txt) [function.ftp-get]: failed to open stream: Permission denied in /home/name/public_html/cron_transfer_texts.php on line 36 Warning: ftp_get() [function.ftp-get]: Error opening file.txt in /home/name/public_html/cron_transfer_texts.php on line 36 (Line 36 is the ftp_get) I wasn't sure if I had a connection or not so I tried; // get contents of the current directory $contents = ftp_nlist($conn_id, "/folder/webfiles/"); // output $contents var_dump($contents); It sat there and chewed on it for several minutes, but just finished without putting anything on the screen. Then I tried this; if (!($type = ftp_systype($conn_id))) { echo "FTP connection has failed! Trying again.\n"; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); }else{ echo ("Nothing to report");} and all I get is; Nothing to report <?php ini_set('display_errors',1); error_reporting(E_ALL); // define some variables $folder_path = "/home/name/public_html/test"; //test is a directory 777 $local_file = "file.txt"; $server_file = "file.txt"; //-- Connection Settings $ftp_server = "ftp.msserver.com"; // Address of FTP server. 00.000.000.000 //tried name & ip same results $ftp_user_name = "username"; // Username $ftp_user_pass = "password"; // Password #$destination_file = "FILEPATH"; // set up basic connection $conn_id = ftp_connect($ftp_server) or die("did not connect"); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file // must be either FTP_ASCII or FTP_BINARY if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII)) { if ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); } echo "Current directory: " . ftp_pwd($conn_id) . "\n"; // try to change the directory to somedir if (ftp_chdir($conn_id, "folder/webfiles")) { echo "Current directory is now: " . ftp_pwd($conn_id) . "\n"; } else { echo "Couldn't change directory\n"; } echo "Successfully written to $local_file\n"; } else { echo "There was a problem\n"; } // close the connection ftp_close($conn_id); ?>
  15. Thanks Jessica, two single quotes works just fine. Helped me weed out another 4500 products we can't actually sell.
  16. Database; MySQL 5.0.96-community-log This is a pretty basic question. UPDATE products p SET p.products_status = 0, p.vendors_prod_comments = "not in warehouse" WHERE p.shelf_pack = 0 AND p.products_quantity < 1 AND p.inventory < 1 AND p.spec_code = ? The p.spec_code column is; varchar(1) latin1_swedish_ci NULL=No DEFAULT= None The query works just fine but I'm adding the last line and the data in that column is a multiple choice of letters, It could be A, B, C, or any of about ten different letters. But for the purpose of the query I'm trying to find where the row entry is simply blank. No value given. Is there a wildcard I could use here? Something in the place of my ? mark that would only result if there was no value given. I'm pretty new at this but any ideas would be greatly appreciated. As an afterthought, I could probably change that column to default to something, but the question stands. Is there a way?
  17. I've probably been the wrong way since birth. But that's a different subject. Thanks. I think you nailed it here. I have to get the alternate vendor into the session, or hard code it throughout the checkout process. Perhaps I could add a good old tep function and call it from each file or find where the array gets into the session. Regarding mvs, which is great, one thing you can't do is switch vendors. If a product is always shipped from one place, one way, its fine. We're trying to modify that because that's not how it actually works for for us.
  18. Right! So can we safely assume that for whatever illogical reason we are going back to the db to double dip on which vendors_id is going to be the one for this product on this order?
  19. Normally that's exactly the way it is. What I'm trying to do is set a switch to change from any vendor to one special vendor. This is because under certain conditions we'll direct ship an item from a different location based on quantity and price. If the switch is false, or quantity or price do not qualify, shipping will be through the normal vendor, the one in the db.
  20. I really appreciate all the help. Thanks to all. Unfortunately, it still switches back to the original vendor when you click on checkout. It must be in a class or function. The advice followed here absolutely changes whats in the array but I'm missing something along the line. Hello Jessica, not quite sure I understand the question.
  21. Okay, my bad. We do display the number 6 in the tab title (as early as I cound put it in there) <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo $order->products[0]['vendors_id']; echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> This is in checkout_shipping.php the second file, Of course, 6 is the original value. We want it to be 15.
  22. Not able to get anything out of this. tried $order & $orders, product & products, vendor & vendors & most / all? possible combinations.
  23. Lost my post back to you. Seemed like the formum just died. All I have is a database field, if true, and several other things work out, switch the vendors_id. There are a number of other files, classes, and functions that go into this big array. This is oscommerce 2.2rc2a all the vendors stuff is from a well established contribution called multi vendor shipping. That established. It doesn't make sense to me that my new field above, the vendor_id, and the product_id all come from the same db table, we put it all together in the shopping_cart.php then we're going to query the db one more time to find out which vendor_id to use. I guess I need to read up on foreach() here to make a change to "order Object", is that about right?
  24. Thank you very much! I've been trying to find some way to make sense of this for hours; order Object ( [info] => Array ( [order_status] => 1 [currency] => USD [currency_value] => 1.00000000 [payment_method] => [cc_type] => [cc_owner] => [cc_number] => [cc_expires] => [shipping_method] => [shipping_cost] => [subtotal] => 768.06 [shipping_tax] => [tax] => 0 [tax_groups] => Array ( [unknown tax rate] => 0 ) [comments] => [total] => 768.06 ) [totals] => Array ( ) [products] => Array ( [0] => Array ( [qty] => 51 [name] => 07261/07561 Tool Holder 24in [model] => 07261 [tax] => 0 [tax_description] => Unknown tax rate [price] => 15.0600 [final_price] => 15.06 [vendors_id] => 6 [vendors_name] => 29 - 50 UI [weight] => 4.1700 [id] => 1 ) ) That's not the whole thing but I'm sure it's good enough. Nothing I've tried so far addresses the first part, "order Object"
  25. Thanks. This works just fine $products[0]['vendors_id'] = '15'; But it isn't actually doing what I'm trying to do. In the next file checkout_shipping.php the vendors_id returns to what it was originally. order Object ( [info] => Array ( [order_status] => 1 [currency] => USD [currency_value] => 1.00000000 [payment_method] => [cc_type] => [cc_owner] => [cc_number] => [cc_expires] => [shipping_method] => [shipping_cost] => [subtotal] => 60.24 [shipping_tax] => [tax] => 0 [tax_groups] => Array ( [unknown tax rate] => 0 ) [comments] => [total] => 60.24 ) [totals] => Array ( ) [products] => Array ( [0] => Array ( [qty] => 4 [name] => 07261/07561 Tool Holder 24in [model] => 07261 [tax] => 0 [tax_description] => Unknown tax rate [price] => 15.0600 [final_price] => 15.06 [vendors_id] => 6 [vendors_name] => 29 - 50 UI [weight] => 4.1700 [id] => 1 ) ) [customer] => Array ( [firstname] => richard [lastname] => brown [company] => [street_address] => ......omitted a bunch more........there are 12 different arrays enclosed here This doesn't through any errors, but it doesn't do it either $info{$products[0]['vendors_id'] = '15'};
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.