Welcome ! edit account | X2 Profile: No X2 profile found | Site Theme: christmas13 | Account: Sign Up (FREE) User Login

Suggestion for development to make the portal X2 more portable over browsers

1 reply [Last post]
davymuncher's picture
Offline
NeoMallers Elite
Joined: 10/08/2009

Hey all,

(Background: this is not necessary to understand the suggestion.)
Lately I've been getting into the swing of stocking my shop again, and getting used to the online portal. I used to use the downloadable portal several years ago heavily, but now I mostly work the portal X2 because I'm jumping between mobile and my laptop all the time.

Sometimes when I go to copy my shop front, I've seen that certain items are marked as out of stock even though they're in stock. I've also noted that other users (Like in http://neomallers.com/node/4235 ) sometimes have some issues with the shop front.

Though I've found it always reliable to paste my shop front on mobile, so I never paid much attention.
One of the features I really liked was the button to emulate sales for items that are too cheap to show up in the sales history because they sell for under 1k, so I had been manually filling out the sales history so that I could track my sales on cheaper items, and I've found that in my shop, books under 1k are some of the top sellers.

Tired of the slow, individual book tracking one by one as they sell to add into sales history, I finally decided to write myself a little tool into which I paste my shop front, and it compares my stock to my database, and generates a sales history with a dummy username that can the be copy and pasted into the neomallers sales history to track my sales of under 1k items. By the way, that isn't the development suggestion I was talking about, but if you'd like the code for that, I'd be more than happy to share, since that'd add a tool to the online portal that I'd like a lot.

Anyways, I tried it and it worked when I had firefox open, but then I tried it with Edge (don't ask why), and everything started coming out wrong. After some checking, I realized what was happening. I was counting blocks of 4 lines, where the lines were Description, Title, In Stock, and Price, but Edge doesn't copy descriptions when you copy the shop front, so it was passing in 3 lines instead of 4 for every item.

I fixed it, then got to thinking about the post I cited above that had an issue when the object description had a new line character, I thought "Hey, maybe the online portal does the same thing of relying on the order Description/Title/Stock/Price, and that might be why the shop front posting is unreliable in certain browsers."

So if that's the case, this logic I used in my loop going over the shop front text might work to get rid of that http://neomallers.com/node/4235 problems and make the shop front poster more robust:

(The actual suggestion, the background has ended)

In the code that reads the shop front text, it could be edited to follow this logic (pseudocode because I don't know what language the portal is in):

Instanciate prev_line as a string
Instanciate item database idb
Instanciate string title
Instanciate integers in_stock, price
For line in shop_front_text,
{
If line does not contain "in stock":
prev_line = line
Else if line contains "in stock":
Title = prev_line // If we're at the in stock line, then the previous line was the title.
in_stock = parse the integer at start of line
Move onto next line
price = parse the integer part of the next line, ignoring commas
Add Item(Title,in_stock,price) to item database
End if
}

That way, you can ignore the item description and just focus on the line preceding and following the in stock line, which will always be the item's title and price.

Just an idea, hope it helps!

Good Idea: Feeding stray kittens in the park.
Bad Idea: Feeding stray kittens in the park... to a bear.

saudor's picture
Offline
Site Admin
Joined: 10/06/2007

Hey. Yeah the emulate sales feature shouldnt be too bad to put in i think. The shop front sync thing already checks against the item database for updates in a way that makes it very easy to put that feature in (it was originally set up in that way to reduce the number of queries against the server) The plan at the time was to have it check against the item DB and then redirect the user to the sales history page with the sales entries pre-filled using username "EMULATEDSALES" or something like that.

My time gets a bit more free in early december so that's when it'll likely happen. Maybe earlier depending on how much work actually needs to be done.

As for the portal X2 and the new shop stock. im surprised it's actually breaking. Maybe it was the original portal but i remember writing a check that looked for the instock thing in the manner you described. I need to look into it. It was necessary even under the old neopets since Internet explorer and chrome/firefox handled these things differently.

-----------------------------
Protect your account
http://www.neopets.com/~punchback_bob
CG information & more

NeoMallers is made possible through non-obtrusive google ads.
Please consider whitelisting your adblockers to help with costs. Thank you!