close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart solution to inventory control

Thread began 7/02/2009 10:01 am by info374483 | Last modified 7/06/2009 10:53 am by Ray Borduin | 3635 views | 8 replies |

info374483

eCart solution to inventory control

Hi Ray.....I have been searching the forums for a solution on creating inventory control with either DataAssist or eCart. I really need a solution to this and I was wondering if you knew of a tutorial on this subject or knew of a programmer who could integrate inventory control for me? This is for a chain of tire companies who will sell tires by mfg, brand, and size and I really need some help on this subject. Powerstore is not an option because I see that they only integrate Paypal Payments, Standard or Pro and I need multiple gateway providers and shipping is only USPS and I will need UPS. I know I would use both DataAssist and eCart for this to happen and I have purchased the suite of extensions. Any help would be greatly appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

In the next couple of weeks we will be coming out with a powerstore version that includes inventory control and options that should work for you.

It will also have support for other shipping and payment providers. You can use that and build whatever additional functionality you would need.

Sign in to reply to this post
Did this help? Tips are appreciated...

info374483

I dont think that the customer will have patience for the new release. Is there a programmer that you know of that could place the extra code in for me who would want to make some extra money?

Sign in to reply to this post

CraigRBeta Tester

Inventory control for eCart4

It's been a few weeks since I did this, but I'm sure I can pick it up again.

I did this for paypal standard payments, but I think the same principles would apply whatever payment gateway is used.

What I can certainly do is give you a few pointers to help you achieve your objective. (Using php/mysql)

My Method...

To ensure that the stock level was updated ONLY when the order was completed and successful payment made, I run the update query on the stock table on the paypal IPN page.

In a nutshell, on my IPN page, there is a section which checks for a valid IPN, which then adds rows to the paypal payment and paypal cart tables.

In this section I run two additional queries...

the first loops through the cart items and sets the new stock qty for each item
the second updates the order status on my orders table.

In this instance, I don't need to worry about colours and sizes, so stock qty is held in my items table.
For your example, you would be updating a stock table

the query I used to update the inventory was something like this...

<?php

// initialize flag
$OK = false;
// create database connection
$conn = dbConnect('admin');

// Now update stock level in tblitem

for ($i = 1; $i <= $num_cart_items; $i++) {
$itemnumber = "item_number".$i;
$quantity = "quantity".$i;

$sqlstock = 'UPDATE tblitem SET StockQty = StockQty - ? WHERE ItemID = ?' ;


// initialize prepared statement
$stmt = $conn->stmt_init();
if ($stmt->prepare($sqlstock)) {
// bind parameters and execute statment
//$var1 = 'StockQty - '.$_POST[$quantity];
//$var2 = $_POST[$itemnumber];

$var1= $_POST[$quantity];
$var2 = $_POST[$itemnumber];



$stmt->bind_param('ii', $var1, $var2);
$OK = $stmt->execute();
}
}
// redirect if successful or display error
if ($OK) {
$result = ' Stock Level Updated ';
$result = nl2br($result);
}
else {
$result = $stmt->error;
}

?>

This uses the unique itemID to update the stock qty, you would need to change the parameters to filter for colour and size

I hope this helps.

Regards

Craig

Sign in to reply to this post

2hollowtree319915

Inventory control for eCart4

Originally Said By: info374483
  Hi Ray.....I have been searching the forums for a solution on creating inventory control with either DataAssist or eCart. I really need a solution to this and I was wondering if you knew of a tutorial on this subject or knew of a programmer who could integrate inventory control for me? This is for a chain of tire companies who will sell tires by mfg, brand, and size and I really need some help on this subject. Powerstore is not an option because I see that they only integrate Paypal Payments, Standard or Pro and I need multiple gateway providers and shipping is only USPS and I will need UPS. I know I would use both DataAssist and eCart for this to happen and I have purchased the suite of extensions. Any help would be greatly appreciated.  



Hi, Before I purchased the Web Developement suite last December I rang the Webassist Sales and was assured that there was inventory control in the package. I have yet to find it! Now you seem to have solved the question for me.
I am a self employed knitwear designer/maker therefore do not hold a large stock of any one garment.
So without Inventory control on my website I have wasted my time and money trying to get this package to work as expected.

Sign in to reply to this post

CraigRBeta Tester

The method I posted may not be the only solution, (if someone has other ideas i'll be happy to explore them), but it works for me.

Apparently Powerstore employs some sort of inventory control, but I can't comment on it as I don't have it.

Sign in to reply to this post

Ray BorduinWebAssist

Inventory control is included in the powerstore.

The way the powerstore does inventory is this:

1) You enter the inventory in stock when you insert or update the product. It stores the data/time when you updated in a separate field.

2) In the normal checkout process your orders and details are inserted into the database.

3) In the catalog we use a complex SQL statement to automatically subtract the number of products sold since the date when it was last updated by comparing the products update date and the order date and subtracting as many as appear in the order details.

As you can see inventory control in this case doesn't even really involve the cart. It just involves writing a complex sql statement and taking advantage of a stock field stored in the products admin back end.

Sign in to reply to this post
Did this help? Tips are appreciated...

CraigRBeta Tester

Ray, can I ask what happens in Powerstore if the order isn't processed successfully ?

One reason I went for the approach I did was that the paypal payment has to be successful before the stock level update query is triggered.

If there was a reliable way of doing it without the need for postback, I would be happy to investigate it with ecart.

thanks

Sign in to reply to this post

Ray BorduinWebAssist

The powerstore currently only supports advanced payments for paypal and other local checkout solutions, which doesn't do the insert until after the transaction was successful.

We probably will add payments standard to powerstore soon, since so many people have asked for it. We would use IPN in that case so that orders were only inserted after a successful transaction. IPN is paypal's solution for making sure your database is only updated upon successful transaction.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...