Update this module to Drupal 7.x and Ubercart 3.0

I've attached a series of patches that update the module. These patches currently apply to uc_out_of_stock 6.x-1.4. I'm working on patches to the dev branch.

There are 4 patches - a patch that applies to each individual file, and one large monolithic patch that makes changes to all the necessary files.

WorksForMe(TM), YMMV.

For those who need instructions:

cd [YOUR_DRUPAL_ROOT]/sites/all/modules/uc_out_of_stock
patch -p1 -b < [path/to/file.patch]

Comments

djflux’s picture

BTW, these patches were tested with Ubercart 3.0-beta3.

djflux’s picture

Status: Active » Patch (to be ported)
djflux’s picture

Version: 6.x-1.x-dev » 6.x-1.4
djflux’s picture

Attaching patches to 6.x-1.x-dev to move to Drupal 7.x and Ubercart 3.0

Again, these patches are tested against Ubercart 3.0-beta3 and Drupal 7.2 - YMMV

djflux’s picture

Add the performance patch included at:

http://drupal.org/node/514170#comment-4179982

Again, I'm including separate patches as well as 2 monolithic patches:

- The separate patches assume that the upgrade patches have already been applied
- The first monolithic patch includes just the performance enhancements. Apply this patch AFTER applying the upgrade patches.
- The second monolithic patch has all of the changes from 6.x-dev to the 7.x version with the performance changes included.

If you're trying to upgrade from 6.x-dev directly and want to include the performance updates use the "monolithic_with_514170" patch.

I hope I didn't screw something up :)

Enjoy,
Flux.

fineartist99’s picture

StatusFileSize
new29.59 KB

Hello, I'm trying to get this working on my site and was unable to install this module http://drupal.org/project/uc_out_of_stock directly thorugh drupal interface so I uploaded it manually where it needed to go. Now I see (I attached a screen grab) in the modules listing so now I need to get your patches in there. I'm working with Drupal 7.0 and have never done a patch before.

I see you say

For those who need instructions:

cd [YOUR_DRUPAL_ROOT]/sites/all/modules/uc_out_of_stock
patch -p1 -b < [path/to/file.patch]

But don't understand what really needs to get done(I know this needs to get done in terminal but have never really used terminal on my Mac before). I downloaded the 4 patches that are at the most top of this post.

Attachment Size
uc_out_of_stock-6.x-1.4_to_7.x-monolithic.patch 5.25 KB
uc_out_of_stock.info-6.x-1.4_to_7.x.patch 644 bytes
uc_out_of_stock.js-6.x-1.4_to_7.x.patch 1.57 KB
uc_out_of_stock.module-6.x-1.4_to_7.x.patch 3.05 KB

My direct URL is http://www.partypalaceplus.com/parts/

what am I supposed to do? Is there anything else I need to do with the uc_out_of_stock module?

Thanks in advanced.

Oh, and BTM I'm gonna just try to use terminal now and will let you know if I succeed.

fineartist99’s picture

Priority: Normal » Major

how would I connect to my server through terminal??? AS I said above, I never have used terminal before. Any help would be greatly appreciated, thanks.

nelslynn’s picture

Fatal error: Call to undefined function filter_form() in /home/mysite/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module on line 212

When clicking "Out of Stock Settings" from the store > config

using patch uc_out_of_stock-6.x-dev_to_7.x-monolithic_with_514170_perf2.patch

Poieo’s picture

Same error for me as #8.

Poieo’s picture

Looks like filter_format_default constant is no longer available: http://drupal.org/node/224333#default-text-formats

But, I haven't figured out how to replace it yet.

@djflux - How did you get this working using an undefined variable?

Poieo’s picture

Another error at checkout:

Fatal error: Call to undefined function db_result() in /data/disk/o1/static/custom/ubercart-7.2/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module on line 78

Thanks for all your work on this.

fineartist99’s picture

WHEN WILL THIS BE PORTED TO DRUPAL 7 INSTEAD OF BEING A FRIGEN PATCH????? And is this working with the patches?

Poieo’s picture

@fineartist99: IT WILL PROBABLY GET COMMITTED SOONER IF WE ALL START WRITING IN CAPS!!!!!

