According to this definition of the 'uc_discount_condition_node_type' callback:

<?php
$conditions['uc_discount_condition_node_type'] = array(
    '#title' => t('Node type'),
    '#description' => t('The node has a particular type.'),
    '#category' => t('Node'),
    '#callback' => 'uc_discount_condition_node_type',
    '#arguments' => array(
      'node' => array('#entity' => 'node', '#title' => t('Node')),
    ),
  );
?>

There should be a function called uc_discount_condition_node_type(), but I've grepped for that string recursively in my ubercart directory and apparently it doesn't exist. Also, I don't have the option to specify a node type when configuring this condition. Is some code missing?

Thanks!

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

Hi Ezra!

Here's a patch.

I have no idea if it works or not, due to #576014: calculate_product_discounts doesn't seem to get called.

joachim’s picture

It's working for me now I've fixed #578196: uc_discount_price_handler_alter never has any effect. Obviously it's my own patch so this doesn't count as a review...

joachim’s picture

Actually, shouldn't this be in CA core, so any predicate can use it without this module? Checking on a product node's type strikes me as something lots of predicates might want to check.

jody lynn’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.53 KB

Here's a reroll without the debug code. It seems to be working fine for me.

joachim’s picture

I've got commit access to uc_discount now, so I'm happy to commit this (all the more because I'm using the patch on a site of mine...)

But it does seem to me it could belong in CA core...

Can we get a UC maintainer's opinion on this?

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Huh.

UC maintainers have pointed out to me that the 'Compare a node field value' condition lets you do this. But they've suggested we add this anyway here, as it's more userfriendly :)

So I've committed the patch, with the whitespace tweaked. Thanks for the reroll Jody :)

#538320 by joachim, Jody Lynn: Fixed missing callback for node type condition.

Status: Fixed » Closed (fixed)

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