Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
nice module!
I have created a module to disabled the quantity field and to block the quantity to one.
If I added many times a product "P" I have much as lines as quantity of this product in my cart.
Of course if I delete one line it delete all the lines about this product.
How to do to only delete the concerning line?
Thanks in advance. Sorry for my broken english
My module
<?php
function uc_bloc_qte_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'uc_cart_view_form') {
$i=-2;
foreach ($form['items'] as $k => $item) {
$arr_nids=$item['nid'];
$nid=$arr_nids['#value'];
if($nid==237){
$form['items'][$i]['qty']['#disabled'] = true;
}
$i++;
}
}
}
?>
Comments
Comment #1
apadernoIt seems more a support request for another module, not for this one.
Comment #2
selinav CreditAttribution: selinav commentedexcuse-me for the bad category, I'd like to know how it is managed in your module to delete only the good item and not all the items which have a node linked.
Should I add a test on the op ?
Thanks
Comment #3
apadernoThe code implements
hook_order()
, and this is the implemented code:Comment #4
selinav CreditAttribution: selinav commentedok thanks, I have found the function in your module, but I don't understand why my hook form alter interfere with the order process.
Can you give me an advice please.
Thanks in advance