The maintainer hasn't made a commit to any project since April, so they are either very busy with something else or have moved on. Either way, someone will probably have to step up as a co-maintainer to get it committed when it works. It does not work correctly with the patches provided in this issue.

If you want to help, you can either troubleshoot the issue and provide a fix. Or, I'm sure djflux would welcome a contribution to continue his work. If neither of those suit you, please stop littering the issue que with worthless posts.

fineartist99’s picture

Just trying to figure out how to get this working in Drupal 7.0, comments are never worthless and thank you for the input.

nelslynn’s picture

Just reporting another issue...

When stock is zero, all works okay, a user cannot add-to-cart. But when there is stock of a product (or SKU), and qty added to cart is more than stock, a user is still allowed you to add-to-cart, and checkout fine, without an "Stock Unavailable" message. Unlike the Drupal 6 version where you can't add to cart if you're trying to add more than is available.

Not sure if this is caused by the #8 error or not.

EDIT: Found another issue that makes this module unusable. When enabled, anytime another ajax function triggers (ie: changing a payment method at checkout), this error pops up:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText: 
Fatal error:  Call to undefined function db_result() in /home/mysite/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module on line 79

and then this message when browsing to another page, after the above error:

Notice: Use of undefined constant FILTER_FORMAT_DEFAULT - assumed 'FILTER_FORMAT_DEFAULT' in uc_out_of_stock_settings() (line 196 of /home/mysite/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
petarb’s picture

subscribe

mandreato’s picture

Subscribe

restyler’s picture

subscribing

Quarantine’s picture

Subscribing as well.

petarb’s picture

I can't do patches. :( I've tried manually doing them, but I always feel I'm going to make a mistake and there's no way to check, even if it 'works' whether the patching has been done correctly, without the requisite, software/setup, its a little confusing to me.

So... can anyone just post a 'patched' version (ie, patch applied) ?

I would be happy to test afterwards!

Quarantine’s picture

I echo PetarB's request - is this possible?

fineartist99’s picture

I'm waiting for the new module. I wish I could contribute but I'm no pro at developing modules.

restyler’s picture

StatusFileSize
new14.11 KB

here is the compiled version with LOTS of new fixes

fineartist99’s picture

Is that new version working in Drupal 7 without any problems?

restyler’s picture

it works for me :)
http://papa.iagency.ru/node/3 - try to select Размер: L, Рост: 120-130см

there certainly can be some smaller bugs I am not aware of.

fineartist99’s picture

Status: Patch (to be ported) » Needs work
StatusFileSize
new26.42 KB

Hey there, I uploaded your new module and enabled it. I went to add a product to my cart and I received this error (see attachment)

I was able to add a product to my cart but after receiving that error I did not continue further with the checkout process.

What could I do to fix that error?

I'd like to add that the product that I added to the cart had a stock level of only one. I don't know why that error occurred, do you have any idea anyone?

restyler’s picture

StatusFileSize
new14.12 KB

notices were fixed in this version.

fineartist99’s picture

StatusFileSize
new69.83 KB

OK, it's working pretty good. Only got 1 issue. Let me explain everything that's happening so you understand EVERYTHING...

When I add a product that I only set as 1 in stock it's fine. If I go back to that product page and try to add it again this module works perfectly. You/the end user is not allowed to add that product to the cart and you don't even leave that product page, you/the end user gets a message that says "We're sorry. We have now only 1 unit of the product nothing sample left in stock"

All is good, and the module is working perfectly besides one thing.

I did further testing and I went to my shopping cart and tried to up the number of the quantity to 2 instead of 1 of this product that I only have 1 in stock. See screen grab of the error message that I got and let me know what to do now. Thank you and thank you for working on this.

emagray’s picture

Has this module been making progress? I just installed drupal 7 and ubercart to my website and this module would help prevent some major mistakes from happening.

Thank you to everyone who is working on this =)

fineartist99’s picture

It does work, but with my #28 comment I still have not received a fix. But it does work and much thanks for everyone that contributed!

hanoii’s picture

