Multi-Products Condition

sphism - October 21, 2008 - 08:50
Project:UC Discounts
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

When adding multi-product condition you select the products, fill in the rest of the form and submit.

Then on the Discount page eg admin/store/discounts/1

There is no entry in the ITEM column of the table.

When you go back to edit the condition there are no products selected.

The condition doesn't seem to be applied to the cart.

The products do however seem to be stored in the database.

Hope that helps,

m

#1

psynaptic - October 21, 2008 - 09:49

I couldn't get Multi Product to work in my local test environment. This module really needs a full audit. Will post back here when we have a fix.

#2

sphism - October 21, 2008 - 10:34

psynaptic: Thanks for all your efforts on this, we really appreciate it.

I really like the look of the discount modules, great concept, but i think it will take a bit of work to get it all up to scratch.

Good luck,

m

#3

mike-green - December 24, 2008 - 19:52
Status:active» needs review

Here is a patch that got this module working for me.

When you edit a condition - the "Multiple Product/Types" field is actually getting saved to DB.
It's only not being shown when you view the conditon (which I believe is a bug) and when you edit the condition you need to select all the products again (which is somehow connected to multipart form limitations).

Overall uc_discounts is good package, but with some bugs and absent documentation.

AttachmentSize
uc_discount_multi_product.patch 486 bytes

#4

mike-green - December 24, 2008 - 22:03

Here is more complete patch that fixes multi product discounts.

AttachmentSize
uc_discounts_multiproduct.patch 5.11 KB

#5

torgosPizza - January 7, 2009 - 18:12

This patch worked for me.

#6

psynaptic - January 8, 2009 - 21:03

Awesome. Thanks for testing torgosPizza!

#7

sven33 - January 16, 2009 - 23:10

I tried this patch on a drupal 6 test system as I was experiencing some similar issues with multi-products condition.

It looks like the patch partially worked, although it does get a hunk #1 failure when patching uc_discounts.module - see check trace below

[...drupal-6/sites/all/modules/uc_discounts]# patch --check < uc_discounts_multiproduct.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -urp /Users/mik/Downloads/uc_discounts/discounts/uc_discounts_multi_product.module ./discounts/uc_discounts_multi_product.module
|--- /Users/mik/Downloads/uc_discounts/discounts/uc_discounts_multi_product.module      2008-10-20 20:05:20.000000000 +0300
|+++ ./discounts/uc_discounts_multi_product.module      2008-12-24 23:41:02.000000000 +0200
--------------------------
Patching file ./discounts/uc_discounts_multi_product.module using Plan A...
Hunk #1 succeeded at 25.
Hunk #2 succeeded at 40.
Hunk #3 succeeded at 68.
Hunk #4 succeeded at 109.
Hunk #5 succeeded at 117.
Hunk #6 succeeded at 126.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -urp /Users/mik/Downloads/uc_discounts/uc_discounts.module ./uc_discounts.module
|--- /Users/mik/Downloads/uc_discounts/uc_discounts.module      2008-11-05 09:57:29.000000000 +0200
|+++ ./uc_discounts.module      2008-12-24 23:39:57.000000000 +0200
--------------------------
Patching file uc_discounts.module using Plan A...
Hunk #1 failed at 1255.
Hunk #2 succeeded at 777 (offset -1022 lines).
Hunk #3 succeeded at 808 (offset -1022 lines).
1 out of 3 hunks failed--saving rejects to uc_discounts.module.rej
Hmm...  Ignoring the trailing garbage.
done

If actually apply the patch rather than just checking it the reject file looks like this

less uc_discounts.module.rej
***************
*** 1255,1261 ****
      $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Next'),
-     );
    }

    // stage 2 - everything else
--- 1255,1261 ----
      $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Next'),
+     );
    }

    // stage 2 - everything else

The function uc_discounts_condition_form is not found in my v6 uc_discounts.module which is where the hunk fails. I'm using uc_discounts-6.x-1.x-dev

Interestingly the patches for discounts/uc_discounts_multi_product.module all succeed with no offset adjustments so those patches might be appropriate for v6 as well. Unfortunately these changes do not seem to help overcome the issue #329674: can't get a multi-product discount to be applied in any form which I am also experiencing.

#8

mike-green - January 20, 2009 - 23:15

Yes, it seems this particular patch helps fix discount editing problem also for D6 version.

 
 

Drupal is a registered trademark of Dries Buytaert.