8 replies [Last post]
stoke's picture
Offline
Joined: 02/24/2009
Juice: 11
Was this information Helpful?

I am busy modifying the uc_product module to include the stock fields inside that table.
Fields:
level :- The current available number of product in stock.
threshold :- The level below which email notification are sent.
nosalestocklevel :- The stock-level at which stock is no longer sold.
autodecrementstock :- Switch to automatically decrement stock levels as product is purchased.

I struggled with the existing stock handling modules and gave up on the uc_stock module up after realising that adding a simple stock-level to a view as a "column" is almost impossible, and would be extremely inefficient.

Anyways, my question is this:

How do I best create this modified module that can be published for everyone to use?

Do I create a branch for the sub-component uc_product, with it's own version number and stuff.

I did try to create a module that is close to uc_product called (say) uc_stockprod that somehow overrides uc_product almost entirely, but could not figure out how to override the functions in uc_product.

Please let me know what the appropriate technique is to "override" uc_product (A mandatory core component of ubercart), I will then research that way further.

chourmovs's picture
Offline
Joined: 02/22/2009
Juice: 52
Re: uc_product to include stock

i wish i could help you !!
I'm very interested by this and i can't understand it has not been implemented in the core of the cart...
I'll try to help

What version of UC did you modify ?
Can i test it ?

stoke's picture
Offline
Joined: 02/24/2009
Juice: 11
Re: Re: uc_product to include stock

I think it would be better if I do it properly before I release it for other to play with. The way it works now you have to actually replace your existing uc_product module with this one, and that will break your upgrade path, and you will keep getting emails that you have a module that can be upgraded.

chourmovs's picture
Offline
Joined: 02/22/2009
Juice: 52
Re: Re: Re: uc_product to include stock

I understand but, you know, i can't put my site in "production" cause i really need this stock managment
So if you need a beta (even alpha) tester.... let me know Eye-wink

stoke's picture
Offline
Joined: 02/24/2009
Juice: 11
Re: Re: Re: Re: uc_product to include stock

You bunch of unhelpful buggers.
I have wasted 3 weeks on this, learning drupal and the way it works, trying valiantly to work out how to add a different type of product into the system, and, EVENTUALLY, I stumble upon product classes.

Now, why on earth did nobody even throw me a tiny hint?
Grrrrrrrrrrr!

Anyways, I will have a new product class that includes stock in it's native processing soon.

stoke's picture
Offline
Joined: 02/24/2009
Juice: 11
Bleugh

Okay, nevermind, fields dynamically added as CCK fields do not show up as view selectable fields, meaning that you cannot disply these CCK stock fields in the views.
Sad.

Back to the drawing board (with apologies).

EDIT : Hey ... there they are in content ... all innocent looking and stuff!

Methinks i'll be more careful before my next post.

Shocked

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Bleugh

lol @ last two posts. Yeah, the whole Node vs. Content thing in Views 2 threw me for a loop at first, too. Glad you got it figured out! Also, you might wanna keep the Creating Products guide for 1.x handy, as it's mostly applicable to 2.x and explains things like product classes and other features of Ubercart.

stoke's picture
Offline
Joined: 02/24/2009
Juice: 11
Re: Re: Bleugh

Thanks Ryan. I did run through that initially, but will go through it with a fine tooth comb later.
I am quite certain that I was not paying attention properly the last time.
Smiling

davidw's picture
Offline
Joined: 05/27/2009
Juice: 95
Re: Bleugh

I have been trying to get this to work for 2 days and just came across this post. Can someone elaborate just a little bit?

I see where the CCK fields are in the content section of the view. My problem is I don't know how to add this field in my product class!

A node reference? If so, I have created the field in CCK, and I see that I can reference content types and even use a view to reference nodes, but I can't seem to get it working.