Maintainer reporting here. I am resuming some work on this module. It has been working stable enough for a lot of sites and it's currently being used in 2k sites, so yes, I was a bit busy and had to prioritize other work. Eventhough I might not commit I am still very active with other modules and patches so I apologize for not being responsive but try to appreciate that every issue is a show stopper for somebody, so it's not easy to be on top of everything and make everybody happy.

Said this..

Can the main contributors to this issue resume a bit of what's going on with what's being submitted to this issue. #23 says there's a LOT of fixes, what are those fixes?

It's important, in order for me to review things, to keep things and issues as isolate as possible.

Also, would any of the people there would want to co-maintain the module and be in charge, for now, of the D7 version? My co-maintainer I don't mean just committing what they have, but actually working, testing, supporting and trying to keep a line of coherence between both the D6 and D7 version so they remain close to each other.

If D7 has to have new features because D6 can't, I'd like to know about those as well. But without going to far away from this issue, let's hear on what's the current status of this.

fineartist99’s picture

Again - It does work, but with my #28 comment I still have not received a fix. But it does work and much thanks for everyone that contributed!

conkdg’s picture

Subscribe

restyler’s picture

#23 says there's a LOT of fixes, what are those fixes?

well, it's easy to create diff by taking latest .dev,
applying uc_out_of_stock-6.x-dev_to_7.x-monolithic_with_514170_perf2.patch from #5 and then
using diff tool against my version in #27.
unfortunately I don't have time to apply fixes to 7.x branch of the module anymore, but #28 is just a small problem with notice, the matter of adding another condition, I think.

hanoii’s picture

Ok with all the diff instructions, I just wanted if you can ease that bit for me and letting me know what has been fixed, but OK.

If anybody is up for co-maintaining the D7 let me know, I am doing quite a bunch of fixes to the 6.x version so ideally I want that version to be ported to D7 and take from here whatever worth taking.

I don't have plans for now to work on D7, but I will probably do soon. Until then, I leave this issue for further discussions.

fineartist99’s picture

any luck with adding that condition or letting us know where and what needs to be added?

hanoii’s picture

I don't think any of the patches here will apply to the latest dev as I have recently changed quite a few things there. Even taking the zip file and diffing it will be time consuming and what this module needs as a start is a straight port to D7 from the current code base in order to allow me to maybe do a quick review. I should think the patch is straightforward but I don't have time to make it right now.

As I asked before, if someone is willing to either submit an updated straightforward patch of the port to D7 and so some tests, I will review it and try to release a new version, even better if he/she has time and waint to commit to support on maintain that branch. Other than that, manually going through what's contributed here will take the same amount of time as porting the module myself, which although I really want to do it, I don't have the time to do it, and then of course, provide proper support to it.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new24.58 KB

Here's a clean patch against the 6.x-2.x version which was built with the zip @ #27 and with some minor modifications to the way the javascript/css is added to be more inline with the new #attached fapi property.

david.murray’s picture

Priority: Major » Critical

Subscribing. I've recently put a proposal together to use Drupal 7.9 with Ubercart as an eCommerce solution to sell tickets to live performances.

The ability to prevent sales of tickets for performances where there are fewer seats left unsold than has been requested is being seen by the committee as very much a show-stopper issue.

Quick progress for releasing a version of this module for UC 7.x would be very much appreciated and most likely result in a complete new implementation of Drupal and Ubercart appearing on the WWW. :)

I do, of course, appreciate that there many demands on your time and and that this is open source software, so updates are very much as people can commit their resources/time to the project.

david.murray’s picture

I've looked through the Drupal.org site and can't find any ubercart module compatible with Drupal 7.x that prevents sale of stock when stock levels go below 1.

Surely this is a show-stopper for Ubercart??!

I'm no programmer, but hope that this defect can be fixed quickly.

amaria’s picture

@restyler: The code in #27 works well for Drupal 7. Thank you! I don't allow the user to change the quantity so I don't have the problem mentioned in #28. However, if I run across any problems or come up with solutions I'll let you know.

UPDATE: By the way, the patch in #38 does not apply to the code in #27.

fineartist99’s picture

