Needs work
Project:
UC Upsell
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Jun 2010 at 19:02 UTC
Updated:
12 Apr 2013 at 14:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
asanvicente1 commentedForgot to mention, I use the Stock module to track stock levels.
Comment #2
torgospizzaHey, sorry for the delay. I haven't looked into this and I'm not sure what it would entail. Probably a simple addition to the SQL query if the Stock module is enabled. Can you roll a patch? If not I can look at this later.
Comment #3
drupalgideonSubscribe
Comment #4
Bruno-2M commentedThanks for this great module.
I'm interested also in this feature for both products and cart pages, the best would be a check box in the admin section of the module
Where stock.uc_product_stock > 0
Any help is welcome
Thanks
Comment #5
summit commentedSubscribing, needing same functionality, greetings, Martijn
Comment #6
ColinMctavish commentedsubscribing
Comment #7
asanvicente1 commentedI finally ended up solving this for our site. (UC Upsell version 6.x-1.21). Now, only related items in stock appear in Upsell blocks. Two MySQL query changes to the uc_upsell_core.inc file in your uc_upsell folder are required.
NOTE: BE SURE to backup before making these changes, and DO NOT test this on a live site.
1. Open the /uc_upsell/uc_upsell_core.inc file and comment out this line (near line 155):
Beneath it, paste this:
2. Near line 208, comment out this line:
and replace it with this:
After you clear your site's cache, you should see your Upsell results filtered.
Good luck!
Comment #8
wis1 commentedI have:
how to resolve this error?
Comment #9
ratinakage commentedAny update on this?
Comment #10
mitrpaka commentedChanges provided in #7 applies for related and random nodes only, but doesn't prevent showing up associated items not in stock when related products are searched based on taxonomy (Handle Related Products based on Taxonomy -setting either set to 'Override' or 'Add')
Attached patch takes related products based on taxonomy into account as well.
Comment #11
mitrpaka commentedAnd here is more generic patch to this - Checkbox added to Global Settings whether filter out items not in stock as suggested originally by asanvicente1.
Comment #12
ermannob commentedPatch at #11 works for me.
Thanks!
Comment #13
iprosp commentedPatch #11 works if all your products have stock enabled. Every product that doesn't have stock enabled will never show up in the block.
Comment #14
reinvented commentedThe patches above appear to work properly for random association and for taxonomy-based selection, but for specific-product associations they modify the query as follows:
$related = db_result(db_query("SELECT `related_products` FROM {uc_upsell_products} WHERE nid = %d", $nid));to:
which does not solve the original issue because it only filters out parent products that are out of stock when what we want to do is filter out child products that are out of stock.
For example, I have a product of with nid of 52659; the resulting query is:
SELECT up.related_products FROM uc_upsell_products up INNER JOIN uc_product_stock ps ON up.nid = ps.nid WHERE up.nid = 52659 AND ps.stock > 0which returns:
a:6:{i:36703;s:5:"36703";i:52761;s:5:"52761";i:52671;s:5:"52671";i:52672;s:5:"52672";i:52673;s:5:"52673";i:52955;s:5:"52955";}However one of those product nids returned -- 36703 -- has no stock, and there's nothing in the query modification that filters out based on this fact.
Comment #15
reinvented commentedI quick hack that got this working for specific-product associations in our situation (where we have stock-keeping turned on for all products) was to replace, in the patch:
with: