Multiple stock edit

Contrib type: 
Module
Status: 
Uploaded for testing
Moderation: 
Not ready for moderation

Downloads

Latest version: 
5.x-1.06
Compatibility: 
Ubercart 1.x

Dependencies: uc_product, uc_stock

As an enhancement of uc_stock.module (and heavily based on it - thanks Ryan!) this module offers you a bulk edit page at http://your.domain.com/admin/store/multiedits/stockedit where you can:

  • Edit your stock and threshold numbers of 30 products plus - if there are some - Attributes with one save
  • To get stock numbers saved you have to check "active"! (If you uncheck it the values are deleted - like in uc_stock.module)
  • Publish / unpublish your products
  • Make them sticky
  • The displayed SKU has the link to the edit page
  • The Title has the link to the node
  • You can control which page shall be reloaded - last, the same or the next one
  • Attributes: the main sku is not editable anymore. Instead is calculated how much items have all attributes together.
  • Product Kits: Same issue like above, just the lowest number of the sub products is taken for stock and the highest for threshold

Version 5.x-1.06
Minor bugfix regarding Product Kits and user access

Version 5.x-1.05

  • Bug fixes: eliminated dependencies on uc_product_kit and uc_attribute (Thanks to TR and frost)
  • Deleted development messages - sorry for this one.
  • Added Debug functionality (optional): Check for orphand SKUs in stocks, delete them or check for wrong NIDs (might be an issue with i18n). This is still under development, but already useful and working. (See Zombie thread)
  • Added Help page, link is on admin/store/multiedits/stockedit (some native speaker could improve the descriptions)
Related threads: 

PreviewAttachmentSize
uc_stockedit-5.x-1.05.tar.gz7.89 KB
uc_stockedit-5.x-1.06.tar.gz7.84 KB
nastov's picture
Offline
Joined: 08/29/2008
Juice: 2
Just installed it

Hi Al,

I just installed this module, and I am impressed!
It's all there, every option I need, very elegantly done!
I'll keep you posted about any issues, but for now, everything seems to be working just fine.

Thank you so much for doing this!

Dime Nastov
__
It takes as much time to wish as it does to plan...

It takes as much time to wish as it does to plan...

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3458
Re: Multiple stock edit

Testing version 1.0 ... Two problems so far:

1) Line 216 $kit_test = db_query(); "Missing argument 1 for db_query()"
2) You never check to see whether the Product Kits module is installed. When it isn't, there are a lot of DB errors since you're making queries against uc_product_kits regardless.

Have you tested this code with product classes?

Can you remove the drupal_set_message() calls, or maybe add "debug" checkbox to the admin menu to turn these on only when wanted?

<tr>.
Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Re: Multiple stock edit

@Dime Nastov: nice to hear this

@TR: Thanks for the Bug report, I fix it ASAP. Not checking for installed Product Kit is a clear miss.

Classes I use all the time, no issues there.

The messages... in a normal environment they could be deleted at all as everything is working just fine. But if somebody pushes Attributes to the limits (what I don't do) it might be useful. So I will switch them off by default and add a checkbox if somebody needs them.

My office is still a big mess after Dcon, so please be patient. The update should be done within this week.

sphoenixee's picture
Offline
Joined: 06/29/2008
Juice: 16
Very nice. Two things in

Very nice.

Two things in addition to the product kit issue and line 216 noted above:
1) without uc_attributes installed, the module just dies.
2) i am getting these errors:

* warning: Invalid argument supplied for foreach() in /home/lushlila/public_html/drupal-5.7/sites/all/modules/uc_stockedit/uc_stockedit.module on line 363.
* warning: Invalid argument supplied for foreach() in /home/lushlila/public_html/drupal-5.7/sites/all/modules/uc_stockedit/uc_stockedit.module on line 392.

note, i do not have product classes. i have no attributes or product kits either if they make a difference.

Thanks for the great software. Hopefully these can get resolved in next release.

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Update 1.05

Thanks for the Bug reports, they should be all fixed now.

Please take a closer look on the new debug functionality, which should solve the Zombie thread. This module is still under development and touches a couple of questions which are about playing together with other modules related to stock, e.g. Product Kit & Attribute handling needs testing with related contribs. Also i18n integration should be once more discussed.

murz@drupal.org's picture
Offline
Joined: 02/07/2008
Juice: 37
Wrong access permissions