How do you not allow the user to change quantity? What would I need to do in order to do the same for certain products?

amaria’s picture

It's in the store settings and it's all or nothing. Meaning, you can't do it on the individual product level, at least not with existing settings.

Go to Administration > Store > Configuration > Products and deselect "Display an optional quantity field in the Add to Cart form."

fineartist99’s picture

ahhh, got it. Thanks.

stud_io3’s picture

Hi I just downloaded from #27 and it works well except I have twirling blue circles(throbber gif) next to the add to cart button all the time? Is it supposed to do that and how can I get rid of it?

stud_io3’s picture

Ok I fixed that by going here http://drupal.org/node/916862 where it tells you to edit your theme .css file. The next problem I have is I set the stock to 0 and I can't get the "add to cart" button to go away and have Out Of Stock in its place...

asimon’s picture

Ya changing the background image in uc_out_of_stock.css to background-image: none !important; works fine.
I'm experiencing the same problem as in #28, and I'm assuming it has to do with the fact that I had to disable the "attributes" module. Simply deleting the $item->data['attributes'] argument however leads to another error (invalid argument) though and I'm not smart enough to know how to work around that.

stud_io3’s picture

ok I fixed my problem by accident by fixing other things lol....I fixed a few things but I'm pretty sure the Out of Stock was working after I enabled clean urls. I enabled clean urls by locating my ".htaccess.txt" file in the drupal root where you put your drupal installation and changed it to ".htaccess" since I'm on a shared server.

And I want to mention clean urls also fixes problems with shipping carriers logos not showing like the ups logo or usps logo. I went here http://www.ubercart.org/docs/user/8387/drupal_settings_tips to figure that out.

davident’s picture

