Hi,
I made a drupal 6 port of that module. I based my work on the latest dev version of october 29th 2008.
It is just a basic port ATM, cause maintainers wanted to proceed step by step. I plan to bring some other stuff, but it will be added later via patches. However I bring some verrrry little changes, that can be applied to 5.x too easily, so, here is the changelog :
- Drupal 6 port ! (this is the main change)
- Separate all administration functions in a uc_discounts_admin.inc file (new d6 menu allow to declare a separate file, I used it, don't remember if d6 allow it)
- When you delete a discount, it delete all related actions and conditions (ATM, the d5 version only delete the discount, letting conditions and actions polluate the database)
- Added uc_discounts_user submodule in the package (found here : http://www.ubercart.org/contrib/143#comment-20625) and correct a condition check problem
- Added description to condition quantity field for uc_discounts_product
- I think that all for this package...
I would add that I test it using uc_discounts_product and uc_discounts_user submodules, I didn't make some tests on others submodules cause I don't use them and I don't have time for a full testing of all submodules. As submodules don't include menu, form, or others things that need attention on a drupal 6 port, it should work as the 5.x version. I let the community gives feedback about that.
So, the next step for me is to make some improvements and add some features into that release via patches. Here is my battleplan :
- Make uc_discounts_product submodules working with attributes, and bring the necessary changes into hook_nodeapi of uc_discounts module
- Allow submodules to add informations in a node when a potential discount is found. Example, you set a condition that make 10% discount for a product if quantity = 3. When the user view the product page, the discount module, actually, show nothing, because it don't know if the user will buy 3 quantity of that product, so it cant alter the display price. The idea is to display, somewhere in the node, a sentence like "Buy 3 quantity of that product, and get a 10% discount". So users will exactly know what's the deal, and it will be done automatically.
Can maintainers review and, if correct, submit the 6.x branch for that module ? It would allow users to know that it's in progress, and allow me to choose 6.x when I create an issue to submit a patch. I would add that all patch I will submit wil be for 6.x branch and will need to be backported if you want to see that in 5.x.
zmove
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | uc_discounts.install.patch | 619 bytes | zmove |
| #5 | uc_discounts.install.txt | 3.1 KB | zmove |
| #3 | uc_discounts.zip | 33.91 KB | zmove |
Comments
Comment #1
zmove commentedI forget to add one thing for my battleplan :
Comment #2
zmove commentedLol, I speak, I speak and I forget to post the package !
Comment #3
zmove commentedWrong package uploaded, I'm a noob ^^
here is the good one
Comment #4
psynaptic commentedI've had a good look through this and it's looking pretty clean.
I've listed all the changes that were not specifically related to the port to 6.x.
uc_discounts.module
- backported to 5.xuc_discounts_discount_form()- changes to #value elements- moved variable creation to match 6.x portuc_discounts_discount_form_submit()- moved variables- backported to 5.xuc_discounts_discount_delete_form_submit()- added delete of conditions and actions- see comment belowuc_discounts_condition_form()- removal of$amount_fieldand$form['amount']- backported to 5.xuc_discounts_condition_form_submit()- addition of two drupal_set_message() calls to confirm when conditions and actions are addeduc_discounts_condition_delete()- addition ofdrupal_set_message()</del> - backported to 5.x- reverted to Itemuc_discounts_actions_table()- change Item to Items- backported to 5.xuc_discounts_action_delete()- addition ofdrupal_set_message()moved all admin functions out into uc_discounts_admin.inc- releated to port to 6.xuc_discounts_product.module
- backported to 5.xuc_discounts_product_discounts_condition()- changed compare_type to text- backported to 5.xuc_discounts_product_discounts_action()- changed has_qty_field to false- backported to 5.xuc_discounts_product_item_field()- added'#required' => true- backported to 5.x but changed to "The number of products the user must to buy to get this discount."uc_discounts_product_value_field()- added'#description' => t('How many products does the user have to buy to get this discount?')uc_discounts_taxonomy.module
- backported to 5.xuc_discounts_product_apply()- removed all debug code and some commentsI'm pretty happy to go ahead and commit, at least now we have a list to work with and can track down all stuff we may want to backport to 5.x.
Anyone want to take a peek before I commit?
Comment #5
zmove commentedHi,
Wow, nice review ! I made this port by removing some addition and functionnalities I made in my experimental d6 version of that module that support attributes and some others things, Item to Items is a good example of a thing I forget to remove to be like the original module. ^^'
I would add some things to your review :
I would add a last things. I suggest you to change the item_id field in uc_discounts_conditions and uc_discounts_actions table in the database into a TEXT type. Actually a varchar(256) is too limit and it can cause error to submodules that save informations in a serialized array like the multiproduct module.
I attach a patch and the original modified .install file for the 6.x branch. I think a copy/paste can be enough to backport to 5.x as I believe the update function hasn't changed.
(Put .txt to the .install file to make drupal accept the upload)
Comment #6
psynaptic commentedI have committed this with a few minor changes to the DRUPAL-6--1 branch. I have made a new release and it will appear on the project page at about midnight tonight.
Not marking as fixed just yet since I need to work through the points in the review above.
4. Amount field
The creation of the $amount_field array was in step 1 of the multi-step form. This stopped the amount field on the form from showing. I'm removing it for now, if and when we decide we need it we can always put it back.
I also just converted tabs to spaces and removed all trailing spaces from the DRUPAL-6--1 branch. zmove, please set your editor to use soft tabs (2 spaces) rather than actual tabs.
Comment #7
psynaptic commentedMarking as fixed now since I've just backported everything relevant to 5.x.
Comment #8
psynaptic commentedComment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.