Module is good and usefull for me. But I use site with user not a user1 and have no permission to access this module page. Because module sets wrong permissions:
<? 'access' => user_access('edit products'), ?>
must be, i think, like in uc_stock module:
<? 'access' => user_access('administer products'), ?>

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Wrong access permissions

Dunno why I changed it, I will fix it in the next update.

BTW: Some native English speaker out there who would improve the help text for me?

TIA,

Al

hedgehog's picture
Offline
Joined: 10/07/2008
Juice: 14
Products with attributes

Hi, this is a great idea!

Could you also make this work for product classes with attributes? I can't edit stock or threshold numbers for them at the moment.

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Products with attributes

I told the help text needs some improvements Eye-wink

Both product classes as well as Attributes are supported. But there are conditions: If there are Attributes, the parent SKU is not editable anymore as their values are summed up by the values set for the children.

Additional you have to setup an Alternate SKU on the product's Adjustment page, without unique SKU the Attributes are ignored.

hedgehog's picture
Offline
Joined: 10/07/2008
Juice: 14
Re: Re: Products with attributes

Hi, thanks for explaining, I think I understand what you mean.

I have products with attributes but they don't have any alternate SKUs on the Adjustment page. I don't want to give them any adjustments and am happy for the attributes to be ignored in terms of stock keeping.

I would just like to be able to edit the stock levels for the parent SKUs but at the moment I can't do that. In fact, when I clicked the "Save Changes" button, it changed all my products with attributes to have 0 stock!

I don't know how hard it would be but if you could develop this module so that it is possible to edit the parent SKU, that would be great for my needs and I imagine other people might also have attributes that don't have adjustment SKUs.

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Re: Re: Products with attributes

I understand, but it will take some time until I come to it.

CV3Back's picture
Offline
Joined: 08/21/2008
Juice: 42
Select all

Would it be possible to add a select "Select All" option for the check boxes? I have a lot of products that need to be updated (several hundred).

Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Batteries as an attribute, same SKU -> editable?

Hi,

I ´m also interested in the feature from hedgehog.
If have some products with additional batteries as an attribute. I don´t need to know how many batteries are sold.
But I want to edit the product´s stock in this mass edit page.

With or without batteries, it has the same SKU.

Jurgen
www.iGadgets.be

Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Manufacturer

Hi,

I ´m also looking to first select a manufacturer, and then do a mass update of the stock.
Thus, I want a filtering on manufacturer. When a new delivery takes place of a manufacturer, I think it is easy to update all the items of the manufacturer in one screen.

Best Regards,

Jurgen

Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Load -> new product -> update

Hi,

First I load the stockedit-page and then add a new SKU or product to Ubercart, then I update the stockedit-page. Wrong products has been updated. I thought this was happened, not sure.

I found it strange because, the code looks right for me.
db_query("UPDATE {uc_product_stock} SET active = %d, stock = %d, threshold = %d, ordercount = %d WHERE sku = '%s'", $form_values['active_'. $index], $form_values['stock_'. $index], $form_values['threshold_'. $index], $form_values['ordercount_'. $index], $model);

If somebody can clean our minds...

stilln's picture
Offline
Joined: 02/25/2009
Juice: 105
No items show

Hi I having a problem. I love the system but it seems that when I get to page 29 it stops showing any item at all. the page load but there no items listed and page 28 was only on later "F" when I lick the last page button from page number 1 it goes to page 92 with the same effect not items, the headers show up but no items. I was also wondering if these is a way to add and alphabetic search so we could just get the items that start with the letter "L" or the sku starts with the letter "L" that would be amazing. thank!

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: No items show

@Jurgen8e: Your request for taxonomy filters makes sense, I'll try to implement it in the release for UC2.x. The "product identification" works through the SKU, so changes during you use the stock editor isn't a good idea. You should reload the stockedit page if you meanwhile added or changed products or SKUs.

@stilln: Need more information. Which other stock related contribs do you use? Attributes? Anyway I am pretty sure that all products are shown. What might confuse you is that ordering is still by SKU only. The UC2.x release might get more flexible.

If all products are accessible you can easily control by going to /products and override this view. Change the page view to display 30 products per page, under Fields add "Product: SKU", Sort Criteria also add "Product: SKU" and move it to the top. Save and go to the last page. You should see that the list ends with the same product like stockedit.