Line 81 of uc_out_of_stock.js:
$.post(Drupal.settings.basePath+'uc_out_of_stock/query', post, function (data, textStatus) {
WIll cause a (404) if clean urls are not turned on.
Known fix:
$.post(Drupal.settings.basePath+'?q=uc_out_of_stock/query', post, function (data, textStatus) {

stud_io3’s picture

I just upgraded to the new ubercart so I'm guessing these are brand new problems:

Notice: Undefined offset: 0 in uc_out_of_stock_validate_cart_items() (line 343 of /home4/blac/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 344 of /home4/blac/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).

UPDATE: seems to be a problem with the new ubercart not the out of stock module so far although I'm not sure.

lagreen’s picture

The same issue for me (after installing new ubercart release)

pointdexter02’s picture

I just started trying to implement this today and I too am getting the error's noted in #50

Also, when I click review order, instead of going to the review page, it bounces me back out to the cart page saying "Your shopping cart contents have changed. Please review your order and try again".

stud_io3’s picture

I guess it is a problem with the out of stock module it needs to be updated for the new ubercart...anybody out there that can do that? It's a weird problem because if I click in my shopping cart to checkout I have no problems it's only when I click on the update cart or checkout in the main window that I have the Notices.

restyler’s picture

I will be glad to update the module, but it looks like maintainer ignores the 7.x branch, saying "I have different fixes in 6.x branch and we need to sync everything", so I'm not sure there is a point to put in these efforts..

hanoii’s picture

@restyler I am not ignoring anything. I maintain several modules and I understand the urge and need for this module for D7. I have recently started to work on D7 so I will focus eventually on this module as well but until then, I appreciate any effort made to port this module. However, I have to be careful and try to organize what's been contributed, as people seems to submit patches that just works for them, even adding features, and all of that, making hard for me to review or even follow.

The first patches are against an old 6.x version in which I modified quite a bit.

#23 and #27, which are yours, are zip files with LOTS of fixes, which I am unsure what they really are. #38 seems to be a patch against 2.x which is not a valid branch. It's on the repo as I was meant to do something to it, but it's not published anywhere and it's not at all current..

So I am not discouraging any work, on the contrary, I welcome any contribution, but I do need to be on top of it, and the way to do that is to be clear on what's been contributed.

Said this, I welcome any patch against the current 6.x-1.x version that would make the module work on D7 with all the features D6 has. I appreciate not to include any new feature on this issue, if anyone is needed, we can discuss it on separate issues and it probably worth working on both D6 and D7 at the same time. The module basically should adhere to any D7 changes needed as well as any Ubercart 3.0.

Even more, if anyone here is interested in a more active role and wish to co-maintain the module with me, I am also open to that. Only that this person should be able to provide support for the module as well, help in maintining both branches in need and helping with the module development overall.

FranckV’s picture

StatusFileSize
new18.38 KB

Bug correction
I am using the Drupal 7 dev version of this module as provided in the zip file of [#27] and it is working fine. "Thanks" to the people who made this version available. This module is very important for shops with "real" goods.

I have just spotted and (I believe) corrected the bug that occurs when you click on the "proceed to payment" button in the cart page (bottom right of the cart list). See #50: More powerful search/archive function.
The bug shows as follows :

Notice : Undefined offset: 0 in uc_out_of_stock_validate_cart_items() (line 343 in /home/myserver/www/mydr7rootfolder/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
Notice : Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 344 in /home/myserver/www/mydr7rootfolder/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).

The bug is indeed in uc_out_of_stock.module in the function function uc_out_of_stock_validate_cart_items($items, $page = 'cart') { :

function uc_out_of_stock_validate_cart_items($items, $page = 'cart') {
  // just in the rare case (http://drupal.org/node/496782)
  // that $items is not an array, do nothing
  if (!is_array($items)) {
    return;
  }

  $cart_items = array();
  $stored_cart_items = uc_cart_get_contents();
  // First group by model
  foreach ($items as $k => $item) {
    // Convert it to object just in case is an array (if coming from a form POST)
    $item = (object) $item;    
    // Validate unless the item was being removed    
    
      // Unserialize data if string
      if (is_string($item->data)) {
        $item->data = unserialize($item->data);
      }
      // If the items comes from the submitted cart, it doesn't have the model
      // set, so we try to get it from the stored cart items which is filled
      // properly with the model.
      // For that, we assume that the sorting is the same, and if not,
      // we provide an alternative method which is probably not
      // very good in terms of performance, but the sorting of both arrays
      // should be the same
      if (!isset($item->model)) {

// I kept the next two lines for you to easily check my fix
//  drupal_set_message("Debug # 82397 :<pre>".print_r($items,true)."</pre>", 'status', FALSE);
// drupal_set_message("Debug # 13521 :<pre>".print_r($stored_cart_items,true)."</pre>", 'status', FALSE);
//########### BUG HERE ############
        $stored_item = $stored_cart_items[$k];
//################################
        if ($item->nid == $stored_item->nid && $item->data == $stored_item->data) {
          $model = $stored_item->model;
        }

and the fix of the emphasized code area is :

//########### CORRECTION HERE ############
        $stored_item = $stored_cart_items[$items[$k]['cart_item_id']];
//######################################

I hope that helps come closer to a first official dev version.

Please find the code that works for me. I have integrated the CSS fix with the strobe (as stated in [#47]) and the clean url issue in (as stated in [#48]). But I haven't dealt with the "attributes" issue as I am using none (as stated in [#47]).

FranckV’s picture

StatusFileSize
new18.81 KB

Sorry, ignore the former zip !

The one attached is the correct one.

Sorry for the inconvenience.

penpalgal’s picture

Category: feature » support

To the person who created these Drupal 7 patches - are you available to install/ customize this on a site (for pay, of course?) or able to recommend someone who is able to do this?

Let me know

xdelfino’s picture

FranckV thanks for your good work!
On my site I get this error:
Notice: Undefined index: 996 in uc_out_of_stock_query() (linea 194 di /sites/all/modules/uc_out_of_stock
it happens to you?

2faroffroad’s picture

Thank you to all who have helped with this. This has saved me from closing my D7 and going back to D6 because of stock controls.
However I am having the same issue in #28. But it does not affect anything that I can see except outputting that error.
My test site - vintagebysandra.com
Thanks again.

FranckV’s picture

xdelfino you obviously have attributes in your online shop and I didn't. That's why I didn't get the same error.
I have little time available now but I will try to have a look. It seems like a similar issue as the one I already solved.

2farofftheroad, I indeed have the same issue. I also agree with you : it seems harmless. I'll see what I can do.

Anonymous’s picture

#57 seems to be working well for me.

samgreco’s picture

Using the version in #57. I get:

We're sorry. We have now only 1 unit of the product DJ-180 - Energy - Closed, Dynamic DJ Headphones left in stock. You have currently 1 unit in your shopping cart.

in the help section at the top. But I am not seeing the "Out of Stock" message, nor is the Add-to-Cart button removed.

samgreco’s picture

Not entirely sure why, but it seems to be working now.

2faroffroad’s picture

THANK YOU TO ALL who have helped with this...
I am using it and it works well for my needs...
Would love to see it become official. or at least beta.
I would help if I knew how.
Thanks.

joe huggans’s picture

THANK YOU SO MUCH FOR THIS!!!

Neo13’s picture

I`m getting following error:
Notice: Undefined index: attributes v uc_out_of_stock_validate_cart_items() (line 382 in /uc_out_of_stock/uc_out_of_stock.module).
We're sorry. We have now only 0 units of the product produkt left in stock.

himagarwal’s picture

I haven't encountered any problem yet and it is working fine with attributes. But there is still one problem.

When SKU of the "product attribute" is same and there are attributes like color and size and if some of the color/size of the product are available and some color/size are not available then it shows "out of stock" for all the attributes. How to correct this situation?

Is there a way to show "out of stock" for some "product attributes" having same SKU and not to show for others?

matt b’s picture

Works fine for my use case! thanks!

Allthegearnoidea’s picture

Thank you vey much for all the work on this guys. This works perfectly for me. I'm only using it on a basic shop with no use of attributes so I can't confirm any of the issues others are reporting.

Thanks again

Allthegearnoidea’s picture

Oops spoke too soon I have the same issue as Samgreco in #63. No "Out of Stock" shown nor is the add to cart button removed.

No show stopper for me, but if it is supposed to do those 2 things... It doesn't seem to.. Not for me anyway.

Allthegearnoidea’s picture

It works now.. Seems since I upped the PHP memory limit that it fixed the issue.

Allthegearnoidea’s picture

Hi guys

Using Out of Stock Notification and loving it, also just installed the D7 Ajax cart to make my site look even slicker..

it seems Out of stock and Ajax cart don't quite work smoothly together yet and I wondered if anyone had any ideas on how to get them working together.

Don't want to fully duplicate posts so the issue I am facing with out of stock notification and ajaz cart is posted here:

http://drupal.org/node/1120590#comment-6006818

Wondered if anyone had any thoughts on how to get the 2 working together well?

Thanks

stud_io3’s picture

What's MACOSX in this file for? Do I need to add it as well in my modules?

goodale’s picture

@FrankV and @restyler Thanks for the patches and zipped up module. The solution works for me and has stopped me having to reverse my previous decision to use Ubercart instead of Commerce for this project.

However could I encourage you to work with @hanoii to get the changes rolled into the version he maintains, so this is under proper version control and is less likely to break if something else changes.

Drupalitta’s picture

Comment #57 works like a charm! Thanks so much! : )
It still displays the price but there's nothing a little CSS can't fix.

brephraim’s picture

I am using #57, and am getting the following errors when changing quantities of an item already in the cart:

Notice: Undefined offset: 1266929712 in uc_out_of_stock_validate_cart_items() (line 347 of /srv/www/cart.com/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of /srv/www/cart.com/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of /srv/www/cart.com/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).

himagarwal’s picture

I am getting following errors in log file.

Location: ?q=uc_out_of_stock/query

Message:

Notice: Undefined offset: 2 in uc_out_of_stock_query() (line 189 of /sites/default/modules/uc_out_of_stock/uc_out_of_stock.module).

Notice: Undefined offset: 1 in uc_out_of_stock_query() (line 189 of /sites/default/modules/uc_out_of_stock/uc_out_of_stock.module).

Notice: Undefined index: 109 in uc_out_of_stock_query() (line 194 of /sites/default/modules/uc_out_of_stock/uc_out_of_stock.module).

Anyone have solution for this?

stevieb’s picture

I'm getting pages and pages and pages of the following notice

Notice: Undefined index: 542 in uc_out_of_stock_query() (Zeile 194 von /sites/all/modules/uc_out_of_stock/uc_out_of_stock.module.

Allthegearnoidea’s picture

I am also getting lots of this message in the logs... And then I also get:

Notice: Undefined index: attributes in uc_out_of_stock_validate_cart_items() (line 382 of /home/rattryde/public_html/modules/uc_out_of_stock/uc_out_of_stock.module).

Worryingly though it displays this to all users regardless of role when they try and order more of a product than we have (only though when they update the quantity in the cart to more than we have but not if they just add more than the stock level from the product pages... Any thoughts how I at least stop it showing the message to users?

Thanks

himagarwal’s picture

Hello!

If anyone interested to group-sponsor this module then contact me as I don't see any one making progress to this module. I am not a drupal/php developer. I have a person hired from odesk who does some work for me. Maybe he can sort some of the problems out. Please let me know through contact page if anyone is interested.

hanoii’s picture

I just want to say, one more time, that I have been following this issue and although I have been silent it's mainly because there's still not any actual concrete work or proposal to help maintaining the D7 version of the module and to provide a patch from the current branch. I haven't had the time to port it myself mainly because we have not yet switch to ubercart and drupal 7 massively. We are actually in the moment of starting to develop new ecommerce sites but I don't have any specific time in which I will be porting and supporting this module to D7.

To @himagarwal in particular, if you are going to sponsor the port of D7, you should do so but starting from the latest 6.x-1.x version of the module and not just to try to sort the issues reported here. The patches and patched versions of the module in this thread are outdated. Also, there might be needed some support after the initial submit of a D7 version and any help with that will be appreciated, however, if a D7 version is made which is line with the current D6 branch I will be able to easily support the D7 branch as well.

So thanks a lot for all the interest on this module.

Neo13’s picture

Hi,
we are willing to co-sponsor port of this module as long as we will be credited as a sponsor. What would be the price?

himagarwal’s picture

@Neo13, I haven't discussed this matter with the drupal developer yet so I don't have any idea on the price. To get your name credited for sponsorship you will need to get in touch with the current maintainer of the module. I will discuss the matter with the developer and will let you know the price.

It would be nice if other people could come up for its sponsorship.

hanoii’s picture

I have been approaced by @Neo13 and @himagarwal to start a ChipIn to port the current feature set of the D6 branch into an usable D7 version.

So as they have shown interest in doing so, here is a link for the ChipIn:

http://hanoii.chipin.com/initial-port-of-ucoutofstock-for-d7

This is only for an initial port.

hanoii’s picture

Status: Needs review » Needs work
MusedFable’s picture

I've installed the version of this module in post #57 on my drupal 7 site.

I get an error whenever trying to add a product kit to an order.

Notice: Undefined variable: model in uc_out_of_stock_validate_cart_items() (line 359 of /var/www/musedfable/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).

A quick temporary fix is fine. I'll add to the chipin when I get some cash from opening my store.

hanoii’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Fixed

there's an initial port of the module available as a dev release now. Feel free to try it out and report bugs related to the current functionality, any new requests or specific issues can be tackled on their own issues.

brephraim’s picture

Still getting the undefined offset errors.

Neo13’s picture

@brephraim dou you have the last git version?

brephraim’s picture

No, I had the package on drupal's project page. Is git more up-to-date?

brephraim’s picture

OK, I changed to the latest git, and I am still getting the offset errors. Specifically, they occur when changing large quantities of an item in cart.

brephraim’s picture

Also:

Notice: Undefined variable: stockinfo in uc_out_of_stock_getstockinfo_from_model()

hanoii’s picture

@brephraim can you let me know exactly what you are doing to trigger these notices and what kind of products you are trying to add? Do the products have any attributes?

brephraim’s picture

It seems that changing any quantity whatsoever of an item already in the cart will get the undefined variable: stockinfo error.

Once I play around with the quantities for a little while (I think particularly with attribute items, and particularly with large quantities) I start to get errors like this:

Notice: Undefined offset: -1651139358 in uc_out_of_stock_validate_cart_items() (line 344 of /srv/www/cart.com/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 345 of /srv/www/cart.com/public_html/sites/all/modules/uc_out_of_stock/uc_out_of_stock.module).

Sorry I am not more specific, but it does seem to occur somewhat unpredictably, but following the trends I mentioned above.

hanoii’s picture

@brephraim I just fixed one of the undefined noticed you've reported, which you can download from git, however I can't seem to either reproduce or understand you other notices on #95. What version of ubercart are you using?

git is always the latest, the dev package on the project page is built daily, so you may have the latest if there were no commits after it was built.

Can you send a link to the live site for me to view?

hanoii’s picture

just committed another undefined notice fix, but still not related to your latest ones.

hanoii’s picture

nevertheless, it worth mentioning that notices are not errors and that the module might be working just fine with those, you could hide php notices no the settings.php file, still I will try to sort them out if I can.

brephraim’s picture

I'm using Ubercart 7.x-3.1, and the live site is at 69.164.217.49

Sorry for the long response time.

mesch’s picture

I started working on a "out of stock" module for Drupal 7 before you posted your initial port. It's in my sandbox here:

http://drupal.org/sandbox/Chrysalis/1724162

I'm using the Drupal 7 AJAX API (no custom javascript needed) via a small utility module I wrote (Ubercart SKU Ajax Adjustment) that's also in my sandbox here:

http://drupal.org/sandbox/Chrysalis/1724148

Details for both projects are on their respective project pages.

It's also worth noting that there is work afoot to make the product page AJAX enabled out of the box, ala Drupal Commerce. See http://drupal.org/node/1380772.

hanoii’s picture

@brephraim check latest dev when it's built, probably tomorrow or in a few hours. I might release a stable release soon as well.

Allthegearnoidea’s picture

I am getting a similar problem to brephraim when anyone, anonymous user or logged in user adds anything to their cart the following message is displayed: Notice: Undefined index: qty in uc_out_of_stock_validate_form_addtocart() (line 306 of /xxx/xxxxxx/xxxxxxx/modules/uc_out_of_stock/uc_out_of_stock.module).

Everything seems to work OK but I'm not keen o this message being displayed to users.

If you want to check it out the website is www.freefromforkids.co.uk and literally all you need to do is add something to the cart.

Using Ubercart 7.x-3.1

hanoii’s picture

@Allthegearnoidea, I tried to fix that undefined notice you reported, download dev version tomorrow, or git checkout of you are fond of doing that to try it out right now.

Allthegearnoidea’s picture

Thanks hanoii will go for the dev version and report back...

Allthegearnoidea’s picture

hanoii

Have installed the dev version and problem is fixed. Thank you very much for your work on this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

meowdogs’s picture

Status: Closed (fixed) » Active

Getting the same issue Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() when i use a coupon and have click the checkout button under the the items in the shopping cart view. if there is no coupon it works fine.

hanoii’s picture

@whuttig are you using the dev version?

gmgallag’s picture

I am experiencing these issues, and I believe it is the fact that coupons are placed in the cart (as I believe they should be). Here are the errors (note: 2 errors and 2 coupons):

Notice: Undefined offset: -297787480 in uc_out_of_stock_validate_cart_items() (line 347 of ...uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of ...uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of .../uc_out_of_stock/uc_out_of_stock.module).
Notice: Undefined offset: -3472230163 in uc_out_of_stock_validate_cart_items() (line 347 of .../uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of .../uc_out_of_stock/uc_out_of_stock.module).
Notice: Trying to get property of non-object in uc_out_of_stock_validate_cart_items() (line 349 of ...uc_out_of_stock/uc_out_of_stock.module).

Appreciate any help.

Hannu’s picture

I, too, began to get the messages listed in #109 after I started to use Coupons, and altered the Qty field of a product in the cart with a coupon in it.

So, subscribing.

hanoii’s picture

Status: Active » Fixed

I have fixed these notices and added some prevention so certain modules like uc_copon doesn't mess with this module.

Please, do not reopen this issue, 7.x version is there and stable to be tested, report any issue on separate issues if there's not one already added, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.