role discount is not working.
all configuration are made.

Comments

mrchristian’s picture

Hi

Im using Drupal 5.1 and Ecommerce 5.x-3.x-dev

Role discount is having no effect on prices of products?

Anyone else has similar problems with this setup?

Ive tried -/+ figures in the different roles, and creating new products after changing per centage changes in the roles.

I can get Flexicharge to add postage and add a % to a final purchase as a commission for example.

Many thanks

Simon

http://metamute.org/ - culture and politics after the net

mrchristian’s picture

Hi

I've carried out further tests and reverted the Ecommerce module set back to 5.3 and only turned on the bare bones basic version of the system and the Role Discount.

The Role Discount now has an effect on the price, but one that doesnt make sense, at least not to me.

1. The product price is set at GBP5
2. I have a Role called 'agent'
3. I set the discounts for the different roles as so;

Role Amount
agent -40.00
anonymous user -10.00
authenticated user -20.00
outlet -33.00

4. I login as the 'agent' user

The product inputted as GBP5 is now GBP -5

5. After much experimenting I discover that the anonymous 'Role' discount is having an effect on the price.

NOW iM CONFUSED!

I'm checked the 'Role' settings of my user and it is set as 'agent' as it should be.

If people could confirm with me that Role Discount does work and suggest proper use of it.

Many thanks

Simon

http://metamute.org/ - culture and politics after the net

hanskuiters’s picture

Flexicharge works fine, but only a fresh made setting. If you edit an existing setting, it doesn't work anymore. When you delete the setting and create a new one, it works again.

Barry Pretsell’s picture

wrong number of parameters defined in role_discount_product_specials function, I've created a patch

hanskuiters’s picture

Patch does not work for me (and there is a space in the url to the patch).

Barry Pretsell’s picture

oops. better link here

The patch has been applied by gordon and status changed to fixed.

If it is not working for you it may be worth putting in some drupal_set_message calls in the function or enable devel and sql and see what's happening. Or if can you describe the discount you are trying to apply and I will give it a go.

mrchristian’s picture

hi

ill give the patch a try out and reportback, thank you for your help.

simon

http://metamute.org/ - culture and politics after the net

mrchristian’s picture

hi,

thank you for the patch on the Role Discount module, the module now works as it should and applies the discount.

what still needs to happen is that the Role discount module applies the discount to the price display in the products area, at present it only applies the dicount to the shopping cart display. Help apprieciated here too.

simon

http://openmute.org/ - culture and politics after the net

Barry Pretsell’s picture

Add this to the end of the function role_discount_product_specials in role_discount.module

  if ($has_adjustment) {
    return array('special' => array( 'type' => 'discount', 'description' => 'role discount', 'price' => $discounts, 'qty' => 1, 'invisible' => 0));
  }

I think the module needs a patch as the return array is nothing like what I think it should be, it needs the price and qty defined to make it work properly in product.module. BTW, the invisible value will toggle whether the discount shows in the checkout, with description

If this works for you I'll submit a patch.

regards

Barry

hanskuiters’s picture

Setting a discount is not the problem. It all works fine. Editing the discount is the problem. If I edit an existing discount, it isn't applied anymore.

Barry Pretsell’s picture

If I edit an existing discount, it isn't applied anymore.

Ok. I have tried this. I see the discount is applied to the cart but not carried forward to the checkout. But that seems to be the case all the time. That looks like another bug in the code. Try changing the end of function product_get_specials in the role_discount.module to the following.

  if ($has_adjustment) {
    return array('special' => array( 'type' => 'role discount', 'price' => $discounts));
  }

Does that help?

That should ensure the discount gets through to the checkout. Though it will not show up as an itemised discount on the cart.
Also of note which I am sure you are aware the module applies the discount per item in the cart.

I'm not an expert on how all this ecommerce stuff hangs together so I'm picking it up as I go debugging this role discount module. So any further info, observations will help.

cheers,

barry

hanskuiters’s picture

Excuse me, bazzaboy. I was refering to the roll discount function in flexicharge module.

mrchristian’s picture

Hi Barry,

I had hoped that Role Discount was carry though the discounts all the way through the system, but my experiences seem to mirror yours, in that the discount isnt showing up in the checkout phase.

Previously I had been elated, when a patch had been posted earlier in this thread, but in my excitment and seeing some results, in that the discount showed up in the shopping basket area and I had neglected to check if it was showing up in the check out area.

I'm going to talk to a colleague in London about reviewing the Role Discount module as its problems seem more than bugs. it looks like it the case that it just doesnt work. I will also post to the Ecommerec lists to see who else is interested in this area.

All best

PS Ill do one last test to see if I can get it to work well

Simon

http://openmute.org/ - culture and politics after the net

Barry Pretsell’s picture

Simon,

I don't think role discount could have ever worked, and I think it's main problem is not returning a suitably populated array which causes the discount to be ignored. It is worth trying the further change I posted on this thread last week as it seemed to make it work on my test install.

Please give it a try and see if it works, I guess the role discount module just fell out of whack with the ecommerce framework at some point. I don't use it, or ecommerce for that matter, I just happened to be playing with it when I noticed your mail and was curious...

regards,

Barry

Rowanw’s picture

The latest version of E-Commerce (5.x-3.1) fixes this issue.

http://drupal.org/project/ecommerce