Download & Extend

Ubercart Restrict quantity - Port to Drupal7 (D7)

Project:Ubercart Restrict Qty
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:active

Issue Summary

Would be a nice feature to have it ported.

I'm off of time with other projects, as soon as I'm able I'm gonna help on that.

Hope somebody decides to begin patching.

P.S: Please, whoever has permissions change the version to 7.x 1.x-dev. Thanks.

Comments

#1

this is what i have done so far,against 6.x-2.x-dev
There some warnings left , i think it needs a bit more work

AttachmentSize
port_to_d7.patch 7.58 KB

#2

Status:active» needs review

Nice job @rootatwc :-)!!

As soon as I can I'll review it (or whoever).

AttachmentSize
port_to_d7.patch 7.58 KB

#3

Status:needs review» active

Ok tested it. It failed to me. Found errors:

It is looking for *.install, but this module doesn't have that file. :S So it looks like doesn't have sense.
At line 84 of uc_restrict_qty.module it brokes.

Hope the feedback helps to repair. As soon as I can I will contribute to repairing patch but I am full of work and other modules patches and cannot more. Sorry for that and thanks for your effort.

#4

Status:active» needs review

@RaulMuroc, like i stated above,this patch is against 6.x-2.x-dev, not 6.x-1.1

#5

I found errors in patch.

Code:
$models = uc_product_get_models($node);

shouldSbe
$models = uc_product_get_models($node->nid);

Because in ubercart module this function get as argument $nid, not $node
function uc_product_get_models($nid, $add_blank = TRUE) {

Also code:
$key = NULL;
if ($product_qty['rqpid']) {
$key = 'rqpid';
}

Should be:
$key = array();
if ($product_qty['rqpid']) {
$key[] = 'rqpid';
}

Code:
function uc_restrict_qty_cart_item($op, &$item) {

Should be:
function uc_restrict_qty_uc_cart_item($op, &$item) {

Code:
function uc_restrict_qty_add_to_cart_data($form_values) {

Should be:
function uc_restrict_qty_uc_add_to_cart_data($form_values) {

Code:
function uc_restrict_qty_theme() {
return array(
'restrict_qty_field' => array(
'arguments' => arra('form' => null),
),
);
}

Should be:
/**
* Implementation of hook_theme().
*/
function uc_restrict_qty_theme() {
return array(
'restrict_qty_field' => array(
'render element' => 'form',
),
);
}

AND

Code:
// Themes cart Qty. boxes so they can't be changed. (currently not in use)
function theme_restrict_qty_field($element) {
return check_plain($element['#value']);
}

Should be:
// Themes cart Qty. boxes so they can't be changed. (currently not in use)
function theme_restrict_qty_field($variables) {
return check_plain($variables['form']['#value']);
}

Sorry i don't know how to make patch file. :)

#6

Ok here is working ported d7 module.

AttachmentSize
uc_restrict_qty.zip 13.7 KB

#7

here,this will help you with patching:
http://drupal.org/project/uc_restrict_qty/git-instructions

#8

@Freakachoo

Thanks for the ported version. Unfortunately, it doesn't work with UC 3.0. A quick troubleshooting reveals that uc3 no longer uses hook_cart_item or hook_uc_cart_item, so the function uc_restrict_qty_uc_add_to_cart() is never called.

#9

Priority:normal» major

#10

I too am interested in this. When I try to use rules, it tells me that the Item QTY field is not writable.. Going to see if there is another way to force a qty for a product.

#11

I had a go too, same thing. :(

#12

Priority:major» normal
Status:needs review» active

Thins would become easier to port & test to D7 with a nex 7.x-1.x-dev branch.

Thanks in advance.

#13

Does anyone have any plans to port this to D7 UC3? I'm compiling a list of Ubercart related modules and trying to get an idea of what still needs to get ported over.

Thanks in advance!!

#14

Category:task» bug report
Priority:normal» major

I have just contacted the module maintainer to discover if he is considering that way...

nobody click here