Inventory API & Simple Stock Levels (Help Needed)

Posts: 64
Joined: 02/13/2008

Hey All

I'm having some trouble my clients asked me to change the stock level of an item when an order goes into pending status and not complete what code and file do I need to edit to make this possible I’ve scan through the whole inventory and stock contrib files but can't find where it changes the stock levels when the item status changes to complete status.

thanks inadvance to anyone that can help.

Posts: 4368
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I believe this is actually being done through a workflow configuration. You should be able to change it there in a few seconds and be done with it. Smiling

Posts: 64
Joined: 02/13/2008

Ryan what would i need to edit i haven't added anything to workflow-g also if i could add a condition to workflow to get it to knock stock off when checkout is completed or even edit the ubercart function on order to grab the sku and then kcnock the stock off.

Posts: 4368
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Maybe you're on an older version, but there's a configuration simply labeled "Decrement stock upon order submission" that you can edit or disable (for replacement) to your heart's content.

Posts: 822
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Inventory API and Simple Stock Levels doesn't use Workflow configurations for changing stock levels, so I think you must be using the core uc_stock module instead. With the Inventory API, stock levels are adjusted at order submission, not at order status change.

Check admin/build/modules and make sure you only have the core uc_stock enabled. Then you can use the uc_stock Workflow condition like Ryan said to specify when the stock gets decremented.

--

<tr>.

Posts: 4368
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Thanks for the save, TR. From the thread body, I just assumed it was the core stock module... reviewing the title before answering could've saved us some time. Sticking out tongue

Posts: 343
Joined: 10/16/2007

And as nice to know, just added 'Inventory and Simple Stock Levels' (Drupal 5.7 and Uber 1022 RC2 +) to a live site and it works fine. The site does not have any attributes so it works well.

TR indicted that Simple Stock will break if attributes are on a site. Yes, that I can confirm on a localhost test site.

Jim

Posts: 64
Joined: 02/13/2008

Hey all

Alaska is there no fix for uc_stock with attributes as I really need the stock control to work with attributes Sad

I get this problem when trying to use the workflow-ng rule for stock

http://www.ubercart.org/forum/support/4259/workflow_missing_actions

Could this be because I have attributes turned on?

Thanks for any help.

Posts: 343
Joined: 10/16/2007

Here is what TR has to say:

"Yes, Inventory & Simple Stock Levels DOES work with RC1 (I've tested it), with the known bug that products with text attributes break the code that prevents ordering more than you have in stock. (Text attributes were a feature added to Ubercart after the Inventory module was written, and Inventory has not been revised to take account of them.)

I do plan to release a replacement, but frankly the appearance of uc_stock cut the legs out from under the whole project. It's now going to be much harder to rework the Inventory API because uc_stock destroyed the whole architecture of API. Properly implementing an inventory solution will require uc_stock to be pulled apart, and will require the new uc_inventory to be in core along with uc_stock. Since I don't have permissions to mess with core, and I'm not party to the discussions as to what goes into core and what doesn't, I fear this is going to be a long and tedious process. Certainly it's not something that can happen before 1.0 is released.

I have mostly finished writing up a detailed plan for what I want to do. When I'm done writing I'll post it here in the forums to get feedback. If I get buy-in from the community I'll go ahead and implement it. If not, the current Inventory API works for my needs so I will stick to making some small bug fixes."

Jim

Posts: 822
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Alaska wrote:
Here is what TR has to say:
"Yes, Inventory & Simple Stock Levels DOES work with RC1 (I've tested it), with the known bug that products with text attributes break the code that prevents ordering more than you have in stock. (Text attributes were a feature added to Ubercart after the Inventory module was written, and Inventory has not been revised to take account of them.)"

Note the key point: only text attributes are a problem. If you have attributes with options, they should work just fine. It's only attributes without options where the user has to enter custom text that cause a problem.

--

<tr>.

Posts: 4
Joined: 03/25/2008

i'm a beginner on drupal and try this module. it solve part of my problem with success (block add to cart if there are not enough stuff) but create me a new one : i can t manage the stock anymore with the core value but with a new value hard to manage (can t use stock report anymore) and can t use anymore threshold system.

did i do a wrong install or did i miss something ?

thank you

Posts: 822
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

You're correct. I'm going to rewrite inventory to fix all these issues, but that won't happen right away.

--

<tr>.

Posts: 64
Joined: 02/13/2008

Sounds good TR

Inventory is such a good module shame it doesn’t work completely i’ve manage to write some custom code in workflow so now when a customer orders a product the stock get’s knocked off if anyone wants a copy of the code i’ll be happy to post it up.

Posts: 343
Joined: 10/16/2007

TR:

That is good news. Will look forward to the rewrite in a few months or so.

Jim

Posts: 17
Joined: 03/27/2008

hi mykz- i would love to get my hands on that code Laughing out loud

Posts: 64
Joined: 02/13/2008

Hey montanna

I’ll post the code snippet latter as I’m currently at work.

The code isn't too great so you might want to mess with it a little more to get it to fit your needs.

Posts: 17
Joined: 03/27/2008

cool. ill be on irc later

Posts: 57
Joined: 08/23/2007

Hi Mykz,

We would be interested in seeing your code too. Can you post it somewhere publicly?

Thanks,

Jim

--

(Drupal^Ubercart) * (Design^Development^Hosting) = Sundays Energy