Jump to content

newbie question regarding fopen


hungryfrank
Go to solution Solved by Jacques1,

Recommended Posts

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.

Edited by hungryfrank
Link to comment
Share on other sites

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?

...Probably? What second file? What primary page? What result?

 

b-opening the second page does not effect the load time of the first page

Probably. It's quite possible for one to affect the other - like if there are file locks involved, which can block one process (page) from executing while another has a lock.

 

c-if the visitor of the first page closes it the second process will continue to run.

Yes.
Link to comment
Share on other sites

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?

Edited by hungryfrank
Link to comment
Share on other sites

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

Edited by hungryfrank
Link to comment
Share on other sites

I think the reason why everybody is confused is because you keep talking about “files”, and files don't make a lot of sense in your context.

 

If you want to make API calls in the background, the easiest way is to create a cronjob which periodically scans the database for new orders, sends request to the ebay API and then marks the order so that it won't be processed again.

 

So the purchasing script doesn't communicate with ebay at all. It just stores the order. Then a separate script is triggered by the operating system every n seconds and takes care of the API calls.

Link to comment
Share on other sites

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

Edited by hungryfrank
Link to comment
Share on other sites

  • Solution

Your goals and ideas don't make any sense from a technical standpoint.

 

If you want to be sure that the eBay stock is updated during the purchase, there will be a delay for the user, even a potentially infinite delay. Network operations can be slow. Network operations can fail (yes, this happens). The only way would be to wait for the response indefinitely, and if there's any error, try again indefinitely. This is obviously unrealistic. And you may still end up selling out-of-stock items: What if somebody purchases the last item on eBay right after your user has clicked on the “order” button and before you make your API calls?

 

Note that this is also a legal question, so if you're a newbie, you definitely shouldn't invent your own processes. Either find a widely accepted standard solution. Or discuss this with an e-commerce expert. The shops I worked on had a non-binding order confirmation on the website and a separate binding confirmation sent by e-mail. But I'm not a lawyer, so I cannot tell you if this works in every country and in every context.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I understand that you find your own ideas “totally logical”, but as you already said, you're a newbie, so you're not qualified to make this statement. You clearly don't understand the technical background.

 

Updating the eBay stock is illegal? Who on earth said that? I said that an order confirmation is a legal matter. If you don't understand that either, you're in the wrong business.

 

Anyway, if you're not interested in advice, I wish you good luck with your “files”.

Link to comment
Share on other sites

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.

Edited by hungryfrank
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.