[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Inventory checking (revisited)
Seems like I posted my inventory system, but here it is again:
I have products with several variables:
option, size, color. Mostly this is for clothing where there are many
sizes and stuff.
Anyway, I concatonated those all together with the product code to form
an inventory code, so I have an inventory table that looks like this:
code qty
3111speciallogoredL 3
Then I put this code in my basket page:
[if data inventory::qty::[item-code][item-modifier size][item-modifier
color][item-modifier option] >= [item-quantity]]
<input type="text" name=[quantity-name] size=3
value="[item-quantity]">
[elsif data inventory::qty::"[item-code][item-modifier
size][item-modifier co
lor][item-modifier option]" > 0]
Sorry: we only have <input type="text" name=[quantity-name] size=3
value=[data base="inventory" field="qty" key="[item-code][item-modifier
size][item-modifier color][item-modifier option]"]><br>of that color,
option and size comibination.
/elsif]
[else]
None of that color, option and size combination left.
<input type="hidden" name=[quantity-name] value="0">
[/else]
[/if]
Then I used the data tag on the reciept page to decrement the inventory
amount. But, it really needed the new value. So, I used the perl tag to
calculate it.
[data base=inventory field=qty key=[item-code][item-modifier
size][item-modifier
color][item-modifier option] value="[perl interpolate=1]
my $curr = '[data base=inventory field=qty
key=[item-code][item-modifier
size][item-modifier color][item-modifier option]]';
my $quan = '[item-quantity]';
$curr =~ s/\D//g;
my $ret = $curr-$quan;
$ret;
[/perl]" op=decrement]
It was definately not an easy thing to do. And it is a little sketchy at
this time. But, it works and works well. Also, look up the table
exporting because it stores the modified inventory in a SQL table not in
the ascii file. Also make sure that inventory doesn't read from the
ascii file all the time. I think the NoCache or something like that in
the catalog.cfg will make it only read once (to create inventory.db) and
then keep going until you export. Seems to work well. Client is pleased
so far.
Trevor Sky Garside wrote:
>
> ****** message to minivend-users from Trevor Sky Garside <trevor@actaeon.net> ******
>
> About a month ago, I think I asked about a way to 'cap' orders, so that nobody could order more of an item than
> the store has in stock (without directly coming out and saying "we have n on stock").
>
> If there were any suggestions about this, I must have missed them. :(
>
> So, if anybody has any ideas, here's what I currently have:
>
> My inventory is kept in inventory.asc, with two columns: code and inv
> I do a lot to the .asc source of the file with outside perl scripts (so I need minivend to keep updating from the
> .asc source)
> There is a bit of javascript at the top of basket.html which checks for negative numbers in the quantity field.
> I have tried fiddling around with it without much success (I am not all that familiar with js).
>
> What I have considered doing is writing a script, such that calls to basket and check-out pages are pre-processed
> and checked for bad inventory entries, but I am unsure how to have the script get all the form variables back to
> minivend without making the user press a button.
>
> If anybody can help, or suggest a better way, or whatever, please let me know!
>
> Thanks!
> ---
> Trevor Garside
> Actaeon West, Inc.
> trevor@actaeon.net
>
> -
> To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list