Hello,
First of all. Thanks for this very nice module.
It works perfectly fine as long you dont use alternative sku for your products with attributes.

If you add a alternative sku to your product to track the stock with uc_multi_stock the module doesnt
pick up the right sku and forward you to the notification page.
you just get the usually out of stock notification.

Please add this part to the module so we can track our multi_stock :)

And a page where we can see the added notifications from customer so we see what we need would be great.

Thanks a lot,
/rob

Comments

longwave’s picture

Priority: Critical » Major

Attributes are not used on the site that I developed this module for, but if anyone is willing to sponsor this addition to the module, please contact me.

longwave’s picture

Category: bug » feature
BigMike’s picture

Title: tokens not supported if different SKUs for each attribute » not working with alternative sku

longwave and cYu, first and foremost, thank you very much for this fantastic module.

We recently had nearly 10 products come back in stock (entirely separate nodes, not just product attributes). The system sent out emails reporting that our products were back in stock.

Within a few hours, we received emails from our customers where the replacement patterns were not being replaced, and instead many customers received emails such as, "This email is to notify you that [title] has come back in stock." They actually received the replacement pattern phrase [title] instead of the product's actual title.

Question: Is this a related issue to the OP in that a product attribute itself indeed does not have a title, and therefore the module doesn't know how to handle the replacement pattern?

Surprised by this, I quickly tested the notification system and found it was working as it should, however after reading this topic, and the description for this module (attribute support is currently not implemented), is it correct to now assume that replacement patterns will not work for notifications to SKUs created as a product's attribute?

If this is an expected behavior, then I am sorry for not understanding this originally. It never occurred to me, and perhaps it should be defined better on the replacement pattern section of the Conditional Actions page that it will not work for attribute notifications if this is the case.

At any rate, is there a work around to this in the works?

Thank you very much for your time,
Regards,
BigMike

pareen’s picture

Title: not working with alternative sku » tokens not supported if different SKUs for each attribute

When an attribute (with different SKU) is out of stock, and I subscribe for notification, I get notified when that SKU is back is stock.

So it supports attributes stock. But it doesn't pick up the title of the node (like BigMike said). That might be because it is not directly associated with that title. The SKU is associated with only that attribute.

If we can use a more universal token or somehow relate the attribute SKU to the product node, email will pick up that token.

BigMike’s picture

Title: not working with alternative sku » tokens not supported if different SKUs for each attribute

I am also having this issue with a script I wrote for the Ubercart Stock Notify module (see reply #5: http://drupal.org/node/423346#comment-5481526), where I wrote,

Because the uc_product_stock table uses snid instead of nid, I don't know how to connect attribute SKU's created through the "Alternate SKU" (see node/###/edit/adjustments) of each possible attribute combination. Therefore, titles will only appear for each main SKU.

It would be great to know how to fix this so I can also apply it to my script!

BigMike’s picture

Issue summary: View changes
Status: Active » Closed (fixed)

Hey guys!

Update with solution to this issue!

I have been ignoring this for many moons and am currently ready to open shopping cart links for a good dozen products that have come back in stock and I figured I would finally get this issue sorted out ... and believe it or not it was extremely simple to fix!

File: uc_stock_notify.ca.inc

Replace (near line 88; beginning of function uc_stock_notify_action_email):

  $nid = db_result(db_query("SELECT n.nid FROM {uc_products} p INNER JOIN {node} n ON p.vid = n.vid WHERE p.model = '%s'", $model));
  $node = node_load($nid);

With:

  $nid = db_result(db_query("SELECT n.nid FROM {uc_products} p INNER JOIN {node} n ON p.vid = n.vid WHERE p.model = '%s'", $model));


  // If we didn't find a NID then try pulling it from Attribute data (by BigMike, Sept 25, 2014)
  if ($nid == NULL)
    $nid = db_result(db_query("SELECT nid FROM {uc_product_adjustments} WHERE model = '%s'", $model));


  $node = node_load($nid);

As you can see it only took two lines of code. All we need to do is check if the NID was found through normal means, and if not, then attempt to retrieve it from attribute data. Because the email being sent uses [title] and [node-url], no other changes are needed since title & URL info is the same between main & attribute model numbers.

Wa-la! Perhaps very few people are still on D6.x & U2.x, but we are still rock'n it and it's about time this issue got resolved!!

Regards,
BigMike

BigMike’s picture

...one more thing to mention is that the email does not include any attribute data. So you are likely to get users visiting your site with great excitement only to find it was an attribute they aren't waiting for which has returned in stock.

I have not looked into implementing this however it is something I will consider doing in the future.

BigMike