stilln's picture
Offline
Joined: 02/25/2009
Juice: 105
Re: Re: No items show

I'm using Simple Stock Levels 1.5 and Stock stub 1.0

fehin's picture
Offline
Joined: 12/17/2008
Juice: 154
Re: Multiple stock edit

I'm getting the warning message below.

# warning: in_array() [function.in-array]: Wrong datatype for second argument in /uc_stockedit/uc_stockedit.module on line 200.
# warning: in_array() [function.in-array]: Wrong datatype for second argument in /uc_stockedit/uc_stockedit.module on line 173.
# warning: in_array() [function.in-array]: Wrong datatype for second argument in /uc_stockedit/uc_stockedit.module on line 176.

fehin's picture
Offline
Joined: 12/17/2008
Juice: 154
Re: Multiple stock edit

I'm wondering if there is a way to make this show only products owned by the user. I use the marketplace module and this module would be very beneficial to my sellers. I changed the access value to "edit own products" and it now shows under every seller's account but it shows all products, even those not owned by the seller. Is there a way to alter this? Thanks in advance for all tips.

jazzdrive3's picture
Offline
Joined: 03/29/2009
Juice: 221
Re: Multiple stock edit

Doesn't seem to work if you keep stock at zero and just check active. I have an item with 4 different unique SKU's. I set one of them to active, and it only makes active the parent SKU on the mass edit page. And then it's not really even active. You edit the product individually, and it hasn't changed anything.

This scenario comes up when you just when you want to prevent selling an item, but want to keep the product page there. Checking active with a stock level of zero is a good way to do this.

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Re: Multiple stock edit

@all: Thanks for the bug reports and the inspirations, I'll start within a couple of days on a new release.

stilln's picture
Offline
Joined: 02/25/2009
Juice: 105
something to think about.

you should add a search section so you cab search by sku or names. So if i have 10 starwars movies with diffrent names at the end (example STARWARS CLONE WARS, STARWARS RETURN OF THE JEDI, STARWARS, STARWARS REVENGE OF THE SITH ect....) and i type starwars it will list anything that has starwars in it, so this way we can find the items we want to edit faster. Also I'm still having that problem where after I think page 30 no products show up just empyt listings, i mean the border and everything is there but the list of products and the buttons at the bottom are not.

TomIslander's picture
Offline
Bug Finder
Joined: 03/22/2008
Juice: 73
D6UC2?

Has anyone ported this to Drupal 6, Ubercart 2 and might want to share?
TIA
Tom

Tom Szigeti

ludde_t's picture
Offline
Joined: 07/29/2009
Juice: 2
DR6 port

Attached. Should be working OK, only done minor testing though.

AttachmentSize
uc_stockeditDR6.tar.gz 8.48 KB
klavsk's picture
Offline
Joined: 02/17/2009
Juice: 131
Small changes.

Just wanted to add a comment. The DR6 edition seems to work fine - but I had to change 2 things:

1) I had to remove all occurences (3) of check_plain on sku/model vars - as I have sku's with special characters.. such as "I'm with noob" - the' is the problem Smiling
2) if you need to show items that does not currently have a stock-entry (to enable stock checking on many items) you could do this:
change line 166 to:
SELECT pr.nid,active,n.status as status,n.sticky as sticky,pr.model as sku,n.title as title,n.type as type,stock,threshold FROM {uc_products} as pr LEFT JOIN {uc_product_stock} as s ON pr.nid = s.nid LEFT JOIN {node} as n ON pr.nid = n.nid WHERE EXISTS (SELECT * FROM uc_product_stock as ups where n.nid = ups.nid)

(I removed the where exists clause).
This works - and it then shows all your products.

If someone knows how to add a "checkbox" to select "show all - and not just the items with a current stock level" that would be "pretty" Smiling

alexd73's picture
Offline
Joined: 08/12/2010
Juice: 33
Re: Small changes.

A small correction in the SQL script ("{uc_product_stock}" instead "uc_product_stock" In the last entry)
SELECT pr.nid,active,n.status as status,n.sticky as sticky,pr.model as sku,n.title as title,n.type as type,stock,threshold FROM {uc_products} as pr LEFT JOIN {uc_product_stock} as s ON pr.nid = s.nid LEFT JOIN {node} as n ON pr.nid = n.nid WHERE EXISTS (SELECT * FROM {uc_product_stock} as ups where n.nid = ups.nid)