Jump to content

hungryfrank

Members
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hungryfrank

  • Rank
    Member
  1. different people think differently. not everything has to fit in your box. and they don't have to have a cubic box either thanks
  2. yes I can change them manually but lets say inn a few months there is an upgrade to the main script. this way I can install my calendar module and all the necessary changes are made. I don't have to remember what they were
  3. I am trying to. modify existing file in a php script to add a module for world calendars. I want to make these changes like this so if in the future there is an upgrade to the original script I can make these changes without remembering what happened. there is only two filets change and either 0,1,2 occurrences of this line. it is always the same and hasn't changed in 15 years
  4. hi I am trying to add a few line of code using fopen It works and it adds the lines but I have multiple occurrence of this line and I would like to all be amended. $target_line='$second = (int)substr($raw_date, 17, 2);'; $lines_to_add= '$raw_datetime = translate_from_gregorian($raw_datetime);'. PHP_EOL. '$year = (int)substr($raw_datetime, 0, 4);'. PHP_EOL. '$month = (int)substr($raw_datetime, 5, 2);'. PHP_EOL. '$day = (int)substr($raw_datetime, 8, 2);'. PHP_EOL; $config ='includes/functions/general.php'; $file=fopen($config,"r+") or exit("Unable to open file!"); $insertPos=0; // variable for saving //Users position while (!feof($file)) { $line=fgets($file); if (strpos($line,$target_line)!==false) { $insertPos=ftell($file); // ftell will tell the position where the pointer moved, here is the new line after //Users. $newline = $lines_to_add; } else { $newline.=$line; // append existing data with new data of user } } fseek($file,$insertPos); // move pointer to the file position where we saved above fwrite($file, $newline); fclose($file);
  5. i am having a problem parsing the file that ebay returns for error codes $results = new SimpleXMLElement($responseXml); if ( $results->Errors != null ) foreach ($results->Errors as $key => $value) { $longMsg =$results->Errors->LongMessage; $shortMsg = $results->Errors->ShortMessage; $code = $results->Errors->ErrorCode; echo '<P>' . $code . ' : ' . str_replace( ">", ">", str_replace( "<", "<", $shortMsg ) ); if ( $longMsg != '' ) echo '<BR>' . str_replace( ">", ">", str_replace( "<", "<", $longMsg ) ); } echo "<br>"; } but i get the same entery repeated again. here is XML file SimpleXMLElement Object ( [Timestamp] => 2017-08-03T19:38:29.478Z [Ack] => Warning [Errors] => Array ( [0] => SimpleXMLElement Object ( [ShortMessage] => Unrecognized element <ActiveList.EntriesPerPage> in request message. [LongMessage] => The element <ActiveList.EntriesPerPage> was found in the input request message. This is not a declared element in the schema and will be ignored. [ErrorCode] => 21927 [SeverityCode] => Warning [ErrorParameters] => SimpleXMLElement Object ( [@attributes] => Array ( [ParamID] => 0 ) [Value] => ActiveList.EntriesPerPage ) [ErrorClassification] => RequestError ) [1] => SimpleXMLElement Object ( [ShortMessage] => Unrecognized element <ActiveList.PageNumber> in request message. [LongMessage] => The element <ActiveList.PageNumber> was found in the input request message. This is not a declared element in the schema and will be ignored. [ErrorCode] => 21927 [SeverityCode] => Warning [ErrorParameters] => SimpleXMLElement Object ( [@attributes] => Array ( [ParamID] => 0 ) [Value] => ActiveList.PageNumber ) [ErrorClassification] => RequestError ) )
  6. i have this code that enters the values of an array into my db foreach ($results->CategoryArray->Category as $key => $value) { $categories_ids = (int) $value->CategoryID; $CategoryName=$value->CategoryName; if(strcmp($first_name,$CategoryName) <0)$firstID=(int) $value->CategoryID; /// other codes to enter in db } echo $firstID i want to get the value of $categories_ids when the $CategoryName is alphabetically first. but it don't work. i always get the last value of the last one in the array.
  7. thanks. sometimes i get so involved with what i want to do that can't see what is right infront of me my apologise
  8. i didnot want to change the order confirmation page. i wanted to do this in the checkout success page which is just an information page as to what customer has bought. it comes after order confirmation page. the customer has not bought anything in order confirmation page so it would be stupid,regardless of legality issues. newbie doesn't mean stupid or illogical.
  9. the point is minimizing the situation. ebay sends you a notification when an item is sold. based on that notification the stock in the store is reduced. i want to reduce the stock on ebay when an item is sold. there is nothing illegal about that. i can just include the call on ebay in the file. but i want to do this in the background. i don't see what would be illegal about that either. it is totally logical. Instead of a cron doing it, it gets done as soon as a purchase is made. It is more accurate than some predetermined cron.
  10. i don't want to use cron for this, because it can create situations in between crons. if i do this when the purchase is made then there will be no risk of selling an outof stock item on ebay. i will also use ebay notification to adjust the quantity on the store. and finally a cron for the double check just incase. sorry about the confusion i have created
  11. this is an actual problem. here is the situation. customer on the website purchases a product. or multiple products. i will have the order that customer places on the last page presented to the customer. i want to communicate with ebay and change the quantity of the ebay items that are associated with this products at this time. there could be a few api calls. which i don't know how long it will take. i want this last page to load and don't have to wait for my api calls. and the api calls to be done in background
  12. thanks for your response. the first file invoves interaction with the visitor. it involves them completing their purchase in the online store. the second file is just communication with ebay. it is to change quantity of the listing based on the customer purchase. this file gets the order# from the first page before it actually loads. the order id is already created before this page so it is available at the beginning of this page. what i want to do is to not disturb the load time of the first page and start the ebay stuff in parallel. if there is a lock.is there a way to overcome this? is there a better way?
  13. am i correct to assume a- having an fopen of a second file does not effect the process of the primary page if i do not want to use result of the second file? b-opening the second page does not effect the load time of the first page c-if the visitor of the first page closes it the second process will continue to run.
×
×
  • 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.